]>
Commit | Line | Data |
---|---|---|
0263db76 | 1 | sdks := /Developer/Platforms/iPhoneOS.platform/Developer/SDKs |
ea958716 | 2 | ioss := $(sort $(patsubst $(sdks)/iPhoneOS%.sdk,%,$(wildcard $(sdks)/iPhoneOS*.sdk))) |
0263db76 | 3 | |
ea958716 | 4 | ios := $(word $(words $(ioss)),$(ioss)) |
670fdb01 | 5 | gcc := 4.2 |
c21004b9 JF |
6 | |
7 | flags := | |
8 | link := | |
9 | ||
d1ba8fd3 JF |
10 | ifeq (o,O) # gzip is actually better |
11 | dpkg := /Library/Cydia/bin/dpkg-deb | |
12 | ifeq ($(wildcard $(dpkg)),$(dpkg)) | |
13 | dpkg := $(dpkg) -zlzma | |
14 | else | |
15 | dpkg := dpkg-deb -zbzip2 | |
16 | endif | |
17 | else | |
c21004b9 | 18 | dpkg := dpkg-deb |
d1ba8fd3 | 19 | endif |
c21004b9 | 20 | |
0263db76 | 21 | sdk := $(sdks)/iPhoneOS$(ios).sdk |
ee4120ad JF |
22 | |
23 | flags += -F$(sdk)/System/Library/PrivateFrameworks | |
c21004b9 JF |
24 | flags += -I. -isystem sysroot/usr/include -Lsysroot/usr/lib |
25 | flags += -Wall -Werror -Wno-deprecated-declarations | |
26 | flags += -fmessage-length=0 | |
27 | flags += -g0 -O2 | |
7c8912f8 | 28 | flags += -fobjc-exceptions |
443b9e05 | 29 | flags += -fno-guess-branch-probability |
9f9ae81c | 30 | flags += -fvisibility=hidden |
7c8912f8 JF |
31 | |
32 | xflags := | |
33 | xflags += -fobjc-call-cxx-cdtors | |
9f9ae81c | 34 | xflags += -fvisibility-inlines-hidden |
c21004b9 JF |
35 | |
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 | |
0e371502 | 43 | link += -framework SpringBoardServices |
c21004b9 | 44 | link += -framework SystemConfiguration |
c21004b9 JF |
45 | link += -framework WebCore |
46 | link += -framework WebKit | |
47 | ||
48 | link += -lapr-1 | |
49 | link += -lapt-pkg | |
50 | link += -lpcre | |
51 | ||
52 | link += -multiply_defined suppress | |
5f6bff8c | 53 | |
e17a8c4f JF |
54 | uikit := |
55 | uikit += -framework UIKit | |
56 | ||
57 | backrow := | |
58 | backrow += -FAppleTV -framework BackRow -framework AppleTV | |
59 | ||
f9ba524a JF |
60 | version := $(shell ./version.sh) |
61 | ||
ee4120ad | 62 | #cycc = cycc -r4.2 -i$(ios) -o$@ |
89b0ea4a | 63 | gxx := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-$(gcc) |
435cb857 | 64 | cycc = $(gxx) -mthumb -arch armv6 -o $@ -mcpu=arm1176jzf-s -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks |
ee4120ad | 65 | |
7c8912f8 JF |
66 | flags += -DCYDIA_VERSION='"$(version)"' |
67 | ||
68 | dirs := Menes CyteKit Cydia SDURLCache | |
69 | ||
70 | code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext)))) | |
71 | code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code)) | |
72 | code += MobileCydia.mm iPhonePrivate.h Cytore.hpp lookup3.c | |
73 | ||
74 | source := $(filter %.m,$(code)) $(filter %.mm,$(code)) | |
75 | source += $(filter %.c,$(code)) $(filter %.cpp,$(code)) | |
76 | header := $(filter %.h,$(code)) $(filter %.hpp,$(code)) | |
77 | ||
78 | object := $(source) | |
79 | object := $(object:.c=.o) | |
80 | object := $(object:.cpp=.o) | |
81 | object := $(object:.m=.o) | |
82 | object := $(object:.mm=.o) | |
83 | object := $(object:%=Objects/%) | |
84 | ||
8a4d4662 JF |
85 | images := $(shell find MobileCydia.app -name '*.png') |
86 | images := $(images:%=Images/%) | |
87 | ||
e17a8c4f | 88 | all: MobileCydia |
dc5812ec | 89 | |
5f6bff8c | 90 | clean: |
e17a8c4f | 91 | rm -f MobileCydia |
8a4d4662 | 92 | rm -rf Objects/ Images/ |
7c8912f8 JF |
93 | |
94 | Objects/%.o: %.c $(header) | |
95 | @mkdir -p $(dir $@) | |
96 | @echo "[cycc] $<" | |
97 | @$(cycc) -c -o $@ -x c $< | |
98 | ||
99 | Objects/%.o: %.m $(header) | |
100 | @mkdir -p $(dir $@) | |
101 | @echo "[cycc] $<" | |
102 | @$(cycc) -c -o $@ $< $(flags) | |
5f6bff8c | 103 | |
7c8912f8 JF |
104 | Objects/%.o: %.mm $(header) |
105 | @mkdir -p $(dir $@) | |
106 | @echo "[cycc] $<" | |
107 | @$(cycc) -c -o $@ $< $(flags) $(xflags) | |
e95a1972 | 108 | |
8a4d4662 JF |
109 | Images/%.png: %.png |
110 | @mkdir -p $(dir $@) | |
111 | @echo "[pngc] $<" | |
112 | @./pngcrush.sh $< $@ | |
113 | ||
8a2c6d14 JF |
114 | sysroot: |
115 | @echo "Please read compiling.txt: you do not have a ./sysroot/ folder with the on-device requirements." 1>&2 | |
116 | @echo 1>&2 | |
117 | @exit 1 | |
118 | ||
7c8912f8 JF |
119 | MobileCydia: sysroot $(object) |
120 | @echo "[link] $(object:Objects/%=%)" | |
121 | @$(cycc) $(filter %.o,$^) $(flags) $(link) $(uikit) | |
443b9e05 JF |
122 | @echo "[strp] $@" |
123 | @strip -no_uuid $@ | |
7c8912f8 | 124 | @echo "[sign] $@" |
443b9e05 | 125 | @ldid -T0 -Slaunch.xml $@ || { rm -f $@ && false; } |
03c0f7a9 | 126 | |
e17a8c4f JF |
127 | CydiaAppliance: CydiaAppliance.mm |
128 | $(cycc) $(filter %.mm,$^) $(flags) -bundle $(link) $(backrow) | |
129 | ||
aa60b57b | 130 | debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia $(images) $(shell find MobileCydia.app) |
7e2bd591 | 131 | sudo rm -rf _ |
03c0f7a9 JF |
132 | mkdir -p _/var/lib/cydia |
133 | ||
134 | mkdir -p _/usr/libexec | |
c21004b9 | 135 | cp -a Library _/usr/libexec/cydia |
7e2bd591 | 136 | cp -a sysroot/usr/bin/du _/usr/libexec/cydia |
03c0f7a9 JF |
137 | |
138 | mkdir -p _/System/Library | |
c21004b9 | 139 | cp -a LaunchDaemons _/System/Library/LaunchDaemons |
03c0f7a9 JF |
140 | |
141 | mkdir -p _/Applications | |
e17a8c4f JF |
142 | cp -a MobileCydia.app _/Applications/Cydia.app |
143 | cp -a MobileCydia _/Applications/Cydia.app/MobileCydia | |
144 | ||
8a4d4662 JF |
145 | cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';' |
146 | ||
e2b57be4 JF |
147 | #mkdir -p _/Applications/AppleTV.app/Appliances |
148 | #cp -a Cydia.frappliance _/Applications/AppleTV.app/Appliances | |
149 | #cp -a CydiaAppliance _/Applications/AppleTV.app/Appliances/Cydia.frappliance | |
150 | ||
e17a8c4f | 151 | #mkdir -p _/Applications/Lowtide.app/Appliances |
e2b57be4 | 152 | #ln -s {/Applications/AppleTV,_/Applications/Lowtide}.app/Appliances/Cydia.frappliance |
03c0f7a9 | 153 | |
03c0f7a9 | 154 | mkdir -p _/DEBIAN |
3adcfba7 | 155 | ./control.sh _ >_/DEBIAN/control |
03c0f7a9 | 156 | |
8fec9d25 | 157 | find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';' |
7fc02989 | 158 | |
7e2bd591 JF |
159 | sudo chown -R 0 _ |
160 | sudo chgrp -R 0 _ | |
e17a8c4f | 161 | sudo chmod 6755 _/Applications/Cydia.app/MobileCydia |
7e2bd591 | 162 | |
3adcfba7 | 163 | mkdir -p debs |
f9ba524a | 164 | ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb |
3adcfba7 | 165 | $(dpkg) -b _ Cydia.deb |
ce0372db | 166 | @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)" |
8cc774c5 | 167 | |
aa60b57b JF |
168 | package: debs/cydia_$(version)_iphoneos-arm.deb |
169 | ||
170 | .PHONY: all clean package sign |