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
31 xflags += -fobjc-call-cxx-cdtors
33 link += -framework CoreFoundation
34 link += -framework CoreGraphics
35 link += -framework Foundation
36 link += -framework GraphicsServices
37 link += -framework IOKit
38 link += -framework JavaScriptCore
39 link += -framework QuartzCore
40 link += -framework SpringBoardServices
41 link += -framework SystemConfiguration
42 link += -framework WebCore
43 link += -framework WebKit
49 link += -multiply_defined suppress
52 uikit += -framework UIKit
55 backrow += -FAppleTV -framework BackRow -framework AppleTV
57 version := $(shell ./version.sh)
59 #cycc = cycc -r4.2 -i$(ios) -o$@
60 gxx := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-$(gcc)
61 cycc = $(gxx) -mthumb -arch armv6 -o $@ -mcpu=arm1176jzf-s -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
63 flags += -DCYDIA_VERSION='"$(version)"'
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 iPhonePrivate.h Cytore.hpp lookup3.c
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/%)
88 Objects/%.o: %.c $(header)
91 @$(cycc) -c -o $@ -x c $<
93 Objects/%.o: %.m $(header)
96 @$(cycc) -c -o $@ $< $(flags)
98 Objects/%.o: %.mm $(header)
101 @$(cycc) -c -o $@ $< $(flags) $(xflags)
104 @echo "Please read compiling.txt: you do not have a ./sysroot/ folder with the on-device requirements." 1>&2
108 MobileCydia: sysroot $(object)
109 @echo "[link] $(object:Objects/%=%)"
110 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(uikit)
112 @ldid -Slaunch.xml $@ || { rm -f $@ && false; }
114 CydiaAppliance: CydiaAppliance.mm
115 $(cycc) $(filter %.mm,$^) $(flags) -bundle $(link) $(backrow)
119 mkdir -p _/var/lib/cydia
121 mkdir -p _/usr/libexec
122 cp -a Library _/usr/libexec/cydia
123 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
125 mkdir -p _/System/Library
126 cp -a LaunchDaemons _/System/Library/LaunchDaemons
128 mkdir -p _/Applications
129 cp -a MobileCydia.app _/Applications/Cydia.app
130 cp -a MobileCydia _/Applications/Cydia.app/MobileCydia
132 #mkdir -p _/Applications/Lowtide.app/Appliances
133 #cp -a Cydia.frappliance _/Applications/Lowtide.app/Appliances
134 #cp -a CydiaAppliance _/Applications/Lowtide.app/Appliances/Cydia.frappliance
137 ./control.sh _ >_/DEBIAN/control
139 find _ -name '*.png' -exec ./pngcrush.sh '{}' ';'
143 sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
146 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
147 $(dpkg) -b _ Cydia.deb
148 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
150 .PHONY: all clean sign