[vlc-commits] extras: fix arch handling in macOS build script
Felix Paul Kühne
git at videolan.org
Thu Dec 3 06:06:04 UTC 2020
vlc/vlc-3.0 | branch: master | Felix Paul Kühne <felix at feepk.net> | Mon Nov 30 18:07:53 2020 +0100| [87f92cc8d8adca7f2f55770616089e81900d1b74] | committer: Felix Paul Kühne
extras: fix arch handling in macOS build script
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=87f92cc8d8adca7f2f55770616089e81900d1b74
---
extras/package/macosx/build.sh | 41 ++++++++++++++++++++++++++++++-----------
1 file changed, 30 insertions(+), 11 deletions(-)
diff --git a/extras/package/macosx/build.sh b/extras/package/macosx/build.sh
index 87a3129bb5..d836a324c8 100755
--- a/extras/package/macosx/build.sh
+++ b/extras/package/macosx/build.sh
@@ -11,6 +11,7 @@ info()
ARCH="x86_64"
MINIMAL_OSX_VERSION="10.7"
OSX_KERNELVERSION=`uname -r | cut -d. -f1`
+BUILD_ARCH=`uname -m | cut -d. -f1`
SDKROOT=$(xcrun --show-sdk-path)
VLCBUILDDIR=""
@@ -54,6 +55,14 @@ spopd()
popd > /dev/null
}
+get_actual_arch() {
+ if [ "$1" = "aarch64" ]; then
+ echo "arm64"
+ else
+ echo "$1"
+ fi
+}
+
while getopts "hvrcpi:k:a:j:C:b:" OPTION
do
case $OPTION in
@@ -124,16 +133,23 @@ builddir=`pwd`
info "Building in \"$builddir\""
-TRIPLET=$ARCH-apple-darwin$OSX_KERNELVERSION
+BUILD_TRIPLET=$BUILD_ARCH-apple-darwin$OSX_KERNELVERSION
+HOST_TRIPLET=$ARCH-apple-darwin$OSX_KERNELVERSION
+ACTUAL_ARCH=`get_actual_arch $ARCH`
python3Path=$(echo /Library/Frameworks/Python.framework/Versions/3.*/bin | awk '{print $1;}')
if [ ! -d "$python3Path" ]; then
python3Path=""
fi
+export AR="`xcrun --find ar`"
export CC="`xcrun --find clang`"
export CXX="`xcrun --find clang++`"
+export NM="`xcrun --find nm`"
export OBJC="`xcrun --find clang`"
+export RANLIB="`xcrun --find ranlib`"
+export STRINGS="`xcrun --find strings`"
+export STRIP="`xcrun --find strip`"
export SDKROOT
export PATH="${vlcroot}/extras/tools/build/bin:${vlcroot}/contrib/${TRIPLET}/bin:$python3Path:${VLC_PATH}:/bin:/sbin:/usr/bin:/usr/sbin"
@@ -216,15 +232,15 @@ export CFLAGS="-Werror=partial-availability"
export CXXFLAGS="-Werror=partial-availability"
export OBJCFLAGS="-Werror=partial-availability"
-export EXTRA_CFLAGS="-isysroot $SDKROOT -mmacosx-version-min=$MINIMAL_OSX_VERSION -DMACOSX_DEPLOYMENT_TARGET=$MINIMAL_OSX_VERSION"
-export EXTRA_LDFLAGS="-Wl,-syslibroot,$SDKROOT -mmacosx-version-min=$MINIMAL_OSX_VERSION -isysroot $SDKROOT -DMACOSX_DEPLOYMENT_TARGET=$MINIMAL_OSX_VERSION"
+export EXTRA_CFLAGS="-isysroot $SDKROOT -mmacosx-version-min=$MINIMAL_OSX_VERSION -DMACOSX_DEPLOYMENT_TARGET=$MINIMAL_OSX_VERSION -arch $ACTUAL_ARCH"
+export EXTRA_LDFLAGS="-Wl,-syslibroot,$SDKROOT -mmacosx-version-min=$MINIMAL_OSX_VERSION -isysroot $SDKROOT -DMACOSX_DEPLOYMENT_TARGET=$MINIMAL_OSX_VERSION -arch $ACTUAL_ARCH"
# xcodebuild only allows to set a build-in sdk, not a custom one. Therefore use the default included SDK here
export XCODE_FLAGS="MACOSX_DEPLOYMENT_TARGET=$MINIMAL_OSX_VERSION -sdk macosx WARNING_CFLAGS=-Werror=partial-availability"
info "Building contribs"
spushd "${vlcroot}/contrib"
-mkdir -p contrib-$TRIPLET && cd contrib-$TRIPLET
-../bootstrap --build=$TRIPLET --host=$TRIPLET > $out
+mkdir -p contrib-$HOST_TRIPLET && cd contrib-$HOST_TRIPLET
+../bootstrap --build=$BUILD_TRIPLET --host=$HOST_TRIPLET > $out
if [ "$REBUILD" = "yes" ]; then
make clean
fi
@@ -238,7 +254,7 @@ if [ "$CONTRIBFROMSOURCE" = "yes" ]; then
fi
else
-if [ ! -e "../$TRIPLET" ]; then
+if [ ! -e "../$HOST_TRIPLET" ]; then
make prebuilt > $out
fi
fi
@@ -253,9 +269,10 @@ unset EXTRA_LDFLAGS
unset XCODE_FLAGS
# Enable debug symbols by default
-export CFLAGS="-g"
-export CXXFLAGS="-g"
-export OBJCFLAGS="-g"
+export CFLAGS="-g -arch $ACTUAL_ARCH"
+export CXXFLAGS="-g -arch $ACTUAL_ARCH"
+export OBJCFLAGS="-g -arch $ACTUAL_ARCH"
+export LDFLAGS="-arch $ACTUAL_ARCH"
#
# vlc/bootstrap
@@ -285,8 +302,8 @@ fi
if [ "${vlcroot}/configure" -nt Makefile ]; then
${vlcroot}/extras/package/macosx/configure.sh \
- --build=$TRIPLET \
- --host=$TRIPLET \
+ --build=$BUILD_TRIPLET \
+ --host=$HOST_TRIPLET \
--with-macosx-version-min=$MINIMAL_OSX_VERSION \
--with-macosx-sdk=$SDKROOT \
$CONFIGFLAGS \
@@ -327,7 +344,9 @@ if [ "$PACKAGETYPE" = "u" ]; then
find VLC.app/ -type f -name "Growl" -exec strip -x {} \;
find VLC.app/ -type f -name "Breakpad" -exec strip -x {} \;
+if [ "$BUILD_TRIPLET" = "$HOST_TRIPLET" ]; then
bin/vlc-cache-gen VLC.app/Contents/MacOS/plugins
+fi
info "Building VLC release archive"
make package-macosx-release
More information about the vlc-commits
mailing list