forked from OSchip/llvm-project
85 lines
1.7 KiB
Bash
Executable File
85 lines
1.7 KiB
Bash
Executable File
#! /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
|
|
|
|
if [ `basename $(pwd)` != "lib" ]
|
|
then
|
|
echo "current directory must be lib"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$CXX" ]
|
|
then
|
|
CXX=clang++
|
|
fi
|
|
|
|
if [ -z $MACOSX_DEPLOYMENT_TARGET ]
|
|
then
|
|
MACOSX_DEPLOYMENT_TARGET=10.6
|
|
fi
|
|
|
|
if [ -z $RC_ProjectSourceVersion ]
|
|
then
|
|
RC_ProjectSourceVersion=1
|
|
fi
|
|
|
|
case $TRIPLE in
|
|
*-apple-*)
|
|
if [ -z $RC_BUILDIT ]
|
|
then
|
|
RC_CFLAGS="-arch i386 -arch x86_64"
|
|
fi
|
|
SOEXT=dylib
|
|
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 \
|
|
-Wl,-reexported_symbols_list,libc++abi.exp \
|
|
-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"
|
|
;;
|
|
esac
|
|
|
|
if [ -z $RC_BUILDIT ]
|
|
then
|
|
rm -f libc++.1.$SOEXT*
|
|
fi
|
|
|
|
set -x
|
|
|
|
for FILE in ../src/*.cpp; do
|
|
$CXX -c -g -Os $RC_CFLAGS -nostdinc++ -I../include $FILE
|
|
done
|
|
|
|
|
|
cc *.o $RC_CFLAGS $LDSHARED_FLAGS
|
|
|
|
#libtool -static -o libc++.a *.o
|
|
|
|
if [ -z $RC_BUILDIT ]
|
|
then
|
|
rm *.o
|
|
fi
|