mirror of
https://github.com/tpoechtrager/osxcross.git
synced 2024-09-11 08:45:25 +03:00
* Update cctools to 927.0.2 and ld64 to 450.3
* Added back support for OpenBSD * Some cleanup and various fixes
This commit is contained in:
parent
d6acb50bab
commit
2f504fe4ba
13
CHANGELOG
13
CHANGELOG
@ -1,8 +1,19 @@
|
||||
/****************************** v1.1 *********************************/
|
||||
|
||||
Added:
|
||||
* ... back support for OpenBSD
|
||||
|
||||
Changed:
|
||||
* Updated cctools to 927.0.2 and ld64 to 450.3
|
||||
* TARGET_DIR can now be configured via env
|
||||
(TARGET_DIR=<path> ./build.sh)
|
||||
* Various other improvements and fixes
|
||||
|
||||
/****************************** v1.0 *********************************/
|
||||
|
||||
Added:
|
||||
* Support for TAPIv3 stubs (including "zippering" target)
|
||||
* Support for Mac OS X SDKs up to 10.14
|
||||
* Support for Mac OS X SDKs up to 10.15
|
||||
* SDK packaging script for ".xip" Xcode images
|
||||
-> tools/gen_sdk_package_pbzx.sh <xcode.xip>
|
||||
--> tested up to Xcode 10.2.1
|
||||
|
@ -311,14 +311,6 @@ can be overriden by explicitly passing `-stdlib=libstdc++` to clang.
|
||||
x86\_64h defaults to `Mac OS X 10.8` and requires clang 3.5+.
|
||||
x86\_64h = x86\_64 with optimizations for the Intel Haswell Architecture.
|
||||
|
||||
### BUILDING OSXCROSS WITH GCC: ###
|
||||
|
||||
You can build OSXCross with GCC this way:
|
||||
|
||||
`CC=gcc CXX=g++ ./build.sh`
|
||||
|
||||
You will need gcc/g++/gcc-objc 4.7+.
|
||||
|
||||
### PROJECTS USING OSXCROSS: ###
|
||||
|
||||
* [multiarch/crossbuild](https://github.com/multiarch/crossbuild): various
|
||||
|
40
build.sh
40
build.sh
@ -5,7 +5,7 @@
|
||||
# This script requires the OS X SDK and the Clang/LLVM compiler.
|
||||
#
|
||||
|
||||
OSXCROSS_VERSION=1.0
|
||||
VERSION=1.1
|
||||
|
||||
pushd "${0%/*}" &>/dev/null
|
||||
|
||||
@ -47,7 +47,7 @@ fi
|
||||
export TARGET
|
||||
|
||||
echo ""
|
||||
echo "Building OSXCross toolchain, Version: $OSXCROSS_VERSION"
|
||||
echo "Building OSXCross toolchain, Version: $VERSION"
|
||||
echo ""
|
||||
echo "OS X SDK Version: $SDK_VERSION, Target: $TARGET"
|
||||
echo "Minimum targeted OS X Version: $OSX_VERSION_MIN"
|
||||
@ -104,12 +104,12 @@ fi
|
||||
|
||||
## cctools and ld64 ##
|
||||
|
||||
get_sources https://github.com/tpoechtrager/cctools-port.git 921-ld64-409.12
|
||||
CCTOOLS_VERSION=927.0.2
|
||||
LINKER_VERSION=450.3
|
||||
|
||||
LINKER_VERSION=$(cat \
|
||||
$CURRENT_BUILD_PROJECT_NAME/cctools/ld64/src/3rd/helper.c | \
|
||||
grep ldVersionString | head -n1 | awk '{print $6}' | tr ':' '\n' | \
|
||||
tr '\\' '\n' | tr '-' '\n' | tr '\n' ' '| awk '{print $3}')
|
||||
get_sources \
|
||||
https://github.com/tpoechtrager/cctools-port.git \
|
||||
$CCTOOLS_VERSION-ld64-$LINKER_VERSION
|
||||
|
||||
if [ $f_res -eq 1 ]; then
|
||||
pushd $CURRENT_BUILD_PROJECT_NAME/cctools &>/dev/null
|
||||
@ -143,6 +143,8 @@ if [ $f_res -eq 1 ]; then
|
||||
create_symlink $CCTOOL $CCTOOL_I386
|
||||
done
|
||||
fi
|
||||
# For unpatched dsymutil. There is currently no way around it.
|
||||
create_symlink x86_64-apple-$TARGET-lipo lipo
|
||||
popd &>/dev/null
|
||||
fi
|
||||
|
||||
@ -173,7 +175,7 @@ fi
|
||||
|
||||
pushd $SDK_DIR/MacOSX$SDK_VERSION.sdk &>/dev/null
|
||||
set +e
|
||||
if [ $PLATFORM == "FreeBSD" ]; then
|
||||
if [ $PLATFORM == "FreeBSD" ] || [ $PLATFORM == "OpenBSD" ]; then
|
||||
files=$(echo $SDK_DIR/MacOSX$SDK_VERSION.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/std*.h)
|
||||
for file in $files; do
|
||||
rm -f usr/include/$(basename $file)
|
||||
@ -193,15 +195,6 @@ popd &>/dev/null
|
||||
|
||||
build_msg "wrapper"
|
||||
|
||||
export X86_64H_SUPPORTED
|
||||
export I386_SUPPORTED
|
||||
|
||||
export OSXCROSS_VERSION
|
||||
export OSXCROSS_TARGET=$TARGET
|
||||
export OSXCROSS_OSX_VERSION_MIN=$OSX_VERSION_MIN
|
||||
export OSXCROSS_LINKER_VERSION=$LINKER_VERSION
|
||||
export OSXCROSS_BUILD_DIR=$BUILD_DIR
|
||||
|
||||
OSXCROSS_CONF="$TARGET_DIR/bin/osxcross-conf"
|
||||
OSXCROSS_ENV="$TARGET_DIR/bin/osxcross-env"
|
||||
rm -f $OSXCROSS_CONF $OSXCROSS_ENV
|
||||
@ -211,11 +204,20 @@ if [ "$PLATFORM" != "Darwin" ]; then
|
||||
set +e
|
||||
eval $(cat $BUILD_DIR/cctools*/cctools/config.log | grep LLVM_LIB_DIR | head -n1)
|
||||
set -e
|
||||
export OSXCROSS_LIBLTO_PATH=$LLVM_LIB_DIR
|
||||
export LIBLTO_PATH=$LLVM_LIB_DIR
|
||||
fi
|
||||
|
||||
$BASE_DIR/wrapper/build.sh 1>/dev/null
|
||||
export VERSION
|
||||
export TARGET
|
||||
export BUILD_DIR
|
||||
export OSX_VERSION_MIN
|
||||
export LIBLTO_PATH
|
||||
export LINKER_VERSION
|
||||
export X86_64H_SUPPORTED
|
||||
export I386_SUPPORTED
|
||||
export TOP_BUILD_SCRIPT=1
|
||||
|
||||
$BASE_DIR/wrapper/build_wrapper.sh
|
||||
|
||||
echo ""
|
||||
|
||||
|
@ -30,33 +30,33 @@ MIRROR="https://ftp.gnu.org/gnu"
|
||||
|
||||
require wget
|
||||
|
||||
pushd $OSXCROSS_BUILD_DIR &>/dev/null
|
||||
pushd $BUILD_DIR &>/dev/null
|
||||
|
||||
function remove_locks()
|
||||
{
|
||||
rm -rf $OSXCROSS_BUILD_DIR/have_binutils*
|
||||
rm -rf $BUILD_DIR/have_binutils*
|
||||
}
|
||||
|
||||
function build_and_install()
|
||||
{
|
||||
if [ ! -f "have_$1_$2_${OSXCROSS_TARGET}" ]; then
|
||||
pushd $OSXCROSS_TARBALL_DIR &>/dev/null
|
||||
if [ ! -f "have_$1_$2_${TARGET}" ]; then
|
||||
pushd $TARBALL_DIR &>/dev/null
|
||||
wget -c "$MIRROR/$1/$1-$2.tar.gz"
|
||||
popd &>/dev/null
|
||||
|
||||
echo "cleaning up ..."
|
||||
rm -rf $1* 2>/dev/null
|
||||
|
||||
extract "$OSXCROSS_TARBALL_DIR/$1-$2.tar.gz" 1
|
||||
extract "$TARBALL_DIR/$1-$2.tar.gz" 1
|
||||
|
||||
pushd $1*$2* &>/dev/null
|
||||
mkdir -p build
|
||||
pushd build &>/dev/null
|
||||
|
||||
../configure \
|
||||
--target=x86_64-apple-$OSXCROSS_TARGET \
|
||||
--program-prefix=x86_64-apple-$OSXCROSS_TARGET- \
|
||||
--prefix=$OSXCROSS_TARGET_DIR/binutils \
|
||||
--target=x86_64-apple-$TARGET \
|
||||
--program-prefix=x86_64-apple-$TARGET- \
|
||||
--prefix=$TARGET_DIR/binutils \
|
||||
--disable-nls \
|
||||
--disable-werror
|
||||
|
||||
@ -65,7 +65,7 @@ function build_and_install()
|
||||
|
||||
popd &>/dev/null
|
||||
popd &>/dev/null
|
||||
touch "have_$1_$2_${OSXCROSS_TARGET}"
|
||||
touch "have_$1_$2_${TARGET}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -75,5 +75,5 @@ build_and_install binutils $BINUTILS_VERSION
|
||||
build_and_install gdb $GDB_VERSION
|
||||
|
||||
echo ""
|
||||
echo "installed binutils and gdb to $OSXCROSS_TARGET_DIR/binutils"
|
||||
echo "installed binutils and gdb to $TARGET_DIR/binutils"
|
||||
echo ""
|
||||
|
@ -60,13 +60,13 @@ else
|
||||
fi
|
||||
|
||||
if [ $(osxcross-cmp $MACOSX_DEPLOYMENT_TARGET ">" \
|
||||
$OSXCROSS_SDK_VERSION) -eq 1 ];
|
||||
$SDK_VERSION) -eq 1 ];
|
||||
then
|
||||
echo ">= $MACOSX_DEPLOYMENT_TARGET SDK required" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd $OSXCROSS_BUILD_DIR &>/dev/null
|
||||
pushd $BUILD_DIR &>/dev/null
|
||||
|
||||
FULL_CLONE=1 \
|
||||
get_sources https://git.llvm.org/git/compiler-rt.git $BRANCH
|
||||
@ -74,9 +74,9 @@ FULL_CLONE=1 \
|
||||
if [ $f_res -eq 1 ]; then
|
||||
pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null
|
||||
|
||||
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.11) -eq 1 ]; then
|
||||
if [ $(osxcross-cmp $SDK_VERSION "<=" 10.11) -eq 1 ]; then
|
||||
# https://github.com/tpoechtrager/osxcross/issues/178
|
||||
patch -p1 < $OSXCROSS_PATCH_DIR/compiler-rt_clock-gettime.patch
|
||||
patch -p1 < $PATCH_DIR/compiler-rt_clock-gettime.patch
|
||||
fi
|
||||
|
||||
EXTRA_MAKE_FLAGS=""
|
||||
|
83
build_gcc.sh
83
build_gcc.sh
@ -27,18 +27,18 @@ GCC_MIRROR="https://mirror.koddos.net/gcc"
|
||||
|
||||
require wget
|
||||
|
||||
pushd $OSXCROSS_BUILD_DIR &>/dev/null
|
||||
pushd $BUILD_DIR &>/dev/null
|
||||
|
||||
function remove_locks()
|
||||
{
|
||||
rm -rf $OSXCROSS_BUILD_DIR/have_gcc*
|
||||
rm -rf $BUILD_DIR/have_gcc*
|
||||
}
|
||||
|
||||
source $BASE_DIR/tools/trap_exit.sh
|
||||
|
||||
if [ ! -f "have_gcc_${GCC_VERSION}_${OSXCROSS_TARGET}" ]; then
|
||||
if [ ! -f "have_gcc_${GCC_VERSION}_${TARGET}" ]; then
|
||||
|
||||
pushd $OSXCROSS_TARBALL_DIR &>/dev/null
|
||||
pushd $TARBALL_DIR &>/dev/null
|
||||
if [[ $GCC_VERSION != *-* ]]; then
|
||||
wget -c "$GCC_MIRROR/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz"
|
||||
else
|
||||
@ -49,32 +49,32 @@ popd &>/dev/null
|
||||
echo "cleaning up ..."
|
||||
rm -rf gcc* 2>/dev/null
|
||||
|
||||
extract "$OSXCROSS_TARBALL_DIR/gcc-$GCC_VERSION.tar.xz"
|
||||
extract "$TARBALL_DIR/gcc-$GCC_VERSION.tar.xz"
|
||||
echo ""
|
||||
|
||||
pushd gcc*$GCC_VERSION* &>/dev/null
|
||||
|
||||
rm -f $OSXCROSS_TARGET_DIR/bin/*-gcc*
|
||||
rm -f $OSXCROSS_TARGET_DIR/bin/*-g++*
|
||||
rm -f $TARGET_DIR/bin/*-gcc*
|
||||
rm -f $TARGET_DIR/bin/*-g++*
|
||||
|
||||
if [ $(osxcross-cmp $GCC_VERSION '>' 5.0.0) -eq 1 ] &&
|
||||
[ $(osxcross-cmp $GCC_VERSION '<' 5.3.0) -eq 1 ]; then
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66035
|
||||
patch -p1 < $OSXCROSS_PATCH_DIR/gcc-pr66035.patch
|
||||
patch -p1 < $PATCH_DIR/gcc-pr66035.patch
|
||||
fi
|
||||
|
||||
if [ $(osxcross-cmp $GCC_VERSION '>=' 6.1.0) -eq 1 ] &&
|
||||
[ $(osxcross-cmp $GCC_VERSION '<=' 6.3.0) -eq 1 ]; then
|
||||
# https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00129.html
|
||||
patch -p1 < $OSXCROSS_PATCH_DIR/gcc-6-buildfix.patch
|
||||
patch -p1 < $PATCH_DIR/gcc-6-buildfix.patch
|
||||
fi
|
||||
|
||||
if [ $(osxcross-cmp $GCC_VERSION '==' 6.3.0) -eq 1 ]; then
|
||||
# https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/config/darwin-driver.c?r1=244010&r2=244009&pathrev=244010
|
||||
patch -p1 < $OSXCROSS_PATCH_DIR/darwin-driver.c.patch
|
||||
patch -p1 < $PATCH_DIR/darwin-driver.c.patch
|
||||
fi
|
||||
|
||||
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION '>=' 10.14) -eq 1 ] &&
|
||||
if [ $(osxcross-cmp $SDK_VERSION '>=' 10.14) -eq 1 ] &&
|
||||
[ $(osxcross-cmp $GCC_VERSION '<' 9.0.0) -eq 1 ]; then
|
||||
files_to_patch=(
|
||||
libsanitizer/asan/asan_mac.cc
|
||||
@ -113,8 +113,8 @@ fi
|
||||
EXTRACONFFLAGS=""
|
||||
|
||||
if [ "$PLATFORM" != "Darwin" ]; then
|
||||
EXTRACONFFLAGS+="--with-ld=$OSXCROSS_TARGET_DIR/bin/x86_64-apple-$OSXCROSS_TARGET-ld "
|
||||
EXTRACONFFLAGS+="--with-as=$OSXCROSS_TARGET_DIR/bin/x86_64-apple-$OSXCROSS_TARGET-as "
|
||||
EXTRACONFFLAGS+="--with-ld=$TARGET_DIR/bin/x86_64-apple-$TARGET-ld "
|
||||
EXTRACONFFLAGS+="--with-as=$TARGET_DIR/bin/x86_64-apple-$TARGET-as "
|
||||
fi
|
||||
|
||||
LANGS="c,c++,objc,obj-c++"
|
||||
@ -123,22 +123,22 @@ if [ -n "$ENABLE_FORTRAN" ]; then
|
||||
LANGS+=",fortran"
|
||||
fi
|
||||
|
||||
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||
if [ $(osxcross-cmp $SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||
EXTRACONFFLAGS+="--with-multilib-list=m32,m64 --enable-multilib "
|
||||
else
|
||||
EXTRACONFFLAGS+="--disable-multilib "
|
||||
fi
|
||||
|
||||
../configure \
|
||||
--target=x86_64-apple-$OSXCROSS_TARGET \
|
||||
--with-sysroot=$OSXCROSS_SDK \
|
||||
--target=x86_64-apple-$TARGET \
|
||||
--with-sysroot=$SDK \
|
||||
--disable-nls \
|
||||
--enable-languages=$LANGS \
|
||||
--without-headers \
|
||||
--enable-lto \
|
||||
--enable-checking=release \
|
||||
--disable-libstdcxx-pch \
|
||||
--prefix=$OSXCROSS_TARGET_DIR \
|
||||
--prefix=$TARGET_DIR \
|
||||
--with-system-zlib \
|
||||
$EXTRACONFFLAGS
|
||||
|
||||
@ -147,11 +147,11 @@ $MAKE install
|
||||
|
||||
GCC_VERSION=`echo $GCC_VERSION | tr '-' ' ' | awk '{print $1}'`
|
||||
|
||||
pushd $OSXCROSS_TARGET_DIR/x86_64-apple-$OSXCROSS_TARGET/include &>/dev/null
|
||||
pushd $TARGET_DIR/x86_64-apple-$TARGET/include &>/dev/null
|
||||
pushd c++/${GCC_VERSION}* &>/dev/null
|
||||
|
||||
cat $OSXCROSS_PATCH_DIR/libstdcxx.patch | \
|
||||
$SED "s/darwin13/$OSXCROSS_TARGET/g" | \
|
||||
cat $PATCH_DIR/libstdcxx.patch | \
|
||||
$SED "s/darwin13/$TARGET/g" | \
|
||||
patch -p0 -l &>/dev/null || true
|
||||
|
||||
popd &>/dev/null
|
||||
@ -160,7 +160,7 @@ popd &>/dev/null
|
||||
popd &>/dev/null # build
|
||||
popd &>/dev/null # gcc
|
||||
|
||||
touch "have_gcc_${GCC_VERSION}_${OSXCROSS_TARGET}"
|
||||
touch "have_gcc_${GCC_VERSION}_${TARGET}"
|
||||
|
||||
fi # have gcc
|
||||
|
||||
@ -169,41 +169,34 @@ popd &>/dev/null # build dir
|
||||
unset USESYSTEMCOMPILER
|
||||
source tools/tools.sh
|
||||
|
||||
pushd $OSXCROSS_TARGET_DIR/bin &>/dev/null
|
||||
pushd $TARGET_DIR/bin &>/dev/null
|
||||
|
||||
if [ ! -f i386-apple-$TARGET-base-gcc ]; then
|
||||
mv x86_64-apple-$TARGET-gcc \
|
||||
x86_64-apple-$TARGET-base-gcc
|
||||
|
||||
if [ ! -f i386-apple-$OSXCROSS_TARGET-base-gcc ]; then
|
||||
mv x86_64-apple-$OSXCROSS_TARGET-gcc \
|
||||
x86_64-apple-$OSXCROSS_TARGET-base-gcc
|
||||
mv x86_64-apple-$TARGET-g++ \
|
||||
x86_64-apple-$TARGET-base-g++
|
||||
|
||||
mv x86_64-apple-$OSXCROSS_TARGET-g++ \
|
||||
x86_64-apple-$OSXCROSS_TARGET-base-g++
|
||||
if [ $(osxcross-cmp $SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||
create_symlink x86_64-apple-$TARGET-base-gcc \
|
||||
i386-apple-$TARGET-base-gcc
|
||||
|
||||
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||
create_symlink x86_64-apple-$OSXCROSS_TARGET-base-gcc \
|
||||
i386-apple-$OSXCROSS_TARGET-base-gcc
|
||||
|
||||
create_symlink x86_64-apple-$OSXCROSS_TARGET-base-g++ \
|
||||
i386-apple-$OSXCROSS_TARGET-base-g++
|
||||
create_symlink x86_64-apple-$TARGET-base-g++ \
|
||||
i386-apple-$TARGET-base-g++
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "compiling wrapper ..."
|
||||
|
||||
export OSXCROSS_VERSION
|
||||
export OSXCROSS_LIBLTO_PATH
|
||||
export OSXCROSS_TARGET
|
||||
export OSXCROSS_OSX_VERSION_MIN=$OSXCROSS_OSX_VERSION_MIN
|
||||
export OSXCROSS_LINKER_VERSION=$OSXCROSS_LINKER_VERSION
|
||||
|
||||
TARGET_DIR=$OSXCROSS_TARGET_DIR TARGETCOMPILER=gcc \
|
||||
$BASE_DIR/wrapper/build.sh 1>/dev/null
|
||||
TARGETCOMPILER=gcc \
|
||||
$BASE_DIR/wrapper/build_wrapper.sh
|
||||
|
||||
popd &>/dev/null # wrapper dir
|
||||
|
||||
echo ""
|
||||
|
||||
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||
if [ $(osxcross-cmp $SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||
test_compiler o32-gcc $BASE_DIR/oclang/test.c
|
||||
test_compiler o32-g++ $BASE_DIR/oclang/test.cpp
|
||||
fi
|
||||
@ -217,8 +210,8 @@ echo "Done! Now you can use o32-gcc/o32-g++ and o64-gcc/o64-g++ as compiler"
|
||||
echo ""
|
||||
echo "Example usage:"
|
||||
echo ""
|
||||
echo "Example 1: CC=o32-gcc ./configure --host=i386-apple-$OSXCROSS_TARGET"
|
||||
echo "Example 2: CC=i386-apple-$OSXCROSS_TARGET-gcc ./configure --host=i386-apple-$OSXCROSS_TARGET"
|
||||
echo "Example 1: CC=o32-gcc ./configure --host=i386-apple-$TARGET"
|
||||
echo "Example 2: CC=i386-apple-$TARGET-gcc ./configure --host=i386-apple-$TARGET"
|
||||
echo "Example 3: o64-gcc -Wall test.c -o test"
|
||||
echo "Example 4: x86_64-apple-$OSXCROSS_TARGET-strip -x test"
|
||||
echo "Example 4: x86_64-apple-$TARGET-strip -x test"
|
||||
echo ""
|
||||
|
@ -2,20 +2,48 @@
|
||||
|
||||
export LC_ALL="C"
|
||||
|
||||
BASE_DIR=$PWD
|
||||
function set_path_vars()
|
||||
{
|
||||
if [ -n "$OSXCROSS_VERSION" ]; then
|
||||
export VERSION=$OSXCROSS_VERSION
|
||||
export TARGET=$OSXCROSS_TARGET
|
||||
export BASE_DIR=$OSXCROSS_BASE_DIR
|
||||
export TARBALL_DIR=$OSXCROSS_TARBALL_DIR
|
||||
export BUILD_DIR=$OSXCROSS_BUILD_DIR
|
||||
export TARGET_DIR=$OSXCROSS_TARGET_DIR
|
||||
export TARGET_DIR_SDK_TOOLS=$OSXCROSS_TARGET_DIR/SDK/tools
|
||||
export PATCH_DIR=$OSXCROSS_PATCH_DIR
|
||||
export SDK_DIR=$OSXCROSS_SDK_DIR
|
||||
export SDK_VERSION=$OSXCROSS_SDK_VERSION
|
||||
export SDK=$OSXCROSS_SDK
|
||||
export LIBLTO_PATH=$OSXCROSS_LIBLTO_PATH
|
||||
export LINKER_VERSION=$OSXCROSS_LINKER_VERSION
|
||||
# Do not use these
|
||||
unset OSXCROSS_VERSION OSXCROSS_OSX_VERSION_MIN
|
||||
unset OSXCROSS_TARGET OSXCROSS_BASE_DIR
|
||||
unset OSXCROSS_SDK_VERSION OSXCROSS_SDK
|
||||
unset OSXCROSS_SDK_DIR OSXCROSS_TARBALL_DIR
|
||||
unset OSXCROSS_PATCH_DIR OSXCROSS_TARGET_DIR
|
||||
unset OSXCROSS_BUILD_DIR OSXCROSS_CCTOOLS_PATH
|
||||
unset OSXCROSS_LIBLTO_PATH OSXCROSS_LINKER_VERSION
|
||||
else
|
||||
export BASE_DIR=$PWD
|
||||
export TARBALL_DIR=$PWD/tarballs
|
||||
export BUILD_DIR=$PWD/build
|
||||
export TARGET_DIR=${TARGET_DIR:-$BASE_DIR/target}
|
||||
export TARGET_DIR_SDK_TOOLS=$TARGET_DIR/SDK/tools
|
||||
export PATCH_DIR=$PWD/patches
|
||||
export SDK_DIR=$TARGET_DIR/SDK
|
||||
fi
|
||||
}
|
||||
|
||||
TARBALL_DIR=$BASE_DIR/tarballs
|
||||
BUILD_DIR=$BASE_DIR/build
|
||||
TARGET_DIR=${TARGET_DIR:-$BASE_DIR/target}
|
||||
TARGET_DIR_SDK_TOOLS=$TARGET_DIR/SDK/tools
|
||||
PATCH_DIR=$BASE_DIR/patches
|
||||
SDK_DIR=$TARGET_DIR/SDK
|
||||
set_path_vars
|
||||
|
||||
PLATFORM=$(uname -s)
|
||||
ARCH=$(uname -m)
|
||||
SCRIPT=$(basename $0)
|
||||
|
||||
if [ $PLATFORM == CYGWIN* ]; then
|
||||
if [[ $PLATFORM == CYGWIN* ]]; then
|
||||
echo "Cygwin is no longer supported." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
@ -79,27 +107,27 @@ require gunzip
|
||||
# enable debug messages
|
||||
[ -n "$OCDEBUG" ] && set -x
|
||||
|
||||
if [[ $SCRIPT != *wrapper/build.sh ]]; then
|
||||
# how many concurrent jobs should be used for compiling?
|
||||
if [ -z "$JOBS" ]; then
|
||||
# how many concurrent jobs should be used for compiling?
|
||||
if [ -z "$JOBS" ]; then
|
||||
JOBS=$(tools/get_cpu_count.sh || echo 1)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $SCRIPT != "build.sh" -a \
|
||||
$SCRIPT != "build_clang.sh" -a \
|
||||
$SCRIPT != "mount_xcode_image.sh" -a \
|
||||
$SCRIPT != "gen_sdk_package_darling_dmg.sh" -a \
|
||||
$SCRIPT != "gen_sdk_package_p7zip.sh" -a \
|
||||
$SCRIPT != "gen_sdk_package_pbzx.sh" ]; then
|
||||
res=$(tools/osxcross_conf.sh)
|
||||
# Don't run osxcross-conf for the top build.sh script
|
||||
if [ $SCRIPT != "build.sh" ]; then
|
||||
res=$(tools/osxcross_conf.sh || echo "")
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -n "you must run ./build.sh first before you can start "
|
||||
echo "building $DESC"
|
||||
if [ -z "$res" ] &&
|
||||
[[ $SCRIPT != gen_sdk_package*.sh ]] &&
|
||||
[ $SCRIPT != "build_wrapper.sh" ] &&
|
||||
[[ $SCRIPT != build*_clang.sh ]] &&
|
||||
[ $SCRIPT != "mount_xcode_image.sh" ]; then
|
||||
echo "you must run ./build.sh first before you can start building $DESC"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$TOP_BUILD_SCRIPT" ]; then
|
||||
eval "$res"
|
||||
set_path_vars
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -2,14 +2,14 @@ PLATFORM ?= $(shell uname -s)
|
||||
OPTIMIZE ?= 2
|
||||
LTO ?= 0
|
||||
|
||||
OSXCROSS_VERSION ?= unknown
|
||||
OSXCROSS_TARGET ?= darwin12
|
||||
OSXCROSS_OSX_VERSION_MIN ?= 10.5
|
||||
OSXCROSS_LINKER_VERSION ?= 134.9
|
||||
OSXCROSS_LIBLTO_PATH ?=
|
||||
OSXCROSS_CXXFLAGS ?=
|
||||
VERSION ?= unknown
|
||||
TARGET ?= darwin12
|
||||
OSX_VERSION_MIN ?= 10.5
|
||||
LINKER_VERSION ?= 134.9
|
||||
LIBLTO_PATH ?=
|
||||
ADDITIONAL_CXXFLAGS ?=
|
||||
|
||||
override CXXFLAGS=-std=c++0x -Wall -Wextra -pedantic
|
||||
override CXXFLAGS=-std=c++1y -Wall -Wextra -pedantic
|
||||
override CXXFLAGS+=-Wno-missing-field-initializers
|
||||
override CXXFLAGS+=-I. -O$(OPTIMIZE) -g
|
||||
|
||||
@ -17,14 +17,14 @@ ifeq ($(LTO), 1)
|
||||
override CXXFLAGS+=-flto
|
||||
endif
|
||||
|
||||
override CXXFLAGS+=-DOSXCROSS_VERSION="\"$(OSXCROSS_VERSION)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_TARGET="\"$(OSXCROSS_TARGET)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_OSX_VERSION_MIN="\"$(OSXCROSS_OSX_VERSION_MIN)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_LINKER_VERSION="\"$(OSXCROSS_LINKER_VERSION)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_LIBLTO_PATH="\"$(OSXCROSS_LIBLTO_PATH)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_BUILD_DIR="\"$(OSXCROSS_BUILD_DIR)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_VERSION="\"$(VERSION)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_TARGET="\"$(TARGET)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_OSX_VERSION_MIN="\"$(OSX_VERSION_MIN)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_LINKER_VERSION="\"$(LINKER_VERSION)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_LIBLTO_PATH="\"$(LIBLTO_PATH)\""
|
||||
override CXXFLAGS+=-DOSXCROSS_BUILD_DIR="\"$(BUILD_DIR)\""
|
||||
|
||||
override CXXFLAGS+= $(OSXCROSS_CXXFLAGS)
|
||||
override CXXFLAGS+= $(ADDITIONAL_CXXFLAGS)
|
||||
|
||||
ifneq (,$(findstring FreeBSD, $(PLATFORM)))
|
||||
override LDFLAGS+=-lutil
|
||||
|
@ -6,19 +6,19 @@ source ./tools/tools.sh
|
||||
popd &>/dev/null
|
||||
|
||||
set +e
|
||||
if [ -z "$OSXCROSS_VERSION" ]; then
|
||||
if [ -z "$VERSION" ]; then
|
||||
eval $(${TARGET_DIR}/bin/osxcross-conf 2>/dev/null)
|
||||
|
||||
if [ -n "$OSXCROSS_SDK_VERSION" ]; then
|
||||
if [ -n "$SDK_VERSION" ]; then
|
||||
if [ -z "$X86_64H_SUPPORTED" ]; then
|
||||
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION ">=" 10.8) -eq 1 ]; then
|
||||
if [ $(osxcross-cmp $SDK_VERSION ">=" 10.8) -eq 1 ]; then
|
||||
X86_64H_SUPPORTED=1
|
||||
else
|
||||
X86_64H_SUPPORTED=0
|
||||
fi
|
||||
fi
|
||||
if [ -z "$I386_SUPPORTED" ]; then
|
||||
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||
if [ $(osxcross-cmp $SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||
I386_SUPPORTED=1
|
||||
else
|
||||
I386_SUPPORTED=0
|
||||
@ -61,16 +61,16 @@ function create_wrapper_link
|
||||
|
||||
if [ $I386_SUPPORTED -eq 1 ]; then
|
||||
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
|
||||
"i386-apple-${OSXCROSS_TARGET}-${1}"
|
||||
"i386-apple-${TARGET}-${1}"
|
||||
fi
|
||||
|
||||
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
|
||||
"x86_64-apple-${OSXCROSS_TARGET}-${1}"
|
||||
"x86_64-apple-${TARGET}-${1}"
|
||||
|
||||
if [ $X86_64H_SUPPORTED -eq 1 ] &&
|
||||
([[ $1 != gcc* ]] && [[ $1 != g++* ]] && [[ $1 != *gstdc++ ]]); then
|
||||
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
|
||||
"x86_64h-apple-${OSXCROSS_TARGET}-${1}"
|
||||
"x86_64h-apple-${TARGET}-${1}"
|
||||
fi
|
||||
|
||||
if [ $# -ge 2 ] && [ $2 -eq 2 ]; then
|
||||
@ -92,7 +92,7 @@ function create_wrapper_link
|
||||
|
||||
[ -z "$TARGETCOMPILER" ] && TARGETCOMPILER=clang
|
||||
|
||||
TARGETTRIPLE=x86_64-apple-${OSXCROSS_TARGET}
|
||||
TARGETTRIPLE=x86_64-apple-${TARGET}
|
||||
|
||||
FLAGS=""
|
||||
|
||||
@ -133,7 +133,7 @@ function compile_wrapper()
|
||||
|
||||
verbose_cmd $MAKE clean
|
||||
|
||||
OSXCROSS_CXXFLAGS="$FLAGS" \
|
||||
ADDITIONAL_CXXFLAGS="$FLAGS" \
|
||||
verbose_cmd $MAKE wrapper -j$JOBS
|
||||
}
|
||||
|
||||
@ -171,7 +171,22 @@ create_wrapper_link pkg-config
|
||||
|
||||
if [ "$PLATFORM" != "Darwin" ]; then
|
||||
create_wrapper_link sw_vers 1
|
||||
which dsymutil &>/dev/null || create_wrapper_link dsymutil 1
|
||||
|
||||
if which dsymutil &>/dev/null; then
|
||||
# If dsymutil is in PATH then it's most likely a recent
|
||||
# LLVM dsymutil version. In this case don't wrap it.
|
||||
# Just create target symlinks.
|
||||
|
||||
if [ $I386_SUPPORTED -eq 1 ]; then
|
||||
verbose_cmd create_symlink $(which dsymutil) i386-apple-$TARGET-dsymutil
|
||||
fi
|
||||
if [ $X86_64H_SUPPORTED -eq 1 ]; then
|
||||
verbose_cmd create_symlink $(which dsymutil) x86_64h-apple-$TARGET-dsymutil
|
||||
fi
|
||||
else
|
||||
create_wrapper_link dsymutil 1
|
||||
fi
|
||||
|
||||
create_wrapper_link xcrun 1
|
||||
fi
|
||||
|
@ -47,32 +47,25 @@ int conf(Target &target) {
|
||||
if (!ltopath)
|
||||
ltopath = "";
|
||||
|
||||
std::cout << "export OSXCROSS_VERSION=" << getOSXCrossVersion()
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_OSX_VERSION_MIN=" << OSXVersionMin.shortStr()
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_TARGET=" << getDefaultTarget()
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_SDK_VERSION=" << target.getSDKOSNum().shortStr()
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_SDK=" << SDKPath
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_TARBALL_DIR=" << BuildDir.c_str()
|
||||
<< "/../tarballs"
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_PATCH_DIR=" << BuildDir.c_str()
|
||||
<< "/../patches"
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_TARGET_DIR=" << target.execpath << "/.."
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_BUILD_DIR=" << BuildDir.c_str()
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_CCTOOLS_PATH=" << target.execpath
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_LIBLTO_PATH=" << ltopath
|
||||
<< std::endl;
|
||||
std::cout << "export OSXCROSS_LINKER_VERSION=" << getLinkerVersion()
|
||||
<< std::endl;
|
||||
auto print = [](const char *var, const auto &val) {
|
||||
std::cout << "export OSXCROSS_" << var << "=" << val << std::endl;
|
||||
};
|
||||
|
||||
print("VERSION", getOSXCrossVersion());
|
||||
print("OSX_VERSION_MIN", OSXVersionMin.shortStr());
|
||||
print("TARGET", getDefaultTarget());
|
||||
print("BASE_DIR", BuildDir + "/..");
|
||||
print("SDK", SDKPath);
|
||||
print("SDK_DIR", SDKPath + "/..");
|
||||
print("SDK_VERSION", target.getSDKOSNum().shortStr());
|
||||
print("TARBALL_DIR", BuildDir + "/../tarballs");
|
||||
print("PATCH_DIR", BuildDir + "/../patches");
|
||||
print("TARGET_DIR", std::string(target.execpath) + "/..");
|
||||
print("DIR_SDK_TOOLS", SDKPath + "/../tools");
|
||||
print("BUILD_DIR", BuildDir);
|
||||
print("CCTOOLS_PATH", target.execpath);
|
||||
print("LIBLTO_PATH", ltopath);
|
||||
print("LINKER_VERSION", getLinkerVersion());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user