]> git.saurik.com Git - cydia.git/blob - makefile
Use -fvisibility=hidden.
[cydia.git] / makefile
1 sdks := /Developer/Platforms/iPhoneOS.platform/Developer/SDKs
2 ioss := $(sort $(patsubst $(sdks)/iPhoneOS%.sdk,%,$(wildcard $(sdks)/iPhoneOS*.sdk)))
3
4 ios := $(word $(words $(ioss)),$(ioss))
5 gcc := 4.2
6
7 flags :=
8 link :=
9
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
18 dpkg := dpkg-deb
19 endif
20
21 sdk := $(sdks)/iPhoneOS$(ios).sdk
22
23 flags += -F$(sdk)/System/Library/PrivateFrameworks
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
28 flags += -fobjc-exceptions
29 flags += -fno-guess-branch-probability
30 flags += -fvisibility=hidden
31
32 xflags :=
33 xflags += -fobjc-call-cxx-cdtors
34 xflags += -fvisibility-inlines-hidden
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
43 link += -framework SpringBoardServices
44 link += -framework SystemConfiguration
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
53
54 uikit :=
55 uikit += -framework UIKit
56
57 backrow :=
58 backrow += -FAppleTV -framework BackRow -framework AppleTV
59
60 version := $(shell ./version.sh)
61
62 #cycc = cycc -r4.2 -i$(ios) -o$@
63 gxx := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-$(gcc)
64 cycc = $(gxx) -mthumb -arch armv6 -o $@ -mcpu=arm1176jzf-s -miphoneos-version-min=2.0 -isysroot $(sdk) -idirafter /usr/include -F{sysroot,}/Library/Frameworks
65
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
85 all: MobileCydia
86
87 clean:
88 rm -f MobileCydia
89 rm -rf Objects/
90
91 Objects/%.o: %.c $(header)
92 @mkdir -p $(dir $@)
93 @echo "[cycc] $<"
94 @$(cycc) -c -o $@ -x c $<
95
96 Objects/%.o: %.m $(header)
97 @mkdir -p $(dir $@)
98 @echo "[cycc] $<"
99 @$(cycc) -c -o $@ $< $(flags)
100
101 Objects/%.o: %.mm $(header)
102 @mkdir -p $(dir $@)
103 @echo "[cycc] $<"
104 @$(cycc) -c -o $@ $< $(flags) $(xflags)
105
106 sysroot:
107 @echo "Please read compiling.txt: you do not have a ./sysroot/ folder with the on-device requirements." 1>&2
108 @echo 1>&2
109 @exit 1
110
111 MobileCydia: sysroot $(object)
112 @echo "[link] $(object:Objects/%=%)"
113 @$(cycc) $(filter %.o,$^) $(flags) $(link) $(uikit)
114 @echo "[strp] $@"
115 @strip -no_uuid $@
116 @echo "[sign] $@"
117 @ldid -T0 -Slaunch.xml $@ || { rm -f $@ && false; }
118
119 CydiaAppliance: CydiaAppliance.mm
120 $(cycc) $(filter %.mm,$^) $(flags) -bundle $(link) $(backrow)
121
122 package: MobileCydia
123 sudo rm -rf _
124 mkdir -p _/var/lib/cydia
125
126 mkdir -p _/usr/libexec
127 cp -a Library _/usr/libexec/cydia
128 cp -a sysroot/usr/bin/du _/usr/libexec/cydia
129
130 mkdir -p _/System/Library
131 cp -a LaunchDaemons _/System/Library/LaunchDaemons
132
133 mkdir -p _/Applications
134 cp -a MobileCydia.app _/Applications/Cydia.app
135 cp -a MobileCydia _/Applications/Cydia.app/MobileCydia
136
137 #mkdir -p _/Applications/Lowtide.app/Appliances
138 #cp -a Cydia.frappliance _/Applications/Lowtide.app/Appliances
139 #cp -a CydiaAppliance _/Applications/Lowtide.app/Appliances/Cydia.frappliance
140
141 mkdir -p _/DEBIAN
142 ./control.sh _ >_/DEBIAN/control
143
144 find _ -name '*.png' -exec ./pngcrush.sh '{}' ';'
145 find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
146
147 sudo chown -R 0 _
148 sudo chgrp -R 0 _
149 sudo chmod 6755 _/Applications/Cydia.app/MobileCydia
150
151 mkdir -p debs
152 ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb
153 $(dpkg) -b _ Cydia.deb
154 @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
155
156 .PHONY: all clean sign