]>
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 |
7c8912f8 JF |
30 | |
31 | xflags := | |
32 | xflags += -fobjc-call-cxx-cdtors | |
c21004b9 JF |
33 | |
34 | link += -framework CoreFoundation | |
35 | link += -framework CoreGraphics | |
36 | link += -framework Foundation | |
37 | link += -framework GraphicsServices | |
38 | link += -framework IOKit | |
39 | link += -framework JavaScriptCore | |
40 | link += -framework QuartzCore | |
0e371502 | 41 | link += -framework SpringBoardServices |
c21004b9 | 42 | link += -framework SystemConfiguration |
c21004b9 JF |
43 | link += -framework WebCore |
44 | link += -framework WebKit | |
45 | ||
46 | link += -lapr-1 | |
47 | link += -lapt-pkg | |
48 | link += -lpcre | |
49 | ||
50 | link += -multiply_defined suppress | |
5f6bff8c | 51 | |
e17a8c4f JF |
52 | uikit := |
53 | uikit += -framework UIKit | |
54 | ||
55 | backrow := | |
56 | backrow += -FAppleTV -framework BackRow -framework AppleTV | |
57 | ||
f9ba524a JF |
58 | version := $(shell ./version.sh) |
59 | ||
ee4120ad | 60 | #cycc = cycc -r4.2 -i$(ios) -o$@ |
89b0ea4a | 61 | gxx := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-$(gcc) |
435cb857 | 62 | cycc = $(gxx) -mthumb -arch armv6 -o $@ -mcpu=arm1176jzf-s -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks |
ee4120ad | 63 | |
7c8912f8 JF |
64 | flags += -DCYDIA_VERSION='"$(version)"' |
65 | ||
66 | dirs := Menes CyteKit Cydia SDURLCache | |
67 | ||
68 | code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext)))) | |
69 | code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code)) | |
70 | code += MobileCydia.mm iPhonePrivate.h Cytore.hpp lookup3.c | |
71 | ||
72 | source := $(filter %.m,$(code)) $(filter %.mm,$(code)) | |
73 | source += $(filter %.c,$(code)) $(filter %.cpp,$(code)) | |
74 | header := $(filter %.h,$(code)) $(filter %.hpp,$(code)) | |
75 | ||
76 | object := $(source) | |
77 | object := $(object:.c=.o) | |
78 | object := $(object:.cpp=.o) | |
79 | object := $(object:.m=.o) | |
80 | object := $(object:.mm=.o) | |
81 | object := $(object:%=Objects/%) | |
82 | ||
e17a8c4f | 83 | all: MobileCydia |
dc5812ec | 84 | |
5f6bff8c | 85 | clean: |
e17a8c4f | 86 | rm -f MobileCydia |
7c8912f8 JF |
87 | rm -rf Objects/ |
88 | ||
89 | Objects/%.o: %.c $(header) | |
90 | @mkdir -p $(dir $@) | |
91 | @echo "[cycc] $<" | |
92 | @$(cycc) -c -o $@ -x c $< | |
93 | ||
94 | Objects/%.o: %.m $(header) | |
95 | @mkdir -p $(dir $@) | |
96 | @echo "[cycc] $<" | |
97 | @$(cycc) -c -o $@ $< $(flags) | |
5f6bff8c | 98 | |
7c8912f8 JF |
99 | Objects/%.o: %.mm $(header) |
100 | @mkdir -p $(dir $@) | |
101 | @echo "[cycc] $<" | |
102 | @$(cycc) -c -o $@ $< $(flags) $(xflags) | |
e95a1972 | 103 | |
8a2c6d14 JF |
104 | sysroot: |
105 | @echo "Please read compiling.txt: you do not have a ./sysroot/ folder with the on-device requirements." 1>&2 | |
106 | @echo 1>&2 | |
107 | @exit 1 | |
108 | ||
7c8912f8 JF |
109 | MobileCydia: sysroot $(object) |
110 | @echo "[link] $(object:Objects/%=%)" | |
111 | @$(cycc) $(filter %.o,$^) $(flags) $(link) $(uikit) | |
443b9e05 JF |
112 | @echo "[strp] $@" |
113 | @strip -no_uuid $@ | |
7c8912f8 | 114 | @echo "[sign] $@" |
443b9e05 | 115 | @ldid -T0 -Slaunch.xml $@ || { rm -f $@ && false; } |
03c0f7a9 | 116 | |
e17a8c4f JF |
117 | CydiaAppliance: CydiaAppliance.mm |
118 | $(cycc) $(filter %.mm,$^) $(flags) -bundle $(link) $(backrow) | |
119 | ||
120 | package: MobileCydia | |
7e2bd591 | 121 | sudo rm -rf _ |
03c0f7a9 JF |
122 | mkdir -p _/var/lib/cydia |
123 | ||
124 | mkdir -p _/usr/libexec | |
c21004b9 | 125 | cp -a Library _/usr/libexec/cydia |
7e2bd591 | 126 | cp -a sysroot/usr/bin/du _/usr/libexec/cydia |
03c0f7a9 JF |
127 | |
128 | mkdir -p _/System/Library | |
c21004b9 | 129 | cp -a LaunchDaemons _/System/Library/LaunchDaemons |
03c0f7a9 JF |
130 | |
131 | mkdir -p _/Applications | |
e17a8c4f JF |
132 | cp -a MobileCydia.app _/Applications/Cydia.app |
133 | cp -a MobileCydia _/Applications/Cydia.app/MobileCydia | |
134 | ||
135 | #mkdir -p _/Applications/Lowtide.app/Appliances | |
136 | #cp -a Cydia.frappliance _/Applications/Lowtide.app/Appliances | |
137 | #cp -a CydiaAppliance _/Applications/Lowtide.app/Appliances/Cydia.frappliance | |
03c0f7a9 | 138 | |
03c0f7a9 | 139 | mkdir -p _/DEBIAN |
3adcfba7 | 140 | ./control.sh _ >_/DEBIAN/control |
03c0f7a9 | 141 | |
7fc02989 JF |
142 | find _ -name '*.png' -exec ./pngcrush.sh '{}' ';' |
143 | ||
7e2bd591 JF |
144 | sudo chown -R 0 _ |
145 | sudo chgrp -R 0 _ | |
e17a8c4f | 146 | sudo chmod 6755 _/Applications/Cydia.app/MobileCydia |
7e2bd591 | 147 | |
3adcfba7 | 148 | mkdir -p debs |
f9ba524a | 149 | ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb |
3adcfba7 | 150 | $(dpkg) -b _ Cydia.deb |
ce0372db | 151 | @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)" |
8cc774c5 JF |
152 | |
153 | .PHONY: all clean sign |