2010-05-24 19:49:41 +02: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
|
2010-12-10 20:47:54 +01:00
|
|
|
# the library. Otherwise we'll use clang++.
|
2010-05-24 19:49:41 +02:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2010-05-11 21:42:16 +02:00
|
|
|
if [ `basename $(pwd)` != "lib" ]
|
|
|
|
then
|
|
|
|
echo "current directory must be lib"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2010-06-02 20:20:39 +02:00
|
|
|
if [ -z "$CXX" ]
|
2010-05-11 21:42:16 +02:00
|
|
|
then
|
2010-09-14 22:26:27 +02:00
|
|
|
CXX=clang++
|
2010-05-11 21:42:16 +02:00
|
|
|
fi
|
|
|
|
|
2010-09-10 22:42:36 +02:00
|
|
|
if [ -z $MACOSX_DEPLOYMENT_TARGET ]
|
|
|
|
then
|
|
|
|
MACOSX_DEPLOYMENT_TARGET=10.6
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $RC_ProjectSourceVersion ]
|
|
|
|
then
|
|
|
|
RC_ProjectSourceVersion=1
|
|
|
|
fi
|
|
|
|
|
2010-05-24 19:49:41 +02:00
|
|
|
case $TRIPLE in
|
|
|
|
*-apple-*)
|
|
|
|
if [ -z $RC_BUILDIT ]
|
|
|
|
then
|
2010-08-11 20:11:36 +02:00
|
|
|
RC_CFLAGS="-arch i386 -arch x86_64"
|
2010-05-24 19:49:41 +02:00
|
|
|
fi
|
|
|
|
SOEXT=dylib
|
2010-09-10 22:42:36 +02:00
|
|
|
if [ "$MACOSX_DEPLOYMENT_TARGET" == "10.6" ]
|
|
|
|
then
|
2011-01-27 22:01:51 +01:00
|
|
|
EXTRA_FLAGS="-std=c++0x -U__STRICT_ANSI__"
|
2010-09-10 22:42:36 +02:00
|
|
|
LDSHARED_FLAGS="-o libc++.1.dylib \
|
|
|
|
-dynamiclib -nodefaultlibs -current_version 1 \
|
|
|
|
-compatibility_version 1 \
|
2011-02-16 01:40:06 +01:00
|
|
|
-install_name /usr/lib/libc++.1.dylib \
|
2010-09-10 22:42:36 +02:00
|
|
|
-Wl,-reexport_library,/usr/lib/libc++abi.dylib \
|
2010-12-17 15:46:43 +01:00
|
|
|
-Wl,-unexported_symbols_list,libc++unexp.exp \
|
2010-09-10 22:42:36 +02:00
|
|
|
/usr/lib/libSystem.B.dylib"
|
|
|
|
else
|
2011-01-27 22:01:51 +01:00
|
|
|
EXTRA_FLAGS="-std=c++0x"
|
2010-09-10 22:42:36 +02:00
|
|
|
LDSHARED_FLAGS="-o libc++.1.dylib \
|
|
|
|
-dynamiclib -nodefaultlibs \
|
|
|
|
-current_version ${RC_ProjectSourceVersion} -compatibility_version 1 \
|
2011-02-16 01:40:06 +01:00
|
|
|
-install_name /usr/lib/libc++.1.dylib \
|
2010-09-10 22:42:36 +02:00
|
|
|
${SDKROOT}/usr/lib/libc++abi.dylib \
|
|
|
|
-lSystem \
|
2010-12-17 15:46:43 +01:00
|
|
|
-Wl,-unexported_symbols_list,libc++unexp.exp \
|
2010-10-29 21:46:14 +02:00
|
|
|
-Wl,-reexported_symbols_list,libc++abi.exp \
|
2010-09-10 22:42:36 +02:00
|
|
|
-Wl,-force_symbols_not_weak_list,notweak.exp"
|
|
|
|
fi
|
2010-05-24 19:49:41 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
RC_CFLAGS="-fPIC"
|
|
|
|
SOEXT=so
|
|
|
|
LDSHARED_FLAGS="-o libc++.so.1.0 \
|
|
|
|
-shared -nodefaultlibs -Wl,-soname,libc++.so.1 \
|
2010-10-03 01:27:23 +02:00
|
|
|
-lpthread -lrt -lc"
|
2010-05-24 19:49:41 +02:00
|
|
|
;;
|
|
|
|
esac
|
2010-05-11 21:42:16 +02:00
|
|
|
|
|
|
|
if [ -z $RC_BUILDIT ]
|
|
|
|
then
|
2010-05-24 19:49:41 +02:00
|
|
|
rm -f libc++.1.$SOEXT*
|
2010-05-11 21:42:16 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
2010-05-24 19:49:41 +02:00
|
|
|
for FILE in ../src/*.cpp; do
|
2011-01-27 22:01:51 +01:00
|
|
|
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -nostdinc++ -I../include $FILE
|
2010-05-11 21:42:16 +02:00
|
|
|
done
|
|
|
|
|
2010-09-10 22:42:36 +02:00
|
|
|
|
2010-12-10 20:47:54 +01:00
|
|
|
cc *.o $RC_CFLAGS $LDSHARED_FLAGS
|
2010-05-11 21:42:16 +02:00
|
|
|
|
|
|
|
#libtool -static -o libc++.a *.o
|
|
|
|
|
|
|
|
if [ -z $RC_BUILDIT ]
|
|
|
|
then
|
|
|
|
rm *.o
|
|
|
|
fi
|