-
Notifications
You must be signed in to change notification settings - Fork 1
/
rules
executable file
·245 lines (217 loc) · 7.77 KB
/
rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#!/usr/bin/make -f
# -*- makefile -*-
export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS
d = debian/gcc-arm-linux-androideabi
DESTDIR = $(CURDIR)/tmp
include /usr/share/dpkg/default.mk
TARGET = arm-linux-androideabi
TARGET_TOOLS_PATH = $(DESTDIR)/usr
TARGET_TOOLS_PREFIX = $(TARGET_TOOLS_PATH)/bin/$(TARGET)-
SYSROOT=$(CURDIR)/sys-root
SET_PATH = PATH=$(DESTDIR)/usr/bin:$(PATH)
CFLAGS_FOR_TARGET = -O2 -Os -g -DTARGET_POSIX_IO -fno-short-enums -isystem $(CURDIR)/android/bionic/libc/include -isystem $(CURDIR)/android/bionic/libc/kernel/common -isystem $(CURDIR)/android/bionic/libc/kernel/arch-arm -isystem $(CURDIR)/android/bionic/libc/arch-arm/include -isystem $(CURDIR)/android/bionic/libm/include -isystem $(CURDIR)/android/bionic/libm/include/arm -isystem $(CURDIR)/android/bionic/libm/arm -include $(CURDIR)/android/bionic/libc/include/sys/limits.h
CFLAGS=-O2
stamps/binutils-prepare:
rm -rf binutils
mkdir -p binutils
tar -C binutils -x -f /usr/src/binutils/binutils-*.tar.*
cd binutils && ln -sf binutils-* binutils
mkdir -p stamps && touch $@
stamps/gcc-prepare:
rm -rf gcc
cp -a /usr/src/gcc-4.7 gcc
mkdir -p gcc/stamps
cd gcc && debian/rules series
cp debian/patches/gcc/* gcc/debian/patches/
cd gcc && debian/rules patch
mkdir -p stamps && touch $@
stamps/binutils1: stamps/binutils-prepare
mkdir -p binutils/build1
cd binutils/build1 && \
../binutils/configure \
--prefix=/usr \
--build=$(DEB_BUILD_GNU_TYPE) \
--host=$(DEB_BUILD_GNU_TYPE) \
--target=$(TARGET) \
--disable-docs \
--disable-nls \
--disable-werror \
--disable-ppl-version-check \
--enable-gold=default \
--disable-cloog-version-check \
--enable-cloog-backend=isl \
--enable-plugins \
--enable-threads \
--disable-shared
dh_auto_build --parallel -Bbinutils/build1
dh_auto_build --parallel -Bbinutils/build1 -- install DESTDIR=$(DESTDIR)
mkdir -p stamps && touch $@
stamps/gcc-stage1: stamps/binutils1 stamps/gcc-prepare
rm -rf gcc/stage1
mkdir -p gcc/stage1
cd gcc/stage1 && \
$(SET_PATH) CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" ../src/configure \
--prefix=$(DESTDIR)/usr \
--libexecdir=$(DESTDIR)/usr/lib \
--build=$(DEB_BUILD_GNU_TYPE) \
--host=$(DEB_BUILD_GNU_TYPE) \
--target=$(TARGET) \
--disable-multilib \
--with-gnu-as \
--with-gnu-ld \
--enable-languages=c,c++ \
--disable-ppl-version-check \
--disable-cloog-version-check \
--enable-cloog-backend=isl \
--disable-libssp --disable-nls \
--disable-libmudflap \
--disable-shared \
--disable-sjlj-exceptions \
--disable-libquadmath \
--disable-libitm \
--disable-libatomic \
--with-float=soft \
--with-fpu=vfp \
--with-arch=armv5te \
--enable-target-optspace \
--disable-docs \
--disable-nls \
--enable-threads \
--enable-tls \
--disable-libgomp \
--disable-libstdc__-v3 \
--disable-libitm \
--disable-libatomic
$(SET_PATH) dh_auto_build --parallel -Bgcc/stage1 -- CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)"
$(SET_PATH) dh_auto_build --parallel -Bgcc/stage1 -- install
touch $@
stamps/bionic1: stamps/gcc-stage1
ONE_SHOT_MAKEFILE=build/libs/host/Android.mk dh_auto_build --parallel -B$(CURDIR)/android -- all_modules TARGET_TOOLS_PREFIX=$(TARGET_TOOLS_PREFIX) TARGET_PRODUCT=pandaboard showcommands
ONE_SHOT_MAKEFILE=build/tools/acp/Android.mk dh_auto_build --parallel -B$(CURDIR)/android -- all_modules TARGET_TOOLS_PREFIX=$(TARGET_TOOLS_PREFIX) TARGET_PRODUCT=pandaboard showcommands
ONE_SHOT_MAKEFILE=bionic/Android.mk dh_auto_build --parallel -B$(CURDIR)/android -- all_modules out/target/product/pandaboard/obj/lib/crtbegin_dynamic.o TARGET_TOOLS_PREFIX=$(TARGET_TOOLS_PREFIX) TARGET_PRODUCT=pandaboard showcommands
./debian/build-sysroot.sh $(CURDIR)/android/out/target/product/pandaboard/ $(SYSROOT)
touch dummy.c
$(SET_PATH) $(TARGET)-gcc -O2 -o dummy.o -c dummy.c
$(SET_PATH) $(TARGET)-ar cru $(SYSROOT)/usr/lib/libpthread.a dummy.o
$(SET_PATH) $(TARGET)-ranlib $(SYSROOT)/usr/lib/libpthread.a
rm -f dummy.[co]
touch $@
stamps/gcc-stage2: stamps/binutils1 stamps/bionic1
rm -rf gcc/stage2
mkdir -p gcc/stage2
# FIXME should use --prefix=/usr & --with-build-sysroot ?
cd gcc/stage2 && \
$(SET_PATH) CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET) -fexceptions" CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET) -frtti" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" ../src/configure \
--prefix=/usr \
--libexecdir=/usr/lib \
--build=$(DEB_BUILD_GNU_TYPE) \
--host=$(DEB_BUILD_GNU_TYPE) \
--target=$(TARGET) \
--with-build-sysroot=$(SYSROOT) \
--disable-multilib \
--with-gnu-as \
--with-gnu-ld \
--enable-languages=c,c++ \
--disable-ppl-version-check \
--disable-cloog-version-check \
--enable-cloog-backend=isl \
--disable-libssp \
--disable-nls \
--disable-libmudflap \
--disable-shared \
--disable-sjlj-exceptions \
--disable-libquadmath \
--disable-libitm \
--disable-libatomic \
--with-float=soft \
--with-fpu=vfp \
--with-arch=armv5te \
--enable-target-optspace \
--disable-docs \
--disable-nls \
--enable-threads \
--enable-tls \
--enable-libgomp \
--disable-libitm \
--disable-libatomic \
--disable-libstdc__-v3
$(SET_PATH) dh_auto_build --parallel -Bgcc/stage2 -- CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET) -fexceptions" CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET) -frtti"
$(SET_PATH) dh_auto_build --parallel -Bgcc/stage2 -- install DESTDIR=$(DESTDIR)
touch $@
# Build shared binutils2
stamps/binutils2: stamps/binutils-prepare
mkdir -p binutils/build2
cd binutils/build2 && \
../binutils/configure \
--prefix=/usr \
--build=$(DEB_BUILD_GNU_TYPE) \
--host=$(DEB_BUILD_GNU_TYPE) \
--target=$(TARGET) \
--disable-docs \
--disable-nls \
--disable-werror \
--disable-ppl-version-check \
--enable-gold=default \
--disable-cloog-version-check \
--enable-cloog-backend=isl \
--enable-plugins \
--enable-threads \
--enable-shared
dh_auto_build --parallel -Bbinutils/build2
dh_auto_build --parallel -Bbinutils/build2 -- install DESTDIR=$(DESTDIR)
mkdir -p stamps && touch $@
build: build-arch build-indep
build-arch: stamps/gcc-stage2 stamps/binutils2
build-indep:
clean:
dh_testdir
dh_testroot
rm -rf stamps
rm -rf binutils gcc android/out tmp $(SYSROOT)
dh_clean
install: install-indep install-arch
install-indep:
install-arch:
dh_testdir
dh_testroot
dh_prep -s
dh_installdirs -s
tar -C $(DESTDIR) -c -f - . | tar -C $(d) -x -f -
cp -a $(SYSROOT)/usr/lib/* $(d)/usr/$(TARGET)/lib/
cp -a $(SYSROOT)/usr/include $(d)/usr/$(TARGET)
find $(d) -name "*.la" -delete
rm -rf $(d)/usr/bin/$(TARGET)-gcc-*
rm -rf $(d)/usr/lib/libiberty.a
rm -rf $(d)/usr/share/locale
rm -rf $(d)/usr/share/man/man7
rm -rf $(d)/usr/share/info
binary-indep: build-indep install-indep
dh_testdir
dh_testroot
binary-arch: build-arch install-arch
dh_testdir
dh_testroot
mkdir -p debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)
cp android/bionic/libm/NOTICE debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/copyright.libm
cp android/bionic/libc/NOTICE debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/copyright.libc
cp android/frameworks/native/NOTICE debian/$(DEB_SOURCE)/usr/share/doc/$(DEB_SOURCE)/copyright.frameworks.native
dh_installchangelogs -s
dh_installdocs -s
dh_installexamples -s
dh_installman -s
dh_strip -s
dh_compress -s
dh_fixperms -s
dh_installdeb -s
dh_shlibdeps -s -X.so
dh_gencontrol -s
dh_md5sums -s
dh_builddeb -s -- -Zxz
get-orig-source:
fakeroot ./debian/rules clean
-quilt pop -a -f
tar --exclude-vcs --transform='s,^,$(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)/,S' -caf ../$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz android
binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure