forked from tytso/xfstests-bld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-all
executable file
·255 lines (231 loc) · 6.54 KB
/
build-all
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
246
247
248
249
250
251
252
253
254
255
#!/bin/bash
set -e
if test -f config.custom ; then
. config.custom
else
. config
fi
if test -n "$TOOLCHAIN_DIR" -a -d "$TOOLCHAIN_DIR"; then
PATH=$TOOLCHAIN_DIR/bin:$PATH
fi
if test -n "$CROSS_COMPILE" ; then
cross="--build=$(e2fsprogs-libs/config/config.guess) --host=$CROSS_COMPILE"
crossfio="--cc=$CROSS_COMPILE-gcc"
fi
case "$CROSS_COMPILE" in
*-android|*-androideabi)
DO_ANDROID=yes
SKIP_KVM_UTILS=yes
SKIP_QUOTA=yes
SKIP_FIO=yes
SKIP_DBENCH=yes
;;
esac
function build_start () {
echo "------------------------ Starting build of $*"
}
function set_skip_all () {
SKIP_E2FSLIBS=yes
SKIP_ATTR=yes
SKIP_ACL=yes
SKIP_POPT=yes
SKIP_AIO=yes
SKIP_DBENCH=yes
SKIP_FIO=yes
SKIP_XFSPROGS=yes
SKIP_XFSTESTS=yes
SKIP_QUOTA=yes
SKIP_KVM_UTILS=yes
}
while [ "$1" != "" ]; do
case $1 in
--skip-dbench)
SKIP_DBENCH=yes
;;
--skip-quota)
SKIP_QUOTA=yes
;;
--attr-only)
set_skip_all
unset SKIP_ATTR
;;
--acl-only)
set_skip_all
unset SKIP_ACL
;;
--popt-only)
set_skip_all
unset SKIP_POPT
;;
--aio-only)
set_skip_all
unset SKIP_AIO
;;
--e2fslibs-only)
set_skip_all
unset SKIP_E2FSLIBS
;;
--dbench-only)
set_skip_all
unset SKIP_DBENCH
;;
--fio-only)
set_skip_all
unset SKIP_FIO
;;
--quota-only)
set_skip_all
unset SKIP_QUOTA
;;
--xfsprogs-only)
set_skip_all
unset SKIP_XFSPROGS
;;
--xfstests-only)
set_skip_all
unset SKIP_XFSTESTS
;;
--kvm-utils-only)
set_skip_all
unset SKIP_KVM_UTILS
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
shift
done
nr_cpus=$(getconf _NPROCESSORS_ONLN)
J=-j$(expr $nr_cpus \* 1)
DESTDIR=$(pwd)/bld
mkdir -p $DESTDIR
if test -n "$DO_ANDROID" ; then
build_start "Android compatibility library"
(cd android-compat; ./configure $cross ; make $J prefix=$DESTDIR install)
android_compat="-landroid_compat"
LCF="-fpie -include android_compat.h"
LLF="-pie"
else
LCF="-g -O2"
fi
if test -z "$SKIP_E2FSLIBS" ; then
build_start "e2fslibs"
(cd e2fsprogs-libs; \
CFLAGS="$LCF -I$DESTDIR/include" \
LDFLAGS="$LLF $EXEC_LDFLAGS -L$DESTDIR/lib" \
./configure $cross --prefix=/ --disable-nls; make $J; \
make DESTDIR=$DESTDIR $J install)
fi
if test -z "$SKIP_ATTR" ; then
build_start "extended attribute library"
(cd attr; \
CFLAGS="$LCF -I$DESTDIR/include" \
LDFLAGS="$LLF $EXEC_LDFLAGS -static -L$DESTDIR/lib" \
./configure $cross --prefix=$DESTDIR --disable-nls; \
make $J LDFLAGS="$LLF $EXEC_LLDFLAGS -L$DESTDIR/lib" ; \
make $J install-dev ; make $J install)
fi
if test -z "$SKIP_ACL" ; then
build_start "ACL library"
(cd acl; \
CPPFLAGS="-I$DESTDIR/include" \
CFLAGS="$LCF -I$DESTDIR/include" \
LDFLAGS="$LLF $EXEC_LDFLAGS -L$DESTDIR/lib" \
./configure $cross --prefix=$DESTDIR --disable-nls; \
make $J LDFLAGS="$LLF $EXEC_LLDFLAGS -static -L$DESTDIR/lib" \
LIBTOOL="/usr/bin/libtool --tag=CC" ; \
make $J install)
fi
if test -z "$SKIP_POPT" ; then
build_start "POPT library"
(cd popt; \
CPPFLAGS="-I$DESTDIR/include" \
CFLAGS="$LCF -I$DESTDIR/include" \
LDFLAGS="$LLF -static -L$DESTDIR/lib" \
./configure $cross --prefix=$DESTDIR --disable-nls; \
make $J LLDFLAGS=-all-static LIBTOOL="/usr/bin/libtool --tag=CC" ; \
make $J install)
fi
if test -z "$SKIP_AIO" ; then
build_start "AIO library"
(cd libaio; ./configure $cross --disable-nls;
make $J prefix=$DESTDIR install)
rm $DESTDIR/lib/libaio.so*
fi
if test -z "$SKIP_DBENCH" ; then
build_start "dbench"
mkdir -p $DESTDIR/lib
mkdir -p $DESTDIR/bin
(cd dbench; \
autoheader ; autoconf ; \
CFLAGS="$LCF -I$DESTDIR/include" \
CPPFLAGS="-I$DESTDIR/include" \
LDFLAGS="$EXEC_LDFLAGS" \
LIBS="$LLF -L$DESTDIR/lib" \
./configure $cross --datadir=/root/xfstests/lib; \
make $J ; cp dbench $DESTDIR/bin ; cp client.txt $DESTDIR/lib)
fi
if test -z "$SKIP_XFSPROGS" ; then
build_start "xfsprogs"
(cd xfsprogs-dev; make $J realclean ; make $J configure ; \
ver=$(git describe --always --dirty); echo "xfsprogs $ver ($(git log -1 --pretty=%cD))" > ../xfsprogs.ver ; \
aclocal -I m4 ; autoconf -I m4 ; \
CFLAGS="$LCF -I$DESTDIR/include" \
CPPFLAGS="-I$DESTDIR/include" \
LDFLAGS="$LLF -static -L$DESTDIR/lib" \
LIBS=-lpthread \
./configure $cross --prefix=/ --disable-lib64 --disable-gettext ; \
make $J LLDFLAGS=-all-static V=1 PLDLIBS="$android_compat" ; \
DIST_ROOT=$DESTDIR make $J install; \
DIST_ROOT=$DESTDIR make $J install-dev)
fi
find . -name \*.la | xargs rm -f # Die, libtool, die!!!!
if test -z "$SKIP_FIO"; then
(cd fio; \
ver=$(git describe --always --dirty); echo "fio $ver ($(git log -1 --pretty=%cD))" > ../fio.ver ; \
export CFLAGS="$LCF -I$DESTDIR/include" ; \
export LDFLAGS="$LLF $EXEC_LDFLAGS -L$DESTDIR/lib" ; \
./configure $crossfio --extra-cflags="$CFLAGS"; make V=1 prefix=/ $J; make prefix=/ V=1 DESTDIR=$DESTDIR $J install)
fi
if test -z "$SKIP_XFSTESTS" ; then
build_start "xfstests"
(cd xfstests-dev; \
ver=$(git describe --always --dirty); echo "xfstests $ver ($(git log -1 --pretty=%cD))" > ../xfstests.ver ; \
autoheader ; autoconf ; \
CFLAGS="$LCF -I$DESTDIR/include -fno-stack-protector" \
CPPFLAGS="-I$DESTDIR/include" \
LDFLAGS="$LLF -static -L$DESTDIR/lib" \
LIBS=-lpthread \
./configure $cross ; \
make $J LLDFLAGS=$EXEC_LLDFLAGS PLDLIBS="$android_compat" \
LIBTOOL="/usr/bin/libtool --tag=CC" BUILD_VERBOSE=1)
fi
if test -z "$SKIP_QUOTA"; then
build_start "quota-tools"
#
# Hack around older quota-tools's lack of cross compilation support
#
if test -f quota/Makefile.in && ! grep -q "@CC@" quota/Makefile.in ; then
echo "No @CC@"
ed quota/Makefile.in <<EOF
1i
CC = @CC@
.
w
q
EOF
fi
(cd quota; \
ver=$(git describe --always --dirty); echo "quota $ver ($(git log -1 --pretty=%cD))" > ../quota.ver ; \
export CFLAGS="$LCF -I$DESTDIR/include" ; \
export LDFLAGS="$LLF $EXEC_LDFLAGS -L$DESTDIR/lib $EXEC_LDFLAGS" ; \
export CPPFLAGS="-I$DESTDIR/include" ; \
autoreconf -fvi ; \
./configure $cross --enable-ext2direct=no --enable-nls=no --prefix=$DESTDIR ; \
make AM_LDFLAGS="" V=1 $J; make V=1 $J install)
fi
if test -z "$SKIP_KVM_UTILS"; then
(cd misc ; LDFLAGS="$EXEC_LDFLAGS" ./configure $cross ; \
make $J ; make install DESTDIR=$DESTDIR)
fi