]> git.saurik.com Git - cydia.git/blame_incremental - makefile
Ignore .dSYM folders I am suddenly ending up with.
[cydia.git] / makefile
... / ...
CommitLineData
1.DELETE_ON_ERROR:
2.SECONDARY:
3
4dpkg := dpkg-deb -Zlzma
5version := $(shell ./version.sh)
6
7flag :=
8plus :=
9link :=
10libs :=
11
12gxx := $(shell xcrun --sdk iphoneos -f g++)
13cycc := $(gxx)
14
15sdk := $(shell xcodebuild -sdk iphoneos -version Path)
16cycc += -isysroot $(sdk)
17cycc += -idirafter /usr/include
18cycc += -F$(sdk)/System/Library/PrivateFrameworks
19
20cycc += -fmessage-length=0
21cycc += -gfull -O2
22cycc += -fvisibility=hidden
23
24link += -Wl,-dead_strip
25link += -Wl,-no_dead_strip_inits_and_terms
26
27iapt :=
28iapt += -Iapt32
29iapt += -Iapt32-contrib
30iapt += -Iapt32-deb
31iapt += -Iapt-extra
32iapt += -IObjects/apt32
33
34flag += $(patsubst %,-Xarch_armv6 %,$(iapt))
35flag += $(patsubst %,-Xarch_arm64 %,$(subst apt32,apt64,$(iapt)))
36
37flag += -I.
38flag += -isystem sysroot/usr/include
39
40flag += -idirafter icu/icuSources/common
41flag += -idirafter icu/icuSources/i18n
42
43flag += -Wall
44flag += -Wno-dangling-else
45flag += -Wno-deprecated-declarations
46flag += -Wno-objc-protocol-method-implementation
47flag += -Wno-logical-op-parentheses
48flag += -Wno-shift-op-parentheses
49flag += -Wno-unknown-pragmas
50flag += -Wno-unknown-warning-option
51
52plus += -fobjc-call-cxx-cdtors
53plus += -fvisibility-inlines-hidden
54
55link += -multiply_defined suppress
56
57libs += -framework CoreFoundation
58libs += -framework CoreGraphics
59libs += -framework Foundation
60libs += -framework GraphicsServices
61libs += -framework IOKit
62libs += -framework QuartzCore
63libs += -framework SpringBoardServices
64libs += -framework SystemConfiguration
65libs += -framework WebCore
66libs += -framework WebKit
67
68libs += -framework CFNetwork
69libs += -llockdown
70
71libs += -Xarch_armv6 -Wl,-force_load,Objects/libapt32.a
72libs += -Xarch_arm64 -Wl,-force_load,Objects/libapt64.a
73
74libs += -licucore
75
76uikit :=
77uikit += -framework UIKit
78
79link += -Xarch_armv6 -Wl,-segalign,4000
80
81dirs := Menes CyteKit Cydia SDURLCache
82
83code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
84code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
85code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm DiskUsage.cpp
86
87code += gpgv.cc
88code += http.cc
89
90source := $(filter %.m,$(code)) $(filter %.mm,$(code))
91source += $(filter %.c,$(code)) $(filter %.cpp,$(code)) $(filter %.cc,$(code))
92header := $(filter %.h,$(code)) $(filter %.hpp,$(code)) $(filter %.hh,$(code))
93
94object := $(source)
95object := $(object:.c=.o)
96object := $(object:.cpp=.o)
97object := $(object:.cc=.o)
98object := $(object:.m=.o)
99object := $(object:.mm=.o)
100object := $(object:%=Objects/%)
101
102methods := copy file rred
103
104libapt32 :=
105libapt32 += $(wildcard apt32/apt-pkg/*.cc)
106libapt32 += $(wildcard apt32/apt-pkg/deb/*.cc)
107libapt32 += $(wildcard apt32/apt-pkg/contrib/*.cc)
108libapt32 += apt32/methods/gzip.cc
109libapt32 += $(patsubst %,apt32/methods/%.cc,$(methods))
110libapt32 := $(patsubst %.cc,Objects/%.o,$(libapt32))
111
112libapt64 :=
113libapt64 += $(wildcard apt64/apt-pkg/*.cc)
114libapt64 += $(wildcard apt64/apt-pkg/deb/*.cc)
115libapt64 += $(wildcard apt64/apt-pkg/contrib/*.cc)
116libapt64 += apt64/apt-pkg/tagfile-keys.cc
117libapt64 += apt64/methods/store.cc
118libapt64 += $(patsubst %,apt64/methods/%.cc,$(methods))
119libapt64 := $(filter-out %/srvrec.cc,$(libapt64))
120libapt64 := $(patsubst %.cc,Objects/%.o,$(libapt64))
121
122link += -Wl,-liconv
123link += -Xarch_arm64 -Wl,-lz
124
125flag += -DAPT_PKG_EXPOSE_STRING_VIEW
126flag += -Dsighandler_t=sig_t
127
128flag32 :=
129flag32 += -arch armv6
130flag32 += -Xarch_armv6 -miphoneos-version-min=2.0
131flag32 += -Xarch_armv6 -marm # @synchronized
132flag32 += -Xarch_armv6 -mcpu=arm1176jzf-s
133flag32 += -mllvm -arm-reserve-r9
134link += -Xarch_armv6 -Wl,-lgcc_s.1
135
136flag64 :=
137flag64 += -arch arm64
138flag64 += -Xarch_arm64 -miphoneos-version-min=7.0
139
140apt32 := $(cycc) $(flag32) $(flag)
141apt32 += -Wno-deprecated-register
142apt32 += -Wno-format-security
143apt32 += -Wno-tautological-compare
144apt32 += -Wno-uninitialized
145apt32 += -Wno-unused-private-field
146apt32 += -Wno-unused-variable
147
148apt64 := $(cycc) $(flag64) $(flag)
149apt64 += -include apt.h
150apt64 += -Wno-deprecated-register
151apt64 += -Wno-unused-private-field
152apt64 += -Wno-unused-variable
153
154eapt := -include apt.h
155apt64 += $(eapt)
156eapt += -D'VERSION="0.7.25.3"'
157apt32 += $(eapt)
158eapt += -Wno-format
159eapt += -Wno-logical-op-parentheses
160iapt += $(eapt)
161
162cycc += $(flag32)
163cycc += $(flag64)
164
165plus += -std=c++11
166
167images := $(shell find MobileCydia.app/ -type f -name '*.png')
168images := $(images:%=Images/%)
169
170lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
171
172all: MobileCydia
173
174clean:
175 rm -f MobileCydia postinst
176 rm -rf Objects/ Images/
177
178Objects/apt64/apt-pkg/tagfile.o: apt64/apt-pkg/tagfile-keys.cc
179Objects/apt64/apt-pkg/deb/deblistparser.o: apt64/apt-pkg/tagfile-keys.cc
180
181apt64/apt-pkg/tagfile-keys.cc:
182 mkdir -p apt64
183 mkdir -p Objects/apt64/apt-pkg
184 cd apt64 && ../apt64/triehash/triehash.pl \
185 --ignore-case \
186 --header ../Objects/apt64/apt-pkg/tagfile-keys.h \
187 --code apt-pkg/tagfile-keys.cc \
188 --enum-class \
189 --enum-name pkgTagSection::Key \
190 --function-name pkgTagHash \
191 --include "<apt-pkg/tagfile.h>" \
192 ../apt64/apt-pkg/tagfile-keys.list
193 sed -i -e 's@typedef char static_assert64@//\\0@' $@
194
195Objects/%.o: %.cc $(header)
196 @mkdir -p $(dir $@)
197 @echo "[cycc] $<"
198 @$(cycc) $(plus) -c -o $@ $< $(flag) -Wno-format -include apt.h -Dmain=main_$(basename $(notdir $@))
199
200Objects/apt32/%.o: apt32/%.cc $(header) apt.h apt-extra/*.h
201 @mkdir -p $(dir $@)
202 @echo "[cycc] $<"
203 @$(apt32) -c -o $@ $< -Dmain=main_$(basename $(notdir $@))
204
205Objects/apt64/%.o: apt64/%.cc $(header) apt.h apt-extra/*.h
206 @mkdir -p $(dir $@)
207 @echo "[cycc] $<"
208 @$(apt64) $(plus) -c -o $@ $< -Dmain=main_$(basename $(notdir $@))
209
210Objects/%.o: %.c $(header)
211 @mkdir -p $(dir $@)
212 @echo "[cycc] $<"
213 @$(cycc) -c -o $@ -x c $< $(flag)
214
215Objects/%.o: %.m $(header)
216 @mkdir -p $(dir $@)
217 @echo "[cycc] $<"
218 @$(cycc) -c -o $@ $< $(flag)
219
220Objects/%.o: %.cpp $(header)
221 @mkdir -p $(dir $@)
222 @echo "[cycc] $<"
223 @$(cycc) $(plus) -c -o $@ $< $(flag)
224
225Objects/%.o: %.mm $(header)
226 @mkdir -p $(dir $@)
227 @echo "[cycc] $<"
228 @$(cycc) $(plus) -c -o $@ $< $(flag)
229
230Objects/Version.o: Version.h
231
232Images/%.png: %.png
233 @mkdir -p $(dir $@)
234 @echo "[pngc] $<"
235 @./pngcrush.sh $< $@
236
237sysroot: sysroot.sh
238 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
239 @echo 1>&2
240 @exit 1
241
242Objects/libapt32.a: $(libapt32)
243 @echo "[arch] $@"
244 @ar -rc $@ $^
245
246Objects/libapt64.a: $(libapt64)
247 @echo "[arch] $@"
248 @ar -rc $@ $^
249
250MobileCydia: $(object) entitlements.xml Objects/libapt32.a Objects/libapt64.a
251 @echo "[link] $@"
252 @$(cycc) -o $@ $(filter %.o,$^) $(link) $(libs) $(uikit) -Wl,-sdk_version,8.0
253 @mkdir -p bins
254 @cp -a $@ bins/$@-$(version)_$(shell date +%s)
255 @echo "[strp] $@"
256 @grep '~' <<<"$(version)" >/dev/null && echo "skipping..." || strip $@
257 @echo "[uikt] $@"
258 @./uikit.sh $@
259 @echo "[sign] $@"
260 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
261
262cfversion: cfversion.mm
263 $(cycc) -o $@ $(filter %.mm,$^) $(flag) $(link) -framework CoreFoundation
264 @ldid -T0 -S $@
265
266setnsfpn: setnsfpn.cpp
267 $(cycc) -o $@ $(filter %.cpp,$^) $(flag) $(link)
268 @ldid -T0 -S $@
269
270cydo: cydo.cpp
271 $(cycc) $(plus) -o $@ $(filter %.cpp,$^) $(flag) $(link) -Wno-deprecated-writable-strings
272 @ldid -T0 -S $@
273
274postinst: postinst.mm CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
275 $(cycc) $(plus) -o $@ $(filter %.mm,$^) $(flag) $(link) -framework CoreFoundation -framework Foundation -framework UIKit
276 @ldid -T0 -S $@
277
278debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion setnsfpn cydo $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh Library/move.sh Library/startup
279 sudo rm -rf _
280 mkdir -p _/var/lib/cydia
281
282 mkdir -p _/etc/apt
283 mkdir _/etc/apt/apt.conf.d
284 mkdir _/etc/apt/preferences.d
285 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
286 cp -a Sources.list _/etc/apt/sources.list.d
287
288 mkdir -p _/usr/libexec
289 cp -a Library _/usr/libexec/cydia
290 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
291 cp -a cfversion _/usr/libexec/cydia
292 cp -a setnsfpn _/usr/libexec/cydia
293
294 cp -a cydo _/usr/libexec/cydia
295
296 mkdir -p _/Library
297 cp -a LaunchDaemons _/Library/LaunchDaemons
298
299 mkdir -p _/Applications
300 cp -a MobileCydia.app _/Applications/Cydia.app
301 rm -rf _/Applications/Cydia.app/*.lproj
302 cp -a MobileCydia _/Applications/Cydia.app/Cydia
303
304 for meth in bzip2 gzip lzma gpgv http https store $(methods); do ln -s Cydia _/Applications/Cydia.app/"$${meth}"; done
305
306 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
307
308 mkdir -p _/Applications/Cydia.app/Sources
309 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
310 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
311
312 mkdir -p _/DEBIAN
313 ./control.sh cydia.control _ >_/DEBIAN/control
314 cp -a preinst postinst _/DEBIAN/
315
316 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
317
318 sudo chown -R 0 _
319 sudo chgrp -R 0 _
320 sudo chmod 6755 _/usr/libexec/cydia/cydo
321
322 mkdir -p debs
323 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
324 $(dpkg) -b _ Cydia.deb
325 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
326
327$(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
328 sudo rm -rf __
329 mkdir -p __/Applications/Cydia.app
330
331 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
332
333 mkdir -p __/DEBIAN
334 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
335
336 sudo chown -R 0 __
337 sudo chgrp -R 0 __
338
339 mkdir -p debs
340 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
341 $(dpkg) -b __ Cydia_.deb
342 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
343
344package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
345
346.PHONY: all clean package