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