]> git.saurik.com Git - apple/cf.git/blob - BuildCFLite
CF-550.tar.gz
[apple/cf.git] / BuildCFLite
1 #/bin/sh
2
3 echo "Setup ..."
4
5 ALL_CFILES=`ls *.c`
6 ALL_HFILES=`ls *.h`
7 ALL_MFILES=`ls *.m`
8
9 MACHINE_TYPE=`uname -p`
10 UNICODE_DATA_FILE="UNKNOWN"
11
12 if [ "$MACHINE_TYPE" == "i386" ]; then
13 UNICODE_DATA_FILE="CFUnicodeData-L.mapping"
14 fi
15
16 if [ "$MACHINE_TYPE" == "i686" ]; then
17 UNICODE_DATA_FILE="CFUnicodeData-L.mapping"
18 fi
19
20 if [ "$MACHINE_TYPE" == "powerpc" ]; then
21 UNICODE_DATA_FILE="CFUnicodeData-B.mapping"
22 fi
23
24 PUBLIC_HEADERS="CFArray.h CFBag.h CFBase.h CFBinaryHeap.h CFBitVector.h CFBundle.h CFByteOrder.h CFCalendar.h CFCharacterSet.h CFData.h CFDate.h CFDateFormatter.h CFDictionary.h CFError.h CFLocale.h CFMachPort.h CFMessagePort.h CFNumber.h CFNumberFormatter.h CFPlugIn.h CFPlugInCOM.h CFPreferences.h CFPropertyList.h CFRunLoop.h CFSet.h CFSocket.h CFStream.h CFString.h CFStringEncodingExt.h CFTimeZone.h CFTree.h CFURL.h CFURLAccess.h CFUUID.h CFUserNotification.h CFXMLNode.h CFXMLParser.h CoreFoundation.h"
25 PRIVATE_HEADERS="CFBundlePriv.h CFCharacterSetPriv.h CFError_Private.h CFLogUtilities.h CFPriv.h CFRuntime.h CFStorage.h CFStreamAbstract.h CFStreamPriv.h CFStreamInternal.h CFStringDefaultEncoding.h CFStringEncodingConverter.h CFStringEncodingConverterExt.h CFUniChar.h CFUnicodeDecomposition.h CFUnicodePrecomposition.h ForFoundationOnly.h"
26
27 OBJBASE=./CF-Objects
28 ARCHFLAGS="-arch i386 -arch x86_64"
29 CFLAGS="-c -x objective-c -pipe -std=gnu99 -g -Wmost -Wno-trigraphs -mmacosx-version-min=10.6 -fconstant-cfstrings -fexceptions -DCF_BUILDING_CF=1 -DDEPLOYMENT_TARGET_MACOSX=1 -DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_6 -DU_SHOW_DRAFT_API=1 -I$OBJBASE -DVERSION=535 -include CoreFoundation_Prefix.h"
30 LFLAGS="-dynamiclib -mmacosx-version-min=10.6 -twolevel_namespace -init ___CFInitialize -compatibility_version 150 -current_version 535 -sectcreate __UNICODE __csbitmaps CFCharacterSetBitmaps.bitmap -Wl,-alias_list,SymbolAliases -sectcreate __UNICODE __properties CFUniCharPropertyDatabase.data -sectcreate __UNICODE __data $UNICODE_DATA_FILE -segprot __UNICODE r r"
31
32 /bin/rm -rf $OBJBASE
33 /bin/mkdir -p $OBJBASE
34 /bin/mkdir $OBJBASE/normal
35 /bin/mkdir $OBJBASE/CoreFoundation
36 /bin/cp $ALL_HFILES $OBJBASE/CoreFoundation
37 if [ $? -ne 0 ]; then
38 echo "Setup failed"
39 exit 1
40 fi
41
42 Build () {
43 echo "Compiling $STYLE ..."
44 for F in $ALL_CFILES ; do
45 echo /usr/bin/gcc $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .c`.o
46 /usr/bin/gcc $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .c`.o
47 if [ $? -ne 0 ]; then
48 echo "*** Compiling $STYLE failed ***"
49 exit 1
50 fi
51 done
52 for F in $ALL_MFILES ; do
53 echo /usr/bin/gcc $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .m`.o
54 /usr/bin/gcc $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .m`.o
55 if [ $? -ne 0 ]; then
56 echo "*** Compiling $STYLE failed ***"
57 exit 1
58 fi
59 done
60 echo "Linking $STYLE ..."
61 echo /usr/bin/gcc $STYLE_LFLAGS -install_name /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation_$STYLE $ARCHFLAGS $LFLAGS $OBJBASE/$STYLE/*.o -licucore.A -lobjc -o $OBJBASE/CoreFoundation_$STYLE
62 /usr/bin/gcc $STYLE_LFLAGS -install_name /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation_$STYLE $ARCHFLAGS $LFLAGS $OBJBASE/$STYLE/*.o -licucore.A -lobjc -o $OBJBASE/CoreFoundation_$STYLE
63 if [ $? -ne 0 ]; then
64 echo "*** Linking $STYLE failed ***"
65 exit 1
66 fi
67 }
68
69 STYLE=normal
70 STYLE_CFLAGS="-O2"
71 STYLE_LFLAGS=
72 Build
73
74 echo "Building done."
75
76 echo "Installing ..."
77 if [ -z "$DSTBASE" ]; then DSTBASE=../CF-Root ; fi
78
79 /bin/rm -rf $DSTBASE/CoreFoundation.framework
80 /bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/Resources
81 /bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/Headers
82 /bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/PrivateHeaders
83 /bin/ln -sf A $DSTBASE/CoreFoundation.framework/Versions/Current
84 /bin/ln -sf Versions/Current/Resources $DSTBASE/CoreFoundation.framework/Resources
85 /bin/ln -sf Versions/Current/Headers $DSTBASE/CoreFoundation.framework/Headers
86 /bin/ln -sf Versions/Current/PrivateHeaders $DSTBASE/CoreFoundation.framework/PrivateHeaders
87 /bin/ln -sf Versions/Current/CoreFoundation $DSTBASE/CoreFoundation.framework/CoreFoundation
88 /bin/cp Info.plist $DSTBASE/CoreFoundation.framework/Versions/A/Resources
89 /bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/Resources/en.lproj
90 /bin/cp $PUBLIC_HEADERS $DSTBASE/CoreFoundation.framework/Versions/A/Headers
91 /bin/cp $PRIVATE_HEADERS $DSTBASE/CoreFoundation.framework/Versions/A/PrivateHeaders
92 /usr/bin/strip -S -o $DSTBASE/CoreFoundation.framework/Versions/A/CoreFoundation $OBJBASE/CoreFoundation_normal
93 /usr/sbin/chown -RH -f root:wheel $DSTBASE/CoreFoundation.framework
94 /bin/chmod -RH a-w,a+rX $DSTBASE/CoreFoundation.framework
95 /bin/chmod -RH u+w $DSTBASE
96
97 install_name_tool -id /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation $DSTBASE/CoreFoundation.framework/Versions/A/CoreFoundation
98
99 echo "Installing done. The framework is in $DSTBASE"
100
101 exit 0
102