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