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