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