]> git.saurik.com Git - cydia.git/blame - makefile
Deterministic build.
[cydia.git] / makefile
CommitLineData
0263db76 1sdks := /Developer/Platforms/iPhoneOS.platform/Developer/SDKs
ea958716 2ioss := $(sort $(patsubst $(sdks)/iPhoneOS%.sdk,%,$(wildcard $(sdks)/iPhoneOS*.sdk)))
0263db76 3
ea958716 4ios := $(word $(words $(ioss)),$(ioss))
670fdb01 5gcc := 4.2
c21004b9
JF
6
7flags :=
8link :=
9
d1ba8fd3
JF
10ifeq (o,O) # gzip is actually better
11dpkg := /Library/Cydia/bin/dpkg-deb
12ifeq ($(wildcard $(dpkg)),$(dpkg))
13dpkg := $(dpkg) -zlzma
14else
15dpkg := dpkg-deb -zbzip2
16endif
17else
c21004b9 18dpkg := dpkg-deb
d1ba8fd3 19endif
c21004b9 20
0263db76 21sdk := $(sdks)/iPhoneOS$(ios).sdk
ee4120ad
JF
22
23flags += -F$(sdk)/System/Library/PrivateFrameworks
c21004b9
JF
24flags += -I. -isystem sysroot/usr/include -Lsysroot/usr/lib
25flags += -Wall -Werror -Wno-deprecated-declarations
26flags += -fmessage-length=0
27flags += -g0 -O2
7c8912f8 28flags += -fobjc-exceptions
443b9e05 29flags += -fno-guess-branch-probability
7c8912f8
JF
30
31xflags :=
32xflags += -fobjc-call-cxx-cdtors
c21004b9
JF
33
34link += -framework CoreFoundation
35link += -framework CoreGraphics
36link += -framework Foundation
37link += -framework GraphicsServices
38link += -framework IOKit
39link += -framework JavaScriptCore
40link += -framework QuartzCore
0e371502 41link += -framework SpringBoardServices
c21004b9 42link += -framework SystemConfiguration
c21004b9
JF
43link += -framework WebCore
44link += -framework WebKit
45
46link += -lapr-1
47link += -lapt-pkg
48link += -lpcre
49
50link += -multiply_defined suppress
5f6bff8c 51
e17a8c4f
JF
52uikit :=
53uikit += -framework UIKit
54
55backrow :=
56backrow += -FAppleTV -framework BackRow -framework AppleTV
57
f9ba524a
JF
58version := $(shell ./version.sh)
59
ee4120ad 60#cycc = cycc -r4.2 -i$(ios) -o$@
89b0ea4a 61gxx := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-$(gcc)
435cb857 62cycc = $(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
64flags += -DCYDIA_VERSION='"$(version)"'
65
66dirs := Menes CyteKit Cydia SDURLCache
67
68code := $(foreach dir,$(dirs),$(wildcard $(foreach ext,h hpp c cpp m mm,$(dir)/*.$(ext))))
69code := $(filter-out SDURLCache/SDURLCacheTests.m,$(code))
70code += MobileCydia.mm iPhonePrivate.h Cytore.hpp lookup3.c
71
72source := $(filter %.m,$(code)) $(filter %.mm,$(code))
73source += $(filter %.c,$(code)) $(filter %.cpp,$(code))
74header := $(filter %.h,$(code)) $(filter %.hpp,$(code))
75
76object := $(source)
77object := $(object:.c=.o)
78object := $(object:.cpp=.o)
79object := $(object:.m=.o)
80object := $(object:.mm=.o)
81object := $(object:%=Objects/%)
82
e17a8c4f 83all: MobileCydia
dc5812ec 84
5f6bff8c 85clean:
e17a8c4f 86 rm -f MobileCydia
7c8912f8
JF
87 rm -rf Objects/
88
89Objects/%.o: %.c $(header)
90 @mkdir -p $(dir $@)
91 @echo "[cycc] $<"
92 @$(cycc) -c -o $@ -x c $<
93
94Objects/%.o: %.m $(header)
95 @mkdir -p $(dir $@)
96 @echo "[cycc] $<"
97 @$(cycc) -c -o $@ $< $(flags)
5f6bff8c 98
7c8912f8
JF
99Objects/%.o: %.mm $(header)
100 @mkdir -p $(dir $@)
101 @echo "[cycc] $<"
102 @$(cycc) -c -o $@ $< $(flags) $(xflags)
e95a1972 103
8a2c6d14
JF
104sysroot:
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
109MobileCydia: 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
117CydiaAppliance: CydiaAppliance.mm
118 $(cycc) $(filter %.mm,$^) $(flags) -bundle $(link) $(backrow)
119
120package: 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