1 dev := $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/Developer
3 ioss := $(sort $(patsubst $(sdks)/iPhoneOS%.sdk,%,$(wildcard $(sdks)/iPhoneOS*.sdk)))
4 ios := $(word $(words $(ioss)),$(ioss))
6 # XXX: as of iOS 6.x armv6 is not supported :(
9 # if you can tolerate clang, set this to blank
13 gxx := $(dev)/usr/bin/clang++
15 gxx := $(dev)/usr/bin/g++
22 ifeq (o,O) # gzip is actually better
23 dpkg := /Library/Cydia/bin/dpkg-deb
24 ifeq ($(wildcard $(dpkg)),$(dpkg))
25 dpkg := $(dpkg) -zlzma
27 dpkg := dpkg-deb -zbzip2
33 sdk := $(sdks)/iPhoneOS$(ios).sdk
35 flags += -F$(sdk)/System/Library/PrivateFrameworks
36 flags += -I. -isystem sysroot/usr/include
37 flags += -fmessage-length=0
39 flags += -fvisibility=hidden
44 flags += -Wno-unknown-warning-option
45 flags += -Wno-logical-op-parentheses
47 flags += -fobjc-exceptions
48 flags += -fno-guess-branch-probability
51 flags += -Wno-deprecated-declarations
54 xflags += -fobjc-call-cxx-cdtors
55 xflags += -fvisibility-inlines-hidden
57 link += -Lsysroot/usr/lib
58 link += -multiply_defined suppress
60 libs += -framework CoreFoundation
61 libs += -framework CoreGraphics
62 libs += -framework Foundation
63 libs += -framework GraphicsServices
64 libs += -framework IOKit
65 libs += -framework JavaScriptCore
66 libs += -framework QuartzCore
67 libs += -framework SpringBoardServices
68 libs += -framework SystemConfiguration
69 libs += -framework WebCore
70 libs += -framework WebKit
77 uikit += -framework UIKit
80 backrow += -FAppleTV -framework BackRow -framework AppleTV
82 version := $(shell ./version.sh)
84 cycc = $(gxx) -mthumb -arch armv6 -o $@ -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
85 #cycc = cycc -r4.2 -i$(ios) -o$@
88 cycc += -Xarch_armv6 -mcpu=arm1176jzf-s
91 dirs := Menes CyteKit Cydia SDURLCache
93 code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
94 code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
95 code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm
97 source := $(filter %.m,$(code)) $(filter %.mm,$(code))
98 source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
99 header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
102 object := $(object:.c=.o)
103 object := $(object:.cpp=.o)
104 object := $(object:.m=.o)
105 object := $(object:.mm=.o)
106 object := $(object:%=Objects/%)
108 images := $(shell find MobileCydia.app/ -type f -name '*.png')
109 images := $(images:%=Images/%)
111 lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
116 rm -f MobileCydia postinst
117 rm -rf Objects/ Images/
119 Objects/%.o: %.c $(header)
124 Objects/%.o: %.m $(header)
127 @$(cycc) -c $< $(flags)
129 Objects/%.o: %.mm $(header)
132 @$(cycc) -c $< $(flags) $(xflags)
134 Objects/Version.o: Version.h
142 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
146 MobileCydia: sysroot $(object) entitlements.xml
147 @echo "[link] $(object:Objects/%=%)"
148 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(libs) $(uikit)
150 @cp -a $@ bins/$@-$(version)
154 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
156 CydiaAppliance: CydiaAppliance.mm
157 $(cycc) $(filter %.mm,$^) $(flags) $(link) -bundle $(libs) $(backrow)
159 cfversion: cfversion.mm
160 $(cycc) $(filter %.mm,$^) $(flags) -framework CoreFoundation
163 postinst: postinst.mm Sources.mm Sources.h CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
164 $(cycc) $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation -framework Foundation -framework UIKit -lpcre
167 debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh Library/startup
169 mkdir -p _/var/lib/cydia
172 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
173 cp -a Sources.list _/etc/apt/sources.list.d
175 mkdir -p _/usr/libexec
176 cp -a Library _/usr/libexec/cydia
177 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
178 cp -a cfversion _/usr/libexec/cydia
180 mkdir -p _/System/Library
181 cp -a LaunchDaemons _/System/Library/LaunchDaemons
183 mkdir -p _/Applications
184 cp -a MobileCydia.app _/Applications/Cydia.app
185 rm -rf _/Applications/Cydia.app/*.lproj
186 cp -a MobileCydia _/Applications/Cydia.app/MobileCydia
188 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
190 mkdir -p _/Applications/Cydia.app/Sources
191 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
192 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
194 #mkdir -p _/Applications/AppleTV.app/Appliances
195 #cp -a Cydia.frappliance _/Applications/AppleTV.app/Appliances
196 #cp -a CydiaAppliance _/Applications/AppleTV.app/Appliances/Cydia.frappliance
198 #mkdir -p _/Applications/Lowtide.app/Appliances
199 #ln -s {/Applications/AppleTV,_/Applications/Lowtide}.app/Appliances/Cydia.frappliance
202 ./control.sh cydia.control _ >_/DEBIAN/control
203 cp -a preinst postinst _/DEBIAN/
205 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
209 sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
212 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
213 $(dpkg) -b _ Cydia.deb
214 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
216 $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
218 mkdir -p __/Applications/Cydia.app
220 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
223 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
229 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
230 $(dpkg) -b __ Cydia_.deb
231 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
233 package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
235 .PHONY: all clean package