From 7009841bcc6bd9d9f30aa11d54f9b1e20a668b11 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 28 Aug 2024 17:27:37 +0200 Subject: [PATCH 1/3] Make docoptcpp use boost.regex on Windows std::regex is kind of broken on Windows[1]. [1] https://github.com/docopt/docopt.cpp/issues/49 --- kiwixbuild/dependencies/__init__.py | 1 + kiwixbuild/dependencies/all_dependencies.py | 2 ++ kiwixbuild/dependencies/boostregex.py | 27 +++++++++++++++++++ kiwixbuild/dependencies/docoptcpp.py | 14 +++++++--- .../patches/docopt_meson_use_boostregex.patch | 14 ++++++++++ 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 kiwixbuild/dependencies/boostregex.py create mode 100644 kiwixbuild/patches/docopt_meson_use_boostregex.patch diff --git a/kiwixbuild/dependencies/__init__.py b/kiwixbuild/dependencies/__init__.py index 7a45018..60697b1 100644 --- a/kiwixbuild/dependencies/__init__.py +++ b/kiwixbuild/dependencies/__init__.py @@ -1,6 +1,7 @@ from .base import * from . import ( all_dependencies, + boostregex, tc_android_ndk, aria2, tc_armhf, diff --git a/kiwixbuild/dependencies/all_dependencies.py b/kiwixbuild/dependencies/all_dependencies.py index 3a364c7..03f36b1 100644 --- a/kiwixbuild/dependencies/all_dependencies.py +++ b/kiwixbuild/dependencies/all_dependencies.py @@ -23,6 +23,8 @@ class AllBaseDependencies(Dependency): "xapian-core", "zim-testing-suite", "icu4c", + "boostregex", + "docoptcpp" ] if not configInfo.name.endswith("_dyn"): diff --git a/kiwixbuild/dependencies/boostregex.py b/kiwixbuild/dependencies/boostregex.py new file mode 100644 index 0000000..db31efb --- /dev/null +++ b/kiwixbuild/dependencies/boostregex.py @@ -0,0 +1,27 @@ +from .base import Dependency, ReleaseDownload, Builder as BaseBuilder + +from kiwixbuild.utils import Remotefile, pj +from shutil import copytree + + +class BoostRegex(Dependency): + name = "boostregex" + + class Source(ReleaseDownload): + archive = Remotefile( + "regex-boost-1.86.0.zip", + "", + "https://codeload.github.com/boostorg/regex/zip/refs/tags/boost-1.86.0", + ) + + class Builder(BaseBuilder): + def build(self): + self.command("copy_headers", self._copy_headers) + + def _copy_headers(self, context): + context.try_skip(self.build_path) + copytree( + pj(self.source_path, "include", "boost"), + pj(self.buildEnv.install_dir, "include", "boost"), + dirs_exist_ok=True, + ) \ No newline at end of file diff --git a/kiwixbuild/dependencies/docoptcpp.py b/kiwixbuild/dependencies/docoptcpp.py index 7a0dbc6..0f30cd2 100644 --- a/kiwixbuild/dependencies/docoptcpp.py +++ b/kiwixbuild/dependencies/docoptcpp.py @@ -1,7 +1,7 @@ from .base import Dependency, ReleaseDownload, MesonBuilder from kiwixbuild.utils import Remotefile - +from kiwixbuild._global import neutralEnv class docoptcpp(Dependency): name = "docoptcpp" @@ -21,6 +21,14 @@ class docoptcpp(Dependency): ) archives = [src_archive, meson_archive] - patches = ["docopt_meson_install_pkgconfig.patch"] + patches = [ + "docopt_meson_install_pkgconfig.patch", + "docopt_meson_use_boostregex.patch", + ] - Builder = MesonBuilder + class Builder(MesonBuilder): + @classmethod + def get_dependencies(cls, configInfo, allDeps): + if neutralEnv("distname") == "Windows": + return ["boostregex"] + return [] \ No newline at end of file diff --git a/kiwixbuild/patches/docopt_meson_use_boostregex.patch b/kiwixbuild/patches/docopt_meson_use_boostregex.patch new file mode 100644 index 0000000..a1343a4 --- /dev/null +++ b/kiwixbuild/patches/docopt_meson_use_boostregex.patch @@ -0,0 +1,14 @@ +diff -ur docoptcpp-0.6.2/meson.build docoptcpp-0.6.2_boostregex/meson.build +--- docoptcpp-0.6.2/meson.build 2024-08-28 17:22:46.256716100 +0200 ++++ docoptcpp-0.6.2_boostregex/meson.build 2024-08-28 17:02:47.932681000 +0200 +@@ -8,6 +8,10 @@ + add_project_arguments('-DDOCOPT_DLL', '-DDOCOPT_EXPORTS', language: 'cpp') + endif + ++if cpp.get_id() =='msvc' ++ add_project_arguments('-DDOCTOPT_USE_BOOST_REGEX', '-DBOOST_REGEX_STANDALONE', language: 'cpp') ++endif ++ + # bug with missing dllexport. fixed in next version. + if cpp.get_argument_syntax() == 'msvc' + doclib = static_library('docopt', 'docopt.cpp', install: true) From 01655d3ce02af00844a2802ca1ac4c94a5a2a5ae Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 28 Aug 2024 17:28:24 +0200 Subject: [PATCH 2/3] Use icu4c pre-compiled using MSVC2022 on Windows --- kiwixbuild/dependencies/icu4c.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kiwixbuild/dependencies/icu4c.py b/kiwixbuild/dependencies/icu4c.py index 1cd71a5..13bebe6 100644 --- a/kiwixbuild/dependencies/icu4c.py +++ b/kiwixbuild/dependencies/icu4c.py @@ -18,9 +18,9 @@ if platform.system() == "Windows": class Source(ReleaseDownload): archive = Remotefile( - "icu4c-73_1-Win64-MSVC2019.zip", + "icu4c-74_1-Win64-MSVC2022.zip", "", - "https://github.com/unicode-org/icu/releases/download/release-73-1/icu4c-73_1-Win64-MSVC2019.zip", + "https://github.com/unicode-org/icu/releases/download/release-74-1/icu4c-74_1-Win64-MSVC2022.zip", ) class Builder(BaseBuilder): From e75fc761621a46a822644445b3d03269e8a3f611 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 28 Aug 2024 17:37:09 +0200 Subject: [PATCH 3/3] Bump base_deps_meta_version to rebuild docopt, icu and boostregex --- kiwixbuild/versions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiwixbuild/versions.py b/kiwixbuild/versions.py index c5f9846..428992a 100644 --- a/kiwixbuild/versions.py +++ b/kiwixbuild/versions.py @@ -39,7 +39,7 @@ release_versions = { # This is the "version" of the whole base_deps_versions dict. # Change this when you change base_deps_versions. -base_deps_meta_version = "06" +base_deps_meta_version = "07" base_deps_versions = { "zlib": "1.2.12",