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