1 sdks := /Developer/Platforms/iPhoneOS.platform/Developer/SDKs
2 ioss := $(sort $(patsubst $(sdks)/iPhoneOS%.sdk,%,$(wildcard $(sdks)/iPhoneOS*.sdk)))
4 ios := $(word $(words $(ioss)),$(ioss))
10 ifeq (o,O) # gzip is actually better
11 dpkg := /Library/Cydia/bin/dpkg-deb
12 ifeq ($(wildcard $(dpkg)),$(dpkg))
13 dpkg := $(dpkg) -zlzma
15 dpkg := dpkg-deb -zbzip2
21 sdk := $(sdks)/iPhoneOS$(ios).sdk
23 flags += -F$(sdk)/System/Library/PrivateFrameworks
24 flags += -I. -isystem sysroot/usr/include -Lsysroot/usr/lib
25 flags += -Wall -Werror -Wno-deprecated-declarations
26 flags += -fmessage-length=0
28 flags += -fobjc-exceptions
29 flags += -fno-guess-branch-probability
30 flags += -fvisibility=hidden
33 xflags += -fobjc-call-cxx-cdtors
34 xflags += -fvisibility-inlines-hidden
36 link += -framework CoreFoundation
37 link += -framework CoreGraphics
38 link += -framework Foundation
39 link += -framework GraphicsServices
40 link += -framework IOKit
41 link += -framework JavaScriptCore
42 link += -framework QuartzCore
43 link += -framework SpringBoardServices
44 link += -framework SystemConfiguration
45 link += -framework WebCore
46 link += -framework WebKit
52 link += -multiply_defined suppress
55 uikit += -framework UIKit
58 backrow += -FAppleTV -framework BackRow -framework AppleTV
60 version := $(shell ./version.sh)
62 #cycc = cycc -r4.2 -i$(ios) -o$@
63 gxx := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-$(gcc)
64 cycc = $(gxx) -mthumb -arch armv6 -o $@ -mcpu=arm1176jzf-s -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
66 dirs := Menes CyteKit Cydia SDURLCache
68 code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
69 code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
70 code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c
72 source := $(filter %.m,$(code)) $(filter %.mm,$(code))
73 source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
74 header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
77 object := $(object:.c=.o)
78 object := $(object:.cpp=.o)
79 object := $(object:.m=.o)
80 object := $(object:.mm=.o)
81 object := $(object:%=Objects/%)
83 images := $(shell find BigBoss.png/ MobileCydia.app/ -type f -name '*.png')
84 images := $(images:%=Images/%)
86 lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
92 rm -rf Objects/ Images/
94 Objects/%.o: %.c $(header)
97 @$(cycc) -c -o $@ -x c $<
99 Objects/%.o: %.m $(header)
102 @$(cycc) -c -o $@ $< $(flags)
104 Objects/%.o: %.mm $(header)
107 @$(cycc) -c -o $@ $< $(flags) $(xflags)
109 Objects/Version.o: version.h
117 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
121 MobileCydia: sysroot $(object)
122 @echo "[link] $(object:Objects/%=%)"
123 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(uikit)
127 @ldid -T0 -Slaunch.xml $@ || { rm -f $@ && false; }
129 CydiaAppliance: CydiaAppliance.mm
130 $(cycc) $(filter %.mm,$^) $(flags) -bundle $(link) $(backrow)
132 debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia $(images) $(shell find MobileCydia.app) cydia.control
134 mkdir -p _/var/lib/cydia
137 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
138 cp -a Sources.list _/etc/apt/sources.list.d
140 mkdir -p _/usr/libexec
141 cp -a Library _/usr/libexec/cydia
142 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
144 mkdir -p _/System/Library
145 cp -a LaunchDaemons _/System/Library/LaunchDaemons
147 mkdir -p _/Applications
148 cp -a MobileCydia.app _/Applications/Cydia.app
149 rm -rf _/Applications/Cydia.app/*.lproj
150 cp -a MobileCydia _/Applications/Cydia.app/MobileCydia
152 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
154 mkdir -p _/usr/share/bigboss/icons
155 cd BigBoss.png && find . -name '*.png' -exec cp -af ../Images/BigBoss.png/{} ../_/usr/share/bigboss/icons/{} ';'
156 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
158 #mkdir -p _/Applications/AppleTV.app/Appliances
159 #cp -a Cydia.frappliance _/Applications/AppleTV.app/Appliances
160 #cp -a CydiaAppliance _/Applications/AppleTV.app/Appliances/Cydia.frappliance
162 #mkdir -p _/Applications/Lowtide.app/Appliances
163 #ln -s {/Applications/AppleTV,_/Applications/Lowtide}.app/Appliances/Cydia.frappliance
166 ./control.sh cydia.control _ >_/DEBIAN/control
167 cp -a preinst _/DEBIAN/
169 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
173 sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
176 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
177 $(dpkg) -b _ Cydia.deb
178 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
180 $(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
182 mkdir -p __/Applications/Cydia.app
184 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
187 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
188 cp -a preinst __/DEBIAN/
194 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
195 $(dpkg) -b __ Cydia_.deb
196 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
198 package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
200 .PHONY: all clean package sign