4 dpkg := dpkg-deb -Zlzma
5 version := $(shell ./version.sh)
14 kind := iphonesimulator
21 gxx := $(shell xcrun --sdk $(kind) -f g++)
24 sdk := $(shell xcodebuild -sdk $(kind) -version Path)
25 mac := $(shell xcodebuild -sdk macosx -version Path)
27 cycc += -isysroot $(sdk)
28 cycc += -idirafter $(mac)/usr/include
29 cycc += -F$(sdk)/System/Library/PrivateFrameworks
32 cycc += -Xarch_x86_64 -F$(sdk)/../../../../iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks
35 cycc += -include system.h
37 cycc += -fmessage-length=0
39 cycc += -fvisibility=hidden
41 link += -Wl,-dead_strip
42 link += -Wl,-no_dead_strip_inits_and_terms
46 iapt += -Iapt32-contrib
49 iapt += -IObjects/apt32
52 flag += $(patsubst %,-Xarch_armv6 %,$(iapt))
55 flag += $(patsubst %,-Xarch_$(arch) %,$(subst apt32,apt64,$(iapt)))
58 flag += -isystem sysroot/usr/include
60 flag += -idirafter icu/icuSources/common
61 flag += -idirafter icu/icuSources/i18n
64 flag += -Wno-dangling-else
65 flag += -Wno-deprecated-declarations
66 flag += -Wno-objc-protocol-method-implementation
67 flag += -Wno-logical-op-parentheses
68 flag += -Wno-shift-op-parentheses
69 flag += -Wno-unknown-pragmas
70 flag += -Wno-unknown-warning-option
72 plus += -fobjc-call-cxx-cdtors
73 plus += -fvisibility-inlines-hidden
75 link += -multiply_defined suppress
77 libs += -framework CoreFoundation
78 libs += -framework CoreGraphics
79 libs += -framework Foundation
80 libs += -framework GraphicsServices
81 libs += -framework IOKit
82 libs += -framework QuartzCore
83 libs += -framework SpringBoardServices
84 libs += -framework SystemConfiguration
85 libs += -framework WebKit
87 libs += -framework CFNetwork
90 libs += -framework WebCore
92 libs += -Xarch_armv6 -Wl,-force_load,Objects/libapt32.a
93 lapt += Objects/libapt32.a
96 libs += -Xarch_$(arch) -Wl,-force_load,Objects/libapt64.a
97 lapt += Objects/libapt64.a
102 uikit += -framework UIKit
104 dirs := Menes CyteKit Cydia SDURLCache
106 code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
107 code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
108 code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm DiskUsage.cpp
113 source := $(filter %.m,$(code)) $(filter %.mm,$(code))
114 source += $(filter %.c,$(code)) $(filter %.cpp,$(code)) $(filter %.cc,$(code))
115 header := $(filter %.h,$(code)) $(filter %.hpp,$(code)) $(filter %.hh,$(code))
118 object := $(object:.c=.o)
119 object := $(object:.cpp=.o)
120 object := $(object:.cc=.o)
121 object := $(object:.m=.o)
122 object := $(object:.mm=.o)
123 object := $(object:%=Objects/%)
125 methods := copy file rred
128 libapt32 += $(wildcard apt32/apt-pkg/*.cc)
129 libapt32 += $(wildcard apt32/apt-pkg/deb/*.cc)
130 libapt32 += $(wildcard apt32/apt-pkg/contrib/*.cc)
131 libapt32 += apt32/methods/gzip.cc
132 libapt32 += $(patsubst %,apt32/methods/%.cc,$(methods))
133 libapt32 := $(patsubst %.cc,Objects/%.o,$(libapt32))
136 libapt64 += $(wildcard apt64/apt-pkg/*.cc)
137 libapt64 += $(wildcard apt64/apt-pkg/deb/*.cc)
138 libapt64 += $(wildcard apt64/apt-pkg/contrib/*.cc)
139 libapt64 += apt64/apt-pkg/tagfile-keys.cc
140 libapt64 += apt64/methods/store.cc
141 libapt64 += $(patsubst %,apt64/methods/%.cc,$(methods))
142 libapt64 := $(filter-out %/srvrec.cc,$(libapt64))
143 libapt64 := $(patsubst %.cc,Objects/%.o,$(libapt64))
146 link += -Xarch_$(arch) -Wl,-lz
148 flag += -DAPT_PKG_EXPOSE_STRING_VIEW
149 flag += -Dsighandler_t=sig_t
153 flag32 += -arch armv6
154 flag32 += -Xarch_armv6 -miphoneos-version-min=2.0
155 flag32 += -Xarch_armv6 -marm # @synchronized
156 flag32 += -Xarch_armv6 -mcpu=arm1176jzf-s
157 flag32 += -mllvm -arm-reserve-r9
159 link += -Xarch_armv6 -Wl,-lgcc_s.1
160 link += -Xarch_armv6 -Wl,-segalign,4000
162 apt32 := $(cycc) $(flag32) $(flag)
163 apt32 += -Wno-deprecated-register
164 apt32 += -Wno-format-security
165 apt32 += -Wno-tautological-compare
166 apt32 += -Wno-uninitialized
167 apt32 += -Wno-unused-private-field
168 apt32 += -Wno-unused-variable
172 flag64 += -arch $(arch)
173 flag64 += -Xarch_$(arch) -m$(kind)-version-min=7.0
175 apt64 := $(cycc) $(flag64) $(flag)
176 apt64 += -include apt.h
177 apt64 += -Wno-deprecated-register
178 apt64 += -Wno-unused-private-field
179 apt64 += -Wno-unused-variable
181 eapt := -include apt.h
183 eapt += -D'VERSION="0.7.25.3"'
186 eapt += -Wno-logical-op-parentheses
197 images := $(shell find MobileCydia.app/ -type f -name '*.png')
198 images := $(images:%=Images/%)
200 lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
205 rm -f MobileCydia postinst
206 rm -rf Objects/ Images/
208 Objects/apt64/apt-pkg/tagfile.o: Objects/apt64/apt-pkg/tagfile-keys.h
209 Objects/apt64/apt-pkg/deb/deblistparser.o: Objects/apt64/apt-pkg/tagfile-keys.h
211 Objects/apt64/apt-pkg/tagfile-keys%h apt64/apt-pkg/tagfile-keys%cc:
213 mkdir -p Objects/apt64/apt-pkg
214 cd apt64 && ../apt64/triehash/triehash.pl \
216 --header ../Objects/apt64/apt-pkg/tagfile-keys.h \
217 --code apt-pkg/tagfile-keys.cc \
219 --enum-name pkgTagSection::Key \
220 --function-name pkgTagHash \
221 --include "<apt-pkg/tagfile.h>" \
222 ../apt64/apt-pkg/tagfile-keys.list
223 sed -i -e 's@typedef char static_assert64@//\\0@' apt64/apt-pkg/tagfile-keys.cc
225 Objects/%.o: %.cc $(header)
228 @$(cycc) $(plus) -c -o $@ $< $(flag) -Wno-format -include apt.h -Dmain=main_$(basename $(notdir $@))
230 Objects/apt32/%.o: apt32/%.cc $(header) apt.h apt-extra/*.h
233 @$(apt32) -c -o $@ $< -Dmain=main_$(basename $(notdir $@))
235 Objects/apt64/%.o: apt64/%.cc $(header) apt.h apt-extra/*.h
238 @$(apt64) $(plus) -c -o $@ $< -Dmain=main_$(basename $(notdir $@))
240 Objects/%.o: %.c $(header)
243 @$(cycc) -c -o $@ -x c $< $(flag)
245 Objects/%.o: %.m $(header)
248 @$(cycc) -c -o $@ $< $(flag)
250 Objects/%.o: %.cpp $(header)
253 @$(cycc) $(plus) -c -o $@ $< $(flag)
255 Objects/%.o: %.mm $(header)
258 @$(cycc) $(plus) -c -o $@ $< $(flag)
260 Objects/Version.o: Version.h
268 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
272 Objects/libapt32.a: $(libapt32)
276 Objects/libapt64.a: $(libapt64)
280 MobileCydia: $(object) entitlements.xml $(lapt)
282 @$(cycc) -o $@ $(filter %.o,$^) $(link) $(libs) $(uikit) -Wl,-sdk_version,8.0
284 @cp -a $@ bins/$@-$(version)_$(shell date +%s)
286 @grep '~' <<<"$(version)" >/dev/null && echo "skipping..." || strip $@
290 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
292 cfversion: cfversion.mm
293 $(cycc) -o $@ $(filter %.mm,$^) $(flag) $(link) -framework CoreFoundation
296 setnsfpn: setnsfpn.cpp
297 $(cycc) -o $@ $(filter %.cpp,$^) $(flag) $(link)
301 $(cycc) $(plus) -o $@ $(filter %.cpp,$^) $(flag) $(link) -Wno-deprecated-writable-strings
304 postinst: postinst.mm CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
305 $(cycc) $(plus) -o $@ $(filter %.mm,$^) $(flag) $(link) -framework CoreFoundation -framework Foundation -framework UIKit
308 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
310 mkdir -p _/var/lib/cydia
313 mkdir _/etc/apt/apt.conf.d
314 mkdir _/etc/apt/preferences.d
315 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
316 cp -a Sources.list _/etc/apt/sources.list.d
318 mkdir -p _/usr/libexec
319 cp -a Library _/usr/libexec/cydia
320 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
321 cp -a cfversion _/usr/libexec/cydia
322 cp -a setnsfpn _/usr/libexec/cydia
324 cp -a cydo _/usr/libexec/cydia
327 cp -a LaunchDaemons _/Library/LaunchDaemons
329 mkdir -p _/Applications
330 cp -a MobileCydia.app _/Applications/Cydia.app
331 rm -rf _/Applications/Cydia.app/*.lproj
332 cp -a MobileCydia _/Applications/Cydia.app/Cydia
334 for meth in bzip2 gzip lzma gpgv http https store $(methods); do ln -s Cydia _/Applications/Cydia.app/"$${meth}"; done
336 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
338 mkdir -p _/Applications/Cydia.app/Sources
339 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
340 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
343 ./control.sh cydia.control _ >_/DEBIAN/control
344 cp -a preinst postinst _/DEBIAN/
346 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
350 sudo chmod 6755 _/usr/libexec/cydia/cydo
353 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
354 $(dpkg) -b _ Cydia.deb
355 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
357 $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
359 mkdir -p __/Applications/Cydia.app
361 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
364 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
370 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
371 $(dpkg) -b __ Cydia_.deb
372 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
374 package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
376 .PHONY: all clean package