From d5a8f98a5d6c41677807ab6d2e72197be4ae5585 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Wed, 18 Sep 2024 21:51:14 +0200 Subject: [PATCH] Clean `pdf2htmlEX` and `wvWare` packages (#18) --- .github/workflows/build.yml | 4 +- .github/workflows/build_inner.yml | 1 + recipes/fontforge/all/conanfile.py | 6 +- .../fontforge/all/test_package/link_test.c | 4 +- recipes/odrcore/all/conandata.yml | 3 - recipes/odrcore/all/conanfile.py | 15 +- recipes/odrcore/config.yml | 2 - recipes/pdf2htmlex/all/conandata.yml | 12 +- recipes/pdf2htmlex/all/conanfile.py | 44 +- .../0001-Upgrade-Poppler-to-24.06.1.patch | 161 ++++++ .../0002-Update-missing-font-workaround.patch | 28 + .../0003-use-find_package.patch | 103 ++++ .../0004-build-and-install-library.patch | 56 ++ .../pdf2htmlex/all/test_package/link_test.cpp | 6 +- recipes/pdf2htmlex/config.yml | 3 +- recipes/wvware/all/conandata.yml | 12 +- recipes/wvware/all/conanfile.py | 6 +- .../patches/1.2.9/0001-gsf-meta-names.patch | 24 + .../0002-C99-decls.patch} | 56 +- .../patches/1.2.9/0003-format-security.patch | 25 + .../0004-gcc14-build-fix.patch} | 20 +- .../patches/wv-1.2.9-format-security.patch | 11 - .../all/patches/wv-1.2.9-gsf-meta-names.patch | 10 - .../wvware/all/patches/wvWare-library.patch | 478 ------------------ scripts/conan_export_all_packages.py | 12 +- 25 files changed, 517 insertions(+), 585 deletions(-) create mode 100644 recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0001-Upgrade-Poppler-to-24.06.1.patch create mode 100644 recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0002-Update-missing-font-workaround.patch create mode 100644 recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0003-use-find_package.patch create mode 100644 recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0004-build-and-install-library.patch create mode 100644 recipes/wvware/all/patches/1.2.9/0001-gsf-meta-names.patch rename recipes/wvware/all/patches/{wv-1.2.9-C99-decls.patch => 1.2.9/0002-C99-decls.patch} (64%) create mode 100644 recipes/wvware/all/patches/1.2.9/0003-format-security.patch rename recipes/wvware/all/patches/{wv-1.2.9-gcc14-build-fix.patch => 1.2.9/0004-gcc14-build-fix.patch} (59%) delete mode 100644 recipes/wvware/all/patches/wv-1.2.9-format-security.patch delete mode 100644 recipes/wvware/all/patches/wv-1.2.9-gsf-meta-names.patch delete mode 100644 recipes/wvware/all/patches/wvWare-library.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48ab721..c788461 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,8 +2,6 @@ name: build on: push: - paths: - - 'recipes/**' schedule: # Executed daily, 9:37 is randomly picked time, not 00:00, # because 00:00 is used too frequently and GitHub asks to do cronjobs at less busy times @@ -88,7 +86,7 @@ jobs: if: ${{ github.event.inputs.build_dependents != 'false' }} shell: bash # bash shell needed to pipefail on error run: | - conan graph info recipes/odrcore/all/conanfile.py --version=4.1.0-pdf2htmlex-git --profile:host=android-21-armv8 --format=json | tee odrcore-dependency-tree.json + conan graph info recipes/odrcore/all/conanfile.py --version=4.1.0 --profile:host=android-21-armv8 --format=json | tee odrcore-dependency-tree.json echo "graph_file=odrcore-dependency-tree.json" >> $GITHUB_OUTPUT - name: Generate wvware dependency tree diff --git a/.github/workflows/build_inner.yml b/.github/workflows/build_inner.yml index ffa8207..6557801 100644 --- a/.github/workflows/build_inner.yml +++ b/.github/workflows/build_inner.yml @@ -16,6 +16,7 @@ on: secrets: ARTIFACTORY: required: true + jobs: build: runs-on: ${{ matrix.config.build_machine }} diff --git a/recipes/fontforge/all/conanfile.py b/recipes/fontforge/all/conanfile.py index ce75593..f035833 100644 --- a/recipes/fontforge/all/conanfile.py +++ b/recipes/fontforge/all/conanfile.py @@ -43,7 +43,7 @@ def requirements(self): self.requires("libxml2/2.12.7") self.requires("giflib/5.2.2") self.requires("libjpeg/9f") - self.requires("libpng/1.6.43") + self.requires("libpng/[>=1.6 <2]") if self.options.with_tiff: self.requires("libtiff/4.6.0") @@ -80,7 +80,7 @@ def source(self): apply_conandata_patches(self) def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def generate(self): deps = CMakeDeps(self) @@ -94,6 +94,7 @@ def generate(self): tc.variables["ENABLE_LIBTIFF"] = self.options.with_tiff tc.variables["ENABLE_LIBREADLINE"] = "OFF" tc.variables["INSTALL_PRIVATE_HEADERS"] = self.options.install_private_headers + tc.variables["CMAKE_INSTALL_INCLUDEDIR"] = "include/fontforge" tc.generate() def build(self): @@ -149,3 +150,4 @@ def package(self): def package_info(self): self.cpp_info.libs = ["fontforge"] + self.cpp_info.includedirs = ["include", "include/fontforge"] diff --git a/recipes/fontforge/all/test_package/link_test.c b/recipes/fontforge/all/test_package/link_test.c index 865436d..2dd148c 100644 --- a/recipes/fontforge/all/test_package/link_test.c +++ b/recipes/fontforge/all/test_package/link_test.c @@ -1,5 +1,5 @@ -#include -#include "start.h" +#include +#include "fontforge/start.h" int main() { diff --git a/recipes/odrcore/all/conandata.yml b/recipes/odrcore/all/conandata.yml index c1f4964..0f2315b 100644 --- a/recipes/odrcore/all/conandata.yml +++ b/recipes/odrcore/all/conandata.yml @@ -35,9 +35,6 @@ sources: source: url: "https://github.com/opendocument-app/OpenDocument.core/archive/refs/tags/v4.1.0.tar.gz" sha256: "3608b1ac4723881b88d6212420bc725a0d758360d97155c1a5919271ae8f3c79" - "4.1.0-pdf2htmlex-git": - source: - url: "https://github.com/opendocument-app/OpenDocument.core/archive/refs/heads/pdf2htmlex-conan.zip" "4.1.1": source: url: "https://github.com/opendocument-app/OpenDocument.core/archive/refs/tags/v4.1.1.tar.gz" diff --git a/recipes/odrcore/all/conanfile.py b/recipes/odrcore/all/conanfile.py index fbb6373..4b5b5e6 100644 --- a/recipes/odrcore/all/conanfile.py +++ b/recipes/odrcore/all/conanfile.py @@ -39,9 +39,6 @@ def config_options(self): # But by the time config_options() is executed, default_options is already done parsed. del self.options.with_pdf2htmlEX del self.options.with_wvWare - elif self.version != "4.1.0-pdf2htmlex-git": - del self.options.with_pdf2htmlEX - del self.options.with_wvWare def configure(self): if self.options.shared: @@ -59,7 +56,7 @@ def requirements(self): self.requires("uchardet/0.0.8") self.requires("utfcpp/4.0.4") if self.options.get_safe("with_pdf2htmlEX"): - self.requires("pdf2htmlex/0.18.8.rc1-20240905-git") + self.requires("pdf2htmlex/0.18.8.rc1-git-6f85c88") if self.options.get_safe("with_wvWare"): self.requires("wvware/1.2.9") @@ -107,16 +104,6 @@ def build(self): cmake.build() def package(self): - # Not needed with CMake changes in 4.1.0-pdf2htmlex-git - # Other versions may not need it too - if self.version != "4.1.0-pdf2htmlex-git": - copy( - self, - "*.hpp", - src=os.path.join(self.recipe_folder, "src"), - dst=os.path.join(self.export_sources_folder, "include"), - ) - cmake = CMake(self) cmake.install() diff --git a/recipes/odrcore/config.yml b/recipes/odrcore/config.yml index 22e0cf0..af50a8c 100644 --- a/recipes/odrcore/config.yml +++ b/recipes/odrcore/config.yml @@ -17,7 +17,5 @@ versions: folder: "all" "4.1.0": folder: "all" - "4.1.0-pdf2htmlex-git": - folder: "all" "4.1.1": folder: "all" diff --git a/recipes/pdf2htmlex/all/conandata.yml b/recipes/pdf2htmlex/all/conandata.yml index f5a7436..0de9db3 100644 --- a/recipes/pdf2htmlex/all/conandata.yml +++ b/recipes/pdf2htmlex/all/conandata.yml @@ -1,4 +1,10 @@ sources: - "0.18.8.rc1-20240905-git": - url: "https://github.com/ViliusSutkus89/pdf2htmlEX/archive/0bbd6686f7214c5ddb230fa3323b75e954f39418.zip" - sha256: "394a5a5555005a18ada6f810ef7ab693f6d916cd9302d874483cbc4956caf557" + "0.18.8.rc1-git-6f85c88": + url: "https://github.com/opendocument-app/pdf2htmlEX/archive/refs/tags/v0.18.8.rc1-git-6f85c88.tar.gz" + sha256: "b88c0897c26caaba62c84069a22043be703a495852af3d9af9d63e18fde2296e" +patches: + "0.18.8.rc1-git-6f85c88": + - patch_file: "patches/0.18.8.rc1-git-6f85c88/0001-Upgrade-Poppler-to-24.06.1.patch" + - patch_file: "patches/0.18.8.rc1-git-6f85c88/0002-Update-missing-font-workaround.patch" + - patch_file: "patches/0.18.8.rc1-git-6f85c88/0003-use-find_package.patch" + - patch_file: "patches/0.18.8.rc1-git-6f85c88/0004-build-and-install-library.patch" diff --git a/recipes/pdf2htmlex/all/conanfile.py b/recipes/pdf2htmlex/all/conanfile.py index 768ba0a..9a7f85e 100644 --- a/recipes/pdf2htmlex/all/conanfile.py +++ b/recipes/pdf2htmlex/all/conanfile.py @@ -25,6 +25,25 @@ class pdf2htmlEXConan(ConanFile): options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def validate(self): + if not self.dependencies["poppler"].options.with_cairo: + raise ConanInvalidConfiguration('Dependency "poppler" needs to be built with "with_cairo" option') + if not self.dependencies["poppler"].options.with_glib: + raise ConanInvalidConfiguration('Dependency "poppler" needs to be built with "with_glib" option') + if self.dependencies["poppler"].options.shared: + raise ConanInvalidConfiguration('Dependency "poppler" needs to be built as a static library (shared=False)') + if not self.dependencies["fontforge"].options.install_private_headers: + raise ConanInvalidConfiguration( + 'Dependency "fontforge" needs to be built with "install_private_headers" option') + def requirements(self): self.requires("poppler/24.08.0-odr", options={ "with_cairo": True, @@ -53,6 +72,9 @@ def requirements(self): # self.requires("libiconv/1.17") # self.requires("giflib/5.2.2") + def layout(self): + cmake_layout(self, src_folder="src") + def export_sources(self): export_conandata_patches(self) @@ -65,28 +87,6 @@ def source(self): exe = os.path.join(self.source_folder, "pdf2htmlEX", "share", executable) os.chmod(exe, os.stat(exe).st_mode | stat.S_IEXEC) - def config_options(self): - if self.settings.os == "Windows": - self.options.rm_safe("fPIC") - - def configure(self): - if self.options.shared: - self.options.rm_safe("fPIC") - - def validate(self): - if not self.dependencies["poppler"].options.with_cairo: - raise ConanInvalidConfiguration('Dependency "poppler" needs to be built with "with_cairo" option') - if not self.dependencies["poppler"].options.with_glib: - raise ConanInvalidConfiguration('Dependency "poppler" needs to be built with "with_glib" option') - if self.dependencies["poppler"].options.shared: - raise ConanInvalidConfiguration('Dependency "poppler" needs to be built as a static library (shared=False)') - if not self.dependencies["fontforge"].options.install_private_headers: - raise ConanInvalidConfiguration( - 'Dependency "fontforge" needs to be built with "install_private_headers" option') - - def layout(self): - cmake_layout(self, src_folder="src") - def generate(self): deps = CMakeDeps(self) deps.generate() diff --git a/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0001-Upgrade-Poppler-to-24.06.1.patch b/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0001-Upgrade-Poppler-to-24.06.1.patch new file mode 100644 index 0000000..adad216 --- /dev/null +++ b/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0001-Upgrade-Poppler-to-24.06.1.patch @@ -0,0 +1,161 @@ +From 5e5a947bd1320e19c1271f5dfaeef098baae4452 Mon Sep 17 00:00:00 2001 +From: Vilius Sutkus '89 +Date: Thu, 13 Jun 2024 14:18:06 +0300 +Subject: [PATCH 1/4] Upgrade Poppler to 24.06.1 + +Poppler-24.02.0 OutlineItem changed Title from Unicode pointer and length counter into Unicode vector. ( https://gitlab.freedesktop.org/poppler/poppler/-/commit/fc1c711cb5f769546c6b31cc688bf0ee7f0c1dbc ) + +Poppler-24.03.0 GooString.h exposes std::string::starts_with and ::ends_with which are CXX20. +--- + buildScripts/versionEnvs | 5 ++- + pdf2htmlEX/CMakeLists.txt | 4 +- + pdf2htmlEX/src/HTMLRenderer/outline.cc | 2 +- + pdf2htmlEX/src/util/encoding.cc | 60 +++++++++++++++----------- + pdf2htmlEX/src/util/encoding.h | 2 + + 5 files changed, 44 insertions(+), 29 deletions(-) + +diff --git a/buildScripts/versionEnvs b/buildScripts/versionEnvs +index 3ea6cba..9ef5f8b 100755 +--- a/buildScripts/versionEnvs ++++ b/buildScripts/versionEnvs +@@ -4,11 +4,12 @@ + # versions + + # see: https://poppler.freedesktop.org/releases.html +-# current working: 24.01.0 ++# current working: 24.06.1 + + export PDF2HTMLEX_VERSION=0.18.8.rc2 + +-export POPPLER_VERSION=poppler-24.01.0 ++export POPPLER_VERSION=poppler-24.06.1 ++#export POPPLER_VERSION=poppler-24.01.0 + #export POPPLER_VERSION=poppler-23.12.0 + #export POPPLER_VERSION=poppler-21.02.0 + #export POPPLER_VERSION=poppler-0.89.0 +diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt +index 761bb21..84b4a98 100644 +--- a/pdf2htmlEX/CMakeLists.txt ++++ b/pdf2htmlEX/CMakeLists.txt +@@ -125,8 +125,8 @@ set(CMAKE_THREAD_PREFER_PTHREAD ON) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} Threads::Threads) +-# Poppler-23.12.0 requires CXX17 +-set(CMAKE_CXX_STANDARD 17) ++# Poppler-24.03.0 requires CXX20 ++set(CMAKE_CXX_STANDARD 20) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + if(NOT CYGWIN) + set(CMAKE_CXX_EXTENSIONS OFF) +diff --git a/pdf2htmlEX/src/HTMLRenderer/outline.cc b/pdf2htmlEX/src/HTMLRenderer/outline.cc +index 4fdc826..28415c8 100644 +--- a/pdf2htmlEX/src/HTMLRenderer/outline.cc ++++ b/pdf2htmlEX/src/HTMLRenderer/outline.cc +@@ -42,7 +42,7 @@ void HTMLRenderer::process_outline_items(const std::vector * items + + f_outline.fs << ">"; + +- writeUnicodes(f_outline.fs, item->getTitle(), item->getTitleLength()); ++ writeUnicodes(f_outline.fs, item->getTitle()); + + f_outline.fs << ""; + +diff --git a/pdf2htmlEX/src/util/encoding.cc b/pdf2htmlEX/src/util/encoding.cc +index 6b600bc..1e3fc29 100644 +--- a/pdf2htmlEX/src/util/encoding.cc ++++ b/pdf2htmlEX/src/util/encoding.cc +@@ -55,34 +55,46 @@ static int mapUTF8(Unicode u, char *buf, int bufSize) + } + } + ++static void writeUnicode(ostream & out, const Unicode u) { ++ switch(u) ++ { ++ case '&': ++ out << "&"; ++ break; ++ case '\"': ++ out << """; ++ break; ++ case '\'': ++ out << "'"; ++ break; ++ case '<': ++ out << "<"; ++ break; ++ case '>': ++ out << ">"; ++ break; ++ default: ++ { ++ char buf[4]; ++ auto n = mapUTF8(u, buf, 4); ++ out.write(buf, n); ++ } ++ } ++} ++ + void writeUnicodes(ostream & out, const Unicode * u, int uLen) + { + for(int i = 0; i < uLen; ++i) + { +- switch(u[i]) +- { +- case '&': +- out << "&"; +- break; +- case '\"': +- out << """; +- break; +- case '\'': +- out << "'"; +- break; +- case '<': +- out << "<"; +- break; +- case '>': +- out << ">"; +- break; +- default: +- { +- char buf[4]; +- auto n = mapUTF8(u[i], buf, 4); +- out.write(buf, n); +- } +- } ++ writeUnicode(out, u[i]); ++ } ++} ++ ++void writeUnicodes(ostream & out, const std::vector & u) ++{ ++ for(const auto & i: u) ++ { ++ writeUnicode(out, i); + } + } + +diff --git a/pdf2htmlEX/src/util/encoding.h b/pdf2htmlEX/src/util/encoding.h +index c4d7732..da3c00f 100644 +--- a/pdf2htmlEX/src/util/encoding.h ++++ b/pdf2htmlEX/src/util/encoding.h +@@ -9,6 +9,7 @@ + #define ENCODING_H__ + + #include ++#include + #include + + #include +@@ -19,6 +20,7 @@ namespace pdf2htmlEX { + * Escape necessary characters, and map Unicode to UTF-8 + */ + void writeUnicodes(std::ostream & out, const Unicode * u, int uLen); ++void writeUnicodes(std::ostream & out, const std::vector & u); + + + /* +-- +2.39.3 (Apple Git-146) + diff --git a/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0002-Update-missing-font-workaround.patch b/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0002-Update-missing-font-workaround.patch new file mode 100644 index 0000000..7d690dd --- /dev/null +++ b/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0002-Update-missing-font-workaround.patch @@ -0,0 +1,28 @@ +From 2110b5eaa45decf7ee222953642af5c7967e0424 Mon Sep 17 00:00:00 2001 +From: Vilius Sutkus '89 +Date: Mon, 5 Aug 2024 21:35:29 +0300 +Subject: [PATCH 2/4] Update missing font workaround + +--- + pdf2htmlEX/src/HTMLRenderer/font.cc | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/pdf2htmlEX/src/HTMLRenderer/font.cc b/pdf2htmlEX/src/HTMLRenderer/font.cc +index 9c3112b..ff27da2 100644 +--- a/pdf2htmlEX/src/HTMLRenderer/font.cc ++++ b/pdf2htmlEX/src/HTMLRenderer/font.cc +@@ -1080,7 +1080,10 @@ static string general_font_family(GfxFont * font) + // TODO: this function is called when some font is unable to process, may use the name there as a hint + void HTMLRenderer::export_remote_default_font(long long fn_id) + { +- f_css.fs << "." << CSS::FONT_FAMILY_CN << fn_id << "{font-family:sans-serif;visibility:hidden;}" << endl; ++// Workaround for https://github.com/opendocument-app/pdf2htmlEX-Android/issues/94 ++// Workaround for https://github.com/opendocument-app/OpenDocument.droid/issues/348 ++// f_css.fs << "." << CSS::FONT_FAMILY_CN << fn_id << "{font-family:sans-serif;visibility:hidden;}" << endl; ++ f_css.fs << "." << CSS::FONT_FAMILY_CN << fn_id << "{font-family:sans-serif;visibility:visible;}" << endl; + } + + void HTMLRenderer::export_local_font(const FontInfo & info, GfxFont * font, const string & original_font_name, const string & cssfont) +-- +2.39.3 (Apple Git-146) + diff --git a/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0003-use-find_package.patch b/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0003-use-find_package.patch new file mode 100644 index 0000000..c8a26ee --- /dev/null +++ b/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0003-use-find_package.patch @@ -0,0 +1,103 @@ +From 90261925551ebd76032324728b2ad52eb741902c Mon Sep 17 00:00:00 2001 +From: Andreas Stefl +Date: Wed, 18 Sep 2024 19:49:39 +0200 +Subject: [PATCH 3/4] use `find_package` + +--- + pdf2htmlEX/CMakeLists.txt | 75 +++++++++++---------------------------- + 1 file changed, 20 insertions(+), 55 deletions(-) + +diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt +index 84b4a98..73a7eeb 100644 +--- a/pdf2htmlEX/CMakeLists.txt ++++ b/pdf2htmlEX/CMakeLists.txt +@@ -21,66 +21,31 @@ add_custom_target(dist + | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + +-find_package(PkgConfig) +- +- +-# SINCE we have a very intimate relationship with a particular version of +-# poppler... we explicitly describe the poppler include and library +-# paths. +-# +-include_directories( +- ../poppler/build/poppler +- ../poppler/build +- ../poppler/poppler +- ../poppler +-) +-# +-# The following order is critical as the glib functions use functions +-# located in the main poppler library +-# +-set(POPPLER_LIBRARIES ${POPPLER_LIBRARIES} +- ${CMAKE_SOURCE_DIR}/../poppler/build/glib/libpoppler-glib.a +- ${CMAKE_SOURCE_DIR}/../poppler/build/libpoppler.a ++find_package(poppler REQUIRED) ++set(PDF2HTMLEX_LIBS ++ ${PDF2HTMLEX_LIBS} ++ poppler::libpoppler ++ poppler::libpoppler-cpp ++ poppler::libpoppler-splash ++ poppler::libpoppler-cairo ++ poppler::libpoppler-glib + ) + +- + if(ENABLE_SVG) +- pkg_check_modules(CAIRO REQUIRED cairo>=1.10.0) +- message("-- Trying to locate cairo-svg...") +- find_path(CAIRO_SVG_INCLUDE_PATH cairo-svg.h PATHS ${CAIRO_INCLUDE_DIRS} NO_DEFAULT_PATH) +- if(CAIRO_SVG_INCLUDE_PATH) +- message("-- found cairo-svg...") +- include_directories(${CAIRO_INCLUDE_DIRS}) +- if(NOT DEFINED ENV{USING_BREW}) +- link_directories(${CAIRO_LIBRARY_DIRS}) +- set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${CAIRO_LIBRARIES}) +- endif() +- set(ENABLE_SVG 1) +- else() +- message(FATAL_ERROR "Error: no SVG support found in Cairo") +- endif() +- +- find_package(Freetype REQUIRED) +- include_directories(${FREETYPE_INCLUDE_DIRS}) +- link_directories(${FREETYPE_LIBRARY_DIRS}) +-# set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${FREETYPE_LIBRARIES}) ++ find_package(cairo REQUIRED) ++ find_package(freetype REQUIRED) ++ set(PDF2HTMLEX_LIBS ++ ${PDF2HTMLEX_LIBS} ++ cairo::cairo-svg ++ Freetype::Freetype ++ ) ++ set(ENABLE_SVG 1) + endif() + +-# SINCE we have a very intimate relationship with a particular version of +-# fontforge... we explicitly describe the fontforge include and library +-# paths. +-# +-include_directories( +- ../fontforge/fontforge +- ../fontforge +- ../fontforge/build/inc +- ../fontforge/inc +-) +-# +-include_directories(${FONTFORGE_INCLUDE_DIRS}) +-link_directories(${FONTFORGE_LIBRARY_DIRS}) +-set(FONTFORGE_LIBRARIES ${FONTFORGE_LIBRARIES} +- ${CMAKE_SOURCE_DIR}/../fontforge/build/lib/libfontforge.a ++find_package(fontforge REQUIRED) ++set(PDF2HTMLEX_LIBS ++ ${PDF2HTMLEX_LIBS} ++ fontforge::fontforge + ) + + # If we are using Alpine Linux then we need to add -lintl +-- +2.39.3 (Apple Git-146) + diff --git a/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0004-build-and-install-library.patch b/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0004-build-and-install-library.patch new file mode 100644 index 0000000..b9ba5c2 --- /dev/null +++ b/recipes/pdf2htmlex/all/patches/0.18.8.rc1-git-6f85c88/0004-build-and-install-library.patch @@ -0,0 +1,56 @@ +From 44f9ac6babee478b3481ee6e9657c12d27a39950 Mon Sep 17 00:00:00 2001 +From: Andreas Stefl +Date: Wed, 18 Sep 2024 20:16:55 +0200 +Subject: [PATCH 4/4] build and install library + +--- + pdf2htmlEX/CMakeLists.txt | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/pdf2htmlEX/CMakeLists.txt b/pdf2htmlEX/CMakeLists.txt +index 73a7eeb..1e05155 100644 +--- a/pdf2htmlEX/CMakeLists.txt ++++ b/pdf2htmlEX/CMakeLists.txt +@@ -108,7 +108,6 @@ configure_file (${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js.in ${CMAKE_SOURCE_DIR}/s + + set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC} + src/Param.h +- src/pdf2htmlEX.cc + src/pdf2htmlEX-config.h + src/HTMLRenderer/HTMLRenderer.h + src/HTMLRenderer/draw.cc +@@ -169,8 +168,12 @@ set(PDF2HTMLEX_SRC ${PDF2HTMLEX_SRC} + src/TmpFiles.cc + ) + +-add_executable(pdf2htmlEX ${PDF2HTMLEX_SRC}) +-target_link_libraries(pdf2htmlEX ${PDF2HTMLEX_LIBS}) ++add_library(libpdf2htmlEX ${PDF2HTMLEX_SRC}) ++target_link_libraries(libpdf2htmlEX ${PDF2HTMLEX_LIBS}) ++set_target_properties(libpdf2htmlEX PROPERTIES OUTPUT_NAME pdf2htmlEX) ++ ++add_executable(pdf2htmlEX src/pdf2htmlEX.cc) ++target_link_libraries(pdf2htmlEX libpdf2htmlEX) + + add_custom_target(pdf2htmlEX_resources ALL DEPENDS + ${CMAKE_SOURCE_DIR}/share/base.min.css +@@ -195,6 +198,16 @@ add_custom_command(OUTPUT + ${CMAKE_SOURCE_DIR}/share/fancy.css + ) + ++install (TARGETS libpdf2htmlEX ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++) ++install ( ++ DIRECTORY pdf2htmlEX/src/ ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++ FILES_MATCHING PATTERN "*.h" ++) ++ + install (TARGETS pdf2htmlEX DESTINATION bin) + + set(PDF2HTMLEX_RESOURCE +-- +2.39.3 (Apple Git-146) + diff --git a/recipes/pdf2htmlex/all/test_package/link_test.cpp b/recipes/pdf2htmlex/all/test_package/link_test.cpp index 3e677c8..b63fe43 100644 --- a/recipes/pdf2htmlex/all/test_package/link_test.cpp +++ b/recipes/pdf2htmlex/all/test_package/link_test.cpp @@ -1,9 +1,7 @@ -#include -#include "pdf2htmlEX.h" +#include "pdf2htmlEX/pdf2htmlEX-config.h" +#include "pdf2htmlEX/HTMLRenderer/HTMLRenderer.h" int main() { - pdf2htmlEX::pdf2htmlEX converter; - std::cout << "pdf2htmlEX object created successfully" << std::endl; return 0; } diff --git a/recipes/pdf2htmlex/config.yml b/recipes/pdf2htmlex/config.yml index ce5bad1..b1c6e2b 100644 --- a/recipes/pdf2htmlex/config.yml +++ b/recipes/pdf2htmlex/config.yml @@ -1,4 +1,3 @@ versions: - "0.18.8.rc1-20240905-git": + "0.18.8.rc1-git-6f85c88": folder: all - diff --git a/recipes/wvware/all/conandata.yml b/recipes/wvware/all/conandata.yml index c29f504..eb8c0a7 100644 --- a/recipes/wvware/all/conandata.yml +++ b/recipes/wvware/all/conandata.yml @@ -1,15 +1,13 @@ sources: "1.2.9": url: - - "https://github.com/ViliusSutkus89/OpenSourceMirrors/releases/download/wvWare-1.2.9/wv-1.2.9.tar.gz" + - "https://github.com/opendocument-app/wvWare/releases/download/v1.2.9/wv-1.2.9.tar.gz" - "http://www.nl.abisource.com/downloads/wv/1.2.9/wv-1.2.9.tar.gz" sha256: "4c730d3b325c0785450dd3a043eeb53e1518598c4f41f155558385dd2635c19d" patches: "1.2.9": - - patch_file: "patches/wv-1.2.9-gsf-meta-names.patch" + - patch_file: "patches/1.2.9/0001-gsf-meta-names.patch" # https://gitweb.gentoo.org/repo/gentoo.git/tree/app-text/wv/files - - patch_file: "patches/wv-1.2.9-C99-decls.patch" - - patch_file: "patches/wv-1.2.9-format-security.patch" - - patch_file: "patches/wv-1.2.9-gcc14-build-fix.patch" - - - patch_file: "patches/wvWare-library.patch" + - patch_file: "patches/1.2.9/0002-C99-decls.patch" + - patch_file: "patches/1.2.9/0003-format-security.patch" + - patch_file: "patches/1.2.9/0004-gcc14-build-fix.patch" diff --git a/recipes/wvware/all/conanfile.py b/recipes/wvware/all/conanfile.py index ec37e88..6131710 100644 --- a/recipes/wvware/all/conanfile.py +++ b/recipes/wvware/all/conanfile.py @@ -4,6 +4,7 @@ from conan import ConanFile from conan.tools.apple import fix_apple_shared_install_name from conan.tools.build import cross_building +from conan.tools.layout import basic_layout from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps @@ -55,7 +56,7 @@ def requirements(self): self.requires("glib/2.81.0-odr") self.requires("libiconv/1.17") self.requires("zlib/1.3.1") - self.requires("libpng/1.6.43") + self.requires("libpng/[>=1.6 <2]") # Requirements not passed from libgsf self.requires("libxml2/2.12.7") @@ -81,6 +82,9 @@ def build_requirements(self): if is_msvc(self): self.tool_requires("automake/1.16.5") + def layout(self): + basic_layout(self, src_folder="src") + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) # apply patches listed in conandata.yml diff --git a/recipes/wvware/all/patches/1.2.9/0001-gsf-meta-names.patch b/recipes/wvware/all/patches/1.2.9/0001-gsf-meta-names.patch new file mode 100644 index 0000000..a47463e --- /dev/null +++ b/recipes/wvware/all/patches/1.2.9/0001-gsf-meta-names.patch @@ -0,0 +1,24 @@ +From 4105b1e53c1c98d0b4b5d139090de6d7b07ebd2e Mon Sep 17 00:00:00 2001 +From: Andreas Stefl +Date: Wed, 18 Sep 2024 15:54:59 +0200 +Subject: [PATCH 1/4] gsf meta names + +--- + wvSummary.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/wvSummary.c b/wvSummary.c +index 980b856..27b5fed 100644 +--- a/wvSummary.c ++++ b/wvSummary.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include + #include +-- +2.39.3 (Apple Git-146) + diff --git a/recipes/wvware/all/patches/wv-1.2.9-C99-decls.patch b/recipes/wvware/all/patches/1.2.9/0002-C99-decls.patch similarity index 64% rename from recipes/wvware/all/patches/wv-1.2.9-C99-decls.patch rename to recipes/wvware/all/patches/1.2.9/0002-C99-decls.patch index 9ef57a2..5cabca3 100644 --- a/recipes/wvware/all/patches/wv-1.2.9-C99-decls.patch +++ b/recipes/wvware/all/patches/1.2.9/0002-C99-decls.patch @@ -1,5 +1,20 @@ ---- field.c -+++ field.c +From da3f2e5aa7ebd510e21dd20eef5b3fb61cce1a1a Mon Sep 17 00:00:00 2001 +From: Andreas Stefl +Date: Wed, 18 Sep 2024 15:55:27 +0200 +Subject: [PATCH 2/4] C99 decls + +--- + field.c | 1 + + md5.c | 17 +++++------------ + md5.h | 6 +++--- + wvConfig.c | 1 + + wvparse.c | 3 +++ + 5 files changed, 13 insertions(+), 15 deletions(-) + +diff --git a/field.c b/field.c +index 8e56c37..0b21f48 100644 +--- a/field.c ++++ b/field.c @@ -25,6 +25,7 @@ #include #include @@ -8,8 +23,10 @@ #include #include "wv.h" ---- md5.c -+++ md5.c +diff --git a/md5.c b/md5.c +index 5557840..c6b001a 100644 +--- a/md5.c ++++ b/md5.c @@ -57,7 +57,7 @@ #include "md5.h" @@ -19,7 +36,7 @@ static unsigned char PADDING[64] = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -@@ -103,8 +103,7 @@ +@@ -103,8 +103,7 @@ static unsigned char PADDING[64] = { } void @@ -29,7 +46,7 @@ { mdContext->i[0] = mdContext->i[1] = (UINT4) 0; -@@ -117,10 +116,7 @@ +@@ -117,10 +116,7 @@ wvMD5Init (mdContext) } void @@ -41,7 +58,7 @@ { UINT4 in[16]; int mdi; -@@ -155,8 +151,7 @@ +@@ -155,8 +151,7 @@ wvMD5Update (mdContext, inBuf, inLen) } void @@ -51,7 +68,7 @@ { UINT4 in[16]; int mdi; -@@ -198,9 +193,7 @@ +@@ -198,9 +193,7 @@ wvMD5Final (mdContext) /* Basic MD5 step. Transform buf based on in. */ static void @@ -62,9 +79,11 @@ { UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3]; ---- md5.h -+++ md5.h -@@ -48,9 +48,9 @@ +diff --git a/md5.h b/md5.h +index c6fdba1..3096dc5 100644 +--- a/md5.h ++++ b/md5.h +@@ -48,9 +48,9 @@ typedef struct { unsigned char digest[16]; /* actual digest after MD5Final call */ } wvMD5_CTX; @@ -77,8 +96,10 @@ /* ********************************************************************** ---- wvConfig.c -+++ wvConfig.c +diff --git a/wvConfig.c b/wvConfig.c +index 03ffccc..e44f4f6 100644 +--- a/wvConfig.c ++++ b/wvConfig.c @@ -24,6 +24,7 @@ #include #include @@ -87,8 +108,10 @@ #include #include #include "wv.h" ---- wvparse.c -+++ wvparse.c +diff --git a/wvparse.c b/wvparse.c +index 250000b..23ada17 100644 +--- a/wvparse.c ++++ b/wvparse.c @@ -35,6 +35,9 @@ #include #include @@ -99,3 +122,6 @@ int wvInit (void) { +-- +2.39.3 (Apple Git-146) + diff --git a/recipes/wvware/all/patches/1.2.9/0003-format-security.patch b/recipes/wvware/all/patches/1.2.9/0003-format-security.patch new file mode 100644 index 0000000..3117677 --- /dev/null +++ b/recipes/wvware/all/patches/1.2.9/0003-format-security.patch @@ -0,0 +1,25 @@ +From 3d71f1679515fda77832907f8c5156c0bbf643cb Mon Sep 17 00:00:00 2001 +From: Andreas Stefl +Date: Wed, 18 Sep 2024 15:55:44 +0200 +Subject: [PATCH 3/4] format security + +--- + wvRTF.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/wvRTF.c b/wvRTF.c +index 364d4e0..7253e53 100644 +--- a/wvRTF.c ++++ b/wvRTF.c +@@ -192,7 +192,7 @@ output_rtfUserData (rtfUserData * ud) + rtf_output_char ('{'); + + /* font color */ +- rtf_output (rtfColors[ud->cCol]); ++ rtf_output ("%s", rtfColors[ud->cCol]); + + /* font face */ + rtf_output ("\\f%d", ud->cFont); +-- +2.39.3 (Apple Git-146) + diff --git a/recipes/wvware/all/patches/wv-1.2.9-gcc14-build-fix.patch b/recipes/wvware/all/patches/1.2.9/0004-gcc14-build-fix.patch similarity index 59% rename from recipes/wvware/all/patches/wv-1.2.9-gcc14-build-fix.patch rename to recipes/wvware/all/patches/1.2.9/0004-gcc14-build-fix.patch index be8a70a..7d3667f 100644 --- a/recipes/wvware/all/patches/wv-1.2.9-gcc14-build-fix.patch +++ b/recipes/wvware/all/patches/1.2.9/0004-gcc14-build-fix.patch @@ -1,7 +1,16 @@ -Bug: https://bugs.gentoo.org/921570 -Bug: https://bugs.gentoo.org/883207 ---- wvConfig.c -+++ wvConfig.c +From cc61f0ae52b642d8e6560ddaed26bcf3fd5eae01 Mon Sep 17 00:00:00 2001 +From: Andreas Stefl +Date: Wed, 18 Sep 2024 15:56:00 +0200 +Subject: [PATCH 4/4] gcc14 build fix + +--- + wvConfig.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/wvConfig.c b/wvConfig.c +index e44f4f6..840fa93 100644 +--- a/wvConfig.c ++++ b/wvConfig.c @@ -158,7 +158,7 @@ wvReleaseStateData (state_data * data) @@ -20,3 +29,6 @@ Bug: https://bugs.gentoo.org/883207 { /* expand_data *mydata = (expand_data *)userData; +-- +2.39.3 (Apple Git-146) + diff --git a/recipes/wvware/all/patches/wv-1.2.9-format-security.patch b/recipes/wvware/all/patches/wv-1.2.9-format-security.patch deleted file mode 100644 index 90e477d..0000000 --- a/recipes/wvware/all/patches/wv-1.2.9-format-security.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- wvRTF.c 2013-12-12 17:03:41.635612853 -0500 -+++ wvRTF.c 2013-12-12 17:04:05.528003832 -0500 -@@ -192,7 +192,7 @@ - rtf_output_char ('{'); - - /* font color */ -- rtf_output (rtfColors[ud->cCol]); -+ rtf_output ("%s", rtfColors[ud->cCol]); - - /* font face */ - rtf_output ("\\f%d", ud->cFont); diff --git a/recipes/wvware/all/patches/wv-1.2.9-gsf-meta-names.patch b/recipes/wvware/all/patches/wv-1.2.9-gsf-meta-names.patch deleted file mode 100644 index 1aa2339..0000000 --- a/recipes/wvware/all/patches/wv-1.2.9-gsf-meta-names.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- wvSummary.c -+++ wvSummary.c 2024-08-20 16:14:11.260000000 +0300 -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - - #include - #include diff --git a/recipes/wvware/all/patches/wvWare-library.patch b/recipes/wvware/all/patches/wvWare-library.patch deleted file mode 100644 index c4b4016..0000000 --- a/recipes/wvware/all/patches/wvWare-library.patch +++ /dev/null @@ -1,478 +0,0 @@ ---- wvWare.c -+++ wvWare.c -@@ -32,8 +32,45 @@ - /* strdup isn't declared in for `gcc -ansi'; declare it here */ - extern char *strdup (const char *); - --extern char *str_copy(char *d, size_t n, char *s); --extern char *str_append(char *d, size_t n, char *s); -+#include -+ -+const char * g_wvDataDir = NULL; -+FILE * g_htmlOutputFileHandle = NULL; -+ -+int printfRedirect(const char *fmt, ...) { -+ int retVal; -+ va_list args; -+ va_start(args, fmt); -+ if (NULL != g_htmlOutputFileHandle) { -+ retVal = vfprintf(g_htmlOutputFileHandle, fmt, args); -+ } else { -+ retVal = vprintf(fmt, args); -+ } -+ va_end(args); -+ return retVal; -+} -+ -+int documentId = 0; -+#define static_reinit( variable, defaultValue ) { \ -+ static int staticVarValue = 0; \ -+ if (staticVarValue != documentId) { \ -+ variable = defaultValue; \ -+ staticVarValue = documentId; \ -+ } \ -+} -+ -+char *strdup_and_append_twice(const char *a, const char *b, const char *c) { -+ const size_t szA = strlen(a); -+ const size_t szB = strlen(b); -+ const size_t szC = strlen(c); -+ -+ char *buf = malloc(szA + szB + szC + 1); -+ strcpy(buf, a); -+ strcpy(buf + szA, b); -+ strcpy(buf + szA + szB, c); -+ buf[szA + szB + szC] = '\0'; -+ return buf; -+} - - /* - Released under GPL, written by Caolan.McNamara@ul.ie. -@@ -290,220 +327,116 @@ - static void wv_query_eps (const char* format); - static void wv_suppress (const char* format); - --char *charset = NULL; -+char *charset = "utf-8"; - --int --main (int argc, char **argv) --{ -- FILE *input; -- char *password = NULL; -- char *dir = NULL; -- int ret; -- state_data myhandle; -- expand_data expandhandle; -- wvParseStruct ps; -- int c, index = 0; -- static struct option long_options[] = { -- {"charset", 1, 0, 'c'}, -- {"config", 1, 0, 'x'}, -- {"password", 1, 0, 'p'}, -- {"dir", 1, 0, 'd'}, -- {"basename", 1, 0, 'b'}, -- {"auto-eps", 1, 0, 'a'}, -- {"suppress", 1, 0, 's'}, -- {"version", 0, 0, 'v'}, -- {"help", 0, 0, '?'}, -- {"xml", 0, 0, 'X'}, -- {"nographics", 0, 0, '1'}, -- {0, 0, 0, 0} -- }; -- -- if (argc < 2) -- { -- do_help (); -- exit (-1); -- } -- -- while (1) -- { -- c = getopt_long (argc, argv, "?vc:x:p:d:b:a:s:X1", long_options, &index); -- if (c == -1) -- break; -- switch (c) -- { -- case '?': -- do_help (); -- return 0; -- case 'v': -- do_version (); -- return 0; -- case 'c': -- if (optarg) -- charset = optarg; -- else -- wvError (("No argument given to charset")); -- break; -- case 'x': -- if (optarg) -- config = optarg; -- else -- wvError (("No config file given to config option")); -- break; -- case 'p': -- if (optarg) -- password = optarg; -- else -- wvError (("No password given to password option")); -- break; -- case 'd': -- if (optarg) -- dir = optarg; -- else -- wvError (("No directory given to dir option")); -- break; -- case 'b': -- if (optarg) -- wv_arg_basename = optarg; -- else -- wvError (("No name given to basename option")); -- break; -- case 'a': -- wv_query_eps (optarg); -- return 0; -- case 's': -- wv_suppress (optarg); -- break; -- -- case 'X': -- config = "wvXml.xml"; -- charset = "utf-8"; -- xml_output = 1; -- xml_slash = " /"; -- break; -- -- case '1': -- no_graphics = 1; -- break; -- -- default: -- do_help (); -- return -1; -- } -- } -+int wvHtml_convert(char *inputFile, char *outputDir, const char *password) { -+ int ret; -+ state_data myhandle; -+ expand_data expandhandle; -+ wvParseStruct ps; - -- if (optind >= argc) -- { -- fprintf (stderr, "No file name given to open\n"); -- return (-1); -- } -+ documentId++; - --#if 0 -- input = fopen (argv[optind], "rb"); -- if (!input) -- { -- fprintf (stderr, "Failed to open %s\n", argv[optind]); -- return (-1); -- } -- fclose (input); --#endif -+ config = "wvHtml.xml"; - -- getcwd (wv_cwd,4096); -- wv_cwd[4096] = 0; -+ getcwd (wv_cwd,4096); -+ wv_cwd[4096] = 0; - -- wvInit (); -- ret = wvInitParser (&ps, argv[optind]); -- ps.filename = argv[optind]; -- ps.dir = dir; -+ wvInit (); -+ ret = wvInitParser (&ps, inputFile); -+ ps.dir = outputDir; - -- if (ret & 0x8000) /* Password protected? */ -- { -- if ((ret & 0x7fff) == WORD8) -- { -- ret = 0; -- if (password == NULL) -- { -- fprintf (stderr, -- "Password required, this is an encrypted document\n"); -- return (-1); -- } -- else -- { -- wvSetPassword (password, &ps); -- if (wvDecrypt97 (&ps)) -- { -- wvError (("Incorrect Password\n")); -- return (-1); -- } -- } -- } -- else if (((ret & 0x7fff) == WORD7) || ((ret & 0x7fff) == WORD6)) -- { -- ret = 0; -- if (password == NULL) -- { -- fprintf (stderr, -- "Password required, this is an encrypted document\n"); -- return (-1); -- } -- else -- { -- wvSetPassword (password, &ps); -- if (wvDecrypt95 (&ps)) -- { -- wvError (("Incorrect Password\n")); -- return (-1); -- } -- } -- } -- } -- -- if (ret) -+ if (ret & 0x8000) /* Password protected? */ -+ { -+ if ((ret & 0x7fff) == WORD8) -+ { -+ ret = 0; -+ if (password == NULL || password[0] == '\0') - { -- wvError (("startup error #%d\n", ret)); -- wvOLEFree (&ps); -- return (-1); -+ fprintf (stderr, -+ "Password required, this is an encrypted document\n"); -+ return 100; - } -- -- wvSetElementHandler (&ps, myelehandler); -- wvSetDocumentHandler (&ps, mydochandler); -- wvSetCharHandler (&ps, myCharProc); -- wvSetSpecialCharHandler (&ps, mySpecCharProc); -- -- wvInitStateData (&myhandle); -- -- if (wvOpenConfig (&myhandle,config) == 0) -+ else - { -- wvError (("config file not found\n")); -- return (-1); -+ wvSetPassword (password, &ps); -+ if (wvDecrypt97 (&ps)) -+ { -+ wvError (("Incorrect Password\n")); -+ return 101; -+ } - } -- else -+ } -+ else if (((ret & 0x7fff) == WORD7) || ((ret & 0x7fff) == WORD6)) -+ { -+ ret = 0; -+ if (password == NULL || password[0] == '\0') - { -- wvTrace (("x for FILE is %x\n", myhandle.fp)); -- ret = wvParseConfig (&myhandle); -+ fprintf (stderr, -+ "Password required, this is an encrypted document\n"); -+ return 100; - } -- -- if (!ret) -+ else - { -- expandhandle.sd = &myhandle; -- ps.userData = &expandhandle; -- ret = wvHtml (&ps); -+ wvSetPassword (password, &ps); -+ if (wvDecrypt95 (&ps)) -+ { -+ wvError (("Incorrect Password\n")); -+ return 101; -+ } - } -- wvReleaseStateData (&myhandle); -+ } -+ } - -- if (ret == 2) -- return (2); -- else if (ret != 0) -- ret = -1; -+ if (ret) -+ { -+ wvError (("startup error #%d\n", ret)); - wvOLEFree (&ps); -- wvShutdown (); -+ return (-1); -+ } -+ -+ wvSetElementHandler (&ps, myelehandler); -+ wvSetDocumentHandler (&ps, mydochandler); -+ wvSetCharHandler (&ps, myCharProc); -+ wvSetSpecialCharHandler (&ps, mySpecCharProc); -+ -+ wvInitStateData (&myhandle); -+ -+ if (wvOpenConfig (&myhandle,config) == 0) -+ { -+ wvError (("config file not found\n")); -+ return (-1); -+ } -+ else -+ { -+ wvTrace (("x for FILE is %x\n", myhandle.fp)); -+ ret = wvParseConfig (&myhandle); -+ } -+ -+ if (!ret) -+ { -+ expandhandle.sd = &myhandle; -+ ps.userData = &expandhandle; -+ ret = wvHtml (&ps); -+ } -+ wvReleaseStateData (&myhandle); -+ -+ if (ret == 2) -+ return (2); -+ else if (ret != 0) -+ ret = -1; -+ wvOLEFree (&ps); -+ wvShutdown (); - -- return (ret); -+ return (ret); - } - - int - myelehandler (wvParseStruct * ps, wvTag tag, void *props, int dirty) - { - static PAP *ppap; -+ static_reinit(ppap, NULL) -+ - expand_data *data = (expand_data *) ps->userData; - data->anSttbfAssoc = &ps->anSttbfAssoc; - data->lfo = &ps->lfo; -@@ -602,6 +535,7 @@ - mydochandler (wvParseStruct * ps, wvTag tag) - { - static int i; -+ static_reinit(i, 0) - expand_data *data = (expand_data *) ps->userData; - data->anSttbfAssoc = &ps->anSttbfAssoc; - data->lfo = &ps->lfo; -@@ -1290,6 +1224,7 @@ - mySpecCharProc (wvParseStruct * ps, U16 eachchar, CHP * achp) - { - static int message; -+ static_reinit(message, 0) - PICF picf; - FSPA *fspa; - expand_data *data = (expand_data *) ps->userData; -@@ -1607,33 +1542,26 @@ - int - wvOpenConfig (state_data *myhandle,char *config) - { -- static char buf[BUFSIZ] = ""; - FILE *tmp; -- int i = 0; - if (config == NULL) -- config = "wvHtml.xml"; -- else -- i = 1; -+ config = "wvHtml.xml"; - tmp = fopen (config, "rb"); -- - if(tmp == NULL) - { -- str_copy (buf, sizeof(buf), WVDATADIR); -- str_append(buf, sizeof(buf), "/"); -- str_append(buf, sizeof(buf), config); -- config = buf; -- tmp = fopen(config, "rb"); -+ static char * buf = NULL; -+ if (NULL != buf) { -+ free(buf); -+ } -+ const char *WV_DATA_DIR = getenv("WVDATADIR"); -+ if (NULL == WV_DATA_DIR) -+ WV_DATA_DIR = g_wvDataDir; -+ if (NULL != WV_DATA_DIR) -+ buf = strdup_and_append_twice(WV_DATA_DIR, "/", config); -+ else -+ buf = strdup(config); -+ config = buf; -+ tmp = fopen(config, "rb"); - } -- -- if (tmp == NULL) -- { -- if (i) -- wvError ( -- ("Attempt to open %s failed, using %s\n", config, -- HTMLCONFIG)); -- config = HTMLCONFIG; -- tmp = fopen (config, "rb"); -- } - myhandle->path = config; - myhandle->fp = tmp; - return (tmp == NULL ? 0 : 1); -@@ -1642,7 +1570,9 @@ - char * figure_name (wvParseStruct * ps) - { - static int number; -+ static_reinit(number, 0) - static char * b_name = 0; -+ static_reinit(b_name, NULL) - char * f_name = 0; - char buffer[10]; - -@@ -1703,7 +1633,9 @@ - char * name_to_url (char * name) - { - static char * url = 0; -+ static_reinit(url, NULL) - static long max = 0; -+ static_reinit(max, 0) - char * ptr = 0; - long count = 0; - ---- GNUmakefile.am -+++ GNUmakefile.am -@@ -18,8 +18,6 @@ - - bin_SCRIPTS = wvCleanLatex wvHtml wvDocBook wvAbw wvMime wvPS wvDVI wvLatex wvPDF wvText wvWml - --bin_PROGRAMS = wvWare wvRTF wvConvert wvVersion wvSummary -- - lib_LTLIBRARIES = libwv.la - - GETOPT = @LIBOBJS@ -@@ -33,6 +31,7 @@ - libwv_la_LIBADD = $(WVLIBS) - libwv_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) -export-dynamic -no-undefined - libwv_la_SOURCES = \ -+ wvWare.c \ - winmmap.c \ - list.c \ - stylesheet.c \ ---- wv.h -+++ wv.h -@@ -10,6 +10,14 @@ - extern "C" { - #endif - -+extern FILE * g_htmlOutputFileHandle; -+int printfRedirect(const char* __fmt, ...); -+#define printf printfRedirect -+ -+extern int no_graphics; -+extern const char * g_wvDataDir; -+int wvHtml_convert(char *inputFile, char *outputDir, const char *password); -+ - /* The structure below is used to refer to a wvStream. Usually, - * kind = GSF_STREAM, - * but if we can't open a file using LibGSF, we fall back to the old file-based diff --git a/scripts/conan_export_all_packages.py b/scripts/conan_export_all_packages.py index fb00f49..f2ab353 100644 --- a/scripts/conan_export_all_packages.py +++ b/scripts/conan_export_all_packages.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import sys import subprocess from pathlib import Path @@ -7,17 +8,24 @@ def main(): + returncode = 0 + script_path = Path(__file__).resolve().parent root_path = script_path.parent package_infos = get_package_infos() for package in package_infos: for version in package_infos[package]: - subprocess.run( + proc = subprocess.run( ["conan", "export", version["conanfile"], "--version", version["version"]], cwd=root_path ) + if proc.returncode != 0: + print(f"Failed to export {package} {version['version']}") + returncode = proc.returncode + + return returncode if __name__ == "__main__": - main() + sys.exit(main())