diff --git a/.github/ci_images/bionic_builder.dockerfile b/.github/ci_images/bionic_builder.dockerfile new file mode 100644 index 0000000..c45cb78 --- /dev/null +++ b/.github/ci_images/bionic_builder.dockerfile @@ -0,0 +1,33 @@ +FROM ubuntu:bionic + +ENV LANG C.UTF-8 +ENV OS_NAME bionic + +RUN apt update -q \ + && apt install -q -y --no-install-recommends \ +# Base build tools + build-essential automake libtool cmake ccache pkg-config autopoint patch \ + python3-pip python3-setuptools python3-wheel git subversion wget unzip \ + ninja-build openssh-client \ +# Packaged dependencies + libbz2-dev libmagic-dev uuid-dev zlib1g-dev \ + libmicrohttpd-dev aria2 libgtest-dev \ +# Qt packages + libqt5gui5 qtbase5-dev qtwebengine5-dev libqt5svg5-dev qt5-image-formats-plugins qt5-default \ +# To create the appimage of kiwix-desktop + libfuse2 fuse patchelf \ +# Flatpak tools + elfutils flatpak flatpak-builder \ +# Cross win32 compiler + g++-mingw-w64-i686 gcc-mingw-w64-i686 gcc-mingw-w64-base mingw-w64-tools \ +# Other tools (to remove) +# vim less grep \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/debconf/* \ + && pip3 install meson==0.52.1 pytest gcovr + +# Create user +RUN useradd --create-home runner +USER runner +WORKDIR /home/runner +ENV PATH /home/runner/.local/bin:$PATH diff --git a/.github/ci_images/f31_builder.dockerfile b/.github/ci_images/f31_builder.dockerfile new file mode 100644 index 0000000..62ed448 --- /dev/null +++ b/.github/ci_images/f31_builder.dockerfile @@ -0,0 +1,27 @@ +FROM fedora:31 + +ENV LANG C.UTF-8 +ENV OS_NAME f31 + +RUN dnf install -y --nodocs \ +# Base build tools + make automake libtool cmake git-core subversion pkg-config gcc-c++ \ + wget unzip ninja-build ccache which patch gcovr xz openssh-clients \ +# Cross win32 compiler + mingw32-gcc-c++ mingw32-bzip2-static mingw32-win-iconv-static \ + mingw32-winpthreads-static mingw32-zlib-static mingw32-xz-libs-static \ + mingw32-libmicrohttpd \ +# python3 + python-unversioned-command \ +# Other tools (to remove) +# vim less grep + && dnf remove -y "*-doc" \ + && dnf autoremove -y \ + && dnf clean all \ + && pip3 install meson==0.52.1 pytest + +# Create user +RUN useradd --create-home runner +USER runner +WORKDIR /home/runner +ENV PATH /home/runner/.local/bin:$PATH diff --git a/.github/ci_images/focal_builder.dockerfile b/.github/ci_images/focal_builder.dockerfile new file mode 100644 index 0000000..b3b9a00 --- /dev/null +++ b/.github/ci_images/focal_builder.dockerfile @@ -0,0 +1,33 @@ +FROM ubuntu:focal + +ENV LANG C.UTF-8 +ENV OS_NAME focal + +RUN apt update -q \ + && apt install -q -y --no-install-recommends \ +# Base build tools + build-essential automake libtool cmake ccache pkg-config autopoint patch \ + python3-pip python3-setuptools python3-wheel git subversion wget unzip \ + ninja-build openssh-client \ +# Packaged dependencies + libbz2-dev libmagic-dev uuid-dev zlib1g-dev \ + libmicrohttpd-dev aria2 libgtest-dev \ +# Qt packages + libqt5gui5 qtbase5-dev qtwebengine5-dev libqt5svg5-dev qt5-image-formats-plugins qt5-default \ +# To create the appimage of kiwix-desktop + libfuse2 fuse patchelf \ +# Flatpak tools + elfutils flatpak flatpak-builder \ +# Cross win32 compiler + g++-mingw-w64-i686 gcc-mingw-w64-i686 gcc-mingw-w64-base mingw-w64-tools \ +# Other tools (to remove) +# vim less grep \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/debconf/* \ + && pip3 install meson==0.52.1 pytest gcovr + +# Create user +RUN useradd --create-home runner +USER runner +WORKDIR /home/runner +ENV PATH /home/runner/.local/bin:$PATH diff --git a/.github/ci_images/xenial_builder.dockerfile b/.github/ci_images/xenial_builder.dockerfile new file mode 100644 index 0000000..2b634a4 --- /dev/null +++ b/.github/ci_images/xenial_builder.dockerfile @@ -0,0 +1,30 @@ +FROM ubuntu:xenial + +ENV LANG C.UTF-8 +ENV OS_NAME xenial + +RUN apt update -q \ + && dpkg --add-architecture i386 \ + && apt install -q -y --no-install-recommends \ +# Base build tools + build-essential automake libtool cmake ccache pkg-config autopoint patch \ + python3-pip python3-setuptools python3-wheel git subversion wget unzip \ + ninja-build openssh-client curl \ +# Python (2) is needed to install android-ndk + python \ +# Packaged dependencies + libbz2-dev libmagic-dev uuid-dev zlib1g-dev default-jdk \ + libmicrohttpd-dev libgtest-dev \ +# Cross compile i586 + libc6-dev-i386 lib32stdc++6 gcc-multilib g++-multilib \ +# Other tools (to remove) +# vim less grep \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/debconf/* \ + && pip3 install meson==0.52.1 pytest gcovr + +# Create user +RUN useradd --create-home runner +USER runner +WORKDIR /home/runner +ENV PATH /home/runner/.local/bin:$PATH diff --git a/.github/scripts/common.py b/.github/scripts/common.py new file mode 100644 index 0000000..de52aa9 --- /dev/null +++ b/.github/scripts/common.py @@ -0,0 +1,169 @@ +import os +from os import environ as _environ +from pathlib import Path +from datetime import date +import tarfile +import subprocess +import re + +from kiwixbuild.versions import base_deps_versions + + +PLATFORM_TARGET = _environ["PLATFORM_TARGET"] +if PLATFORM_TARGET == "native_desktop": + PLATFORM_TARGET = "native_dyn" + DESKTOP = True +else: + DESKTOP = False +OS_NAME = _environ["OS_NAME"] +HOME = Path(os.path.expanduser("~")) + +BASE_DIR = HOME / "BUILD_{}".format(PLATFORM_TARGET) +SOURCE_DIR = HOME / "SOURCE" +ARCHIVE_DIR = HOME / "ARCHIVE" +INSTALL_DIR = BASE_DIR / "INSTALL" +TMP_DIR = Path("/tmp") + +# [TODO] +KIWIX_DESKTOP_ONLY = False + +_ref = _environ.get("GITHUB_REF", "").split("/")[-1] +MAKE_RELEASE = re.fullmatch(r"[0-9]+\.[0-9]+\.[0-9]+", _ref) is not None + + +def print_message(message, *args, **kwargs): + message = message.format(*args, **kwargs) + message = "{0} {1} {0}".format("-" * 3, message) + print(message, flush=True) + + +MANIFEST_TEMPLATE = """{archive_name} +*************************** + +Dependencies archive for {target} on platform {platform} +Generated at {date} +""" + + +def write_manifest(manifest_file, archive_name, target, platform): + with manifest_file.open(mode="w") as f: + f.write( + MANIFEST_TEMPLATE.format( + archive_name=archive_name, + target=target, + platform=platform, + date=date.today().isoformat(), + ) + ) + + +def run_kiwix_build( + target, + platform, + build_deps_only=False, + target_only=False, + make_release=False, + make_dist=False, +): + command = ["kiwix-build"] + command.append(target) + command.append("--hide-progress") + if platform == "flatpak" or platform.startswith("win32_"): + command.append("--assume-packages-installed") + if target == "kiwix-lib-app" and platform.startswith("android_"): + command.extend(["--target-platform", "android", "--android-arch", platform[8:]]) + elif platform == "android": + command.extend(["--target-platform", "android"]) + for arch in ("arm", "arm64", "x86", "x86_64"): + command.extend(["--android-arch", arch]) + else: + command.extend(["--target-platform", platform]) + if build_deps_only: + command.append("--build-deps-only") + if target_only: + command.append("--build-nodeps") + if make_release: + command.append("--make-release") + if make_dist: + command.append("--make-dist") + print_message( + "Build {} (deps={}, release={}, dist={})", + target, + build_deps_only, + make_release, + make_dist, + ) + env = dict(_environ) + env['SKIP_BIG_MEMORY_TEST'] = '1' + subprocess.check_call(command, cwd=str(HOME), env=env) + print_message("Build ended") + + +def upload(file_to_upload, host, dest_path): + command = [ + "scp", + "-i", + _environ.get("SSH_KEY"), + "-o", + "StrictHostKeyChecking=no", + str(file_to_upload), + "{}:{}".format(host, dest_path), + ] + print_message("Sending archive with command {}", command) + subprocess.check_call(command) + + +def make_deps_archive(target=None, name=None, full=False): + archive_name = name or "deps2_{}_{}_{}.tar.xz".format( + OS_NAME, PLATFORM_TARGET, target + ) + print_message("Create archive {}.", archive_name) + files_to_archive = [INSTALL_DIR] + files_to_archive += HOME.glob("BUILD_*/LOGS") + if PLATFORM_TARGET == "native_mixed": + files_to_archive += [HOME / "BUILD_native_static" / "INSTALL"] + if PLATFORM_TARGET.startswith("android"): + files_to_archive.append(HOME / "BUILD_neutral" / "INSTALL") + if PLATFORM_TARGET == "android": + for arch in ("arm", "arm64", "x86", "x86_64"): + base_dir = HOME / "BUILD_android_{}".format(arch) + files_to_archive.append(base_dir / "INSTALL") + if (base_dir / "meson_cross_file.txt").exists(): + files_to_archive.append(base_dir / "meson_cross_file.txt") + files_to_archive += HOME.glob("BUILD_*/android-ndk*") + files_to_archive += HOME.glob("BUILD_*/android-sdk*") + if (BASE_DIR / "meson_cross_file.txt").exists(): + files_to_archive.append(BASE_DIR / "meson_cross_file.txt") + + manifest_file = BASE_DIR / "manifest.txt" + write_manifest(manifest_file, archive_name, target, PLATFORM_TARGET) + files_to_archive.append(manifest_file) + + relative_path = HOME + if full: + files_to_archive += ARCHIVE_DIR.glob(".*_ok") + files_to_archive += BASE_DIR.glob("*/.*_ok") + files_to_archive += (HOME / "BUILD_native_dyn").glob("*/.*_ok") + files_to_archive += (HOME / "BUILD_native_static").glob("*/.*_ok") + files_to_archive += HOME.glob("BUILD_android*/**/.*_ok") + files_to_archive += SOURCE_DIR.glob("*/.*_ok") + files_to_archive += [ + SOURCE_DIR / "pugixml-{}".format(base_deps_versions["pugixml"]) + ] + files_to_archive += HOME.glob( + "BUILD_*/pugixml-{}".format(base_deps_versions["pugixml"]) + ) + if PLATFORM_TARGET.startswith("armhf"): + files_to_archive += (SOURCE_DIR / "armhf").glob("*") + toolchains_subdirs = HOME.glob("BUILD_*/TOOLCHAINS/*/*") + for subdir in toolchains_subdirs: + if not subdir.match("tools"): + files_to_archive.append(subdir) + + archive_file = TMP_DIR / archive_name + with tarfile.open(str(archive_file), "w:xz") as tar: + for name in set(files_to_archive): + print(".{}".format(name), flush=True) + tar.add(str(name), arcname=str(name.relative_to(relative_path))) + + return archive_file diff --git a/.github/scripts/compile_all_deps.py b/.github/scripts/compile_all_deps.py new file mode 100755 index 0000000..d6d5197 --- /dev/null +++ b/.github/scripts/compile_all_deps.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +import os + +from common import ( + run_kiwix_build, + make_deps_archive, + upload, + OS_NAME, + PLATFORM_TARGET, + DESKTOP, + KIWIX_DESKTOP_ONLY, +) + +if PLATFORM_TARGET.startswith("android_"): + TARGETS = ("libzim", "kiwix-lib") +elif PLATFORM_TARGET.startswith("iOS"): + TARGETS = ("libzim", "kiwix-lib") +elif PLATFORM_TARGET.startswith("native_"): + if OS_NAME == "osx": + TARGETS = ("libzim", "zimwriterfs", "zim-tools", "kiwix-lib") + else: + if DESKTOP: + TARGETS = ("kiwix-desktop",) + elif PLATFORM_TARGET == "native_mixed": + TARGETS = ("libzim",) + else: + TARGETS = ("libzim", "zimwriterfs", "zim-tools", "kiwix-lib", "kiwix-tools") +else: + TARGETS = ("libzim", "zim-tools", "kiwix-lib", "kiwix-tools") + +for target in TARGETS: + run_kiwix_build(target, platform=PLATFORM_TARGET, build_deps_only=True) + archive_file = make_deps_archive(target=target) + upload(archive_file, "ci@tmp.kiwix.org", "/data/tmp/ci") + os.remove(str(archive_file)) diff --git a/.github/scripts/ensure_base_deps.py b/.github/scripts/ensure_base_deps.py new file mode 100755 index 0000000..004f837 --- /dev/null +++ b/.github/scripts/ensure_base_deps.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 + +import os +import tarfile +from urllib.request import urlopen +from urllib.error import URLError + +from kiwixbuild.versions import base_deps_meta_version + +from common import ( + print_message, + run_kiwix_build, + upload, + make_deps_archive, + HOME, + PLATFORM_TARGET, + OS_NAME, + MAKE_RELEASE, +) + +def download_base_archive(base_name): + url = "http://tmp.kiwix.org/ci/{}".format(base_name) + file_path = str(HOME / base_name) + batch_size = 1024 * 1024 * 8 + with urlopen(url) as resource, open(file_path, "wb") as file: + while True: + batch = resource.read(batch_size) + if not batch: + break + print(".", end="", flush=True) + file.write(batch) + return file_path + + +ARCHIVE_NAME_TEMPLATE = "base_deps2_{os}_{platform}_{version}_{release}.tar.xz" +base_dep_archive_name = ARCHIVE_NAME_TEMPLATE.format( + os=OS_NAME, + platform=PLATFORM_TARGET, + version=base_deps_meta_version, + release="release" if MAKE_RELEASE else "debug", +) + +print_message("Getting archive {}", base_dep_archive_name) +try: + local_filename = download_base_archive(base_dep_archive_name) + with tarfile.open(local_filename) as f: + f.extractall(str(HOME)) + os.remove(str(local_filename)) +except URLError: + print_message("Cannot get archive. Build dependencies") + if PLATFORM_TARGET == "android": + for arch in ("arm", "arm64", "x86", "x86_64"): + archive_name = ARCHIVE_NAME_TEMPLATE.format( + os=OS_NAME, + platform="android_{}".format(arch), + version=base_deps_meta_version, + release="release" if MAKE_RELEASE else "debug", + ) + print_message("Getting archive {}", archive_name) + try: + local_filename = download_base_archive(archive_name) + with tarfile.open(local_filename) as f: + f.extractall(str(HOME)) + os.remove(str(local_filename)) + except URLError: + pass + else: + run_kiwix_build("alldependencies", platform=PLATFORM_TARGET) + archive_file = make_deps_archive(name=base_dep_archive_name, full=True) + upload(archive_file, "ci@tmp.kiwix.org", "/data/tmp/ci") + os.remove(str(archive_file)) diff --git a/.github/scripts/upload_failure_logs.sh b/.github/scripts/upload_failure_logs.sh new file mode 100755 index 0000000..240a915 --- /dev/null +++ b/.github/scripts/upload_failure_logs.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e + +cd $HOME + +ARCHIVE_NAME=fail_log_${OS_NAME}_${PLATFORM_TARGET}.tar.gz +tar -czf ${ARCHIVE_NAME} $HOME/BUILD_* $HOME/SOURCE $HOME/LOGS $HOME/TOOLCHAINS + +echo "Uploading archive $ARCHIVE_NAME" + +scp -p -i ${SSH_KEY} \ + -o PasswordAuthentication=no \ + -o StrictHostKeyChecking=no \ + $ARCHIVE_NAME \ + ci@tmp.kiwix.org:/data/tmp/ci diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml new file mode 100644 index 0000000..0e2ad1b --- /dev/null +++ b/.github/workflows/base.yml @@ -0,0 +1,181 @@ +name: Build Base + +on: [push] + +env: + DOCKER_VERSION: 26 + +jobs: + Docker: + strategy: + fail-fast: false + matrix: + variant: [xenial, bionic, f31, focal] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build docker image + shell: bash + run: | + TAGNAME=${{matrix.variant}}-${DOCKER_VERSION} + if [ ! $(curl -sflL https://hub.docker.com/v2/repositories/kiwix/kiwix-build_ci/tags/${TAGNAME}) ] + then + echo "${{secrets.docker_password}}" | docker login -u "${{secrets.docker_username}}" --password-stdin + FULLTAGNAME=kiwix/kiwix-build_ci:${TAGNAME} + docker build -t ${FULLTAGNAME} - < ${GITHUB_WORKSPACE}/.github/ci_images/${{matrix.variant}}_builder.dockerfile + docker push ${FULLTAGNAME} + fi + + Linux: + strategy: + fail-fast: false + matrix: + target: + - native_static + - native_dyn + - native_mixed + - native_desktop + - armhf_static + - armhf_dyn + - win32_static + - win32_dyn + - i586_static + - i586_dyn + - android_arm + - android_arm64 + - android_x86 + - android_x86_64 + include: + - target: native_static + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + - target: native_dyn + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + - target: native_mixed + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + - target: native_desktop + image_variant: bionic + lib_postfix: '/x86_64-linux-gnu' + - target: armhf_static + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + - target: armhf_dyn + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + - target: win32_static + image_variant: f31 + lib_postfix: '64' + - target: win32_dyn + image_variant: f31 + lib_postfix: '64' + - target: i586_static + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + - target: i586_dyn + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + - target: android_arm + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + - target: android_arm64 + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + - target: android_x86 + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + - target: android_x86_64 + image_variant: xenial + lib_postfix: '/x86_64-linux-gnu' + env: + HOME: /home/runner + SSH_KEY: /tmp/id_rsa + runs-on: ubuntu-latest + needs: Docker + container: + image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-26" + steps: + - name: Checkout code + shell: bash + run: | + cd $HOME + git clone https://github.com/${REP} --depth=1 --branch ${GITHUB_REF##*/} + pip3 install --user --no-deps ./${REP##*/} + env: + REP: ${{github.repository}} + - name: secret + shell: bash + run: | + echo "${{secrets.ssh_key}}" > $SSH_KEY + chmod 600 $SSH_KEY + - name: Ensure base deps + shell: bash + run: | + cd $HOME + kiwix-build/.github/scripts/ensure_base_deps.py + env: + PLATFORM_TARGET: ${{matrix.target}} + - name: Compile all deps + shell: bash + run: | + cd $HOME + kiwix-build/.github/scripts/compile_all_deps.py + env: + PLATFORM_TARGET: ${{matrix.target}} + - name: Upload failure logs + if: failure() + run: $HOME/kiwix-build/.github/scripts/upload_failure_logs.sh + env: + PLATFORM_TARGET: ${{matrix.target}} + + + Macos: + strategy: + fail-fast: false + matrix: + target: + - native_dyn + runs-on: macos-latest + env: + SSH_KEY: /tmp/id_rsa + OS_NAME: osx + steps: + - name: Checkout code + uses: actions/checkout@v1 + - name: Setup python 3.6 + uses: actions/setup-python@v1 + with: + python-version: '3.6' + - name: Install packages + uses: mstksg/get-package@v1 + with: + brew: pkg-config ninja + - name: Install python modules + run: | + pip3 install meson==0.52.1 pytest + pip3 install --no-deps $GITHUB_WORKSPACE + - name: secret + shell: bash + run: | + echo "${{secrets.ssh_key}}" > $SSH_KEY + chmod 600 $SSH_KEY + - name: Ensure base deps + shell: bash + run: | + cd $HOME + $GITHUB_WORKSPACE/.github/scripts/ensure_base_deps.py + env: + PLATFORM_TARGET: ${{matrix.target}} + - name: Compile all deps + shell: bash + run: | + cd $HOME + $GITHUB_WORKSPACE/.github/scripts/compile_all_deps.py + env: + PLATFORM_TARGET: ${{matrix.target}} + - name: Upload failure logs + if: failure() + run: $GITHUB_WORKSPACE/.github/scripts/upload_failure_logs.sh + env: + PLATFORM_TARGET: ${{matrix.target}} diff --git a/.travis.yml b/.travis.yml index 6a9eb8c..6b78217 100644 --- a/.travis.yml +++ b/.travis.yml @@ -114,7 +114,7 @@ env: global: - NIGHTLY_DATE=$(date +%Y-%m-%d) - SSH_KEY=/tmp/private/travisci_builder_id_key - - DOCKER_VERSION=2 + - DOCKER_VERSION=4 matrix: - PLATFORM="flatpak" DESKTOP_ONLY=1 - PLATFORM="native_dyn" diff --git a/kiwixbuild/platforms/android.py b/kiwixbuild/platforms/android.py index c7e0b0e..668a2ab 100644 --- a/kiwixbuild/platforms/android.py +++ b/kiwixbuild/platforms/android.py @@ -26,8 +26,10 @@ class AndroidPlatformInfo(PlatformInfo): def binaries(self): install_path = self.install_path - return {k:pj(install_path, 'bin', v) - for k,v in self.binaries_name.items()} + binaries = {k:pj(install_path, 'bin', v) + for k,v in self.binaries_name.items()} + binaries['PKGCONFIG'] = 'pkg-config' + return binaries @property def ndk_builder(self): @@ -40,9 +42,6 @@ class AndroidPlatformInfo(PlatformInfo): def get_cross_config(self): extra_libs = ['-llog'] extra_cflags = ['-I{}'.format(pj(self.buildEnv.install_dir, 'include'))] - if hasattr(self, 'march'): - extra_libs.append('-march={}'.format(self.march)) - extra_cflags.append('-march={}'.format(self.march)) return { 'exe_wrapper_def': '', 'install_path': self.install_path, @@ -65,11 +64,10 @@ class AndroidPlatformInfo(PlatformInfo): def set_env(self, env): root_path = pj(self.install_path, 'sysroot') - march = '-march={}'.format(self.march) if hasattr(self,'march') else '' env['PKG_CONFIG_LIBDIR'] = pj(root_path, 'lib', 'pkgconfig') - env['CFLAGS'] = '-fPIC -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 --sysroot={} {} '.format(root_path, march) + env['CFLAGS'] - env['CXXFLAGS'] = '-fPIC -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 --sysroot={} {} '.format(root_path, march) + env['CXXFLAGS'] - env['LDFLAGS'] = '--sysroot={} {} '.format(root_path, march) + env['LDFLAGS'] + env['CFLAGS'] = '-fPIC -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 --sysroot={} '.format(root_path) + env['CFLAGS'] + env['CXXFLAGS'] = '-fPIC -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 --sysroot={} '.format(root_path) + env['CXXFLAGS'] + env['LDFLAGS'] = '--sysroot={} '.format(root_path) + env['LDFLAGS'] #env['CFLAGS'] = ' -fPIC -D_FILE_OFFSET_BITS=64 -O3 '+env['CFLAGS'] #env['CXXFLAGS'] = (' -D__OPTIMIZE__ -fno-strict-aliasing ' # ' -DU_HAVE_NL_LANGINFO_CODESET=0 ' @@ -97,7 +95,6 @@ class AndroidArm(AndroidPlatformInfo): arch = cpu = 'arm' arch_full = 'arm-linux-androideabi' abi = 'armeabi-v7a' - march = 'armv7-a' class AndroidArm64(AndroidPlatformInfo): diff --git a/kiwixbuild/platforms/armhf.py b/kiwixbuild/platforms/armhf.py index d07710d..6e0497d 100644 --- a/kiwixbuild/platforms/armhf.py +++ b/kiwixbuild/platforms/armhf.py @@ -49,8 +49,10 @@ class ArmhfPlatformInfo(PlatformInfo): ('RANLIB', 'ranlib'), ('LD', 'ld')) ) - return {k:pj(self.root_path, 'bin', v) - for k,v in binaries} + binaries = {k:pj(self.root_path, 'bin', v) + for k,v in binaries} + binaries['PKGCONFIG'] = 'pkg-config' + return binaries @property def exe_wrapper_def(self): diff --git a/kiwixbuild/platforms/i586.py b/kiwixbuild/platforms/i586.py index ec1160a..e090001 100644 --- a/kiwixbuild/platforms/i586.py +++ b/kiwixbuild/platforms/i586.py @@ -37,7 +37,8 @@ class I586PlatformInfo(PlatformInfo): ('AR', 'ar'), ('STRIP', 'strip'), ('RANLIB', 'ranlib'), - ('LD', 'ld')) + ('LD', 'ld'), + ('PKGCONFIG', 'pkg-config')) } def set_env(self, env): diff --git a/kiwixbuild/platforms/ios.py b/kiwixbuild/platforms/ios.py index 523d426..df08374 100644 --- a/kiwixbuild/platforms/ios.py +++ b/kiwixbuild/platforms/ios.py @@ -64,6 +64,7 @@ class iOSPlatformInfo(PlatformInfo): 'STRIP': '/usr/bin/strip', 'RANLIB': '/usr/bin/ranlib', 'LD': '/usr/bin/ld', + 'PKGCONFIG': 'pkg-config', } @property diff --git a/kiwixbuild/platforms/win32.py b/kiwixbuild/platforms/win32.py index b2f3fa6..17b37c4 100644 --- a/kiwixbuild/platforms/win32.py +++ b/kiwixbuild/platforms/win32.py @@ -49,7 +49,8 @@ class Win32PlatformInfo(PlatformInfo): ('AR', 'ar'), ('STRIP', 'strip'), ('WINDRES', 'windres'), - ('RANLIB', 'ranlib')) + ('RANLIB', 'ranlib'), + ('PKGCONFIG', 'pkg-config')) } @property diff --git a/kiwixbuild/templates/meson_cross_file.txt b/kiwixbuild/templates/meson_cross_file.txt index 6a664de..d5e6716 100644 --- a/kiwixbuild/templates/meson_cross_file.txt +++ b/kiwixbuild/templates/meson_cross_file.txt @@ -1,5 +1,5 @@ [binaries] -pkgconfig = 'pkg-config' +pkgconfig = '{binaries[PKGCONFIG]}' c = '{binaries[CC]}' ar = '{binaries[AR]}' cpp = '{binaries[CXX]}' diff --git a/setup.py b/setup.py index eb1642d..0deb12f 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ setup( packages=find_packages(), include_package_data=True, install_requires=[ - 'meson==0.49.2' + 'meson==0.52.1' ], entry_points={ 'console_scripts': [ diff --git a/travis/xenial_builder.dockerfile b/travis/xenial_builder.dockerfile index 3508ace..e0b7bcb 100644 --- a/travis/xenial_builder.dockerfile +++ b/travis/xenial_builder.dockerfile @@ -20,7 +20,9 @@ RUN apt update -q && \ # vim less grep \ && \ apt-get clean -y && \ - rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/debconf/* + rm -rf /var/lib/apt/lists/* /usr/share/doc/* /var/cache/debconf/* && \ + pip3 install --upgrade pip && \ + pip3 install meson==0.52.1 pytest gcovr # Create user RUN useradd --create-home ci_builder @@ -32,4 +34,4 @@ ENV TRAVIS_BUILD_DIR /home/ci_builder/kiwix-build ENV GRADLE_USER_HOME /home/ci_builder ENV TRAVIS_OS_NAME linux_xenial -CMD pip3 install --user ./kiwix-build && kiwix-build/travis/compile_all.py +CMD pip3 install --user --no-deps ./kiwix-build && kiwix-build/travis/compile_all.py