summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorL. E. Segovia <amy@centricular.com>2024-02-13 18:13:37 -0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-02-14 05:39:18 +0000
commit1b1867ff74b9ffafd525ede2e5ae8374e4e4a231 (patch)
tree581ab97ea64c86166f572e97f5545a6d5e2d3f25
parent73345c9c9a96571d42e397ef3e0cdcb87ab32c54 (diff)
cerbero, config/android, openssl: Don't pass the Android toolchain path wholesale
In !1191 (commit 643087f3f09fd637b29335efb608ac7a82031ecf), the removal of GCC support relied on making the Android compiler available to all processes. This fixed accessing the host's compiler for Meson based builds like fribidi's, and also allowed OpenSSL to build, but there was a hidden side effect: it broke Rust's ability to compile build scripts because the linker it finds (LLVM 14 from the NDK) no longer supports `--no-add-needed` [1] [2]. A more Meson-ese fix is to pass the toolchain as a constant in the native file, and fill the path in manually. This also needs to be injected manually into the `PATH` for OpenSSL as that's how its configure script consumes the toolchain. [1]: https://github.com/llvm/llvm-project/issues/54756 [2]: https://github.com/llvm/llvm-project/commit/815a1207bfe121c8dcf3804a4f4638e580f63519 Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1368>
-rw-r--r--cerbero/build/build.py12
-rw-r--r--config/android.config3
-rw-r--r--recipes/openssl.recipe2
3 files changed, 13 insertions, 4 deletions
diff --git a/cerbero/build/build.py b/cerbero/build/build.py
index efdb4b71..0247dff1 100644
--- a/cerbero/build/build.py
+++ b/cerbero/build/build.py
@@ -725,6 +725,9 @@ cpu_family = '{cpu_family}'
cpu = '{cpu}'
endian = '{endian}'
+[constants]
+toolchain = '{toolchain}'
+
[properties]
{extra_properties}
@@ -976,6 +979,7 @@ class Meson (Build, ModifyEnvBase) :
cpu_family=self._get_target_cpu_family(),
# Assume all supported target archs are little endian
endian='little',
+ toolchain='',
CC=cc,
CXX=cxx,
OBJC=objc,
@@ -1008,9 +1012,9 @@ class Meson (Build, ModifyEnvBase) :
objc = cc
objcxx = cxx
elif self.config.target_platform == Platform.ANDROID:
- cc = ['clang']
- cxx = ['clang++']
- ar = ['llvm-ar']
+ cc = "toolchain / 'clang'"
+ cxx = "toolchain / 'clang++'"
+ ar = "toolchain / 'llvm-ar'"
objc = cc
objcxx = cxx
else:
@@ -1026,6 +1030,7 @@ class Meson (Build, ModifyEnvBase) :
cpu=self.config.arch,
cpu_family=self.config.arch,
endian='little',
+ toolchain=self.get_env('ANDROID_NDK_TOOLCHAIN_BIN', ''),
CC=cc,
CXX=cxx,
OBJC=objc,
@@ -1051,6 +1056,7 @@ class Meson (Build, ModifyEnvBase) :
cpu=self.config.arch,
cpu_family=self.config.arch,
endian='little',
+ toolchain='',
CC=false,
CXX=false,
OBJC=false,
diff --git a/config/android.config b/config/android.config
index bdbc7dbb..611a5751 100644
--- a/config/android.config
+++ b/config/android.config
@@ -109,6 +109,7 @@ env.pop('RUSTFLAGS', None)
# Android NDK path
env['ANDROID_NDK_HOME'] = toolchain_prefix
+env['ANDROID_NDK_TOOLCHAIN_BIN'] = llvm_toolchain_path
# 'universal' is set by cerbero itself when building under a universal regime
# so that we can construct different paths to include/lib directories to where
@@ -188,7 +189,7 @@ env['NM']= llvm_cmd('llvm-nm')
env['STRIP']= llvm_cmd('llvm-strip')
env['OBJCOPY']= llvm_cmd('llvm-objcopy')
-env['PATH'] = f'{llvm_toolchain_path}:{spirv_toolchain_path}:{env["PATH"]}'
+env['PATH'] = f'{spirv_toolchain_path}:{env["PATH"]}'
# For the libc.so dependency in i686-linux-android-as
if target_arch == Architecture.X86:
extra_lib_path = f'{sysroot}/usr/lib'
diff --git a/recipes/openssl.recipe b/recipes/openssl.recipe
index 77c50d56..dfc9572a 100644
--- a/recipes/openssl.recipe
+++ b/recipes/openssl.recipe
@@ -181,6 +181,8 @@ class Recipe(recipe.Recipe):
if self.config.target_platform == Platform.IOS:
self.library_type = LibraryType.STATIC
+ if self.config.target_platform == Platform.ANDROID:
+ self.prepend_env('PATH', self.get_env('ANDROID_NDK_TOOLCHAIN_BIN'), sep=os.pathsep)
@modify_environment