]> git.saurik.com Git - cydia.git/blob - makefile
Allow user to select a specific candidate version.
[cydia.git] / makefile
1 gxx := $(shell xcrun --sdk iphoneos -f g++)
2 sdk := $(shell xcodebuild -sdk iphoneos -version Path)
3
4 flags :=
5 link :=
6 libs :=
7
8 dpkg := dpkg-deb -Zlzma
9
10 flags += -F$(sdk)/System/Library/PrivateFrameworks
11 flags += -I. -isystem sysroot/usr/include
12 flags += -fmessage-length=0
13 flags += -g0 -O2
14 flags += -fvisibility=hidden
15
16 flags += -idirafter icu/icuSources/common
17 flags += -idirafter icu/icuSources/i18n
18
19 flags += -Wall
20
21 flags += -Wno-unknown-warning-option
22 flags += -Wno-logical-op-parentheses
23 flags += -Wno-dangling-else
24 flags += -Wno-shift-op-parentheses
25 flags += -Wno-deprecated-declarations
26
27 xflags :=
28 xflags += -fobjc-call-cxx-cdtors
29 xflags += -fvisibility-inlines-hidden
30
31 link += -Lsysroot/usr/lib
32 link += -multiply_defined suppress
33
34 libs += -framework CoreFoundation
35 libs += -framework CoreGraphics
36 libs += -framework Foundation
37 libs += -framework GraphicsServices
38 libs += -framework IOKit
39 libs += -framework QuartzCore
40 libs += -framework SpringBoardServices
41 libs += -framework SystemConfiguration
42 libs += -framework WebCore
43 libs += -framework WebKit
44
45 libs += -lapt-pkg
46 libs += -licucore
47
48 uikit :=
49 uikit += -framework UIKit
50
51 version := $(shell ./version.sh)
52
53 cycc = $(gxx) -arch armv6 -o $@ -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
54
55 cycc += -marm # @synchronized
56 cycc += -mcpu=arm1176jzf-s
57 cycc += -mllvm -arm-reserve-r9
58 link += -lgcc_s.1
59
60 dirs := Menes CyteKit Cydia SDURLCache
61
62 code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
63 code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
64 code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm DiskUsage.cpp
65
66 source := $(filter %.m,$(code)) $(filter %.mm,$(code))
67 source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
68 header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
69
70 object := $(source)
71 object := $(object:.c=.o)
72 object := $(object:.cpp=.o)
73 object := $(object:.m=.o)
74 object := $(object:.mm=.o)
75 object := $(object:%=Objects/%)
76
77 images := $(shell find MobileCydia.app/ -type f -name '*.png')
78 images := $(images:%=Images/%)
79
80 lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
81
82 all: MobileCydia
83
84 clean:
85 rm -f MobileCydia postinst
86 rm -rf Objects/ Images/
87
88 Objects/%.o: %.c $(header)
89 @mkdir -p $(dir $@)
90 @echo "[cycc] $<"
91 @$(cycc) -c -x c $<
92
93 Objects/%.o: %.m $(header)
94 @mkdir -p $(dir $@)
95 @echo "[cycc] $<"
96 @$(cycc) -c $< $(flags)
97
98 Objects/%.o: %.cpp $(header)
99 @mkdir -p $(dir $@)
100 @echo "[cycc] $<"
101 @$(cycc) -std=c++11 -c $< $(flags) $(xflags)
102
103 Objects/%.o: %.mm $(header)
104 @mkdir -p $(dir $@)
105 @echo "[cycc] $<"
106 @$(cycc) -std=c++11 -c $< $(flags) $(xflags)
107
108 Objects/Version.o: Version.h
109
110 Images/%.png: %.png
111 @mkdir -p $(dir $@)
112 @echo "[pngc] $<"
113 @./pngcrush.sh $< $@
114
115 sysroot: sysroot.sh
116 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
117 @echo 1>&2
118 @exit 1
119
120 MobileCydia: sysroot $(object) entitlements.xml
121 @echo "[link] $(object:Objects/%=%)"
122 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(libs) $(uikit) -Wl,-sdk_version,8.0
123 @mkdir -p bins
124 @cp -a $@ bins/$@-$(version)
125 @echo "[strp] $@"
126 @strip $@
127 @echo "[uikt] $@"
128 @./uikit.sh $@
129 @echo "[sign] $@"
130 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
131
132 cfversion: cfversion.mm
133 $(cycc) $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation
134 @ldid -T0 -S $@
135
136 setnsfpn: setnsfpn.cpp
137 $(cycc) $(filter %.cpp,$^) $(flags) $(link)
138 @ldid -T0 -S $@
139
140 cydo: cydo.cpp
141 $(cycc) -std=c++11 $(filter %.cpp,$^) $(flags) $(link) -Wno-deprecated-writable-strings
142 @ldid -T0 -S $@
143
144 postinst: postinst.mm CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
145 $(cycc) -std=c++11 $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation -framework Foundation -framework UIKit
146 @ldid -T0 -S $@
147
148 debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion setnsfpn cydo $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh Library/move.sh Library/startup
149 sudo rm -rf _
150 mkdir -p _/var/lib/cydia
151
152 mkdir -p _/etc/apt
153 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
154 cp -a Sources.list _/etc/apt/sources.list.d
155
156 mkdir -p _/usr/libexec
157 cp -a Library _/usr/libexec/cydia
158 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
159 cp -a cfversion _/usr/libexec/cydia
160 cp -a setnsfpn _/usr/libexec/cydia
161
162 cp -a cydo _/usr/libexec/cydia
163 sudo chmod 6755 _/usr/libexec/cydia/cydo
164
165 mkdir -p _/Library
166 cp -a LaunchDaemons _/Library/LaunchDaemons
167
168 mkdir -p _/Applications
169 cp -a MobileCydia.app _/Applications/Cydia.app
170 rm -rf _/Applications/Cydia.app/*.lproj
171 cp -a MobileCydia _/Applications/Cydia.app/Cydia
172
173 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
174
175 mkdir -p _/Applications/Cydia.app/Sources
176 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
177 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
178
179 mkdir -p _/DEBIAN
180 ./control.sh cydia.control _ >_/DEBIAN/control
181 cp -a preinst postinst _/DEBIAN/
182
183 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
184
185 sudo chown -R 0 _
186 sudo chgrp -R 0 _
187
188 mkdir -p debs
189 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
190 $(dpkg) -b _ Cydia.deb
191 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
192
193 $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
194 sudo rm -rf __
195 mkdir -p __/Applications/Cydia.app
196
197 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
198
199 mkdir -p __/DEBIAN
200 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
201
202 sudo chown -R 0 __
203 sudo chgrp -R 0 __
204
205 mkdir -p debs
206 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
207 $(dpkg) -b __ Cydia_.deb
208 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
209
210 package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
211
212 .PHONY: all clean package