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