2010-05-25 01:49:41 +08:00
|
|
|
#! /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 g++.
|
|
|
|
|
|
|
|
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
|
2010-09-15 04:26:27 +08:00
|
|
|
CXX=clang++
|
2010-05-12 03:42:16 +08:00
|
|
|
fi
|
|
|
|
|
2010-09-11 04:42:36 +08:00
|
|
|
if [ -z $MACOSX_DEPLOYMENT_TARGET ]
|
|
|
|
then
|
|
|
|
MACOSX_DEPLOYMENT_TARGET=10.6
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $RC_ProjectSourceVersion ]
|
|
|
|
then
|
|
|
|
RC_ProjectSourceVersion=1
|
|
|
|
fi
|
|
|
|
|
2010-05-25 01:49:41 +08:00
|
|
|
case $TRIPLE in
|
|
|
|
*-apple-*)
|
|
|
|
if [ -z $RC_BUILDIT ]
|
|
|
|
then
|
2010-08-12 02:11:36 +08:00
|
|
|
RC_CFLAGS="-arch i386 -arch x86_64"
|
2010-05-25 01:49:41 +08:00
|
|
|
fi
|
|
|
|
SOEXT=dylib
|
2010-09-11 04:42:36 +08:00
|
|
|
if [ "$MACOSX_DEPLOYMENT_TARGET" == "10.6" ]
|
|
|
|
then
|
|
|
|
LDSHARED_FLAGS="-o libc++.1.dylib \
|
|
|
|
-dynamiclib -nodefaultlibs -current_version 1 \
|
|
|
|
-compatibility_version 1 \
|
|
|
|
-install_name /usr/lib/libc++.dylib \
|
|
|
|
-Wl,-reexport_library,/usr/lib/libc++abi.dylib \
|
|
|
|
/usr/lib/libSystem.B.dylib"
|
|
|
|
else
|
|
|
|
LDSHARED_FLAGS="-o libc++.1.dylib \
|
|
|
|
-dynamiclib -nodefaultlibs \
|
|
|
|
-current_version ${RC_ProjectSourceVersion} -compatibility_version 1 \
|
|
|
|
-install_name /usr/lib/libc++.dylib \
|
|
|
|
${SDKROOT}/usr/lib/libc++abi.dylib \
|
|
|
|
-lSystem \
|
|
|
|
-Xarch_x86_64 -exported_symbols_list \
|
|
|
|
-Xarch_x86_64 x86_64.exp \
|
|
|
|
-Xarch_i386 -exported_symbols_list \
|
|
|
|
-Xarch_i386 i386.exp \
|
|
|
|
-exported_symbols_list libc++abi.exp \
|
|
|
|
-Wl,-force_symbols_not_weak_list,notweak.exp"
|
|
|
|
fi
|
2010-05-25 01:49:41 +08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
RC_CFLAGS="-fPIC"
|
|
|
|
SOEXT=so
|
|
|
|
LDSHARED_FLAGS="-o libc++.so.1.0 \
|
|
|
|
-shared -nodefaultlibs -Wl,-soname,libc++.so.1 \
|
2010-10-03 07:27:23 +08:00
|
|
|
-lpthread -lrt -lc"
|
2010-05-25 01:49:41 +08:00
|
|
|
;;
|
|
|
|
esac
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
if [ -z $RC_BUILDIT ]
|
|
|
|
then
|
2010-05-25 01:49:41 +08:00
|
|
|
rm -f libc++.1.$SOEXT*
|
2010-05-12 03:42:16 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
2010-05-25 01:49:41 +08:00
|
|
|
for FILE in ../src/*.cpp; do
|
|
|
|
$CXX -c -g -Os $RC_CFLAGS -nostdinc++ -I../include $FILE
|
2010-05-12 03:42:16 +08:00
|
|
|
done
|
|
|
|
|
2010-09-11 04:42:36 +08:00
|
|
|
|
2010-10-14 05:12:41 +08:00
|
|
|
cc *.o $RC_CFLAGS $LDSHARED_FLAGS
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
#libtool -static -o libc++.a *.o
|
|
|
|
|
|
|
|
if [ -z $RC_BUILDIT ]
|
|
|
|
then
|
|
|
|
rm *.o
|
|
|
|
fi
|