-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build-scripts: modernized gcc-fat.sh for Big Sur and ARM64.
Put these in "clang-fat.sh" and "clang++-fat.sh" in case someone still needs 32-bit x86 support from the old scripts. Fixes #4350.
- Loading branch information
Showing
2 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#!/bin/sh | ||
# | ||
# Build Universal binaries on Mac OS X, thanks Ryan! | ||
# | ||
# Usage: ./configure CXX="sh clang++-fat.sh" && make && rm -rf arm64 x64 | ||
|
||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" | ||
|
||
# Intel 64-bit compiler flags (10.6 runtime compatibility) | ||
CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.6 \ | ||
-I/usr/local/include" | ||
|
||
CLANG_LINK_X64="-mmacosx-version-min=10.6" | ||
|
||
# ARM 64-bit compiler flags (11.0 runtime compatibility) | ||
CLANG_COMPILE_ARM64="clang++ -arch arm64 -mmacosx-version-min=11.0 \ | ||
-I/usr/local/include" | ||
|
||
CLANG_LINK_ARM64="-mmacosx-version-min=11.0" | ||
|
||
|
||
# Output both Intel and ARM object files | ||
args="$*" | ||
compile=yes | ||
link=yes | ||
while test x$1 != x; do | ||
case $1 in | ||
--version) exec clang++ $1;; | ||
-v) exec clang++ $1;; | ||
-V) exec clang++ $1;; | ||
-print-prog-name=*) exec clang++ $1;; | ||
-print-search-dirs) exec clang++ $1;; | ||
-E) CLANG_COMPILE_ARM64="$CLANG_COMPILE_ARM64 -E" | ||
CLANG_COMPILE_X64="$CLANG_COMPILE_X64 -E" | ||
compile=no; link=no;; | ||
-c) link=no;; | ||
-o) output=$2;; | ||
*.c|*.cc|*.cpp|*.S|*.m|*.mm) source=$1;; | ||
esac | ||
shift | ||
done | ||
if test x$link = xyes; then | ||
CLANG_COMPILE_ARM64="$CLANG_COMPILE_ARM64 $CLANG_LINK_ARM64" | ||
CLANG_COMPILE_X64="$CLANG_COMPILE_X64 $CLANG_LINK_X64" | ||
fi | ||
if test x"$output" = x; then | ||
if test x$link = xyes; then | ||
output=a.out | ||
elif test x$compile = xyes; then | ||
output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o | ||
fi | ||
fi | ||
|
||
# Compile ARM 64-bit | ||
if test x"$output" != x; then | ||
dir=arm64/`dirname $output` | ||
if test -d $dir; then | ||
: | ||
else | ||
mkdir -p $dir | ||
fi | ||
fi | ||
set -- $args | ||
while test x$1 != x; do | ||
if test -f "arm64/$1" && test "$1" != "$output"; then | ||
arm64_args="$arm64_args arm64/$1" | ||
else | ||
arm64_args="$arm64_args $1" | ||
fi | ||
shift | ||
done | ||
$CLANG_COMPILE_ARM64 $arm64_args || exit $? | ||
if test x"$output" != x; then | ||
cp $output arm64/$output | ||
fi | ||
|
||
# Compile Intel 64-bit | ||
if test x"$output" != x; then | ||
dir=x64/`dirname $output` | ||
if test -d $dir; then | ||
: | ||
else | ||
mkdir -p $dir | ||
fi | ||
fi | ||
set -- $args | ||
while test x$1 != x; do | ||
if test -f "x64/$1" && test "$1" != "$output"; then | ||
x64_args="$x64_args x64/$1" | ||
else | ||
x64_args="$x64_args $1" | ||
fi | ||
shift | ||
done | ||
$CLANG_COMPILE_X64 $x64_args || exit $? | ||
if test x"$output" != x; then | ||
cp $output x64/$output | ||
fi | ||
|
||
if test x"$output" != x; then | ||
lipo -create -o $output arm64/$output x64/$output | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/bin/sh | ||
# | ||
# Build Universal binaries on Mac OS X, thanks Ryan! | ||
# | ||
# Usage: ./configure CC="sh clang-fat.sh" && make && rm -rf arm64 x64 | ||
|
||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer" | ||
|
||
# Intel 64-bit compiler flags (10.6 runtime compatibility) | ||
CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.6 \ | ||
-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \ | ||
-I/usr/local/include" | ||
|
||
CLANG_LINK_X64="-mmacosx-version-min=10.6" | ||
|
||
# ARM 64-bit compiler flags (11.0 runtime compatibility) | ||
CLANG_COMPILE_ARM64="clang -arch arm64 -mmacosx-version-min=11.0 \ | ||
-I/usr/local/include" | ||
|
||
CLANG_LINK_ARM64="-mmacosx-version-min=11.0" | ||
|
||
|
||
# Output both Intel and ARM object files | ||
args="$*" | ||
compile=yes | ||
link=yes | ||
while test x$1 != x; do | ||
case $1 in | ||
--version) exec clang $1;; | ||
-v) exec clang $1;; | ||
-V) exec clang $1;; | ||
-print-prog-name=*) exec clang $1;; | ||
-print-search-dirs) exec clang $1;; | ||
-E) CLANG_COMPILE_X64="$CLANG_COMPILE_X64 -E" | ||
CLANG_COMPILE_ARM64="$CLANG_COMPILE_ARM64 -E" | ||
compile=no; link=no;; | ||
-c) link=no;; | ||
-o) output=$2;; | ||
*.c|*.cc|*.cpp|*.S|*.m|*.mm) source=$1;; | ||
esac | ||
shift | ||
done | ||
if test x$link = xyes; then | ||
CLANG_COMPILE_X64="$CLANG_COMPILE_X64 $CLANG_LINK_X64" | ||
CLANG_COMPILE_ARM64="$CLANG_COMPILE_ARM64 $CLANG_LINK_ARM64" | ||
fi | ||
if test x"$output" = x; then | ||
if test x$link = xyes; then | ||
output=a.out | ||
elif test x$compile = xyes; then | ||
output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o | ||
fi | ||
fi | ||
|
||
# Compile Intel 64-bit | ||
if test x"$output" != x; then | ||
dir=x64/`dirname $output` | ||
if test -d $dir; then | ||
: | ||
else | ||
mkdir -p $dir | ||
fi | ||
fi | ||
set -- $args | ||
while test x$1 != x; do | ||
if test -f "x64/$1" && test "$1" != "$output"; then | ||
x64_args="$x64_args x64/$1" | ||
else | ||
x64_args="$x64_args $1" | ||
fi | ||
shift | ||
done | ||
$CLANG_COMPILE_X64 $x64_args || exit $? | ||
if test x"$output" != x; then | ||
cp $output x64/$output | ||
fi | ||
|
||
# Compile ARM 64-bit | ||
if test x"$output" != x; then | ||
dir=arm64/`dirname $output` | ||
if test -d $dir; then | ||
: | ||
else | ||
mkdir -p $dir | ||
fi | ||
fi | ||
set -- $args | ||
while test x$1 != x; do | ||
if test -f "arm64/$1" && test "$1" != "$output"; then | ||
arm64_args="$arm64_args arm64/$1" | ||
else | ||
arm64_args="$arm64_args $1" | ||
fi | ||
shift | ||
done | ||
$CLANG_COMPILE_ARM64 $arm64_args || exit $? | ||
if test x"$output" != x; then | ||
cp $output arm64/$output | ||
fi | ||
|
||
|
||
if test x"$output" != x; then | ||
lipo -create -o $output arm64/$output x64/$output | ||
fi | ||
|