]> git.saurik.com Git - cydia.git/blame - makefile
Cytore values need to be _packed (I got lucky :D).
[cydia.git] / makefile
CommitLineData
0209cce5
JF
1.DELETE_ON_ERROR:
2.SECONDARY:
3
4dpkg := dpkg-deb -Zlzma
5version := $(shell ./version.sh)
4cc9e99a 6
0209cce5
JF
7flag :=
8plus :=
c21004b9 9link :=
543e172a 10libs :=
c21004b9 11
0209cce5
JF
12gxx := $(shell xcrun --sdk iphoneos -f g++)
13cycc := $(gxx)
14
15sdk := $(shell xcodebuild -sdk iphoneos -version Path)
16cycc += -isysroot $(sdk)
17cycc += -idirafter /usr/include
18cycc += -F$(sdk)/System/Library/PrivateFrameworks
19
20cycc += -arch arm64
21cycc += -Xarch_arm64 -miphoneos-version-min=7.0
22
23cycc += -fmessage-length=0
24cycc += -gfull -O2
25cycc += -fvisibility=hidden
ee4120ad 26
0209cce5
JF
27link += -Wl,-dead_strip
28link += -Wl,-no_dead_strip_inits_and_terms
4cc9e99a 29
0209cce5
JF
30flag += -Xarch_arm64 -Iapt
31flag += -Xarch_arm64 -Iapt-contrib
32flag += -Xarch_arm64 -Iapt-deb
33flag += -Xarch_arm64 -Iapt-extra
34flag += -Xarch_arm64 -Iapt-tag
8e57d50b 35
0209cce5
JF
36flag += -I.
37flag += -isystem sysroot/usr/include
4cc9e99a 38
0209cce5
JF
39flag += -idirafter icu/icuSources/common
40flag += -idirafter icu/icuSources/i18n
7c8912f8 41
0209cce5
JF
42flag += -Wall
43flag += -Wno-dangling-else
44flag += -Wno-deprecated-declarations
45flag += -Wno-objc-protocol-method-implementation
46flag += -Wno-logical-op-parentheses
47flag += -Wno-shift-op-parentheses
48flag += -Wno-unknown-pragmas
49flag += -Wno-unknown-warning-option
50
51plus += -fobjc-call-cxx-cdtors
52plus += -fvisibility-inlines-hidden
c21004b9 53
4cc9e99a 54link += -Lsysroot/usr/lib
c21004b9 55link += -multiply_defined suppress
5f6bff8c 56
543e172a
JF
57libs += -framework CoreFoundation
58libs += -framework CoreGraphics
59libs += -framework Foundation
60libs += -framework GraphicsServices
61libs += -framework IOKit
543e172a
JF
62libs += -framework QuartzCore
63libs += -framework SpringBoardServices
64libs += -framework SystemConfiguration
65libs += -framework WebCore
66libs += -framework WebKit
67
0209cce5
JF
68libs += -Xarch_armv6 -Wl,-lapt-pkg
69libs += -Xarch_arm64 -Wl,Objects/libapt64.a
8e57d50b 70libs += -licucore
543e172a 71
e17a8c4f
JF
72uikit :=
73uikit += -framework UIKit
74
0209cce5 75link += -Wl,-segalign,4000
eb40eaca 76
7c8912f8
JF
77dirs := Menes CyteKit Cydia SDURLCache
78
79code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
80code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
e40620ab 81code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm DiskUsage.cpp
7c8912f8
JF
82
83source := $(filter %.m,$(code)) $(filter %.mm,$(code))
84source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
85header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
86
87object := $(source)
88object := $(object:.c=.o)
89object := $(object:.cpp=.o)
90object := $(object:.m=.o)
91object := $(object:.mm=.o)
92object := $(object:%=Objects/%)
93
0209cce5
JF
94libapt :=
95libapt += $(wildcard apt/apt-pkg/*.cc)
96libapt += $(wildcard apt/apt-pkg/deb/*.cc)
97libapt += $(wildcard apt/apt-pkg/contrib/*.cc)
98libapt += apt-tag/apt-pkg/tagfile-keys.cc
99libapt += apt/methods/store.cc
100libapt := $(filter-out %/srvrec.cc,$(libapt))
101libapt := $(patsubst %.cc,Objects/%.o,$(libapt))
102
103link += -Xarch_arm64 -Wl,-lz,-liconv
104
105flag += -DAPT_PKG_EXPOSE_STRING_VIEW
106flag += -Dsighandler_t=sig_t
107
108aptc := $(cycc) $(flag)
109aptc += -include apt.h
110aptc += -Wno-deprecated-register
111aptc += -Wno-unused-private-field
112aptc += -Wno-unused-variable
113
114cycc += -arch armv6
115cycc += -Xarch_armv6 -miphoneos-version-min=2.0
116flag += -Xarch_armv6 -marm # @synchronized
117flag += -Xarch_armv6 -mcpu=arm1176jzf-s
118flag += -mllvm -arm-reserve-r9
119link += -Xarch_armv6 -Wl,-lgcc_s.1
120
121plus += -std=c++11
122#plus += -Wp,-stdlib=libc++
123#link += libcxx/lib/libc++.a
124
4339c9ef 125images := $(shell find MobileCydia.app/ -type f -name '*.png')
8a4d4662
JF
126images := $(images:%=Images/%)
127
915284a6
JF
128lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
129
e17a8c4f 130all: MobileCydia
dc5812ec 131
5f6bff8c 132clean:
eaa9f122 133 rm -f MobileCydia postinst
8a4d4662 134 rm -rf Objects/ Images/
7c8912f8 135
0209cce5
JF
136Objects/%.o: %.cc $(header) apt.h apt-extra/*.h
137 @mkdir -p $(dir $@)
138 @echo "[cycc] $<"
139 @$(aptc) $(plus) -c -o $@ $< -Dmain=main_$(basename $(notdir $@))
140
7c8912f8
JF
141Objects/%.o: %.c $(header)
142 @mkdir -p $(dir $@)
143 @echo "[cycc] $<"
0209cce5 144 @$(cycc) -c -o $@ -x c $< $(flag)
7c8912f8
JF
145
146Objects/%.o: %.m $(header)
147 @mkdir -p $(dir $@)
148 @echo "[cycc] $<"
0209cce5 149 @$(cycc) -c -o $@ $< $(flag)
5f6bff8c 150
e40620ab
JF
151Objects/%.o: %.cpp $(header)
152 @mkdir -p $(dir $@)
153 @echo "[cycc] $<"
0209cce5 154 @$(cycc) $(plus) -c -o $@ $< $(flag)
e40620ab 155
7c8912f8
JF
156Objects/%.o: %.mm $(header)
157 @mkdir -p $(dir $@)
158 @echo "[cycc] $<"
0209cce5 159 @$(cycc) $(plus) -c -o $@ $< $(flag)
e95a1972 160
174327c1 161Objects/Version.o: Version.h
e61d7bfc 162
8a4d4662
JF
163Images/%.png: %.png
164 @mkdir -p $(dir $@)
165 @echo "[pngc] $<"
166 @./pngcrush.sh $< $@
167
0d5393af
JF
168sysroot: sysroot.sh
169 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
8a2c6d14
JF
170 @echo 1>&2
171 @exit 1
172
0209cce5
JF
173Objects/libapt64.a: $(libapt)
174 @echo "[arch] $@"
175 @ar -rc $@ $^
176
177MobileCydia: sysroot $(object) entitlements.xml Objects/libapt64.a
178 @echo "[link] $@"
179 @$(cycc) -o $@ $(filter %.o,$^) $(link) $(libs) $(uikit) -Wl,-sdk_version,8.0
0dbada51 180 @mkdir -p bins
665d1e62 181 @cp -a $@ bins/$@-$(version)
443b9e05 182 @echo "[strp] $@"
c158ffc8 183 @strip $@
cc31c45d
JF
184 @echo "[uikt] $@"
185 @./uikit.sh $@
7c8912f8 186 @echo "[sign] $@"
9c0eddfd 187 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
03c0f7a9 188
e967efd5 189cfversion: cfversion.mm
0209cce5 190 $(cycc) -o $@ $(filter %.mm,$^) $(flag) $(link) -framework CoreFoundation
e967efd5
JF
191 @ldid -T0 -S $@
192
82e370b3 193setnsfpn: setnsfpn.cpp
0209cce5 194 $(cycc) -o $@ $(filter %.cpp,$^) $(flag) $(link)
82e370b3
JF
195 @ldid -T0 -S $@
196
232b396b 197cydo: cydo.cpp
0209cce5 198 $(cycc) $(plus) -o $@ $(filter %.cpp,$^) $(flag) $(link) -Wno-deprecated-writable-strings
232b396b
JF
199 @ldid -T0 -S $@
200
f6b68b2c 201postinst: postinst.mm CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
0209cce5 202 $(cycc) $(plus) -o $@ $(filter %.mm,$^) $(flag) $(link) -framework CoreFoundation -framework Foundation -framework UIKit
2d46d29e 203 @ldid -T0 -S $@
eaa9f122 204
232b396b 205debs/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 206 sudo rm -rf _
03c0f7a9
JF
207 mkdir -p _/var/lib/cydia
208
33e30380
JF
209 mkdir -p _/etc/apt
210 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
211 cp -a Sources.list _/etc/apt/sources.list.d
212
03c0f7a9 213 mkdir -p _/usr/libexec
c21004b9 214 cp -a Library _/usr/libexec/cydia
d3b5a983 215 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
e967efd5 216 cp -a cfversion _/usr/libexec/cydia
82e370b3 217 cp -a setnsfpn _/usr/libexec/cydia
03c0f7a9 218
232b396b 219 cp -a cydo _/usr/libexec/cydia
232b396b 220
2eef6631
JF
221 mkdir -p _/Library
222 cp -a LaunchDaemons _/Library/LaunchDaemons
03c0f7a9
JF
223
224 mkdir -p _/Applications
e17a8c4f 225 cp -a MobileCydia.app _/Applications/Cydia.app
915284a6 226 rm -rf _/Applications/Cydia.app/*.lproj
f7f32d9a 227 cp -a MobileCydia _/Applications/Cydia.app/Cydia
0209cce5 228 ln -s Cydia _/Applications/Cydia.app/store
e17a8c4f 229
8a4d4662
JF
230 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
231
4339c9ef
JF
232 mkdir -p _/Applications/Cydia.app/Sources
233 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
5ad3e6d9
JF
234 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
235
03c0f7a9 236 mkdir -p _/DEBIAN
915284a6 237 ./control.sh cydia.control _ >_/DEBIAN/control
eaa9f122 238 cp -a preinst postinst _/DEBIAN/
03c0f7a9 239
8fec9d25 240 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
7fc02989 241
7e2bd591
JF
242 sudo chown -R 0 _
243 sudo chgrp -R 0 _
0209cce5 244 sudo chmod 6755 _/usr/libexec/cydia/cydo
7e2bd591 245
3adcfba7 246 mkdir -p debs
f9ba524a 247 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
3adcfba7 248 $(dpkg) -b _ Cydia.deb
ce0372db 249 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
8cc774c5 250
33e30380 251$(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
915284a6
JF
252 sudo rm -rf __
253 mkdir -p __/Applications/Cydia.app
254
255 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
256
257 mkdir -p __/DEBIAN
258 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
915284a6
JF
259
260 sudo chown -R 0 __
261 sudo chgrp -R 0 __
262
263 mkdir -p debs
264 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
265 $(dpkg) -b __ Cydia_.deb
266 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
267
268package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
aa60b57b 269
10ff7664 270.PHONY: all clean package