1 gxx := $(shell xcrun --sdk iphoneos -f g++)
2 sdk := $(shell xcodebuild -sdk iphoneos -version Path)
8 dpkg := dpkg-deb -Zlzma
10 flags += -F$(sdk)/System/Library/PrivateFrameworks
11 flags += -I. -isystem sysroot/usr/include
12 flags += -fmessage-length=0
14 flags += -fvisibility=hidden
16 flags += -idirafter icu/icuSources/common
17 flags += -idirafter icu/icuSources/i18n
21 flags += -Wno-unknown-warning-option
22 flags += -Wno-logical-op-parentheses
23 flags += -Wno-dangling-else
24 flags += -Wno-shift-op-parentheses
25 flags += -Wno-deprecated-declarations
28 xflags += -fobjc-call-cxx-cdtors
29 xflags += -fvisibility-inlines-hidden
31 link += -Lsysroot/usr/lib
32 link += -multiply_defined suppress
34 libs += -framework CoreFoundation
35 libs += -framework CoreGraphics
36 libs += -framework Foundation
37 libs += -framework GraphicsServices
38 libs += -framework IOKit
39 libs += -framework QuartzCore
40 libs += -framework SpringBoardServices
41 libs += -framework SystemConfiguration
42 libs += -framework WebCore
43 libs += -framework WebKit
51 uikit += -framework UIKit
54 backrow += -FAppleTV -framework BackRow -framework AppleTV
56 version := $(shell ./version.sh)
58 cycc = $(gxx) -arch armv6 -o $@ -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
60 cycc += -marm # @synchronized
61 cycc += -mcpu=arm1176jzf-s
62 cycc += -mllvm -arm-reserve-r9
65 dirs := Menes CyteKit Cydia SDURLCache
67 code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
68 code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
69 code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm
71 source := $(filter %.m,$(code)) $(filter %.mm,$(code))
72 source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
73 header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
76 object := $(object:.c=.o)
77 object := $(object:.cpp=.o)
78 object := $(object:.m=.o)
79 object := $(object:.mm=.o)
80 object := $(object:%=Objects/%)
82 images := $(shell find MobileCydia.app/ -type f -name '*.png')
83 images := $(images:%=Images/%)
85 lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
90 rm -f MobileCydia postinst
91 rm -rf Objects/ Images/
93 Objects/%.o: %.c $(header)
98 Objects/%.o: %.m $(header)
101 @$(cycc) -c $< $(flags)
103 Objects/%.o: %.mm $(header)
106 @$(cycc) -std=c++11 -c $< $(flags) $(xflags)
108 Objects/Version.o: Version.h
116 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
120 MobileCydia: sysroot $(object) entitlements.xml
121 @echo "[link] $(object:Objects/%=%)"
122 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(libs) $(uikit) -Wl,-sdk_version,8.0
124 @cp -a $@ bins/$@-$(version)
130 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
132 CydiaAppliance: CydiaAppliance.mm
133 $(cycc) $(filter %.mm,$^) $(flags) $(link) -bundle $(libs) $(backrow)
135 cfversion: cfversion.mm
136 $(cycc) $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation
139 setnsfpn: setnsfpn.cpp
140 $(cycc) $(filter %.cpp,$^) $(flags) $(link)
143 postinst: postinst.mm Sources.mm Sources.h CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
144 $(cycc) -std=c++11 $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation -framework Foundation -framework UIKit -lpcre
147 debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion setnsfpn $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh Library/move.sh Library/startup
149 mkdir -p _/var/lib/cydia
152 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
153 cp -a Sources.list _/etc/apt/sources.list.d
155 mkdir -p _/usr/libexec
156 cp -a Library _/usr/libexec/cydia
157 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
158 cp -a cfversion _/usr/libexec/cydia
159 cp -a setnsfpn _/usr/libexec/cydia
162 cp -a LaunchDaemons _/Library/LaunchDaemons
164 mkdir -p _/Applications
165 cp -a MobileCydia.app _/Applications/Cydia.app
166 rm -rf _/Applications/Cydia.app/*.lproj
167 cp -a MobileCydia _/Applications/Cydia.app/MobileCydia
169 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
171 mkdir -p _/Applications/Cydia.app/Sources
172 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
173 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
175 #mkdir -p _/Applications/AppleTV.app/Appliances
176 #cp -a Cydia.frappliance _/Applications/AppleTV.app/Appliances
177 #cp -a CydiaAppliance _/Applications/AppleTV.app/Appliances/Cydia.frappliance
179 #mkdir -p _/Applications/Lowtide.app/Appliances
180 #ln -s {/Applications/AppleTV,_/Applications/Lowtide}.app/Appliances/Cydia.frappliance
183 ./control.sh cydia.control _ >_/DEBIAN/control
184 cp -a preinst postinst _/DEBIAN/
186 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
190 sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
193 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
194 $(dpkg) -b _ Cydia.deb
195 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
197 $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
199 mkdir -p __/Applications/Cydia.app
201 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
204 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
210 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
211 $(dpkg) -b __ Cydia_.deb
212 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
214 package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
216 .PHONY: all clean package