]> git.saurik.com Git - cydia.git/blob - makefile
Fixed deadlock rendering error during source removal.
[cydia.git] / makefile
1 dev := /Developer/Platforms/iPhoneOS.platform/Developer
2 sdks := $(dev)/SDKs
3 ioss := $(sort $(patsubst $(sdks)/iPhoneOS%.sdk,%,$(wildcard $(sdks)/iPhoneOS*.sdk)))
4 ios := $(word $(words $(ioss)),$(ioss))
5
6 # if you can tolerate clang, set this to blank
7 gcc := 4.2
8
9 ifeq ($(gcc),)
10 gxx := $(dev)/usr/bin/clang++
11 else
12 gxx := $(dev)/usr/bin/g++-$(gcc)
13 endif
14
15 flags :=
16 link :=
17 libs :=
18
19 ifeq (o,O) # gzip is actually better
20 dpkg := /Library/Cydia/bin/dpkg-deb
21 ifeq ($(wildcard $(dpkg)),$(dpkg))
22 dpkg := $(dpkg) -zlzma
23 else
24 dpkg := dpkg-deb -zbzip2
25 endif
26 else
27 dpkg := dpkg-deb
28 endif
29
30 sdk := $(sdks)/iPhoneOS$(ios).sdk
31
32 flags += -F$(sdk)/System/Library/PrivateFrameworks
33 flags += -I. -isystem sysroot/usr/include
34 flags += -fmessage-length=0
35 flags += -g0 -O2
36 flags += -fvisibility=hidden
37
38 flags += -Wall
39
40 ifeq ($(gcc),)
41 flags += -Wno-unknown-warning-option
42 flags += -Wno-logical-op-parentheses
43 else
44 flags += -fobjc-exceptions
45 flags += -fno-guess-branch-probability
46 endif
47
48 flags += -Wno-deprecated-declarations
49
50 xflags :=
51 xflags += -fobjc-call-cxx-cdtors
52 xflags += -fvisibility-inlines-hidden
53
54 link += -Lsysroot/usr/lib
55 link += -multiply_defined suppress
56
57 libs += -framework CoreFoundation
58 libs += -framework CoreGraphics
59 libs += -framework Foundation
60 libs += -framework GraphicsServices
61 libs += -framework IOKit
62 libs += -framework JavaScriptCore
63 libs += -framework QuartzCore
64 libs += -framework SpringBoardServices
65 libs += -framework SystemConfiguration
66 libs += -framework WebCore
67 libs += -framework WebKit
68
69 libs += -lapr-1
70 libs += -lapt-pkg
71 libs += -lpcre
72
73 uikit :=
74 uikit += -framework UIKit
75
76 backrow :=
77 backrow += -FAppleTV -framework BackRow -framework AppleTV
78
79 version := $(shell ./version.sh)
80
81 cycc = $(gxx) -mthumb -arch armv6 -o $@ -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
82 #cycc = cycc -r4.2 -i$(ios) -o$@
83
84 ifneq ($(gcc),)
85 cycc += -Xarch_armv6 -mcpu=arm1176jzf-s
86 endif
87
88 dirs := Menes CyteKit Cydia SDURLCache
89
90 code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
91 code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
92 code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm
93
94 source := $(filter %.m,$(code)) $(filter %.mm,$(code))
95 source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
96 header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
97
98 object := $(source)
99 object := $(object:.c=.o)
100 object := $(object:.cpp=.o)
101 object := $(object:.m=.o)
102 object := $(object:.mm=.o)
103 object := $(object:%=Objects/%)
104
105 images := $(shell find MobileCydia.app/ -type f -name '*.png')
106 images := $(images:%=Images/%)
107
108 lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
109
110 all: MobileCydia
111
112 clean:
113 rm -f MobileCydia postinst
114 rm -rf Objects/ Images/
115
116 Objects/%.o: %.c $(header)
117 @mkdir -p $(dir $@)
118 @echo "[cycc] $<"
119 @$(cycc) -c -x c $<
120
121 Objects/%.o: %.m $(header)
122 @mkdir -p $(dir $@)
123 @echo "[cycc] $<"
124 @$(cycc) -c $< $(flags)
125
126 Objects/%.o: %.mm $(header)
127 @mkdir -p $(dir $@)
128 @echo "[cycc] $<"
129 @$(cycc) -c $< $(flags) $(xflags)
130
131 Objects/Version.o: version.h
132
133 Images/%.png: %.png
134 @mkdir -p $(dir $@)
135 @echo "[pngc] $<"
136 @./pngcrush.sh $< $@
137
138 sysroot: sysroot.sh
139 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
140 @echo 1>&2
141 @exit 1
142
143 MobileCydia: sysroot $(object) entitlements.xml
144 @echo "[link] $(object:Objects/%=%)"
145 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(libs) $(uikit)
146 @mkdir -p bins
147 @cp -a $@ bins/$@-$(version)
148 @echo "[strp] $@"
149 @strip -no_uuid $@
150 @echo "[sign] $@"
151 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
152
153 CydiaAppliance: CydiaAppliance.mm
154 $(cycc) $(filter %.mm,$^) $(flags) $(link) -bundle $(libs) $(backrow)
155
156 cfversion: cfversion.mm
157 $(cycc) $(filter %.mm,$^) $(flags) -framework CoreFoundation
158 @ldid -T0 -S $@
159
160 postinst: postinst.mm Sources.mm Sources.h CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
161 $(cycc) $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation -framework Foundation -framework UIKit -lpcre
162 @ldid -T0 -S $@
163
164 debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh
165 sudo rm -rf _
166 mkdir -p _/var/lib/cydia
167
168 mkdir -p _/etc/apt
169 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
170 cp -a Sources.list _/etc/apt/sources.list.d
171
172 mkdir -p _/usr/libexec
173 cp -a Library _/usr/libexec/cydia
174 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
175 cp -a cfversion _/usr/libexec/cydia
176
177 mkdir -p _/System/Library
178 cp -a LaunchDaemons _/System/Library/LaunchDaemons
179
180 mkdir -p _/Applications
181 cp -a MobileCydia.app _/Applications/Cydia.app
182 rm -rf _/Applications/Cydia.app/*.lproj
183 cp -a MobileCydia _/Applications/Cydia.app/MobileCydia
184
185 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
186
187 mkdir -p _/Applications/Cydia.app/Sources
188 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
189 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
190
191 #mkdir -p _/Applications/AppleTV.app/Appliances
192 #cp -a Cydia.frappliance _/Applications/AppleTV.app/Appliances
193 #cp -a CydiaAppliance _/Applications/AppleTV.app/Appliances/Cydia.frappliance
194
195 #mkdir -p _/Applications/Lowtide.app/Appliances
196 #ln -s {/Applications/AppleTV,_/Applications/Lowtide}.app/Appliances/Cydia.frappliance
197
198 mkdir -p _/DEBIAN
199 ./control.sh cydia.control _ >_/DEBIAN/control
200 cp -a preinst postinst _/DEBIAN/
201
202 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
203
204 sudo chown -R 0 _
205 sudo chgrp -R 0 _
206 sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
207
208 mkdir -p debs
209 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
210 $(dpkg) -b _ Cydia.deb
211 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
212
213 $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
214 sudo rm -rf __
215 mkdir -p __/Applications/Cydia.app
216
217 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
218
219 mkdir -p __/DEBIAN
220 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
221
222 sudo chown -R 0 __
223 sudo chgrp -R 0 __
224
225 mkdir -p debs
226 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
227 $(dpkg) -b __ Cydia_.deb
228 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
229
230 package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
231
232 .PHONY: all clean package