-
Notifications
You must be signed in to change notification settings - Fork 2
/
BuildCFLite.windows
113 lines (95 loc) · 5.28 KB
/
BuildCFLite.windows
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#/bin/sh
echo "Setup ..."
ALL_CFILES=`ls *.c`
ALL_HFILES=`ls *.h`
ALL_MFILES=`ls *.m`
CC="/mingw/bin/gcc"
AR="/mingw/bin/ar"
MACHINE_TYPE=`uname -p`
UNICODE_DATA_FILE="UNKNOWN"
# DEPLOYMENT_TARGET="-DDEPLOYMENT_TARGET_MACOSX=1"
DEPLOYMENT_TARGET="-DDEPLOYMENT_TARGET_WIN32=1"
#MACOSVERS="-mmacosx-version-min=10.5 -fconstant-cfstrings"
MACOSVERS=""
#WARNINGS="-Wmost"
WARNINGS=""
if [ "$MACHINE_TYPE" == "i386" ]; then
UNICODE_DATA_FILE="CFUnicodeData-L.mapping"
fi
if [ "$MACHINE_TYPE" == "i686" ]; then
UNICODE_DATA_FILE="CFUnicodeData-L.mapping"
fi
if [ "$MACHINE_TYPE" == "powerpc" ]; then
UNICODE_DATA_FILE="CFUnicodeData-B.mapping"
fi
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"
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"
OBJBASE=../CF-Objects
#ARCHFLAGS="-arch i386 -arch x86_64"
ARCHFLAGS=""
# 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=550.13 -include CoreFoundation_Prefix.h"
CFLAGS="-c -pipe -std=gnu99 -g $WARNINGS -Wno-trigraphs $MACOSVERS -fexceptions -DCF_BUILDING_CF=1 $DEPLOYMENT_TARGET -DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_5 -DU_SHOW_DRAFT_API=1 -I. -I./Compatability -I$OBJBASE -DVERSION=476.19 -DWINVER=0x0500 -D_WIN32_WINNT=0x0501"
# LFLAGS="-dynamiclib -mmacosx-version-min=10.6 -twolevel_namespace -init ___CFInitialize -compatibility_version 150 -current_version 550.13 -sectcreate __UNICODE __csbitmaps CFCharacterSetBitmaps.bitmap -Wl,-alias_list,SymbolAliases -sectcreate __UNICODE __properties CFUniCharPropertyDatabase.data -sectcreate __UNICODE __data $UNICODE_DATA_FILE -segprot __UNICODE r r"
LFLAGS="-lmsvcrt -lnetapi32 -lobjc -lole32 -lws2_32 -lkernel32 -lrpcrt4"
/bin/rm -rf $OBJBASE
/bin/mkdir -p $OBJBASE
/bin/mkdir $OBJBASE/normal
/bin/mkdir $OBJBASE/CoreFoundation
/bin/cp $ALL_HFILES $OBJBASE/CoreFoundation
if [ $? -ne 0 ]; then
echo "Setup failed"
exit 1
fi
Build () {
echo "Compiling $STYLE ..."
for F in $ALL_CFILES ; do
echo $CC $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .c`.o
$CC $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .c`.o
if [ $? -ne 0 ]; then
echo "*** Compiling $STYLE failed ***"
exit 1
fi
done
for F in $ALL_MFILES ; do
echo $CC $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .m`.o
$CC $STYLE_CFLAGS $ARCHFLAGS $CFLAGS $F -o $OBJBASE/$STYLE/`basename $F .m`.o
if [ $? -ne 0 ]; then
echo "*** Compiling $STYLE failed ***"
exit 1
fi
done
echo "Linking $STYLE ..."
echo $CC $STYLE_LFLAGS $ARCHFLAGS $OBJBASE/$STYLE/*.o $LFLAGS -licuuc -licuin -lobjc -o $OBJBASE/CoreFoundation_$STYLE
$CC -shared $STYLE_LFLAGS $ARCHFLAGS $OBJBASE/$STYLE/*.o $LFLAGS lib/libicuuc.lib lib/libicuin.lib -lobjc -o $OBJBASE/libCFlite_635_0.dll
if [ $? -ne 0 ]; then
echo "*** Linking $STYLE failed ***"
exit 1
fi
}
STYLE=normal
STYLE_CFLAGS="-O2"
STYLE_LFLAGS=
Build
echo "Building done."
echo "Installing ..."
if [ -z "$DSTBASE" ]; then DSTBASE=../CF-Root ; fi
/bin/rm -rf $DSTBASE/CoreFoundation.framework
/bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/Resources
/bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/Headers
/bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/PrivateHeaders
/bin/ln -sf A $DSTBASE/CoreFoundation.framework/Versions/Current
/bin/ln -sf Versions/Current/Resources $DSTBASE/CoreFoundation.framework/Resources
/bin/ln -sf Versions/Current/Headers $DSTBASE/CoreFoundation.framework/Headers
/bin/ln -sf Versions/Current/PrivateHeaders $DSTBASE/CoreFoundation.framework/PrivateHeaders
/bin/ln -sf Versions/Current/CoreFoundation $DSTBASE/CoreFoundation.framework/CoreFoundation
/bin/cp Info.plist $DSTBASE/CoreFoundation.framework/Versions/A/Resources
/bin/mkdir -p $DSTBASE/CoreFoundation.framework/Versions/A/Resources/en.lproj
/bin/cp $PUBLIC_HEADERS $DSTBASE/CoreFoundation.framework/Versions/A/Headers
/bin/cp $PRIVATE_HEADERS $DSTBASE/CoreFoundation.framework/Versions/A/PrivateHeaders
/usr/bin/strip -S -o $DSTBASE/CoreFoundation.framework/Versions/A/CoreFoundation $OBJBASE/CoreFoundation_normal
/usr/sbin/chown -RH -f root:wheel $DSTBASE/CoreFoundation.framework
/bin/chmod -RH a-w,a+rX $DSTBASE/CoreFoundation.framework
/bin/chmod -RH u+w $DSTBASE
install_name_tool -id /System/Library/Frameworks/CoreFoundation/Versions/A/CoreFoundation $DSTBASE/CoreFoundation.framework/Versions/A/CoreFoundation
echo "Installing done. The framework is in $DSTBASE"
exit 0