]> git.saurik.com Git - cydia.git/blame - makefile
Add missing LogBrowser NSLog for didClearWindowObject.
[cydia.git] / makefile
CommitLineData
164e8139 1dev := $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/Developer
4cc9e99a 2sdks := $(dev)/SDKs
ea958716 3ioss := $(sort $(patsubst $(sdks)/iPhoneOS%.sdk,%,$(wildcard $(sdks)/iPhoneOS*.sdk)))
ea958716 4ios := $(word $(words $(ioss)),$(ioss))
4cc9e99a
JF
5
6# if you can tolerate clang, set this to blank
670fdb01 7gcc := 4.2
c21004b9 8
4cc9e99a
JF
9ifeq ($(gcc),)
10gxx := $(dev)/usr/bin/clang++
11else
8ba636c7 12gxx := $(dev)/usr/bin/g++
4cc9e99a
JF
13endif
14
c21004b9
JF
15flags :=
16link :=
543e172a 17libs :=
c21004b9 18
d1ba8fd3
JF
19ifeq (o,O) # gzip is actually better
20dpkg := /Library/Cydia/bin/dpkg-deb
21ifeq ($(wildcard $(dpkg)),$(dpkg))
22dpkg := $(dpkg) -zlzma
23else
24dpkg := dpkg-deb -zbzip2
25endif
26else
c21004b9 27dpkg := dpkg-deb
d1ba8fd3 28endif
c21004b9 29
0263db76 30sdk := $(sdks)/iPhoneOS$(ios).sdk
ee4120ad
JF
31
32flags += -F$(sdk)/System/Library/PrivateFrameworks
4cc9e99a 33flags += -I. -isystem sysroot/usr/include
c21004b9
JF
34flags += -fmessage-length=0
35flags += -g0 -O2
4cc9e99a
JF
36flags += -fvisibility=hidden
37
38flags += -Wall
39
40ifeq ($(gcc),)
41flags += -Wno-unknown-warning-option
42flags += -Wno-logical-op-parentheses
43else
7c8912f8 44flags += -fobjc-exceptions
443b9e05 45flags += -fno-guess-branch-probability
4cc9e99a
JF
46endif
47
48flags += -Wno-deprecated-declarations
7c8912f8
JF
49
50xflags :=
51xflags += -fobjc-call-cxx-cdtors
9f9ae81c 52xflags += -fvisibility-inlines-hidden
c21004b9 53
4cc9e99a 54link += -Lsysroot/usr/lib
c21004b9 55link += -multiply_defined suppress
5f6bff8c 56
543e172a
JF
57libs += -framework CoreFoundation
58libs += -framework CoreGraphics
59libs += -framework Foundation
60libs += -framework GraphicsServices
61libs += -framework IOKit
62libs += -framework JavaScriptCore
63libs += -framework QuartzCore
64libs += -framework SpringBoardServices
65libs += -framework SystemConfiguration
66libs += -framework WebCore
67libs += -framework WebKit
68
69libs += -lapr-1
70libs += -lapt-pkg
71libs += -lpcre
72
e17a8c4f
JF
73uikit :=
74uikit += -framework UIKit
75
76backrow :=
77backrow += -FAppleTV -framework BackRow -framework AppleTV
78
f9ba524a
JF
79version := $(shell ./version.sh)
80
eb40eaca 81cycc = $(gxx) -mthumb -arch armv6 -o $@ -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
4cc9e99a 82#cycc = cycc -r4.2 -i$(ios) -o$@
ee4120ad 83
eb40eaca
JF
84ifneq ($(gcc),)
85cycc += -Xarch_armv6 -mcpu=arm1176jzf-s
86endif
87
7c8912f8
JF
88dirs := Menes CyteKit Cydia SDURLCache
89
90code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
91code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
25c1dafb 92code += MobileCydia.mm Version.mm iPhonePrivate.h Cytore.hpp lookup3.c Sources.h Sources.mm
7c8912f8
JF
93
94source := $(filter %.m,$(code)) $(filter %.mm,$(code))
95source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
96header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
97
98object := $(source)
99object := $(object:.c=.o)
100object := $(object:.cpp=.o)
101object := $(object:.m=.o)
102object := $(object:.mm=.o)
103object := $(object:%=Objects/%)
104
4339c9ef 105images := $(shell find MobileCydia.app/ -type f -name '*.png')
8a4d4662
JF
106images := $(images:%=Images/%)
107
915284a6
JF
108lproj_deb := debs/cydia-lproj_$(version)_iphoneos-arm.deb
109
e17a8c4f 110all: MobileCydia
dc5812ec 111
5f6bff8c 112clean:
eaa9f122 113 rm -f MobileCydia postinst
8a4d4662 114 rm -rf Objects/ Images/
7c8912f8
JF
115
116Objects/%.o: %.c $(header)
117 @mkdir -p $(dir $@)
118 @echo "[cycc] $<"
4cc9e99a 119 @$(cycc) -c -x c $<
7c8912f8
JF
120
121Objects/%.o: %.m $(header)
122 @mkdir -p $(dir $@)
123 @echo "[cycc] $<"
4cc9e99a 124 @$(cycc) -c $< $(flags)
5f6bff8c 125
7c8912f8
JF
126Objects/%.o: %.mm $(header)
127 @mkdir -p $(dir $@)
128 @echo "[cycc] $<"
4cc9e99a 129 @$(cycc) -c $< $(flags) $(xflags)
e95a1972 130
174327c1 131Objects/Version.o: Version.h
e61d7bfc 132
8a4d4662
JF
133Images/%.png: %.png
134 @mkdir -p $(dir $@)
135 @echo "[pngc] $<"
136 @./pngcrush.sh $< $@
137
0d5393af
JF
138sysroot: sysroot.sh
139 @echo "Your ./sysroot/ is either missing or out of date. Please read compiling.txt for help." 1>&2
8a2c6d14
JF
140 @echo 1>&2
141 @exit 1
142
9c0eddfd 143MobileCydia: sysroot $(object) entitlements.xml
7c8912f8 144 @echo "[link] $(object:Objects/%=%)"
543e172a 145 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(libs) $(uikit)
0dbada51 146 @mkdir -p bins
665d1e62 147 @cp -a $@ bins/$@-$(version)
443b9e05
JF
148 @echo "[strp] $@"
149 @strip -no_uuid $@
7c8912f8 150 @echo "[sign] $@"
9c0eddfd 151 @ldid -T0 -Sentitlements.xml $@ || { rm -f $@ && false; }
03c0f7a9 152
e17a8c4f 153CydiaAppliance: CydiaAppliance.mm
543e172a 154 $(cycc) $(filter %.mm,$^) $(flags) $(link) -bundle $(libs) $(backrow)
e17a8c4f 155
e967efd5
JF
156cfversion: cfversion.mm
157 $(cycc) $(filter %.mm,$^) $(flags) -framework CoreFoundation
158 @ldid -T0 -S $@
159
eaa9f122 160postinst: postinst.mm Sources.mm Sources.h CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
543e172a 161 $(cycc) $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation -framework Foundation -framework UIKit -lpcre
2d46d29e 162 @ldid -T0 -S $@
eaa9f122 163
378a293a 164debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion $(images) $(shell find MobileCydia.app) cydia.control Library/firmware.sh Library/startup
7e2bd591 165 sudo rm -rf _
03c0f7a9
JF
166 mkdir -p _/var/lib/cydia
167
33e30380
JF
168 mkdir -p _/etc/apt
169 cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
170 cp -a Sources.list _/etc/apt/sources.list.d
171
03c0f7a9 172 mkdir -p _/usr/libexec
c21004b9 173 cp -a Library _/usr/libexec/cydia
7e2bd591 174 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
e967efd5 175 cp -a cfversion _/usr/libexec/cydia
03c0f7a9
JF
176
177 mkdir -p _/System/Library
c21004b9 178 cp -a LaunchDaemons _/System/Library/LaunchDaemons
03c0f7a9
JF
179
180 mkdir -p _/Applications
e17a8c4f 181 cp -a MobileCydia.app _/Applications/Cydia.app
915284a6 182 rm -rf _/Applications/Cydia.app/*.lproj
e17a8c4f
JF
183 cp -a MobileCydia _/Applications/Cydia.app/MobileCydia
184
8a4d4662
JF
185 cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';'
186
4339c9ef
JF
187 mkdir -p _/Applications/Cydia.app/Sources
188 ln -s /usr/share/bigboss/icons/bigboss.png _/Applications/Cydia.app/Sources/apt.bigboss.us.com.png
5ad3e6d9
JF
189 ln -s /usr/share/bigboss/icons/planetiphones.png _/Applications/Cydia.app/Sections/"Planet-iPhones Mods.png"
190
e2b57be4
JF
191 #mkdir -p _/Applications/AppleTV.app/Appliances
192 #cp -a Cydia.frappliance _/Applications/AppleTV.app/Appliances
193 #cp -a CydiaAppliance _/Applications/AppleTV.app/Appliances/Cydia.frappliance
194
e17a8c4f 195 #mkdir -p _/Applications/Lowtide.app/Appliances
e2b57be4 196 #ln -s {/Applications/AppleTV,_/Applications/Lowtide}.app/Appliances/Cydia.frappliance
03c0f7a9 197
03c0f7a9 198 mkdir -p _/DEBIAN
915284a6 199 ./control.sh cydia.control _ >_/DEBIAN/control
eaa9f122 200 cp -a preinst postinst _/DEBIAN/
03c0f7a9 201
8fec9d25 202 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
7fc02989 203
7e2bd591
JF
204 sudo chown -R 0 _
205 sudo chgrp -R 0 _
e17a8c4f 206 sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
7e2bd591 207
3adcfba7 208 mkdir -p debs
f9ba524a 209 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
3adcfba7 210 $(dpkg) -b _ Cydia.deb
ce0372db 211 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
8cc774c5 212
33e30380 213$(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
915284a6
JF
214 sudo rm -rf __
215 mkdir -p __/Applications/Cydia.app
216
217 cp -a MobileCydia.app/*.lproj __/Applications/Cydia.app
218
219 mkdir -p __/DEBIAN
220 ./control.sh cydia-lproj.control __ >__/DEBIAN/control
915284a6
JF
221
222 sudo chown -R 0 __
223 sudo chgrp -R 0 __
224
225 mkdir -p debs
226 ln -sf debs/cydia-lproj_$(version)_iphoneos-arm.deb Cydia_.deb
227 $(dpkg) -b __ Cydia_.deb
228 @echo "$$(stat -L -f "%z" Cydia_.deb) $$(stat -f "%Y" Cydia_.deb)"
229
230package: debs/cydia_$(version)_iphoneos-arm.deb $(lproj_deb)
aa60b57b 231
10ff7664 232.PHONY: all clean package