Merge pull request #584 from kiwix/macos_arm64

This commit is contained in:
Matthieu Gautier 2023-04-05 15:48:52 +02:00 committed by GitHub
commit 0b5eb668e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 44 additions and 17 deletions

View File

@ -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", )

View File

@ -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)

View File

@ -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",

View File

@ -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:

View File

@ -170,6 +170,7 @@ jobs:
target:
- native_dyn
- native_mixed
- macOs_arm64_mixed
runs-on: macos-12
env:
SSH_KEY: /tmp/id_rsa

View File

@ -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))

View File

@ -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',

View File

@ -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

View File

@ -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',

View File

@ -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'

View File

@ -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',