]> git.saurik.com Git - cydia.git/blame_incremental - makefile
Don't use /System/Library/LaunchDaemons for Cydia.
[cydia.git] / makefile
... / ...
CommitLineData
1gxx := $(shell xcrun --sdk iphoneos -f g++)
2sdk := $(shell xcodebuild -sdk iphoneos -version Path)
3
4flags :=
5link :=
6libs :=
7
8dpkg := dpkg-deb -Zlzma
9
10flags += -F$(sdk)/System/Library/PrivateFrameworks
11flags += -I. -isystem sysroot/usr/include
12flags += -fmessage-length=0
13flags += -g0 -O2
14flags += -fvisibility=hidden
15
16flags += -idirafter icu/icuSources/common
17flags += -idirafter icu/icuSources/i18n
18
19flags += -Wall
20
21flags += -Wno-unknown-warning-option
22flags += -Wno-logical-op-parentheses
23flags += -Wno-dangling-else
24flags += -Wno-shift-op-parentheses
25flags += -Wno-deprecated-declarations
26
27xflags :=
28xflags += -fobjc-call-cxx-cdtors
29xflags += -fvisibility-inlines-hidden
30
31link += -Lsysroot/usr/lib
32link += -multiply_defined suppress
33
34libs += -framework CoreFoundation
35libs += -framework CoreGraphics
36libs += -framework Foundation
37libs += -framework GraphicsServices
38libs += -framework IOKit
39libs += -framework QuartzCore
40libs += -framework SpringBoardServices
41libs += -framework SystemConfiguration
42libs += -framework WebCore
43libs += -framework WebKit
44
45libs += -lapr-1
46libs += -lapt-pkg
47libs += -licucore
48libs += -lpcre
49
50uikit :=
51uikit += -framework UIKit
52
53backrow :=
54backrow += -FAppleTV -framework BackRow -framework AppleTV
55
56version := $(shell ./version.sh)
57
58cycc = $(gxx) -arch armv6 -o $@ -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
59
60cycc += -marm # @synchronized
61cycc += -mcpu=arm1176jzf-s
62cycc += -mllvm -arm-reserve-r9
63link += -lgcc_s.1
64
65dirs := Menes CyteKit Cydia SDURLCache
66
67code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
68code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
69code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm
70
71source := $(filter %.m,$(code)) $(filter %.mm,$(code))
72source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
73header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
74
75object := $(source)
76object := $(object:.c=.o)
77object := $(object:.cpp=.o)
78object := $(object:.m=.o)
79object := $(object:.mm=.o)
80object := $(object:%=Objects/%)
81
82images := $(shell find MobileCydia.app/ -type f -name '*.png')
83images := $(images:%=Images/%)
84
85lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
86
87all: MobileCydia
88
89clean:
90 rm -f MobileCydia postinst
91 rm -rf Objects/ Images/
92
93Objects/%.o: %.c $(header)
94 @mkdir -p $(dir $@)
95 @echo "[cycc] $<"
96 @$(cycc) -c -x c $<
97
98Objects/%.o: %.m $(header)
99 @mkdir -p $(dir $@)
100 @echo "[cycc] $<"
101 @$(cycc) -c $< $(flags)
102
103Objects/%.o: %.mm $(header)
104 @mkdir -p $(dir $@)
105 @echo "[cycc] $<"
106 @$(cycc) -std=c++11 -c $< $(flags) $(xflags)
107
108Objects/Version.o: Version.h
109
110Images/%.png: %.png
111 @mkdir -p $(dir $@)
112 @echo "[pngc] $<"
113 @./pngcrush.sh $< $@
114
115sysroot: sysroot.sh
116 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
117 @echo 1>&2
118 @exit 1
119
120MobileCydia: sysroot $(object) entitlements.xml
121 @echo "[link] $(object:Objects/%=%)"
122 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(libs) $(uikit) -Wl,-sdk_version,7.0
123 @mkdir -p bins
124 @cp -a $@ bins/$@-$(version)
125 @echo "[strp] $@"
126 @strip -no_uuid $@
127 @echo "[uikt] $@"
128 @./uikit.sh $@
129 @echo "[sign] $@"
130 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
131
132CydiaAppliance: CydiaAppliance.mm
133 $(cycc) $(filter %.mm,$^) $(flags) $(link) -bundle $(libs) $(backrow)
134
135cfversion: cfversion.mm
136 $(cycc) $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation
137 @ldid -T0 -S $@
138
139postinst: postinst.mm Sources.mm Sources.h CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
140 $(cycc) $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation -framework Foundation -framework UIKit -lpcre
141 @ldid -T0 -S $@
142
143debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh Library/startup
144 sudo rm -rf _
145 mkdir -p _/var/lib/cydia
146
147 mkdir -p _/etc/apt
148 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
149 cp -a Sources.list _/etc/apt/sources.list.d
150
151 mkdir -p _/usr/libexec
152 cp -a Library _/usr/libexec/cydia
153 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
154 cp -a cfversion _/usr/libexec/cydia
155
156 mkdir -p _/Library
157 cp -a LaunchDaemons _/Library/LaunchDaemons
158
159 mkdir -p _/Applications
160 cp -a MobileCydia.app _/Applications/Cydia.app
161 rm -rf _/Applications/Cydia.app/*.lproj
162 cp -a MobileCydia _/Applications/Cydia.app/MobileCydia
163
164 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
165
166 mkdir -p _/Applications/Cydia.app/Sources
167 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
168 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
169
170 #mkdir -p _/Applications/AppleTV.app/Appliances
171 #cp -a Cydia.frappliance _/Applications/AppleTV.app/Appliances
172 #cp -a CydiaAppliance _/Applications/AppleTV.app/Appliances/Cydia.frappliance
173
174 #mkdir -p _/Applications/Lowtide.app/Appliances
175 #ln -s {/Applications/AppleTV,_/Applications/Lowtide}.app/Appliances/Cydia.frappliance
176
177 mkdir -p _/DEBIAN
178 ./control.sh cydia.control _ >_/DEBIAN/control
179 cp -a preinst postinst _/DEBIAN/
180
181 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
182
183 sudo chown -R 0 _
184 sudo chgrp -R 0 _
185 sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
186
187 mkdir -p debs
188 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
189 $(dpkg) -b _ Cydia.deb
190 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
191
192$(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
193 sudo rm -rf __
194 mkdir -p __/Applications/Cydia.app
195
196 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
197
198 mkdir -p __/DEBIAN
199 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
200
201 sudo chown -R 0 __
202 sudo chgrp -R 0 __
203
204 mkdir -p debs
205 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
206 $(dpkg) -b __ Cydia_.deb
207 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
208
209package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
210
211.PHONY: all clean package