From ece4df37218b37daf26b9889dc0cf73915eae045 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Tue, 31 Mar 2020 13:29:50 +0400 Subject: [PATCH 1/5] Added zstd dependency --- kiwixbuild/dependencies/__init__.py | 3 ++- kiwixbuild/dependencies/all_dependencies.py | 2 +- kiwixbuild/dependencies/libzim.py | 2 +- kiwixbuild/dependencies/zstd.py | 22 +++++++++++++++++++++ kiwixbuild/versions.py | 3 ++- 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 kiwixbuild/dependencies/zstd.py diff --git a/kiwixbuild/dependencies/__init__.py b/kiwixbuild/dependencies/__init__.py index 7464bd9..258c38d 100644 --- a/kiwixbuild/dependencies/__init__.py +++ b/kiwixbuild/dependencies/__init__.py @@ -25,5 +25,6 @@ from . import ( xapian, zim_tools, zimwriterfs, - zlib + zlib, + zstd ) diff --git a/kiwixbuild/dependencies/all_dependencies.py b/kiwixbuild/dependencies/all_dependencies.py index d642dcd..4aa1c20 100644 --- a/kiwixbuild/dependencies/all_dependencies.py +++ b/kiwixbuild/dependencies/all_dependencies.py @@ -12,7 +12,7 @@ class AllBaseDependencies(Dependency): class Builder(NoopBuilder): @classmethod def get_dependencies(cls, platformInfo, allDeps): - base_deps = ['zlib', 'lzma', 'xapian-core', 'pugixml', 'libcurl', 'icu4c', 'mustache', 'libmicrohttpd'] + base_deps = ['zlib', 'lzma', 'zstd', 'xapian-core', 'pugixml', 'libcurl', 'icu4c', 'mustache', 'libmicrohttpd'] # zimwriterfs if platformInfo.build not in ('android', 'win32'): base_deps += ['libmagic', 'gumbo'] diff --git a/kiwixbuild/dependencies/libzim.py b/kiwixbuild/dependencies/libzim.py index cba24ad..8869cd0 100644 --- a/kiwixbuild/dependencies/libzim.py +++ b/kiwixbuild/dependencies/libzim.py @@ -14,7 +14,7 @@ class Libzim(Dependency): class Builder(MesonBuilder): test_option = "-t 8" - dependencies = ['zlib', 'lzma', 'xapian-core', 'icu4c'] + dependencies = ['zlib', 'lzma', 'zstd', 'xapian-core', 'icu4c'] strip_option = '' @property diff --git a/kiwixbuild/dependencies/zstd.py b/kiwixbuild/dependencies/zstd.py new file mode 100644 index 0000000..30e67cd --- /dev/null +++ b/kiwixbuild/dependencies/zstd.py @@ -0,0 +1,22 @@ +from .base import ( + Dependency, + ReleaseDownload, + MesonBuilder) + +from kiwixbuild.utils import Remotefile + + + +class zstd(Dependency): + name = 'zstd' + + class Source(ReleaseDownload): + archive = Remotefile('zstd-1.4.4.tar.gz', + '59ef70ebb757ffe74a7b3fe9c305e2ba3350021a918d168a046c6300aeea9315', + 'https://github.com/facebook/zstd/releases/download/v1.4.4/zstd-1.4.4.tar.gz') + + class Builder(MesonBuilder): + subsource_dir = 'build/meson' + build_type = 'release' + strip_option = '' + configure_option = '-Dbin_programs=false -Dbin_contrib=false' diff --git a/kiwixbuild/versions.py b/kiwixbuild/versions.py index 0a0dbff..1ca1bd0 100644 --- a/kiwixbuild/versions.py +++ b/kiwixbuild/versions.py @@ -42,11 +42,12 @@ 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 = '64' +base_deps_meta_version = '65' base_deps_versions = { 'zlib' : '1.2.8', 'lzma' : '5.2.4', + 'zstd' : '1.4.4', 'uuid' : '1.43.4', 'xapian-core' : '1.4.14', 'mustache' : '3.2', From 3a03e9a8aaa0355d6121713c173bd561b73bcac3 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Tue, 31 Mar 2020 14:36:03 +0400 Subject: [PATCH 2/5] Added appveyor/install_zstd.cmd --- appveyor.yml | 1 + appveyor/install_zstd.cmd | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 appveyor/install_zstd.cmd diff --git a/appveyor.yml b/appveyor.yml index a039811..a55a4e2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -49,6 +49,7 @@ build_script: - IF "%USE_CACHE%" EQU "1" appveyor\setup_from_cache.cmd - IF "%USE_CACHE%" NEQ "1" appveyor\install_zlib.cmd - IF "%USE_CACHE%" NEQ "1" appveyor\install_lzma.cmd + - IF "%USE_CACHE%" NEQ "1" appveyor\install_zstd.cmd - IF "%USE_CACHE%" NEQ "1" appveyor\install_libcurl.cmd - IF "%USE_CACHE%" NEQ "1" appveyor\install_pthread.cmd - IF "%USE_CACHE%" NEQ "1" appveyor\install_dirent.cmd diff --git a/appveyor/install_zstd.cmd b/appveyor/install_zstd.cmd new file mode 100644 index 0000000..6529d63 --- /dev/null +++ b/appveyor/install_zstd.cmd @@ -0,0 +1,10 @@ +REM ======================================================== +REM Install zstd +curl -fsSL -o zstd-v1.4.4.zip https://github.com/facebook/zstd/archive/v1.4.4.zip || exit /b 1 +7z x zstd-v1.4.4.zip || exit /b 1 +cd zstd-1.4.4/build/meson +meson . builddir --prefix %EXTRA_DIR% --default-library static --buildtype release -Dbin_programs=false -Dbin_contrib=false || exit /b 1 +cd builddir +ninja || exit /b 1 +ninja install || exit /b 1 +cd ..\..\..\.. From a2aac46da9be2e198c6fa73b47ba29f903c2f766 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Mon, 6 Apr 2020 23:53:28 +0400 Subject: [PATCH 3/5] Moved C:\Python36\Scripts to the begging of PATH Otherwise in the appveyor Windows build meson installed under "C:\Program Files" is used. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a55a4e2..303e223 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ version: '0.1.{build}' environment: EXTRA_DIR: 'C:\extra' MINGW64_EXTRA_DIR: '/c/extra' - PATH: '%PATH%;%EXTRA_DIR%\bin;C:\\Python36\\Scripts;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\%platform%' + PATH: 'C:\\Python36\\Scripts;%PATH%;%EXTRA_DIR%\bin;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\%platform%' PKG_CONFIG_PATH: '%EXTRA_DIR%\lib\pkgconfig' MSYS2_PATH_TYPE: 'inherit' MSYS2_ARG_CONV_EXCL: '-Tp' From 25d9e18e3dd0b73887f10e7d1d4fc82350c00328 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Tue, 7 Apr 2020 00:46:23 +0400 Subject: [PATCH 4/5] Temporary fix for facebook/zstd#2073 --- appveyor/apply_patch.sh | 4 ++++ appveyor/install_zstd.cmd | 2 ++ kiwixbuild/dependencies/zstd.py | 1 + kiwixbuild/patches/zstd_meson.patch | 20 ++++++++++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 appveyor/apply_patch.sh create mode 100644 kiwixbuild/patches/zstd_meson.patch diff --git a/appveyor/apply_patch.sh b/appveyor/apply_patch.sh new file mode 100644 index 0000000..4d85392 --- /dev/null +++ b/appveyor/apply_patch.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +mydir=$(dirname "$0") +patch -p1 < "$mydir"/../kiwixbuild/patches/"$1" diff --git a/appveyor/install_zstd.cmd b/appveyor/install_zstd.cmd index 6529d63..5f08da9 100644 --- a/appveyor/install_zstd.cmd +++ b/appveyor/install_zstd.cmd @@ -2,6 +2,8 @@ REM ======================================================== REM Install zstd curl -fsSL -o zstd-v1.4.4.zip https://github.com/facebook/zstd/archive/v1.4.4.zip || exit /b 1 7z x zstd-v1.4.4.zip || exit /b 1 +REM Fixing https://github.com/facebook/zstd/issues/2073 +%MINGW64_RUN% "cd /c/projects/kiwix-build/zstd-1.4.4 && ../appveyor/apply_patch.sh zstd_meson.patch" || exit /b 1 cd zstd-1.4.4/build/meson meson . builddir --prefix %EXTRA_DIR% --default-library static --buildtype release -Dbin_programs=false -Dbin_contrib=false || exit /b 1 cd builddir diff --git a/kiwixbuild/dependencies/zstd.py b/kiwixbuild/dependencies/zstd.py index 30e67cd..ec2e108 100644 --- a/kiwixbuild/dependencies/zstd.py +++ b/kiwixbuild/dependencies/zstd.py @@ -14,6 +14,7 @@ class zstd(Dependency): archive = Remotefile('zstd-1.4.4.tar.gz', '59ef70ebb757ffe74a7b3fe9c305e2ba3350021a918d168a046c6300aeea9315', 'https://github.com/facebook/zstd/releases/download/v1.4.4/zstd-1.4.4.tar.gz') + patches = ['zstd_meson.patch'] class Builder(MesonBuilder): subsource_dir = 'build/meson' diff --git a/kiwixbuild/patches/zstd_meson.patch b/kiwixbuild/patches/zstd_meson.patch new file mode 100644 index 0000000..83e7fc3 --- /dev/null +++ b/kiwixbuild/patches/zstd_meson.patch @@ -0,0 +1,20 @@ +diff -ur zstd-1.4.4/build/meson/meson.build zstd-1.4.4.patched/build/meson/meson.build +--- zstd-1.4.4/build/meson/meson.build 2019-11-04 21:54:32.000000000 +0400 ++++ zstd-1.4.4.patched/build/meson/meson.build 2020-04-07 13:59:26.012106549 +0400 +@@ -68,6 +68,7 @@ + # Built-in options + use_debug = get_option('debug') + buildtype = get_option('buildtype') ++default_library_type = get_option('default_library') + + # Custom options + debug_level = get_option('debug_level') +@@ -121,7 +122,7 @@ + if use_multi_thread + msvc_compile_flags += '/MP' + endif +- if enable_static_runtime ++ if use_static_runtime + msvc_compile_flags += '/MT' + endif + add_project_arguments(msvc_compile_flags, language: ['c', 'cpp']) From 3cbcac2e300903d913ee623a95c901e7a80e1ece Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Tue, 7 Apr 2020 16:17:05 +0400 Subject: [PATCH 5/5] Applying xapian_remote.patch in appveyor build Failing to do so in PR#384 secretly broke the appveyor build (no real failures were observed since the appveyor builds ran in USE_CACHE=1 mode, without rebuilding the base dependencies to which xapian belongs). --- appveyor/install_xapian.cmd | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor/install_xapian.cmd b/appveyor/install_xapian.cmd index 625310c..a3d6002 100644 --- a/appveyor/install_xapian.cmd +++ b/appveyor/install_xapian.cmd @@ -2,6 +2,7 @@ REM ======================================================== REM Install xapian curl -fsSL -O http://download.kiwix.org/dev/xapian-core-1.4.14.zip || exit /b 1 7z x xapian-core-1.4.14.zip || exit /b 1 +%MINGW64_RUN% "cd /c/Projects/kiwix-build/xapian-core-1.4.14 && ../appveyor/apply_patch.sh xapian_remote.patch" || exit /b 1 cd xapian-core-1.4.14 mkdir build cd build