]>
Commit | Line | Data |
---|---|---|
3e5a9f5d JF |
1 | gxx := $(shell xcrun --sdk iphoneos -f g++) |
2 | sdk := $(shell xcodebuild -sdk iphoneos -version Path) | |
4cc9e99a | 3 | |
c21004b9 JF |
4 | flags := |
5 | link := | |
543e172a | 6 | libs := |
c21004b9 | 7 | |
3e5a9f5d | 8 | dpkg := dpkg-deb -Zlzma |
ee4120ad JF |
9 | |
10 | flags += -F$(sdk)/System/Library/PrivateFrameworks | |
4cc9e99a | 11 | flags += -I. -isystem sysroot/usr/include |
c21004b9 JF |
12 | flags += -fmessage-length=0 |
13 | flags += -g0 -O2 | |
4cc9e99a JF |
14 | flags += -fvisibility=hidden |
15 | ||
8e57d50b JF |
16 | flags += -idirafter icu/icuSources/common |
17 | flags += -idirafter icu/icuSources/i18n | |
18 | ||
4cc9e99a JF |
19 | flags += -Wall |
20 | ||
4cc9e99a JF |
21 | flags += -Wno-unknown-warning-option |
22 | flags += -Wno-logical-op-parentheses | |
3e5a9f5d JF |
23 | flags += -Wno-dangling-else |
24 | flags += -Wno-shift-op-parentheses | |
4cc9e99a | 25 | flags += -Wno-deprecated-declarations |
7c8912f8 JF |
26 | |
27 | xflags := | |
28 | xflags += -fobjc-call-cxx-cdtors | |
9f9ae81c | 29 | xflags += -fvisibility-inlines-hidden |
c21004b9 | 30 | |
4cc9e99a | 31 | link += -Lsysroot/usr/lib |
c21004b9 | 32 | link += -multiply_defined suppress |
5f6bff8c | 33 | |
543e172a JF |
34 | libs += -framework CoreFoundation |
35 | libs += -framework CoreGraphics | |
36 | libs += -framework Foundation | |
37 | libs += -framework GraphicsServices | |
38 | libs += -framework IOKit | |
543e172a JF |
39 | libs += -framework QuartzCore |
40 | libs += -framework SpringBoardServices | |
41 | libs += -framework SystemConfiguration | |
42 | libs += -framework WebCore | |
43 | libs += -framework WebKit | |
44 | ||
45 | libs += -lapr-1 | |
46 | libs += -lapt-pkg | |
8e57d50b | 47 | libs += -licucore |
543e172a JF |
48 | libs += -lpcre |
49 | ||
e17a8c4f JF |
50 | uikit := |
51 | uikit += -framework UIKit | |
52 | ||
53 | backrow := | |
54 | backrow += -FAppleTV -framework BackRow -framework AppleTV | |
55 | ||
f9ba524a JF |
56 | version := $(shell ./version.sh) |
57 | ||
3e5a9f5d | 58 | cycc = $(gxx) -arch armv6 -o $@ -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks |
ee4120ad | 59 | |
3e5a9f5d JF |
60 | cycc += -marm # @synchronized |
61 | cycc += -mcpu=arm1176jzf-s | |
62 | cycc += -mllvm -arm-reserve-r9 | |
63 | link += -lgcc_s.1 | |
eb40eaca | 64 | |
7c8912f8 JF |
65 | dirs := Menes CyteKit Cydia SDURLCache |
66 | ||
67 | code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext)))) | |
68 | code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code)) | |
25c1dafb | 69 | code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm |
7c8912f8 JF |
70 | |
71 | source := $(filter %.m,$(code)) $(filter %.mm,$(code)) | |
72 | source += $(filter %.c,$(code)) $(filter %.cpp,$(code)) | |
73 | header := $(filter %.h,$(code)) $(filter %.hpp,$(code)) | |
74 | ||
75 | object := $(source) | |
76 | object := $(object:.c=.o) | |
77 | object := $(object:.cpp=.o) | |
78 | object := $(object:.m=.o) | |
79 | object := $(object:.mm=.o) | |
80 | object := $(object:%=Objects/%) | |
81 | ||
4339c9ef | 82 | images := $(shell find MobileCydia.app/ -type f -name '*.png') |
8a4d4662 JF |
83 | images := $(images:%=Images/%) |
84 | ||
915284a6 JF |
85 | lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb |
86 | ||
e17a8c4f | 87 | all: MobileCydia |
dc5812ec | 88 | |
5f6bff8c | 89 | clean: |
eaa9f122 | 90 | rm -f MobileCydia postinst |
8a4d4662 | 91 | rm -rf Objects/ Images/ |
7c8912f8 JF |
92 | |
93 | Objects/%.o: %.c $(header) | |
94 | @mkdir -p $(dir $@) | |
95 | @echo "[cycc] $<" | |
4cc9e99a | 96 | @$(cycc) -c -x c $< |
7c8912f8 JF |
97 | |
98 | Objects/%.o: %.m $(header) | |
99 | @mkdir -p $(dir $@) | |
100 | @echo "[cycc] $<" | |
4cc9e99a | 101 | @$(cycc) -c $< $(flags) |
5f6bff8c | 102 | |
7c8912f8 JF |
103 | Objects/%.o: %.mm $(header) |
104 | @mkdir -p $(dir $@) | |
105 | @echo "[cycc] $<" | |
b129e6d9 | 106 | @$(cycc) -std=c++11 -c $< $(flags) $(xflags) |
e95a1972 | 107 | |
174327c1 | 108 | Objects/Version.o: Version.h |
e61d7bfc | 109 | |
8a4d4662 JF |
110 | Images/%.png: %.png |
111 | @mkdir -p $(dir $@) | |
112 | @echo "[pngc] $<" | |
113 | @./pngcrush.sh $< $@ | |
114 | ||
0d5393af JF |
115 | sysroot: sysroot.sh |
116 | @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2 | |
8a2c6d14 JF |
117 | @echo 1>&2 |
118 | @exit 1 | |
119 | ||
9c0eddfd | 120 | MobileCydia: sysroot $(object) entitlements.xml |
7c8912f8 | 121 | @echo "[link] $(object:Objects/%=%)" |
8dbbd7d6 | 122 | @$(cycc) $(filter %.o,$^) $(flags) $(link) $(libs) $(uikit) -Wl,-sdk_version,8.0 |
0dbada51 | 123 | @mkdir -p bins |
665d1e62 | 124 | @cp -a $@ bins/$@-$(version) |
443b9e05 JF |
125 | @echo "[strp] $@" |
126 | @strip -no_uuid $@ | |
cc31c45d JF |
127 | @echo "[uikt] $@" |
128 | @./uikit.sh $@ | |
7c8912f8 | 129 | @echo "[sign] $@" |
9c0eddfd | 130 | @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; } |
03c0f7a9 | 131 | |
e17a8c4f | 132 | CydiaAppliance: CydiaAppliance.mm |
543e172a | 133 | $(cycc) $(filter %.mm,$^) $(flags) $(link) -bundle $(libs) $(backrow) |
e17a8c4f | 134 | |
e967efd5 | 135 | cfversion: cfversion.mm |
3e5a9f5d | 136 | $(cycc) $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation |
e967efd5 JF |
137 | @ldid -T0 -S $@ |
138 | ||
82e370b3 JF |
139 | setnsfpn: setnsfpn.cpp |
140 | $(cycc) $(filter %.cpp,$^) $(flags) $(link) | |
141 | @ldid -T0 -S $@ | |
142 | ||
eaa9f122 | 143 | postinst: postinst.mm Sources.mm Sources.h CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h |
82e370b3 | 144 | $(cycc) -std=c++11 $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation -framework Foundation -framework UIKit -lpcre |
2d46d29e | 145 | @ldid -T0 -S $@ |
eaa9f122 | 146 | |
12b8ca68 | 147 | debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion setnsfpn $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh Library/move.sh Library/startup |
7e2bd591 | 148 | sudo rm -rf _ |
03c0f7a9 JF |
149 | mkdir -p _/var/lib/cydia |
150 | ||
33e30380 JF |
151 | mkdir -p _/etc/apt |
152 | cp -a Trusted.gpg _/etc/apt/trusted.gpg.d | |
153 | cp -a Sources.list _/etc/apt/sources.list.d | |
154 | ||
03c0f7a9 | 155 | mkdir -p _/usr/libexec |
c21004b9 | 156 | cp -a Library _/usr/libexec/cydia |
7e2bd591 | 157 | cp -a sysroot/usr/bin/du _/usr/libexec/cydia |
e967efd5 | 158 | cp -a cfversion _/usr/libexec/cydia |
82e370b3 | 159 | cp -a setnsfpn _/usr/libexec/cydia |
03c0f7a9 | 160 | |
2eef6631 JF |
161 | mkdir -p _/Library |
162 | cp -a LaunchDaemons _/Library/LaunchDaemons | |
03c0f7a9 JF |
163 | |
164 | mkdir -p _/Applications | |
e17a8c4f | 165 | cp -a MobileCydia.app _/Applications/Cydia.app |
915284a6 | 166 | rm -rf _/Applications/Cydia.app/*.lproj |
e17a8c4f JF |
167 | cp -a MobileCydia _/Applications/Cydia.app/MobileCydia |
168 | ||
8a4d4662 JF |
169 | cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';' |
170 | ||
4339c9ef JF |
171 | mkdir -p _/Applications/Cydia.app/Sources |
172 | ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png | |
5ad3e6d9 JF |
173 | ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png" |
174 | ||
e2b57be4 JF |
175 | #mkdir -p _/Applications/AppleTV.app/Appliances |
176 | #cp -a Cydia.frappliance _/Applications/AppleTV.app/Appliances | |
177 | #cp -a CydiaAppliance _/Applications/AppleTV.app/Appliances/Cydia.frappliance | |
178 | ||
e17a8c4f | 179 | #mkdir -p _/Applications/Lowtide.app/Appliances |
e2b57be4 | 180 | #ln -s {/Applications/AppleTV,_/Applications/Lowtide}.app/Appliances/Cydia.frappliance |
03c0f7a9 | 181 | |
03c0f7a9 | 182 | mkdir -p _/DEBIAN |
915284a6 | 183 | ./control.sh cydia.control _ >_/DEBIAN/control |
eaa9f122 | 184 | cp -a preinst postinst _/DEBIAN/ |
03c0f7a9 | 185 | |
8fec9d25 | 186 | find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';' |
7fc02989 | 187 | |
7e2bd591 JF |
188 | sudo chown -R 0 _ |
189 | sudo chgrp -R 0 _ | |
e17a8c4f | 190 | sudo chmod 6755 _/Applications/Cydia.app/MobileCydia |
7e2bd591 | 191 | |
3adcfba7 | 192 | mkdir -p debs |
f9ba524a | 193 | ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb |
3adcfba7 | 194 | $(dpkg) -b _ Cydia.deb |
ce0372db | 195 | @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)" |
8cc774c5 | 196 | |
33e30380 | 197 | $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control |
915284a6 JF |
198 | sudo rm -rf __ |
199 | mkdir -p __/Applications/Cydia.app | |
200 | ||
201 | cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app | |
202 | ||
203 | mkdir -p __/DEBIAN | |
204 | ./control.sh cydia-lproj.control __ >__/DEBIAN/control | |
915284a6 JF |
205 | |
206 | sudo chown -R 0 __ | |
207 | sudo chgrp -R 0 __ | |
208 | ||
209 | mkdir -p debs | |
210 | ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb | |
211 | $(dpkg) -b __ Cydia_.deb | |
212 | @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)" | |
213 | ||
214 | package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb) | |
aa60b57b | 215 | |
10ff7664 | 216 | .PHONY: all clean package |