blob: 44e7c3a06003991e5654033acfad0cfb165dd1fb [file] [log] [blame]
Howard Hinnantadff4892010-05-24 17:49:41 +00001#! /bin/sh
2#
3# Set the $TRIPLE environment variable to your system's triple before
4# running this script. If you set $CXX, that will be used to compile
5# the library. Otherwise we'll use g++.
6
7set -e
8
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00009if [ `basename $(pwd)` != "lib" ]
10then
11 echo "current directory must be lib"
12 exit 1
13fi
14
Howard Hinnanta6a062d2010-06-02 18:20:39 +000015if [ -z "$CXX" ]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000016then
Howard Hinnantadff4892010-05-24 17:49:41 +000017 CXX=g++
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000018fi
19
Howard Hinnantadff4892010-05-24 17:49:41 +000020case $TRIPLE in
21 *-apple-*)
22 if [ -z $RC_BUILDIT ]
23 then
Howard Hinnant0e353f22010-08-11 18:11:36 +000024 RC_CFLAGS="-arch i386 -arch x86_64"
Howard Hinnantadff4892010-05-24 17:49:41 +000025 fi
26 SOEXT=dylib
27 LDSHARED_FLAGS="-o libc++.1.dylib \
28 -dynamiclib -nodefaultlibs -current_version 1 \
29 -compatibility_version 1 \
30 -install_name /usr/lib/libc++.dylib \
31 -Wl,-reexport_library,/usr/lib/libc++abi.dylib \
32 /usr/lib/libSystem.B.dylib"
33 ;;
34 *)
35 RC_CFLAGS="-fPIC"
36 SOEXT=so
37 LDSHARED_FLAGS="-o libc++.so.1.0 \
38 -shared -nodefaultlibs -Wl,-soname,libc++.so.1 \
39 -lstdc++ -lc"
40 ;;
41esac
42
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000043if [ -z $RC_BUILDIT ]
44then
Howard Hinnantadff4892010-05-24 17:49:41 +000045 rm -f libc++.1.$SOEXT*
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000046fi
47
48set -x
49
Howard Hinnantadff4892010-05-24 17:49:41 +000050for FILE in ../src/*.cpp; do
51 $CXX -c -g -Os $RC_CFLAGS -nostdinc++ -I../include $FILE
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000052done
53
Howard Hinnantadff4892010-05-24 17:49:41 +000054$CXX *.o $RC_CFLAGS $LDSHARED_FLAGS
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000055
56#libtool -static -o libc++.a *.o
57
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000058if [ -z $RC_BUILDIT ]
59then
60 rm *.o
61fi