[vlc-devel] [PATCH] package/apple: fix compilation on ARM-64

Felix Paul Kühne fkuehne at videolan.org
Tue Feb 16 10:25:38 UTC 2021


From: Felix Paul Kühne <felix at feepk.net>

---
 extras/package/apple/build.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/extras/package/apple/build.sh b/extras/package/apple/build.sh
index 1868c8f1f4..b33eb38856 100755
--- a/extras/package/apple/build.sh
+++ b/extras/package/apple/build.sh
@@ -57,6 +57,7 @@ VLC_HOST_ARCH="x86_64"
 # Host platform information
 VLC_HOST_PLATFORM=
 VLC_HOST_TRIPLET=
+VLC_BUILD_TRIPLET=
 # Set to "1" when building for simulator
 VLC_HOST_PLATFORM_SIMULATOR=
 # The host OS name (without the simulator suffix)
@@ -232,6 +233,21 @@ set_host_triplet()
     VLC_HOST_TRIPLET="${triplet_arch}-apple-darwin"
 }
 
+# Set the VLC_BUILD_TRIPLET based on the architecture
+# that we run on.
+# Globals:
+#   VLC_BUILD_TRIPLET
+# Arguments:
+#   None
+set_build_triplet()
+{
+    local build_arch=`uname -m | cut -d. -f1`
+	if [ "$build_arch" = "arm64" ]; then
+        build_arch="aarch64"
+	fi
+    VLC_BUILD_TRIPLET="$build_arch-apple-darwin"
+}
+
 # Take SDK name, verify it exists and populate
 # VLC_HOST_*, VLC_APPLE_SDK_PATH variables based
 # on the SDK and calls the set_deployment_target
@@ -490,6 +506,7 @@ validate_architecture "$VLC_HOST_ARCH"
 
 # Set triplet (needs to be called after validating the arch)
 set_host_triplet "$VLC_HOST_ARCH"
+set_build_triplet
 
 # Set pseudo-triplet
 # FIXME: This should match the actual clang triplet and should be used for compiler invocation too!
@@ -603,6 +620,7 @@ write_config_mak "-Werror=partial-availability"
 # Bootstrap contribs
 ../bootstrap \
     --host="$VLC_HOST_TRIPLET" \
+    --build="$VLC_BUILD_TRIPLET" \
     --prefix="$VLC_CONTRIB_INSTALL_DIR" \
     "${VLC_CONTRIB_OPTIONS[@]}" \
 || abort_err "Bootstrapping contribs failed"
@@ -680,6 +698,7 @@ mkdir -p "$VLC_INSTALL_DIR"
 hostenv ../../configure \
     --with-contrib="$VLC_CONTRIB_INSTALL_DIR" \
     --host="$VLC_HOST_TRIPLET" \
+    --build="$VLC_BUILD_TRIPLET" \
     --prefix="$VLC_INSTALL_DIR" \
     "${VLC_CONFIG_OPTIONS[@]}" \
  || abort_err "Configuring VLC failed"
-- 
2.24.3 (Apple Git-128)



More information about the vlc-devel mailing list