Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
windows:mingw
kdoctools
0001-Generate-xml-files-containing-relative-pat...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Generate-xml-files-containing-relative-pathes-to-dtd.patch of Package kdoctools
From 41e079c4ffb303269422bc46071f4376d39612f7 Mon Sep 17 00:00:00 2001 From: Ralf Habacker <ralf.habacker@freenet.de> Date: Mon, 5 Jul 2021 13:38:00 +0200 Subject: [PATCH 1/2] Generate xml files containing relative pathes to dtd and xsl on Windows. Windows installations needs to be relocatable. --- src/CMakeLists.txt | 9 ++++++++- src/customization/kde-include-common.xsl.cmake | 4 ++-- src/customization/kde-include-man.xsl.cmake | 2 +- src/docbookl10nhelper.cpp | 11 ++++++----- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ca9e6e0..0effc79 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,13 @@ include_directories( ${LIBXML2_INCLUDE_DIR} ${LIBXSLT_INCLUDE_DIR} ) include(uriencode) kdoctools_encode_uri(DocBookXML4_DTD_DIR) +if(WIN32) + string(REPLACE "${CMAKE_INSTALL_PREFIX}/share" "../../../.." DOCBOOKXSL_REL_DIR ${DOCBOOKXSL_DIR}) + string(REPLACE "${CMAKE_INSTALL_PREFIX}/share" "../../../.." DocBookXML4_DTD_REL_DIR ${DocBookXML4_DTD_DIR}) +else() + set(DOCBOOKXSL_REL_DIR ${DOCBOOKXSL_DIR}) + set(DocBookXML4_DTD_REL_DIR ${DocBookXML4_DTD_DIR}) +endif() set (_custom_dtd_kdex "customization/dtd/kdedbx45.dtd") configure_file(${_custom_dtd_kdex}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${_custom_dtd_kdex} ) # WARNING: this is due to severe limitations on the windows platform to keep the dtd relocateable @@ -222,7 +229,7 @@ endif() add_custom_command( TARGET docbookl10nhelper POST_BUILD COMMAND $<TARGET_FILE:KF5::docbookl10nhelper> "${DOCBOOKXSL_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/customization/xsl" - "${CMAKE_CURRENT_BINARY_DIR}/customization/xsl" + "${CMAKE_CURRENT_BINARY_DIR}/customization/xsl" "${DOCBOOKXSL_REL_DIR}" ) # all-l10n.xml is generated by docbookl10nhelper diff --git a/src/customization/kde-include-common.xsl.cmake b/src/customization/kde-include-common.xsl.cmake index 585aff5..55be065 100644 --- a/src/customization/kde-include-common.xsl.cmake +++ b/src/customization/kde-include-common.xsl.cmake @@ -1,8 +1,8 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> - <xsl:import href="@DOCBOOKXSL_DIR@/html/autoidx.xsl"/> - <xsl:import href="@DOCBOOKXSL_DIR@/html/chunk.xsl"/> + <xsl:import href="@DOCBOOKXSL_REL_DIR@/html/autoidx.xsl"/> + <xsl:import href="@DOCBOOKXSL_REL_DIR@/html/chunk.xsl"/> <xsl:param name="l10n.xml" select="document('xsl/all-l10n.xml')"/> <xsl:param name="local.l10n.xml" select="document(concat('xsl/',/*/@lang,'.xml'))"/> diff --git a/src/customization/kde-include-man.xsl.cmake b/src/customization/kde-include-man.xsl.cmake index 079f41d..a562f1b 100644 --- a/src/customization/kde-include-man.xsl.cmake +++ b/src/customization/kde-include-man.xsl.cmake @@ -1,7 +1,7 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> - <xsl:import href="@DOCBOOKXSL_DIR@/manpages/docbook.xsl"/> + <xsl:import href="@DOCBOOKXSL_REL_DIR@/manpages/docbook.xsl"/> <xsl:param name="chunker.output.encoding" select="'UTF-8'"/> <xsl:output method="text" encoding="UTF-8" indent="no"/> diff --git a/src/docbookl10nhelper.cpp b/src/docbookl10nhelper.cpp index c1245b5..b55c97a 100644 --- a/src/docbookl10nhelper.cpp +++ b/src/docbookl10nhelper.cpp @@ -132,7 +132,7 @@ int main(int argc, char **argv) QCoreApplication app(argc, argv); const QStringList arguments = app.arguments(); - if (arguments.count() != 4) { + if (arguments.count() < 4) { qCCritical(KDocToolsLog) << "wrong argument count"; return (1); } @@ -140,6 +140,7 @@ int main(int argc, char **argv) const QString l10nDir = addTrailingSlash(arguments[1]); const QString l10nCustomDir = addTrailingSlash(arguments[2]); const QString destDir = addTrailingSlash(arguments[3]); + const QString l10nRelDir = arguments.count() == 5 ? addTrailingSlash(arguments[4]) : l10nDir; QFile i18nFile(l10nDir + QStringLiteral("common/l10n.xml")); @@ -185,13 +186,13 @@ int main(int argc, char **argv) if (rxEntity.indexIn(line) != -1 && !foundRxEntity2) { foundRxEntity = true; langCode = rxEntity.cap(1); - langFile = l10nDir + QStringLiteral("common/") + rxEntity.cap(2); + langFile = l10nRelDir + QStringLiteral("common/") + rxEntity.cap(2); allLangs += qMakePair(langCode, langFile); //qCDebug(KDocToolsLog) << langCode << " - " << langFile; } else if (rxEntity2.indexIn(line) != -1 && !foundRxEntity) { foundRxEntity2 = true; langCode = rxEntity2.cap(1); - langFile = l10nDir + QStringLiteral("common/") + rxEntity2.cap(2); + langFile = l10nRelDir + QStringLiteral("common/") + rxEntity2.cap(2); allLangs += qMakePair(langCode, langFile); //qCDebug(KDocToolsLog) << langCode << " - " << langFile; } @@ -242,10 +243,10 @@ int main(int argc, char **argv) if (foundRxEntity) { /* old style (docbook-xsl<=1.75) */ - res = writeLangFile(all10nFName, l10nDir + QStringLiteral("common/l10n.dtd"), + res = writeLangFile(all10nFName, l10nRelDir + QStringLiteral("common/l10n.dtd"), allLangs); } else { - res = writeLangFileNew(all10nFName, l10nDir + QStringLiteral("common/l10n.dtd"), + res = writeLangFileNew(all10nFName, l10nRelDir + QStringLiteral("common/l10n.dtd"), allLangs); } -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor