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