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