diff --git a/.github/scripts/build_definition.py b/.github/scripts/build_definition.py index 7ce277c..b9b55f5 100644 --- a/.github/scripts/build_definition.py +++ b/.github/scripts/build_definition.py @@ -22,9 +22,9 @@ BUILD_DEF = """ | manylinux | aarch64_mixed | BP | | | | | linux-aarch64-manylinux | | ---------------------------------------------------------------------------------------------------------------------------------------------- # On Windows, we build only libzim for now. And only native_mixed as xapian doesn't compile as dll - | windows | native_static | Bd | | | | | win-x86_64 | win-x86_64-static | + | windows | native_static | Bd | d | | d | | win-x86_64 | win-x86_64-static | | windows | native_dyn | Bd | | | | | win-x86_64 | win-x86_64-dyn | - | windows | native_mixed | BPd | | | | | win-x86_64 | win-x86_64-mixed | + | windows | native_mixed | BPd | d | | | d | win-x86_64 | win-x86_64-mixed | ---------------------------------------------------------------------------------------------------------------------------------------------- # Osx builds, build binaries on native_dyn and native_static. On anyother things, build only the libraries | macos | native_dyn | d | d | dB | B | | | macos-x86_64-dyn | diff --git a/.github/scripts/common.py b/.github/scripts/common.py index c01b8f8..8361baa 100644 --- a/.github/scripts/common.py +++ b/.github/scripts/common.py @@ -103,6 +103,8 @@ EXPORT_FILES = { ), "lib/libzim.dylib", "lib/*/libzim.pc", + "lib/libzim.dll", + "lib/libzim.lib", "include/zim/**/*.h", "share/icu/{}/icudt{}l.dat".format( base_deps_versions["icu4c"], major_version(base_deps_versions["icu4c"]) @@ -432,7 +434,7 @@ def make_archive(project, make_release): files_to_archive = [] for export_file in export_files: files_to_archive.extend(base_dir.glob(export_file)) - if platform_name == "win-i686": + if platform_name == "win-i686" or platform.system() == "Windows": open_archive = lambda a: zipfile.ZipFile( str(a), "w", compression=zipfile.ZIP_DEFLATED ) diff --git a/kiwixbuild/dependencies/aria2.py b/kiwixbuild/dependencies/aria2.py index b2b8ee7..4d2fa23 100644 --- a/kiwixbuild/dependencies/aria2.py +++ b/kiwixbuild/dependencies/aria2.py @@ -1,27 +1,51 @@ -from .base import Dependency, ReleaseDownload, MakeBuilder +from .base import Dependency, ReleaseDownload, MakeBuilder, NoopBuilder -from kiwixbuild.utils import Remotefile, run_command +from kiwixbuild.utils import Remotefile, run_command, pj +import platform +from shutil import copy2 class Aria2(Dependency): name = "aria2" - class Source(ReleaseDownload): - archive = Remotefile( - "aria2-1.37.0.tar.xz", - "60a420ad7085eb616cb6e2bdf0a7206d68ff3d37fb5a956dc44242eb2f79b66b", - "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0.tar.xz", - ) + if platform.system() == "Windows": - def _post_prepare_script(self, context): - context.try_skip(self.extract_path) - command = ["autoreconf", "-i"] - run_command(command, self.extract_path, context) + class Source(ReleaseDownload): + archive = Remotefile( + "aria2-1.37.0-win-64bit-build1.zip", + "67d015301eef0b612191212d564c5bb0a14b5b9c4796b76454276a4d28d9b288", + "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip", + ) - class Builder(MakeBuilder): - dependencies = ["zlib"] - configure_options = [ - "--disable-libaria2", - "--disable-websocket", - "--without-sqlite3", - ] + class Builder(NoopBuilder): + def build(self): + self.command("copy_binary", self._copy_binary) + + def _copy_binary(self, context): + context.try_skip(self.build_path) + copy2( + pj(self.source_path, "aria2c.exe"), + pj(self.buildEnv.install_dir, "bin"), + ) + + else: + + class Source(ReleaseDownload): + archive = Remotefile( + "aria2-1.37.0.tar.xz", + "60a420ad7085eb616cb6e2bdf0a7206d68ff3d37fb5a956dc44242eb2f79b66b", + "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0.tar.xz", + ) + + def _post_prepare_script(self, context): + context.try_skip(self.extract_path) + command = ["autoreconf", "-i"] + run_command(command, self.extract_path, context) + + class Builder(MakeBuilder): + dependencies = ["zlib"] + configure_options = [ + "--disable-libaria2", + "--disable-websocket", + "--without-sqlite3", + ] diff --git a/kiwixbuild/dependencies/libcurl.py b/kiwixbuild/dependencies/libcurl.py index f63ef7b..9044259 100644 --- a/kiwixbuild/dependencies/libcurl.py +++ b/kiwixbuild/dependencies/libcurl.py @@ -3,7 +3,7 @@ import os from .base import ( Dependency, ReleaseDownload, - MakeBuilder, + MesonBuilder, ) from kiwixbuild.utils import Remotefile, pj, Defaultdict, SkipCommand, run_command @@ -15,44 +15,44 @@ class LibCurl(Dependency): class Source(ReleaseDownload): name = "libcurl" - archive = Remotefile( - "curl-7.67.0.tar.xz", - "f5d2e7320379338c3952dcc7566a140abb49edb575f9f99272455785c40e536c", - "https://curl.haxx.se/download/curl-7.67.0.tar.xz", + src_archive = Remotefile( + "curl-8.4.0.tar.xz", + "16c62a9c4af0f703d28bda6d7bbf37ba47055ad3414d70dec63e2e6336f2a82d", + "https://curl.se/download/curl-8.4.0.tar.xz", ) + meson_archive = Remotefile( + "curl_8.4.0-2_patch.zip", + "bbb6ae75225c36ef9bb336cface729794c7c070c623a003fff40bd416042ff6e", + "https://public.kymeria.fr/KIWIX/curl_8.4.0-2_patch.zip", + ) + archives = [src_archive, meson_archive] - class Builder(MakeBuilder): + class Builder(MesonBuilder): dependencies = ["zlib"] configure_options = [ - *[ - f"--without-{p}" - for p in ( - "libssh2", - "ssl", - "libmetalink", - "librtmp", - "nghttp2", - "libidn2", - "brotli", - ) - ], - *[ - f"--disable-{p}" - for p in ( - "ftp", - "file", - "ldap", - "ldaps", - "rtsp", - "dict", - "telnet", - "tftp", - "pop3", - "imap", - "smb", - "smtp", - "gopher", - "manual", - ) - ], + f"-D{p}=disabled" + for p in ( + "ssh", + "ssl", + "rtmp", + "http2", + "idn", + "brotli", + "ftp", + "file", + "ldap", + "ldaps", + "rtsp", + "dict", + "telnet", + "tftp", + "pop3", + "imap", + "smb", + "smtp", + "gopher", + ) ] + + def _test(self, context): + context.skip("No Test") diff --git a/kiwixbuild/dependencies/libkiwix.py b/kiwixbuild/dependencies/libkiwix.py index 66c7a59..82a2a0b 100644 --- a/kiwixbuild/dependencies/libkiwix.py +++ b/kiwixbuild/dependencies/libkiwix.py @@ -50,3 +50,11 @@ class Libkiwix(Dependency): if self.buildEnv.configInfo.build == "android": return "shared" return super().library_type + + def _test(self, context): + # Libkiwix tests are currently broken on Windows. + # Until we fix them, let's deactivate tests. + # It allow us to build dependencies for kiwix-desktop + if neutralEnv("distname") == "Windows": + context.skip() + super()._test(context) diff --git a/kiwixbuild/dependencies/libmicrohttpd.py b/kiwixbuild/dependencies/libmicrohttpd.py index ddc0178..8702112 100644 --- a/kiwixbuild/dependencies/libmicrohttpd.py +++ b/kiwixbuild/dependencies/libmicrohttpd.py @@ -1,4 +1,4 @@ -from .base import Dependency, ReleaseDownload, MakeBuilder +from .base import Dependency, ReleaseDownload, MesonBuilder from kiwixbuild.utils import Remotefile @@ -7,17 +7,23 @@ class MicroHttpd(Dependency): name = "libmicrohttpd" class Source(ReleaseDownload): - archive = Remotefile( + src_archive = Remotefile( "libmicrohttpd-0.9.76.tar.gz", "f0b1547b5a42a6c0f724e8e1c1cb5ce9c4c35fb495e7d780b9930d35011ceb4c", "https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.76.tar.gz", ) + meson_archive = Remotefile( + "libmicrohttpd_0.9.16-3_patch.zip", + "0954c094a0d4cfe0dd799d8df8a04face6669f7b4d51a7386a9c3e2d37b9c3b3", + "https://wrapdb.mesonbuild.com/v2/libmicrohttpd_0.9.76-3/get_patch", + ) + archives = [src_archive, meson_archive] + patches = ["libmicrohttpd_meson_pkgconfig.patch"] - class Builder(MakeBuilder): + class Builder(MesonBuilder): configure_options = [ - "--disable-https", - "--without-libgcrypt", - "--without-libcurl", - "--disable-doc", - "--disable-examples", + "-Dgnutls=disabled", + "-Dgcrypt=disabled", + "-Dcurl=disabled", + "-Dexpat=disabled", ] diff --git a/kiwixbuild/dependencies/pugixml.py b/kiwixbuild/dependencies/pugixml.py index 30bac3d..e8ae793 100644 --- a/kiwixbuild/dependencies/pugixml.py +++ b/kiwixbuild/dependencies/pugixml.py @@ -15,5 +15,4 @@ class Pugixml(Dependency): flatpak_dest = "src" class Builder(MesonBuilder): - build_type = "release" strip_options = [] diff --git a/kiwixbuild/flatpak_builder.py b/kiwixbuild/flatpak_builder.py index f07c641..2f3bc49 100644 --- a/kiwixbuild/flatpak_builder.py +++ b/kiwixbuild/flatpak_builder.py @@ -158,14 +158,16 @@ class FlatpakBuilder: module["no-autogen"] = True module_sources = module.setdefault("sources", []) if isinstance(source, ReleaseDownload): - src = { - "type": "archive", - "sha256": source.archive.sha256, - "url": source.archive.url, - } - if hasattr(source, "flatpak_dest"): - src["dest"] = source.flatpak_dest - module_sources.append(src) + for archive in source.archives: + src = { + "type": "archive", + "dest-filename": archive.name, + "sha256": archive.sha256, + "url": archive.url, + } + if hasattr(source, "flatpak_dest"): + src["dest"] = source.flatpak_dest + module_sources.append(src) elif isinstance(source, GitClone): src = { "type": "git", diff --git a/kiwixbuild/patches/libmicrohttpd_meson_pkgconfig.patch b/kiwixbuild/patches/libmicrohttpd_meson_pkgconfig.patch new file mode 100644 index 0000000..cf0a53b --- /dev/null +++ b/kiwixbuild/patches/libmicrohttpd_meson_pkgconfig.patch @@ -0,0 +1,29 @@ +diff '--color=auto' -ur libmicrohttpd-0.9.76_orig/meson.build libmicrohttpd-0.9.76/meson.build +--- libmicrohttpd-0.9.76_orig/meson.build 2024-08-18 14:55:29.372805433 +0200 ++++ libmicrohttpd-0.9.76/meson.build 2024-08-18 17:19:44.087444728 +0200 +@@ -6,6 +6,8 @@ + default_options: ['warning_level=1'], + ) + ++pkg = import('pkgconfig') ++ + add_project_arguments('-D_GNU_SOURCE', language: 'c') + + incdirs = include_directories('src/include') +@@ -267,6 +269,16 @@ + install: true, + ) + ++install_headers( ++ 'src/include/microhttpd.h', ++) ++ ++pkg.generate( ++ libmicrohttpd, ++ description: 'Libmicrohttpd', ++ name: 'libmicrohttpd', ++) ++ + depinc = include_directories('.', 'src/include') + libmicrohttpd_dep = declare_dependency( + include_directories: depinc, diff --git a/kiwixbuild/versions.py b/kiwixbuild/versions.py index ebf97b0..3739487 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 = "02" +base_deps_meta_version = "03" base_deps_versions = { "zlib": "1.2.12",