Skip to content

Commit 3014b61

Browse files
author
Markus Perl
committed
MacOS System detection
1 parent 696f608 commit 3014b61

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

build-ffmpeg

+22-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CFLAGS="-I$WORKSPACE/include -Wno-int-conversion"
1313
LDFLAGS="-L$WORKSPACE/lib"
1414
LDEXEFLAGS=""
1515
EXTRALIBS="-ldl -lpthread -lm -lz"
16-
MACOS_M1=false
16+
MACOS_SILICON=false
1717
CONFIGURE_OPTIONS=()
1818
NONFREE_AND_GPL=false
1919
DISABLE_LV2=false
@@ -27,7 +27,20 @@ if [[ ("$(uname -m)" == "arm64") && ("$OSTYPE" == "darwin"*) ]]; then
2727
export ARCH=arm64
2828
export MACOSX_DEPLOYMENT_TARGET=11.0
2929
export CXX=$(which clang++)
30-
MACOS_M1=true
30+
MACOS_SILICON=true
31+
echo "Apple Silicon detected."
32+
33+
# get macos version
34+
MACOS_VERSION=$(sw_vers -productVersion)
35+
echo "macOS Version: $MACOS_VERSION"
36+
37+
#check if clang++ is installed and print version. Otherwise exit with an error message
38+
if command_exists "clang++"; then
39+
echo "clang++ is installed. Version: $(clang++ --version | head -n 1)"
40+
else
41+
echo "clang++ is not installed. Please install Xcode."
42+
exit 1
43+
fi
3144
fi
3245

3346
# Speed up the process
@@ -195,7 +208,7 @@ verify_binary_type() {
195208
echo ""
196209
case $BINARY_TYPE in
197210
"Mach-O 64-bit executable arm64")
198-
echo "Successfully built Apple Silicon (M1) for ${OSTYPE}: ${BINARY_TYPE}"
211+
echo "Successfully built Apple Silicon for ${OSTYPE}: ${BINARY_TYPE}"
199212
;;
200213
*)
201214
echo "Successfully built binary for ${OSTYPE}: ${BINARY_TYPE}"
@@ -427,7 +440,7 @@ if $NONFREE_AND_GPL; then
427440

428441
if build "openssl" "1.1.1w"; then
429442
download "https://www.openssl.org/source/openssl-$CURRENT_PACKAGE_VERSION.tar.gz"
430-
if $MACOS_M1; then
443+
if $MACOS_SILICON; then
431444
sed -n 's/\(##### GNU Hurd\)/"darwin64-arm64-cc" => { \n inherit_from => [ "darwin-common", asm("aarch64_asm") ],\n CFLAGS => add("-Wall"),\n cflags => add("-arch arm64 "),\n lib_cppflags => add("-DL_ENDIAN"),\n bn_ops => "SIXTY_FOUR_BIT_LONG", \n perlasm_scheme => "macosx", \n}, \n\1/g' Configurations/10-main.conf
432445
execute ./Configure --prefix="${WORKSPACE}" no-shared no-asm darwin64-arm64-cc
433446
else
@@ -517,15 +530,15 @@ if command_exists "python3"; then
517530
make_dir build
518531

519532
CFLAGSBACKUP=$CFLAGS
520-
if $MACOS_M1; then
533+
if $MACOS_SILICON; then
521534
export CFLAGS="-arch arm64"
522535
fi
523536

524537
execute meson build --prefix="${WORKSPACE}" --buildtype=release --default-library=static --libdir="${WORKSPACE}"/lib
525538
execute ninja -C build
526539
execute ninja -C build install
527540

528-
if $MACOS_M1; then
541+
if $MACOS_SILICON; then
529542
export CFLAGS=$CFLAGSBACKUP
530543
fi
531544

@@ -669,7 +682,7 @@ if $NONFREE_AND_GPL; then
669682
if build "vid_stab" "1.1.1"; then
670683
download "https://github.com/georgmartius/vid.stab/archive/v$CURRENT_PACKAGE_VERSION.tar.gz" "vid.stab-$CURRENT_PACKAGE_VERSION.tar.gz"
671684

672-
if $MACOS_M1; then
685+
if $MACOS_SILICON; then
673686
curl -L --silent -o "$PACKAGES/vid.stab-$CURRENT_PACKAGE_VERSION/fix_cmake_quoting.patch" "https://raw.githubusercontent.com/Homebrew/formula-patches/5bf1a0e0cfe666ee410305cece9c9c755641bfdf/libvidstab/fix_cmake_quoting.patch"
674687
patch -p1 <fix_cmake_quoting.patch
675688
fi
@@ -688,7 +701,7 @@ if build "av1" "42dfaa1d47022650bc157dbe20d210591d14bae4"; then
688701
download "https://aomedia.googlesource.com/aom/+archive/$CURRENT_PACKAGE_VERSION.tar.gz" "av1.tar.gz" "av1"
689702
make_dir "$PACKAGES"/aom_build
690703
cd "$PACKAGES"/aom_build || exit
691-
if $MACOS_M1; then
704+
if $MACOS_SILICON; then
692705
execute cmake -DENABLE_TESTS=0 -DENABLE_EXAMPLES=0 -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_INSTALL_LIBDIR=lib -DCONFIG_RUNTIME_CPU_DETECT=0 "$PACKAGES"/av1
693706
else
694707
execute cmake -DENABLE_TESTS=0 -DENABLE_EXAMPLES=0 -DCMAKE_INSTALL_PREFIX="${WORKSPACE}" -DCMAKE_INSTALL_LIBDIR=lib "$PACKAGES"/av1
@@ -833,7 +846,7 @@ if build "libtheora" "1.1.1"; then
833846
chmod +x configure.patched
834847
mv configure.patched configure
835848

836-
if ! $MACOS_M1; then
849+
if ! $MACOS_SILICON; then
837850
##BEGIN CONFIG.GUESS PATCH -- Updating config.guess file. Which allowed me to compile on aarch64 (ARMv8) [linux kernel 4.9 Ubuntu 20.04]
838851
rm config.guess
839852
curl -L --silent -o "config.guess" "https://raw.githubusercontent.com/gcc-mirror/gcc/master/config.guess"

0 commit comments

Comments
 (0)