]> git.saurik.com Git - cydia.git/blob - makefile
Actually fixed the dropbar adjustments on iOS 7.
[cydia.git] / makefile
1 dev := $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/Developer
2 sdks := $(dev)/SDKs
3 ioss := $(sort $(patsubst $(sdks)/iPhoneOS%.sdk,%,$(wildcard $(sdks)/iPhoneOS*.sdk)))
4 ios := $(word $(words $(ioss)),$(ioss))
5
6 # XXX: as of iOS 6.x armv6 is not supported :(
7 ios := 5.1
8
9 # if you can tolerate clang, set this to blank
10 gcc := 4.2
11
12 ifeq ($(gcc),)
13 gxx := $(dev)/usr/bin/clang++
14 else
15 gxx := $(dev)/usr/bin/g++
16 endif
17
18 flags :=
19 link :=
20 libs :=
21
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
30 dpkg := dpkg-deb
31 endif
32
33 sdk := $(sdks)/iPhoneOS$(ios).sdk
34
35 flags += -F$(sdk)/System/Library/PrivateFrameworks
36 flags += -I. -isystem sysroot/usr/include
37 flags += -fmessage-length=0
38 flags += -g0 -O2
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
47 flags += -fobjc-exceptions
48 flags += -fno-guess-branch-probability
49 endif
50
51 flags += -Wno-deprecated-declarations
52
53 xflags :=
54 xflags += -fobjc-call-cxx-cdtors
55 xflags += -fvisibility-inlines-hidden
56
57 link += -Lsysroot/usr/lib
58 link += -multiply_defined suppress
59
60 libs += -framework CoreFoundation
61 libs += -framework CoreGraphics
62 libs += -framework Foundation
63 libs += -framework GraphicsServices
64 libs += -framework IOKit
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
75 uikit :=
76 uikit += -framework UIKit
77
78 backrow :=
79 backrow += -FAppleTV -framework BackRow -framework AppleTV
80
81 version := $(shell ./version.sh)
82
83 cycc = $(gxx) -mthumb -arch armv6 -o $@ -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
84 #cycc = cycc -r4.2 -i$(ios) -o$@
85
86 ifneq ($(gcc),)
87 cycc += -Xarch_armv6 -mcpu=arm1176jzf-s
88 endif
89
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))
94 code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm
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
107 images := $(shell find MobileCydia.app/ -type f -name '*.png')
108 images := $(images:%=Images/%)
109
110 lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
111
112 all: MobileCydia
113
114 clean:
115 rm -f MobileCydia postinst
116 rm -rf Objects/ Images/
117
118 Objects/%.o: %.c $(header)
119 @mkdir -p $(dir $@)
120 @echo "[cycc] $<"
121 @$(cycc) -c -x c $<
122
123 Objects/%.o: %.m $(header)
124 @mkdir -p $(dir $@)
125 @echo "[cycc] $<"
126 @$(cycc) -c $< $(flags)
127
128 Objects/%.o: %.mm $(header)
129 @mkdir -p $(dir $@)
130 @echo "[cycc] $<"
131 @$(cycc) -c $< $(flags) $(xflags)
132
133 Objects/Version.o: Version.h
134
135 Images/%.png: %.png
136 @mkdir -p $(dir $@)
137 @echo "[pngc] $<"
138 @./pngcrush.sh $< $@
139
140 sysroot: sysroot.sh
141 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
142 @echo 1>&2
143 @exit 1
144
145 MobileCydia: sysroot $(object) entitlements.xml
146 @echo "[link] $(object:Objects/%=%)"
147 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(libs) $(uikit) -Wl,-sdk_version,7.0
148 @mkdir -p bins
149 @cp -a $@ bins/$@-$(version)
150 @echo "[strp] $@"
151 @strip -no_uuid $@
152 @echo "[uikt] $@"
153 @./uikit.sh $@
154 @echo "[sign] $@"
155 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
156
157 CydiaAppliance: CydiaAppliance.mm
158 $(cycc) $(filter %.mm,$^) $(flags) $(link) -bundle $(libs) $(backrow)
159
160 cfversion: cfversion.mm
161 $(cycc) $(filter %.mm,$^) $(flags) -framework CoreFoundation
162 @ldid -T0 -S $@
163
164 postinst: postinst.mm Sources.mm Sources.h CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
165 $(cycc) $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation -framework Foundation -framework UIKit -lpcre
166 @ldid -T0 -S $@
167
168 debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh Library/startup
169 sudo rm -rf _
170 mkdir -p _/var/lib/cydia
171
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
176 mkdir -p _/usr/libexec
177 cp -a Library _/usr/libexec/cydia
178 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
179 cp -a cfversion _/usr/libexec/cydia
180
181 mkdir -p _/System/Library
182 cp -a LaunchDaemons _/System/Library/LaunchDaemons
183
184 mkdir -p _/Applications
185 cp -a MobileCydia.app _/Applications/Cydia.app
186 rm -rf _/Applications/Cydia.app/*.lproj
187 cp -a MobileCydia _/Applications/Cydia.app/MobileCydia
188
189 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
190
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
193 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
194
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
199 #mkdir -p _/Applications/Lowtide.app/Appliances
200 #ln -s {/Applications/AppleTV,_/Applications/Lowtide}.app/Appliances/Cydia.frappliance
201
202 mkdir -p _/DEBIAN
203 ./control.sh cydia.control _ >_/DEBIAN/control
204 cp -a preinst postinst _/DEBIAN/
205
206 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
207
208 sudo chown -R 0 _
209 sudo chgrp -R 0 _
210 sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
211
212 mkdir -p debs
213 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
214 $(dpkg) -b _ Cydia.deb
215 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
216
217 $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
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
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)
235
236 .PHONY: all clean package