diff --git a/.github/scripts/build_projects.py b/.github/scripts/build_projects.py index bf325fc..7a67a34 100755 --- a/.github/scripts/build_projects.py +++ b/.github/scripts/build_projects.py @@ -19,7 +19,7 @@ if (PLATFORM_TARGET.startswith("android_") TARGETS = ("libzim", "libkiwix") elif PLATFORM_TARGET.startswith("native_"): if OS_NAME == "osx": - if PLATFORM_TARGET == "native_mixed": + if PLATFORM_TARGET.endswith("_mixed"): TARGETS = ("libzim", "libkiwix") else: TARGETS = ("zim-tools", ) diff --git a/.github/scripts/build_release_nightly.py b/.github/scripts/build_release_nightly.py index 168359a..f21cb5a 100755 --- a/.github/scripts/build_release_nightly.py +++ b/.github/scripts/build_release_nightly.py @@ -26,7 +26,7 @@ if PLATFORM_TARGET.startswith("android_") or PLATFORM_TARGET.startswith("iOS"): TARGETS = ("libzim", "libkiwix") elif PLATFORM_TARGET.startswith("native_"): if OS_NAME == "osx": - if PLATFORM_TARGET == "native_mixed": + if PLATFORM_TARGET.endswith("_mixed"): TARGETS = ("libzim", "libkiwix") else: TARGETS = ("zim-tools", ) @@ -57,7 +57,7 @@ for target in TARGETS: if target == "kiwix-desktop": archive = create_desktop_image(make_release=MAKE_RELEASE) else: - if PLATFORM_TARGET == "native_mixed" and OS_NAME == "osx": + if OS_NAME == "osx" and PLATFORM_TARGET.endswith("_mixed"): fix_macos_rpath(target) notarize_macos_build(target) archive = make_archive(target, make_release=MAKE_RELEASE) diff --git a/.github/scripts/common.py b/.github/scripts/common.py index 22b9f0a..1b302b1 100644 --- a/.github/scripts/common.py +++ b/.github/scripts/common.py @@ -55,6 +55,7 @@ PLATFORM_TO_RELEASE = { "aarch64_static": "{os}-aarch64".format(os=RELEASE_OS_NAME), "aarch64_mixed": "{os}-aarch64".format(os=RELEASE_OS_NAME), "i586_static": "{os}-i586".format(os=RELEASE_OS_NAME), + "macOS_arm64_mixed": "{os}-arm64".format(os=RELEASE_OS_NAME), "android_arm": "android-arm", "android_arm64": "android-arm64", "android_x86": "android-x86", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d37b0ad..fc6bf25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,7 +140,8 @@ jobs: - iOS_arm64 - iOS_x86_64 - iOS_Mac_ABI - - macOS_arm64 + - macOS_arm64_static + - macOS_arm64_mixed - macOS_x86_64 runs-on: macos-latest env: diff --git a/.github/workflows/releaseNigthly.yml b/.github/workflows/releaseNigthly.yml index 7d8a07a..8586dee 100644 --- a/.github/workflows/releaseNigthly.yml +++ b/.github/workflows/releaseNigthly.yml @@ -170,6 +170,7 @@ jobs: target: - native_dyn - native_mixed + - macOs_arm64_mixed runs-on: macos-12 env: SSH_KEY: /tmp/id_rsa diff --git a/kiwixbuild/platforms/android.py b/kiwixbuild/platforms/android.py index e38133f..b5a49b4 100644 --- a/kiwixbuild/platforms/android.py +++ b/kiwixbuild/platforms/android.py @@ -45,7 +45,7 @@ class AndroidPlatformInfo(PlatformInfo): def get_cross_config(self): extra_libs = ['-llog'] - extra_cflags = ['-I{}'.format(pj(self.buildEnv.install_dir, 'include'))] + extra_cflags = ['-I{}'.format(include_dir) for include_dir in self.get_include_dirs()] if hasattr(self, 'march'): extra_libs.append('-march={}'.format(self.march)) extra_cflags.append('-march={}'.format(self.march)) diff --git a/kiwixbuild/platforms/armhf.py b/kiwixbuild/platforms/armhf.py index 9a8a8d3..2864fe8 100644 --- a/kiwixbuild/platforms/armhf.py +++ b/kiwixbuild/platforms/armhf.py @@ -16,7 +16,7 @@ class ArmhfPlatformInfo(PlatformInfo): 'exe_wrapper_def': '', 'root_path': self.root_path, 'extra_libs': [], - 'extra_cflags': ['-I{}'.format(pj(self.buildEnv.install_dir, 'include'))], + 'extra_cflags': ['-I{}'.format(include_dir) for include_dir in self.get_include_dirs()], 'host_machine': { 'system': 'linux', 'lsystem': 'linux', diff --git a/kiwixbuild/platforms/base.py b/kiwixbuild/platforms/base.py index 0f9d6e2..881bff1 100644 --- a/kiwixbuild/platforms/base.py +++ b/kiwixbuild/platforms/base.py @@ -77,6 +77,8 @@ class PlatformInfo(metaclass=_MetaPlatform): def get_cross_config(self): return {} + def get_include_dirs(self): + return [pj(self.buildEnv.install_dir, 'include')] def get_env(self): return DefaultEnv() @@ -135,6 +137,7 @@ class MetaPlatformInfo(PlatformInfo): def MixedMixin(static_name): class MixedMixinClass: mixed = True + static = False def add_targets(self, targetName, targets): print(targetName) @@ -151,16 +154,23 @@ def MixedMixin(static_name): return self.name, dep return static_name, dep + @property + def static_buildEnv(self): + static_platform = self.get_platform(static_name) + return static_platform.buildEnv + + def get_include_dirs(self): + return [ + pj(self.buildEnv.install_dir, 'include'), + pj(self.static_buildEnv.install_dir, 'include') + ] def get_env(self): env = super().get_env() - static_platform = self.get_platform(static_name) - static_buildEnv = static_platform.buildEnv - static_install_dir = static_buildEnv.install_dir - env['PATH'] = ':'.join([pj(static_install_dir, 'bin')] + [env['PATH']]) - pkgconfig_path = pj(static_install_dir, static_buildEnv.libprefix, 'pkgconfig') + env['PATH'] = ':'.join([pj(self.static_buildEnv.install_dir, 'bin')] + [env['PATH']]) + pkgconfig_path = pj(self.static_buildEnv.install_dir, self.static_buildEnv.libprefix, 'pkgconfig') env['PKG_CONFIG_PATH'] = ':'.join([env['PKG_CONFIG_PATH'], pkgconfig_path]) - env['CPPFLAGS'] = " ".join(['-I'+pj(static_install_dir, 'include'), env['CPPFLAGS']]) + env['CPPFLAGS'] = " ".join(['-I'+pj(self.static_buildEnv.install_dir, 'include'), env['CPPFLAGS']]) return env return MixedMixinClass diff --git a/kiwixbuild/platforms/i586.py b/kiwixbuild/platforms/i586.py index 13f2890..7745696 100644 --- a/kiwixbuild/platforms/i586.py +++ b/kiwixbuild/platforms/i586.py @@ -14,7 +14,12 @@ class I586PlatformInfo(PlatformInfo): 'binaries': self.binaries, 'exe_wrapper_def': '', 'extra_libs': ['-m32', '-march=i586', '-mno-sse'], - 'extra_cflags': ['-m32', '-march=i586', '-mno-sse', '-I{}'.format(pj(self.buildEnv.install_dir, 'include'))], + 'extra_cflags': [ + '-m32', + '-march=i586', + '-mno-sse', + *('-I{}'.format(include_dir) for include_dir in self.get_include_dirs()) + ], 'host_machine': { 'system': 'linux', 'lsystem': 'linux', diff --git a/kiwixbuild/platforms/ios.py b/kiwixbuild/platforms/ios.py index 2ec65af..9ed9a4d 100644 --- a/kiwixbuild/platforms/ios.py +++ b/kiwixbuild/platforms/ios.py @@ -2,7 +2,7 @@ import subprocess from kiwixbuild._global import option from kiwixbuild.utils import pj, xrun_find -from .base import PlatformInfo, MetaPlatformInfo +from .base import PlatformInfo, MetaPlatformInfo, MixedMixin class ApplePlatformInfo(PlatformInfo): @@ -52,7 +52,7 @@ class ApplePlatformInfo(PlatformInfo): '-arch', self.arch, '-target', self.target, '-stdlib=libc++', - '-I{}'.format(pj(self.buildEnv.install_dir, 'include')) + *('-I{}'.format(include_dir) for include_dir in self.get_include_dirs()) ], 'host_machine': { 'system': 'Darwin', @@ -144,7 +144,16 @@ class iOSMacABI(ApplePlatformInfo): class macOSArm64(ApplePlatformInfo): - name = 'macOS_arm64' + name = 'macOS_arm64_static' + arch = cpu = 'arm64' + host = 'aarch64-apple-darwin' + target = 'arm64-apple-macos11' + sdk_name = 'macosx' + min_iphoneos_version = None + + +class macOSArm64Mixed(MixedMixin('macOS_arm64_static'), ApplePlatformInfo): + name = 'macOS_arm64_mixed' arch = cpu = 'arm64' host = 'aarch64-apple-darwin' target = 'arm64-apple-macos11' diff --git a/kiwixbuild/platforms/win32.py b/kiwixbuild/platforms/win32.py index 2d2a2cf..a88fe36 100644 --- a/kiwixbuild/platforms/win32.py +++ b/kiwixbuild/platforms/win32.py @@ -17,7 +17,7 @@ class Win32PlatformInfo(PlatformInfo): 'binaries': self.binaries, 'root_path': self.root_path, 'extra_libs': self.extra_libs, - 'extra_cflags': ['-DWIN32', '-I{}'.format(pj(self.buildEnv.install_dir, 'include'))], + 'extra_cflags': ['-DWIN32', *('-I{}'.format(include_dir) for include_dir in self.get_include_dirs())], 'host_machine': { 'system': 'Windows', 'lsystem': 'windows',