4 dpkg := dpkg-deb -Zlzma
5 version := $(shell ./version.sh)
12 gxx := $(shell xcrun --sdk iphoneos -f g++)
15 sdk := $(shell xcodebuild -sdk iphoneos -version Path)
16 cycc += -isysroot $(sdk)
17 cycc += -idirafter /usr/include
18 cycc += -F$(sdk)/System/Library/PrivateFrameworks
20 cycc += -fmessage-length=0
22 cycc += -fvisibility=hidden
24 link += -Wl,-dead_strip
25 link += -Wl,-no_dead_strip_inits_and_terms
27 flag += -Xarch_armv6 -Iapt32
28 flag += -Xarch_armv6 -Iapt32-contrib
29 flag += -Xarch_armv6 -Iapt32-deb
30 flag += -Xarch_armv6 -Iapt-extra
31 flag += -Xarch_armv6 -IObjects/apt32
33 flag += -Xarch_arm64 -Iapt64
34 flag += -Xarch_arm64 -Iapt64-contrib
35 flag += -Xarch_arm64 -Iapt64-deb
36 flag += -Xarch_arm64 -Iapt-extra
37 flag += -Xarch_arm64 -IObjects/apt64
40 flag += -isystem sysroot/usr/include
42 flag += -idirafter icu/icuSources/common
43 flag += -idirafter icu/icuSources/i18n
46 flag += -Wno-dangling-else
47 flag += -Wno-deprecated-declarations
48 flag += -Wno-objc-protocol-method-implementation
49 flag += -Wno-logical-op-parentheses
50 flag += -Wno-shift-op-parentheses
51 flag += -Wno-unknown-pragmas
52 flag += -Wno-unknown-warning-option
54 plus += -fobjc-call-cxx-cdtors
55 plus += -fvisibility-inlines-hidden
57 link += -multiply_defined suppress
59 libs += -framework CoreFoundation
60 libs += -framework CoreGraphics
61 libs += -framework Foundation
62 libs += -framework GraphicsServices
63 libs += -framework IOKit
64 libs += -framework QuartzCore
65 libs += -framework SpringBoardServices
66 libs += -framework SystemConfiguration
67 libs += -framework WebCore
68 libs += -framework WebKit
70 libs += -Xarch_armv6 -Wl,-force_load,Objects/libapt32.a
71 libs += -Xarch_arm64 -Wl,-force_load,Objects/libapt64.a
76 uikit += -framework UIKit
78 link += -Xarch_armv6 -Wl,-segalign,4000
80 dirs := Menes CyteKit Cydia SDURLCache
82 code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
83 code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
84 code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm DiskUsage.cpp
86 source := $(filter %.m,$(code)) $(filter %.mm,$(code))
87 source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
88 header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
91 object := $(object:.c=.o)
92 object := $(object:.cpp=.o)
93 object := $(object:.m=.o)
94 object := $(object:.mm=.o)
95 object := $(object:%=Objects/%)
98 libapt32 += $(wildcard apt32/apt-pkg/*.cc)
99 libapt32 += $(wildcard apt32/apt-pkg/deb/*.cc)
100 libapt32 += $(wildcard apt32/apt-pkg/contrib/*.cc)
101 libapt32 := $(patsubst %.cc,Objects/%.o,$(libapt32))
104 libapt64 += $(wildcard apt64/apt-pkg/*.cc)
105 libapt64 += $(wildcard apt64/apt-pkg/deb/*.cc)
106 libapt64 += $(wildcard apt64/apt-pkg/contrib/*.cc)
107 libapt64 += apt64/apt-pkg/tagfile-keys.cc
108 libapt64 += apt64/methods/store.cc
109 libapt64 := $(filter-out %/srvrec.cc,$(libapt64))
110 libapt64 := $(patsubst %.cc,Objects/%.o,$(libapt64))
113 link += -Xarch_arm64 -Wl,-lz
115 flag += -DAPT_PKG_EXPOSE_STRING_VIEW
116 flag += -Dsighandler_t=sig_t
119 flag32 += -arch armv6
120 flag32 += -Xarch_armv6 -miphoneos-version-min=2.0
121 flag32 += -Xarch_armv6 -marm # @synchronized
122 flag32 += -Xarch_armv6 -mcpu=arm1176jzf-s
123 flag32 += -mllvm -arm-reserve-r9
124 link += -Xarch_armv6 -Wl,-lgcc_s.1
127 flag64 += -arch arm64
128 flag64 += -Xarch_arm64 -miphoneos-version-min=7.0
130 apt32 := $(cycc) $(flag32) $(flag)
131 apt32 += -include apt.h
132 apt32 += -Wno-deprecated-register
133 apt32 += -Wno-format-security
134 apt32 += -Wno-tautological-compare
135 apt32 += -Wno-uninitialized
136 apt32 += -Wno-unused-private-field
137 apt32 += -Wno-unused-variable
138 apt32 += -D'VERSION="0.7.25.3"'
140 apt64 := $(cycc) $(flag64) $(flag)
141 apt64 += -include apt.h
142 apt64 += -Wno-deprecated-register
143 apt64 += -Wno-unused-private-field
144 apt64 += -Wno-unused-variable
151 images := $(shell find MobileCydia.app/ -type f -name '*.png')
152 images := $(images:%=Images/%)
154 lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
159 rm -f MobileCydia postinst
160 rm -rf Objects/ Images/
162 Objects/apt64/apt-pkg/tagfile.o: apt64/apt-pkg/tagfile-keys.cc
163 Objects/apt64/apt-pkg/deb/deblistparser.o: apt64/apt-pkg/tagfile-keys.cc
165 apt64/apt-pkg/tagfile-keys.cc:
167 mkdir -p Objects/apt64/apt-pkg
168 cd apt64 && ../apt64/triehash/triehash.pl \
170 --header ../Objects/apt64/apt-pkg/tagfile-keys.h \
171 --code apt-pkg/tagfile-keys.cc \
173 --enum-name pkgTagSection::Key \
174 --function-name pkgTagHash \
175 --include "<apt-pkg/tagfile.h>" \
176 ../apt64/apt-pkg/tagfile-keys.list
177 sed -i -e 's@typedef char static_assert64@//\\0@' $@
179 Objects/apt32/%.o: apt32/%.cc $(header) apt.h apt-extra/*.h
182 @$(apt32) -c -o $@ $< -Dmain=main_$(basename $(notdir $@))
184 Objects/apt64/%.o: apt64/%.cc $(header) apt.h apt-extra/*.h
187 @$(apt64) $(plus) -c -o $@ $< -Dmain=main_$(basename $(notdir $@))
189 Objects/%.o: %.c $(header)
192 @$(cycc) -c -o $@ -x c $< $(flag)
194 Objects/%.o: %.m $(header)
197 @$(cycc) -c -o $@ $< $(flag)
199 Objects/%.o: %.cpp $(header)
202 @$(cycc) $(plus) -c -o $@ $< $(flag)
204 Objects/%.o: %.mm $(header)
207 @$(cycc) $(plus) -c -o $@ $< $(flag)
209 Objects/Version.o: Version.h
217 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
221 Objects/libapt32.a: $(libapt32)
225 Objects/libapt64.a: $(libapt64)
229 MobileCydia: $(object) entitlements.xml Objects/libapt32.a Objects/libapt64.a
231 @$(cycc) -o $@ $(filter %.o,$^) $(link) $(libs) $(uikit) -Wl,-sdk_version,8.0
233 @cp -a $@ bins/$@-$(version)_$(shell date +%s)
235 @grep '~' <<<"$(version)" >/dev/null && echo "skipping..." || strip $@
239 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
241 cfversion: cfversion.mm
242 $(cycc) -o $@ $(filter %.mm,$^) $(flag) $(link) -framework CoreFoundation
245 setnsfpn: setnsfpn.cpp
246 $(cycc) -o $@ $(filter %.cpp,$^) $(flag) $(link)
250 $(cycc) $(plus) -o $@ $(filter %.cpp,$^) $(flag) $(link) -Wno-deprecated-writable-strings
253 postinst: postinst.mm CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
254 $(cycc) $(plus) -o $@ $(filter %.mm,$^) $(flag) $(link) -framework CoreFoundation -framework Foundation -framework UIKit
257 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
259 mkdir -p _/var/lib/cydia
262 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
263 cp -a Sources.list _/etc/apt/sources.list.d
265 mkdir -p _/usr/libexec
266 cp -a Library _/usr/libexec/cydia
267 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
268 cp -a cfversion _/usr/libexec/cydia
269 cp -a setnsfpn _/usr/libexec/cydia
271 cp -a cydo _/usr/libexec/cydia
274 cp -a LaunchDaemons _/Library/LaunchDaemons
276 mkdir -p _/Applications
277 cp -a MobileCydia.app _/Applications/Cydia.app
278 rm -rf _/Applications/Cydia.app/*.lproj
279 cp -a MobileCydia _/Applications/Cydia.app/Cydia
280 ln -s Cydia _/Applications/Cydia.app/store
282 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
284 mkdir -p _/Applications/Cydia.app/Sources
285 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
286 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
289 ./control.sh cydia.control _ >_/DEBIAN/control
290 cp -a preinst postinst _/DEBIAN/
292 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
296 sudo chmod 6755 _/usr/libexec/cydia/cydo
299 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
300 $(dpkg) -b _ Cydia.deb
301 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
303 $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
305 mkdir -p __/Applications/Cydia.app
307 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
310 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
316 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
317 $(dpkg) -b __ Cydia_.deb
318 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
320 package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
322 .PHONY: all clean package