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