add SDK packaging script

libc++ works now out of the box as long 'tools/gen_sdk_package.sh'
is used to create the SDK package
This commit is contained in:
Thomas Pöchtrager 2014-03-28 21:04:32 +01:00
parent 9b1674129d
commit 6c79d88501
8 changed files with 214 additions and 239 deletions

View File

@ -1,6 +1,7 @@
0.6:
- added: NetBSD support
- added: dependencies installer script (Don Bright)
- added: SDK package script
0.5:
- fixed: help clang to find its own intrinsic headers (this issue appears to be fixed in clang 3.4+)
@ -15,7 +16,6 @@
- added: a workaround for buggy unistd.h headers
0.3:
- added: SDK download links to README
- added: support 10.9 (Mavericks) SDK
- added: *-apple-darwin*-clang* symlinks (same as invoking o32-clang or o64-clang++)
- changed: no need to build extra cctools binaries for targeting i386, symlinking the x86_64 builds works as well

View File

@ -15,7 +15,7 @@ If you want, then you can build an up-to-date vanilla GCC as well.
### WHAT IS NOT WORKING (YET)? ###
* GCC itself [doesn't build with GCC](https://github.com/tpoechtrager/osxcross/commit/12f5dcdde4bc1000180d25ffda229f0a13cf723d),
* GCC itself [doesn't build with GCC](https://github.com/tpoechtrager/osxcross/commit/dc8c471),
but builds fine when clang is used to build GCC.
### WHAT CAN I BUILD WITH IT? ###
@ -42,14 +42,6 @@ Then either run `source ~/.profile` or restart your shell session.
That's it. See usage examples below.
##### Building libc++: #####
If you want to build libc++ for modern C++11 with clang, then you can do this by running `./build_libcxx.sh`.
The resulting library will be linked statically into the applications to avoid troubles with different
libc++.dylib versions on OS X.
See below in how to use libc++ as the standard library.
##### Building GCC: #####
If you want to build GCC as well, then you can do this by running `./build_gcc.sh`.
@ -58,7 +50,15 @@ on debian like systems you can run `apt-get install libmpc-dev libmpfr-dev libgm
### PACKAGING THE SDK: ###
* Soon.
1. Boot into OS X
2. [Download [Xcode](https://developer.apple.com/downloads/index.action?name=Xcode) (used 5.1)]
3. [Mount Xcode.dmg (Open With -> DiskImageMounter)]
4. Run: ./tools/gen_sdk_package.sh (from the OSXCross package)
5. Copy the packaged SDK (\*.tar.\* or \*.pkg) on a USB Stick
6. Reboot back into Linux
7. Copy or move the SDK into the tarball/ directory of OSXCross
Step 2. and 3. can be skipped if you have Xcode installed.
### USAGE EXAMPLES: ###

View File

@ -150,9 +150,7 @@ if [ "`ls $TARBALL_DIR/cctools*.tar.* | wc -l | tr -d ' '`" != "1" ]; then
exit 1
fi
CCTOOLS_REVHASH=`ls $TARBALL_DIR/cctools*.tar.* | \
tr '_' ' ' | tr '.' ' ' | \
awk '{print $3}'`
CCTOOLS_REVHASH=`ls $TARBALL_DIR/cctools*.tar.* | tr '_' ' ' | tr '.' ' ' | awk '{print $3}'`
# CCTOOLS
if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET" ]; then
@ -277,11 +275,18 @@ set -e
extract $SDK 1 1
rm -rf $SDK_DIR/MacOSX$SDK_VERSION* 2>/dev/null
mv -f SDKs/*$SDK_VERSION* $SDK_DIR
if [ "`ls -l SDKs/*$SDK_VERSION* 2>/dev/null | wc -l | tr -d ' '`" != "0" ]; then
mv -f SDKs/*$SDK_VERSION* $SDK_DIR
else
mv -f *OSX*$SDK_VERSION*sdk* $SDK_DIR
fi
pushd $SDK_DIR/MacOSX$SDK_VERSION.sdk &>/dev/null
set +e
ln -s $SDK_DIR/MacOSX$SDK_VERSION.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/std*.h usr/include 2>/dev/null
ln -s \
$SDK_DIR/MacOSX$SDK_VERSION.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/std*.h \
usr/include 2>/dev/null
$BASE_DIR/oclang/find_intrinsic_headers.sh $SDK_DIR/MacOSX$SDK_VERSION.sdk
test ! -f "usr/include/float.h" && cp -f $BASE_DIR/oclang/quirks/float.h usr/include
set -e
@ -390,6 +395,19 @@ test_compiler o64-clang $BASE_DIR/oclang/test.c
test_compiler o32-clang++ $BASE_DIR/oclang/test.cpp
test_compiler o64-clang++ $BASE_DIR/oclang/test.cpp
if [ `echo "${SDK_VERSION/u/}>=10.7" | bc -l` -eq 1 ]; then
if [ ! -d "$SDK_DIR/MacOSX$SDK_VERSION.sdk/usr/include/c++/v1" ]; then
echo ""
echo -n "Given SDK does not contain libc++ headers "
echo "(-stdlib=libc++ test may fail)"
echo -n "You may want to re-package your SDK using "
echo "'tools/gen_sdk_package.sh' on OS X"
fi
echo ""
test_compiler_cxx11 o32-clang++ $BASE_DIR/oclang/test_libcxx.cpp
test_compiler_cxx11 o64-clang++ $BASE_DIR/oclang/test_libcxx.cpp
fi
echo ""
echo "Now add"
echo ""

View File

@ -1,152 +0,0 @@
#!/usr/bin/env bash
pushd "${0%/*}" &>/dev/null
DESC=libc++
source tools/tools.sh
if [ `echo "${OSXCROSS_SDK_VERSION}<10.7" | bc -l` -eq 1 ]; then
echo "you must use the SDK from 10.7 or newer to get $DESC compiled"
exit 1
fi
# libc++ version to build
LIBCXX_VERSION=3.4
require wget
require cmake
pushd $OSXCROSS_BUILD_DIR &>/dev/null
function remove_locks()
{
rm -f $OSXCROSS_BUILD_DIR/have_libcxx*
}
source $BASE_DIR/tools/trap_exit.sh
if [ ! -f "have_libcxx_${LIBCXX_VERSION}_${OSXCROSS_TARGET}" ]; then
pushd $OSXCROSS_TARBALL_DIR &>/dev/null
wget -c "http://llvm.org/releases/${LIBCXX_VERSION}/libcxx-${LIBCXX_VERSION}.src.tar.gz"
popd &>/dev/null
extract "$OSXCROSS_TARBALL_DIR/libcxx-${LIBCXX_VERSION}.src.tar.gz"
pushd libcxx-${LIBCXX_VERSION}* &>/dev/null
rm -rf build
mkdir build
pushd build &>/dev/null
# remove conflicting versions
rm -rf $OSXCROSS_SDK/usr/include/c++/v1
rm -rf $OSXCROSS_SDK/usr/lib/libc++.dylib
rm -rf $OSXCROSS_SDK/usr/lib/libc++.*.dylib
rm -rf $OSXCROSS_SDK/../libcxx_$OSXCROSS_SDK_VERSION
function cmake_error()
{
echo -e "\e[1m"
echo "It looks like CMake failed."
echo "If you see something like:"
echo -e "\e[31m"
echo "CMake Error at /usr/share/cmake-2.8/Modules/Platform/Darwin.cmake:<LINE NUMBER> (list):"
echo " list sub-command REMOVE_DUPLICATES requires list to be present."
echo -e "\e[0m\e[1m"
echo "Then either remove that line (look for the LINE NUMBER) or comment it out (with #) in /usr/share/cmake-.../Modules/Platform/Darwin.cmake"
echo "It appears to be a bug in CMake."
echo ""
echo "Then re-run this script."
echo -e "\e[0m"
exit 1
}
export BUILD_LIBCXX=1
cmake .. \
-DCMAKE_CXX_COMPILER=x86_64-apple-$OSXCROSS_TARGET-clang++ \
-DCMAKE_C_COMPILER=x86_64-apple-$OSXCROSS_TARGET-clang \
-DCMAKE_SYSTEM_NAME=Darwin \
-DCMAKE_OSX_SYSROOT=$OSXCROSS_SDK \
-DLIBCXX_ENABLE_SHARED=No \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$OSXCROSS_SDK/../libcxx_$OSXCROSS_SDK_VERSION \
-DCMAKE_AR=$OSXCROSS_CCTOOLS_PATH/x86_64-apple-$OSXCROSS_TARGET-ar \
-DCMAKE_RANLIB=$OSXCROSS_CCTOOLS_PATH/x86_64-apple-$OSXCROSS_TARGET-ranlib \
-DCMAKE_CXX_FLAGS="-arch i386 -arch x86_64" || cmake_error
export BUILD_LIBCXX=2
make -j$JOBS
make install -j$JOBS
unset BUILD_LIBCXX
popd &>/dev/null # build
popd &>/dev/null # libcxx
touch "have_libcxx_${LIBCXX_VERSION}_${OSXCROSS_TARGET}"
fi # have libcxx
popd &>/dev/null # build dir
function test_compiler_clang()
{
echo -ne "testing $2 -stdlib=libc++ ... "
$1 $3 -O2 -stdlib=libc++ -std=c++11 -Wall -o test
rm test
echo "ok"
}
function test_compiler_gcc()
{
echo -ne "testing $2 ... "
$1 $3 -O2 -std=c++0x -Wall -o test
rm test
echo "ok"
}
HAVE_GCC=0
echo ""
echo "testing libc++ (including a lot c++11 headers + linking a small test program)"
echo ""
test_compiler_clang i386-apple-$OSXCROSS_TARGET-clang++ o32-clang++ $BASE_DIR/oclang/test_libcxx.cpp
test_compiler_clang x86_64-apple-$OSXCROSS_TARGET-clang++ o64-clang++ $BASE_DIR/oclang/test_libcxx.cpp
which i386-apple-$OSXCROSS_TARGET-g++-libc++ &>/dev/null && \
HAVE_GCC=1 && \
test_compiler_gcc i386-apple-$OSXCROSS_TARGET-g++-libc++ o32-g++-libc++ $BASE_DIR/oclang/test_libcxx.cpp
which x86_64-apple-$OSXCROSS_TARGET-g++-libc++ &>/dev/null && \
HAVE_GCC=1 && \
test_compiler_gcc x86_64-apple-$OSXCROSS_TARGET-g++-libc++ o64-g++-libc++ $BASE_DIR/oclang/test_libcxx.cpp
echo ""
echo "Done!"
echo ""
echo "Example usage:"
echo ""
if [ $HAVE_GCC -eq 1 ]; then
echo "Clang:"
echo ""
fi
echo "Example 1: o32-clang++ -stdlib=libc++ -Wall test.cpp -o test"
echo "Example 2: o64-clang++ -stdlib=libc++ -std=c++11 -Wall test.cpp"
echo "Example 3: o32-clang++-libc++ -Wall test.cpp -o test"
echo "Example 4: o64-clang++-libc++ -std=c++11 -Wall test.cpp -o test"
echo "Example 5: x86_64-apple-$OSXCROSS_TARGET-clang++-libc++ -Wall test.cpp -o test"
echo "Example 6: i386-apple-$OSXCROSS_TARGET-clang++-libc++ -std=c++11 -Wall test.cpp -o test"
echo ""
if [ $HAVE_GCC -eq 1 ]; then
echo "GCC:"
echo ""
echo "Example 1: o32-g++-libc++ -Wall test.cpp -o test"
echo "Example 2: o64-g++-libc++ -std=c++1y -Wall test.cpp -o test"
echo "Example 3: x86_64-apple-$OSXCROSS_TARGET-g++-libc++ -Wall test.cpp -o test"
echo "Example 4: i386-apple-$OSXCROSS_TARGET-g++-libc++ -std=c++1y -Wall test.cpp -o test"
echo ""
fi

View File

@ -35,6 +35,8 @@ fi
TARGET=$ARCH1-apple-$OSXCROSS_TARGET
OSX_VERSION_MIN=$OSXCROSS_OSX_VERSION_MIN
export COMPILER_PATH="$OSXCROSS_CCTOOLS_PATH:$COMPILER_PATH"
if [ $# -gt 0 ]; then
for p in "$@"
do
@ -59,59 +61,32 @@ else
exit $?
fi
if [ $OSXCROSS_OSX_VERSION_MIN != "default" ]; then
OSX_VERSION_MIN_OPT="-mmacosx-version-min=$OSXCROSS_OSX_VERSION_MIN"
else
OSX_VERSION_MIN_OPT=""
fi
export COMPILER_PATH="$OSXCROSS_CCTOOLS_PATH:$COMPILER_PATH"
STDINC=$OSXCROSS_SDK/usr/include
if [ -n "$BUILD_LIBCXX" ]; then
if [ $BUILD_LIBCXX -eq 1 ]; then
# TODO: Write a fake libc++ library (without any symbols)
# once libstdc++ disappears from the SDK.
# Newer versions of clang default to libc++ for >= 10.9,
# so configuring libc++ fails because of the hardcoded
# -lc++ ... (at least with cmake).
if [ $USE_LIBCXX -eq 0 ]; then
MIN_TARGET_VERSION=`echo "$OSX_VERSION_MIN" | tr '.' ' ' | awk '{printf "%d %d", $1, $2}'`
MIN_TARGET_VERSION_MAJOR=`echo $MIN_TARGET_VERSION | awk '{print $1}'`
MIN_TARGET_VERSION_MINOR=`echo $MIN_TARGET_VERSION | awk '{print $2}'`
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -stdlib=libstdc++"
fi
USE_LIBCXX=0
else
if [ $USE_LIBCXX -eq 0 ]; then
MIN_TARGET_VERSION=`echo "$OSX_VERSION_MIN" | tr '.' ' ' | awk '{printf "%d %d", $1, $2}'`
MIN_TARGET_VERSION_MAJOR=`echo $MIN_TARGET_VERSION | awk '{print $1}'`
MIN_TARGET_VERSION_MINOR=`echo $MIN_TARGET_VERSION | awk '{print $2}'`
if [ $MIN_TARGET_VERSION_MAJOR -ge 10 ] && [ $MIN_TARGET_VERSION_MINOR -ge 9 ]; then
# default to libc++ on >= 10.9
USE_LIBCXX=1
fi
if [ $MIN_TARGET_VERSION_MAJOR -ge 10 ] && [ $MIN_TARGET_VERSION_MINOR -ge 9 ]; then
# default to libc++ on >= 10.9
USE_LIBCXX=1
fi
fi
if [ $USE_LIBCXX -ne 0 ]; then
if [ ! -f "$OSXCROSS_SDK/../libcxx_$OSXCROSS_SDK_VERSION/lib/libc++.a" ]; then
echo -e "\e[1mosxcross \e[31merror:\e[0m\e[1m you must build libc++ before you can use it (./build_libcxx.sh)\e[0m" 1>&2
exit 1
fi
# -nostdinc++ to avoid using local libc++ headers...
CXXINC="-nostdinc++ -cxx-isystem $OSXCROSS_SDK/usr/include/c++/v1"
CXXINC="-nostdinc++ -cxx-isystem $OSXCROSS_SDK/../libcxx_$OSXCROSS_SDK_VERSION/include/c++/v1"
if [ $USE_LIBCXX -eq 1 ]; then
CXXINC="$CXXINC -stdlib=libc++"
fi
REGEX="\-o\s*[^ ]+\.gch"
if [[ ! "$@" =~ $REGEX ]]; then
if [[ $COMPILER == *clang++* ]]; then
CXXINC="$CXXINC -Qunused-arguments -lc++abi"
if ( [ $OSX_VERSION_MIN != "default" ] &&
[ `echo "$OSX_VERSION_MIN<=10.6" | bc -l` -eq 1 ] );
then
if [ $OSXCROSS_OSX_VERSION_MIN = "default" ]; then
echo -en "\e[1mosxcross \e[31merror:\e[0m\e[0m" 2>&1
echo " -stdlib=libc++ requires Mac OS X 10.7 or later" 2>&1
exit 1
fi
CXXINC="$CXXINC -L$OSXCROSS_SDK/../libcxx_$OSXCROSS_SDK_VERSION/lib"
OSXCROSS_OSX_VERSION_MIN="10.7"
fi
else
CXXINC="-cxx-isystem $OSXCROSS_SDK/usr/lib/gcc/i686-apple-$OSXCROSS_TARGET/4.2.1/include"
@ -119,6 +94,12 @@ else
CXXINC="$CXXINC -cxx-isystem $OSXCROSS_SDK/usr/include/c++/4.0.0/$ARCH2-apple-darwin9 "
fi
if [ $OSXCROSS_OSX_VERSION_MIN != "default" ]; then
OSX_VERSION_MIN_OPT="-mmacosx-version-min=$OSXCROSS_OSX_VERSION_MIN"
else
OSX_VERSION_MIN_OPT=""
fi
XMMINTRIN=`readlink "$STDINC/xmmintrin.h"`
if [ $? -eq 0 ] && [ ! -f "$XMMINTRIN" ]; then
pushd "${0%/*}" &>/dev/null
@ -127,14 +108,15 @@ if [ $? -eq 0 ] && [ ! -f "$XMMINTRIN" ]; then
./osxcross-fix-intrinsic-headers $OSXCROSS_SDK || { echo -e "\e[31mfailed.\e[0m" 1>&2 && exit 1; }
echo -e "\e[1mdone.\e[0m" 1>&2
else
echo -e "\e[1mosxcross \e[31merror:\e[0m\e[1m dead intrinsic link found - please re-run ./build.sh\e[0m" 1>&2
echo -en "\e[1mosxcross \e[31merror:\e[0m\e[1m dead intrinsic link found -" 1>&2
echo -e "please re-run ./build.sh\e[0m" 1>&2
exit 1
fi
fi
$COMPILER \
$OSXCROSS_TARGET_OPTION $TARGET -isysroot $OSXCROSS_SDK \
$CXXINC $OSX_VERSION_MIN_OPT -mlinker-version=$OSXCROSS_LINKER_VERSION \
$OSXCROSS_OPT_ARGS ${1+"$@"}
$CXXINC -mlinker-version=$OSXCROSS_LINKER_VERSION \
$OSXCROSS_OPT_ARGS ${1+"$@"} $OSX_VERSION_MIN_OPT
exit $?

View File

@ -26,30 +26,7 @@ else
COMPILER="$OSXCROSS_TARGET_DIR/bin/$ARCH-apple-$OSXCROSS_TARGET-base-gcc"
fi
if [[ $COMPILER == *g++ ]] && [[ $type == *libc++* ]]; then
if [ ! -f "$OSXCROSS_SDK/../libcxx_$OSXCROSS_SDK_VERSION/lib/libc++.a" ]; then
echo -e "\e[1mosxcross \e[31merror:\e[0m\e[1m you must build libc++ before you can use it (./build_libcxx.sh)\e[0m" 1>&2
exit 1
fi
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -std=c++0x -nostdinc++ -nodefaultlibs"
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -lc -isystem $OSXCROSS_SDK/../libcxx_$OSXCROSS_SDK_VERSION/include/c++/v1"
REGEX="\-o\s*[^ ]+\.gch"
if [[ ! "$@" =~ $REGEX ]]; then
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -L$OSXCROSS_SDK/../libcxx_$OSXCROSS_SDK_VERSION/lib -lc++ -lc++abi"
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -L$OSXCROSS_SDK/usr/lib -lgcc_s.10.5"
fi
else
REGEX="\-o\s*[^ ]+\.gch"
if [[ ! "$@" =~ $REGEX ]]; then
if [[ $COMPILER == *g++ ]]; then
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -static-libgcc -static-libstdc++"
else
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -static-libgcc"
fi
fi
fi
OSX_VERSION_MIN=$OSXCROSS_OSX_VERSION_MIN
if [ $# -gt 0 ]; then
ARCHGIVEN=0
@ -62,6 +39,7 @@ if [ $# -gt 0 ]; then
fi
if [[ "$p" == -mmacosx-version-min=* ]]; then
OSXCROSS_OSX_VERSION_MIN="default"
OSX_VERSION_MIN=`echo "$p" | tr '=' ' ' | awk '{print $2}'`
continue
fi
if [ "$p" == "-v" ] || [ "$p" == "--version" ]; then
@ -77,6 +55,36 @@ if [ $# -gt 0 ]; then
fi
fi
if [[ $COMPILER == *g++ ]] && [[ $type == *libc++* ]]; then
if ( [ $OSX_VERSION_MIN != "default" ] &&
[ `echo "$OSX_VERSION_MIN<=10.6" | bc -l` -eq 1 ] );
then
if [ $OSXCROSS_OSX_VERSION_MIN = "default" ]; then
echo -en "\e[1mosxcross \e[31merror:\e[0m\e[0m" 2>&1
echo " -stdlib=libc++ requires Mac OS X 10.7 or later" 2>&1
exit 1
fi
OSXCROSS_OSX_VERSION_MIN="10.7"
fi
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -std=c++0x -nostdinc++ -nodefaultlibs"
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -lc -isystem $OSXCROSS_SDK/usr/include/c++/v1"
REGEX="\-o\s*[^ ]+\.gch"
if [[ ! "$@" =~ $REGEX ]]; then
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -lc++ -lc++abi -lgcc_s.10.5"
fi
else
REGEX="\-o\s*[^ ]+\.gch"
if [[ ! "$@" =~ $REGEX ]]; then
if [[ $COMPILER == *g++ ]]; then
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -static-libgcc -static-libstdc++"
else
OSXCROSS_OPT_ARGS="$OSXCROSS_OPT_ARGS -static-libgcc"
fi
fi
fi
if [ $OSXCROSS_OSX_VERSION_MIN != "default" ]; then
OSX_VERSION_MIN_OPT="-mmacosx-version-min=$OSXCROSS_OSX_VERSION_MIN"
else

105
tools/gen_sdk_package.sh Normal file
View File

@ -0,0 +1,105 @@
#!/usr/bin/env bash
#
# OS X SDK packaging script
# This script must be run on OS X
#
if [ `uname -s` != "Darwin" ]; then
echo "This script must be run on OS X"
exit 1
fi
XCODEDIR=$(ls /Volumes | grep Xcode | head -n1)
if [ -z "$XCODEDIR" ]; then
if [ -d "/Applications/Xcode.app" ]; then
XCODEDIR="/Applications/Xcode.app"
else
echo "please mount Xcode.dmg"
exit 1
fi
else
XCODEDIR="/Volumes/$XCODEDIR/Xcode.app"
fi
[ ! -d $XCODEDIR ] && exit 1
echo -e "found Xcode: $XCODEDIR"
WDIR=$(pwd)
which gnutar &>/dev/null
if [ $? -eq 0 ]; then
TAR=gnutar
else
TAR=tar
fi
which xz &>/dev/null
if [ $? -eq 0 ]; then
COMPRESSOR=xz
PKGEXT="tar.xz"
else
COMPRESSOR=bzip2
PKGEXT="tar.bz2"
fi
set -e
pushd $XCODEDIR &>/dev/null
pushd "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" &>/dev/null || {
echo "Xcode (or this script) is out of date"
echo "trying some magic to find the SDKs anyway ..."
SDKDIR=$(find . -name SDKs -type d | grep MacOSX | head -n1)
if [ -z "$SDKDIR" ]; then
echo "cannot find SDKs!"
exit 1
fi
pushd $SDKDIR &>/dev/null
}
SDKS=$(ls | grep MacOSX)
if [ -z "$SDKS" ]; then
echo "No SDK found"
exit 1
fi
LIBCXXDIR="Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1"
for SDK in $SDKS; do
echo "packaging ${SDK/.sdk/} SDK (this may take several minutes) ..."
if [[ $SDK == *.pkg ]]; then
cp $SDK $WDIR
continue
fi
TMP=$(mktemp -d /tmp/XXXXXXXXXXX)
cp -r $SDK $TMP &>/dev/null || true
pushd $XCODEDIR &>/dev/null
# libc++ headers for C++11/C++14
if [ -d $LIBCXXDIR ]; then
cp -rf $LIBCXXDIR "$TMP/$SDK/usr/include/c++"
fi
popd &>/dev/null
pushd $TMP &>/dev/null
$TAR -cf - * | $COMPRESSOR -9 -c - > "$WDIR/$SDK.$PKGEXT"
popd &>/dev/null
rm -rf $TMP
done
popd &>/dev/null
popd &>/dev/null
echo ""
ls -l | grep MacOSX

View File

@ -86,5 +86,19 @@ function test_compiler()
echo "works"
}
function test_compiler_cxx11()
{
set +e
echo -ne "testing $1 -stdlib=libc++ -std=c++11 ... "
$1 $2 -O2 -stdlib=libc++ -std=c++11 -Wall -o test &>/dev/null
if [ $? -eq 0 ]; then
rm test
echo "works"
else
echo "failed (ignored)"
fi
set -e
}
# exit on error
set -e