hanchenye-llvm-project/libcxx/lib/buildit

109 lines
2.3 KiB
Plaintext
Raw Normal View History

#! /bin/sh
#
# Set the $TRIPLE environment variable to your system's triple before
# running this script. If you set $CXX, that will be used to compile
# the library. Otherwise we'll use clang++.
set -e
2010-05-12 03:42:16 +08:00
if [ `basename $(pwd)` != "lib" ]
then
echo "current directory must be lib"
exit 1
fi
2010-06-03 02:20:39 +08:00
if [ -z "$CXX" ]
2010-05-12 03:42:16 +08:00
then
CXX=clang++
2010-05-12 03:42:16 +08:00
fi
if [ -z "$CC" ]
then
CC=clang
fi
if [ -z $MACOSX_DEPLOYMENT_TARGET ]
then
if [ -z $IPHONEOS_DEPLOYMENT_TARGET ]
then
MACOSX_DEPLOYMENT_TARGET=10.6
fi
fi
if [ -z $RC_ProjectSourceVersion ]
then
RC_ProjectSourceVersion=1
fi
EXTRA_FLAGS="-std=c++0x "
case $TRIPLE in
*-apple-*)
if [ -z $RC_XBS ]
then
RC_CFLAGS="-arch i386 -arch x86_64"
fi
SOEXT=dylib
if [ "$MACOSX_DEPLOYMENT_TARGET" == "10.6" ]
then
EXTRA_FLAGS="-std=c++0x -U__STRICT_ANSI__"
LDSHARED_FLAGS="-o libc++.1.dylib \
-dynamiclib -nodefaultlibs -current_version 1 \
-compatibility_version 1 \
-install_name /usr/lib/libc++.1.dylib \
-Wl,-reexport_library,/usr/lib/libc++abi.dylib \
-Wl,-unexported_symbols_list,libc++unexp.exp \
/usr/lib/libSystem.B.dylib"
else
RE_EXPORT_FILE="libc++abi.exp"
if [ -n "$SDKROOT" ]
then
EXTRA_FLAGS+="-isysroot ${SDKROOT}"
if [ "${RC_armv7}" = "YES" ]
then
RE_EXPORT_FILE="libc++sjlj-abi.exp"
fi
CXX=`xcrun -sdk "${SDKROOT}" -find clang++`
CC=`xcrun -sdk "${SDKROOT}" -find clang`
fi
LDSHARED_FLAGS="-o libc++.1.dylib \
-dynamiclib -nodefaultlibs \
-current_version ${RC_ProjectSourceVersion} -compatibility_version 1 \
-install_name /usr/lib/libc++.1.dylib \
${SDKROOT}/usr/lib/libc++abi.dylib \
-lSystem \
-Wl,-unexported_symbols_list,libc++unexp.exp \
-Wl,-reexported_symbols_list,${RE_EXPORT_FILE} \
-Wl,-force_symbols_not_weak_list,notweak.exp "
fi
;;
*)
RC_CFLAGS="-fPIC"
SOEXT=so
LDSHARED_FLAGS="-o libc++.so.1.0 \
-shared -nodefaultlibs -Wl,-soname,libc++.so.1 \
-lpthread -lrt -lc -lstdc++"
;;
esac
2010-05-12 03:42:16 +08:00
if [ -z $RC_XBS ]
2010-05-12 03:42:16 +08:00
then
rm -f libc++.1.$SOEXT*
2010-05-12 03:42:16 +08:00
fi
set -x
for FILE in ../src/*.cpp; do
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -nostdinc++ -I../include $FILE
2010-05-12 03:42:16 +08:00
done
$CC *.o $RC_CFLAGS $LDSHARED_FLAGS $EXTRA_FLAGS
2010-05-12 03:42:16 +08:00
#libtool -static -o libc++.a *.o
if [ -z $RC_XBS ]
2010-05-12 03:42:16 +08:00
then
rm *.o
fi