-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbld-arm-hi3531-linux-gnueabi.sh
522 lines (467 loc) · 20.3 KB
/
bld-arm-hi3531-linux-gnueabi.sh
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
#/bin/bash
#
# Script for create custom cross toolchain for hi3531 platform
# Author: Varphone Wong, varphone@foxmail.com
# Require:
# Host: gcc >= 4.5, autotools, flex, bison, gmp-5.1.1, mpfr-3.1.2, mpc-1.0.1,
# isl-0.11.2, cloog-0.18.0, libelf-0.8.13
# Target: linux-3.0.y, binutils-2.23.52, gcc-4.8.1, glibc-2.17, gdb-4.6, qt-4.8.4, ncurses-5.9
#
# Usage:
# $ mkdir xxx
# $ cd xxx
# $ bld-arm-hi3531-linux-gnueabi.sh
#
TOP_BUILD_DIR=$(pwd)
BUILD=i686-linux-gnu
HOST=i686-linux-gnu
HOST_ROOT=${HOME}/workspace/target/i686-linux-gnu
HOST_SYSROOT=${HOST_ROOT}/usr
HOST_CFLAGS="-O2 -pipe"
HOST_CXXFLAGS="-O2 -pipe"
HOST_LDFLAGS=""
HOST_HEADERS="-I${HOST_SYSROOT}/include"
HOST_LIBS="-L${HOST_SYSROOT}/lib"
HOST_VARS="CC=${HOST}-gcc CXX=${HOST}-g++ AR=${HOST}-ar AS=${HOST}-as LD=${HOST}-ld RANLIB=${HOST}-ranlib STRIP=${HOST}-strip"
TARGET=arm-hi3531-linux-gnueabi
TARGET_ROOT=${HOME}/workspace/toolchain/${TARGET}
TARGET_SYSROOT=${TARGET_ROOT}/${TARGET}/sysroot
#TARGET_CFLAGS="-O2 -g -pipe -mlittle-endian -march=armv7-a -mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=vfpv3-d16"
#TARGET_CXXFLAGS="-O2 -g -pipe -mlittle-endian -march=armv7-a -mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=vfpv3-d16"
#TARGET_LDFLAGS="-Wl,-EL"
TARGET_CFLAGS="-O2 -g -pipe"
TARGET_CXXFLAGS="-O2 -g -pipe"
TARGET_LDFLAGS="-Wl,-EL"
TARGET_HEADERS="-I${TARGET_SYSROOT}/usr/include"
TARGET_LIBS="-L${TARGET_SYSROOT}/usr/lib"
TARGET_VARS="CC=${TARGET}-gcc CXX=${TARGET}-g++ AR=${TARGET}-ar AS=${TARGET}-as LD=${TARGET}-ld RANLIB=${TARGET}-ranlib STRIP=${TARGET}-strip"
TARGET_TARBALLS=${TARGET_ROOT}/${TARGET}/tarballs
PKG_VERSION="VCT v110 for Hi3531(gcc-4.8.1,glibc-2.17,eabi,ntpl)"
BUGURL="mailto://varphone@foxmail.com"
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[ "$1" = "rebuild" ] && rm -f .*${TARGET}.ok
check_dirs()
{
[ -d "${TARGET_TARBALLS}" ] || mkdir -p "${TARGET_TARBALLS}"
}
build_linux_headers()
{
[ -d "$1" ] || exit 1
[ -f .$1.${TARGET}.ok ] || {
pushd "$1"
make headers_install ARCH=$(echo "${TARGET}" | cut -d'-' -f1) INSTALL_HDR_PATH=${TARGET_SYSROOT}/usr || exit 1
popd
touch .$1.${TARGET}.ok
}
}
build_host_lib()
{
[ -d "$1" ] || exit 1
[ -f .$1.${HOST}.ok ] || {
mkdir -p "build-$1" || exit 1
pushd "build-$1"
CFLAGS="${HOST_CFLAGS} ${HOST_HEADERS}" CXXFLAGS="${HOST_CXXFLAGS} ${HOST_HEADERS}" LDFLAGS="${HOST_LDFLAGS} ${HOST_LIBS}" ../$1/configure --build=${HOST} --host=${HOST} --target=${HOST} --disable-shared --prefix=${HOST_SYSROOT} || exit 1
make || exit 1
make install || exit 1
popd
rm -rf "build-$1"
touch .$1.${HOST}.ok
}
}
build_target_app()
{
[ -d "$1" ] || exit 1
[ -f .$1.${TARGET}.ok ] || {
mkdir -p "build-$1" || exit 1
pushd "build-$1"
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
[ "${AUTORECONF}" = "y" ] && {
pushd ../$1/
[ -x autogen.sh ] && ./autogen.sh || autoreconf -fiv
popd
}
CFLAGS="${TARGET_CFLAGS} ${TARGET_HEADERS} ${EXTRA_CFLAGS}" CXXFLAGS="${TARGET_CXXFLAGS} ${TARGET_HEADERS} ${EXTRA_CXXFLAGS}" LDFLAGS="${TARGET_LDFLAGS} ${TARGET_LIBS} ${EXTRA_LDFLAGS}" ../$1/configure --host=${TARGET} --prefix=${TARGET_SYSROOT}/usr ${EXTRA_CONF} || exit 1
make -j1 || exit 1
make install || exit 1
popd
export PATH=${PATH_ORIG}
rm -rf "build-$1"
touch .$1.${TARGET}.ok
}
}
build_target_lib()
{
[ -d "$1" ] || exit 1
[ -f .$1.${TARGET}.ok ] || {
mkdir -p "build-$1" || exit 1
pushd "build-$1"
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
CFLAGS="${TARGET_CFLAGS} ${TARGET_HEADERS}" CXXFLAGS="${TARGET_CXXFLAGS} ${TARGET_HEADERS}" LDFLAGS="${TARGET_LDFLAGS} ${TARGET_LIBS}" ../$1/configure --host=${TARGET} --prefix=${TARGET_SYSROOT}/usr --enable-shared --enable-static ${EXTRA_CONF} || exit 1
make -j4 || exit 1
make install || exit 1
popd
export PATH=${PATH_ORIG}
rm -rf "build-$1"
touch .$1.${TARGET}.ok
}
}
build_target_lib_qt()
{
[ -d "$1" ] || exit 1
[ -f .$1.${TARGET}.ok ] || {
mkdir -p "build-$1" || exit 1
pushd "build-$1"
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
CFLAGS="${TARGET_HEADERS}" CXXFLAGS="${TARGET_HEADERS}" LDFLAGS="${TARGET_LDFLAGS} ${TARGET_LIBS}" ../$1/configure -opensource -confirm-license -embedded arm -xplatform qws/linux-arm-hi3531-gnueabi-g++ -release -fast -little-endian -qt-sql-sqlite -plugin-sql-sqlite -qt-gfx-linuxfb -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -no-rpath -no-pch -no-glib -no-webkit -no-qt3support -no-phonon -no-script -no-scripttools -no-declarative -no-declarative-debug -no-3dnow -no-avx -no-neon -no-openssl -no-nis -no-cups -no-dbus -no-opengl -no-libmng -nomake demos -nomake examples -nomake docs ${EXTRA_CONF} || exit 1
make -j4 || exit 1
make install || exit 1
popd
export PATH=${PATH_ORIG}
rm -rf "build-$1"
touch .$1.${TARGET}.ok
}
}
build_binutils()
{
[ -d "$1" ] || exit 1
[ -f .$1.${TARGET}.ok ] || {
mkdir -p build-binutils
pushd build-binutils
CFLAGS="${HOST_CFLAGS} ${HOST_HEADERS}" CXXFLAGS="${HOST_CXXFLAGS} ${HOST_HEADERS}" LDFLAGS="${HOST_LDFLAGS} ${HOST_LIBS}" ../$1/configure --build=${HOST} --host=${HOST} --target=${TARGET} --disable-shared --prefix=${TARGET_ROOT} --disable-multilib --disable-ppl-version-check --disable-cloog-version-check --enable-cloog-backend=isl --with-float=softfp --with-sysroot=${TARGET_SYSROOT} || exit 1
make -j4 || exit 1
make install || exit 1
popd
rm -rf build-binutils
touch .$1.${TARGET}.ok
}
}
build_gcc()
{
[ -d "$1" ] || exit 1
[ -f .$1.$2.${TARGET}.ok ] || {
mkdir -p build-gcc
pushd build-gcc
case "$2" in
stage1)
CC_FOR_BUILD=${HOST}-gcc CFLAGS="${HOST_CFLAGS} ${HOST_HEADERS}" CXXFLAGS="${HOST_CXXFLAGS} ${HOST_HEADERS}" LDFLAGS="${HOST_LDFLAGS} ${HOST_LIBS}" ../$1/configure --build=${HOST} --host=${HOST} --target=${TARGET} --prefix=${TARGET_ROOT} --disable-shared --disable-threads --disable-multilib --disable-isl-version-check --enable-languages=c,c++ --enable-__cxa_atexit --with-float=softfp --with-newlib --with-libelf=${HOST_SYSROOT} --with-local-prefix=${TARGET_SYSROOT} --with-sysroot=${TARGET_SYSROOT} --with-host-libstdcxx="-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" --without-headers || exit 1
make -j4 -l all-gcc all-target-libgcc || exit 1
make -j4 -l install-gcc install-target-libgcc || exit 1
;;
stage2)
CC_FOR_BUILD=${HOST}-gcc CFLAGS="${HOST_CFLAGS} ${HOST_HEADERS}" CXXFLAGS="${HOST_CXXFLAGS} ${HOST_HEADERS}" LDFLAGS="${HOST_LDFLAGS} ${HOST_LIBS}" ../$1/configure --build=${HOST} --host=${HOST} --target=${TARGET} --prefix=${TARGET_ROOT} --enable-shared --enable-threads=posix --disable-multilib --disable-isl-version-check --enable-languages=c,c++ --enable-__cxa_atexit --with-arch=armv7-a --with-cpu=cortex-a9 --with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb --with-local-prefix=${TARGET_SYSROOT} --with-sysroot=${TARGET_SYSROOT} --with-host-libstdcxx="-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" --with-pkgversion="${PKG_VERSION}" --with-bugurl="${BUGURL}" --without-newlib || exit 1
make -j4 -l all-gcc all-target-libgcc || exit 1
make -j4 -l install-gcc install-target-libgcc || exit 1
;;
stage3)
CC_FOR_BUILD=${HOST}-gcc CFLAGS="${HOST_CFLAGS} ${HOST_HEADERS}" CXXFLAGS="${HOST_CXXFLAGS} ${HOST_HEADERS}" LDFLAGS="${HOST_LDFLAGS} ${HOST_LIBS}" CFLAGS_FOR_TARGET="${TARGET_CFLAGS} " CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}" LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}" ../$1/configure --build=${HOST} --host=${HOST} --target=${TARGET} --prefix=${TARGET_ROOT} --disable-multilib --disable-isl-version-check --enable-shared --enable-threads=posix --enable-languages=c,c++ --enable-__cxa_atexit --with-arch=armv7-a --with-cpu=cortex-a9 --with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb --with-local-prefix=${TARGET_SYSROOT} --with-sysroot=${TARGET_SYSROOT} --with-host-libstdcxx="-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" --with-pkgversion="${PKG_VERSION}" --with-bugurl="${BUGURL}" --without-newlib || exit 1
make -j4 -l || exit 1
make -j4 -l install || exit 1
;;
*)
;;
esac
popd
rm -rf build-gcc
touch .$1.$2.${TARGET}.ok
}
}
build_glibc()
{
[ -d "$1" ] || exit 1
[ -f .$1.$2.${TARGET}.ok ] || {
mkdir -p build-glibc
pushd build-glibc
case "$2" in
stage1)
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
#cp ../$1/Makeconfig.static ../$1/Makeconfig
CFLAGS="${TARGET_CFLAGS}" CXXFLAGS="${TARGET_CXXFLAGS}" LDFLAGS="${TARGET_LDFLAGS}" ../$1/configure --prefix=/usr --host=${TARGET} --enable-add-ons --with-headers=${TARGET_SYSROOT}/usr/include || exit 1
make -j4 -l || exit 1
make -j4 -l install_root=${TARGET_SYSROOT} install || exit 1
export PATH=${PATH_ORIG}
;;
stage2)
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
#cp ../$1/Makeconfig.shared ../$1/Makeconfig
CFLAGS="${TARGET_CFLAGS}" CXXFLAGS="${TARGET_CXXFLAGS}" LDFLAGS="${TARGET_LDFLAGS}" ../$1/configure --host=${TARGET} --prefix=/usr --enable-add-ons --enable-obsolete-rpc --with-headers=${TARGET_SYSROOT}/usr/include --with-pkgversion="${PKG_VERSION}" --with-bugurl="${BUGURL}" || exit 1
make -j4 -l || exit 1
make -j4 -l install_root=${TARGET_SYSROOT} install || exit 1
export PATH=${PATH_ORIG}
;;
stage3)
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
#cp ../$1/Makeconfig.shared ../$1/Makeconfig
CFLAGS="${TARGET_CFLAGS}" CXXFLAGS="${TARGET_CXXFLAGS}" LDFLAGS="${TARGET_LDFLAGS}" ../$1/configure --host=${TARGET} --prefix=/usr --enable-add-ons --enable-obsolete-rpc --with-headers=${TARGET_SYSROOT}/usr/include || exit 1
make -j4 -l || exit 1
make -j4 -l install_root=${TARGET_SYSROOT} install || exit 1
export PATH=${PATH_ORIG}
;;
*)
;;
esac
popd
rm -rf build-glibc
touch .$1.$2.${TARGET}.ok
}
}
build_target_busybox()
{
[ -d "$1" ] || exit 1
[ -f .$1.$2.${TARGET}.ok ] || {
pushd $1
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
make $2
make -j4 -l || exit 1
make install || exit 1
pushd _install
fakeroot tar zcvf "${TARGET_TARBALLS}/$1.tgz" *
popd
make distclean
export PATH=${PATH_ORIG}
popd
touch .$1.$2.${TARGET}.ok
}
}
pack_runtime_libs()
{
# tar glibc libs
pushd "${TARGET_SYSROOT}"
cp -aP ../lib/libgcc_s.so* lib/
chmod a+x lib/libgcc_s.so*
fakeroot tar zcvf "${TARGET_TARBALLS}/lib.glibc.tgz" lib
rm lib/libgcc_s.so*
popd
# tar stdc++ libs
pushd "${TARGET_ROOT}/${TARGET}"
fakeroot tar zcvf "${TARGET_TARBALLS}/lib.stdc++.tgz" lib/libstdc++.so.6.0.18 lib/libstdc++.so.6 lib/libstdc++.so
popd
# tar qt libs
pushd "${TARGET_SYSROOT}/usr/local/qt-4.8.4"
cp -aP plugins lib/
fakeroot tar --transform 's,^,/usr/,S' -zcvf "${TARGET_TARBALLS}/lib.qt.tgz" lib/lib*.so* lib/fonts lib/plugins
rm -rf lib/plugins
popd
# tar sqlite3, lua, ... tools & libs
pushd "${TARGET_SYSROOT}"
fakeroot tar -zcvf "${TARGET_TARBALLS}/luajit2.tgz" usr/bin/luajit* usr/lib/libluajit*.so* usr/share/lua usr/share/luajit-2.0.1
fakeroot tar -zcvf "${TARGET_TARBALLS}/sqlite3.tgz" usr/bin/sqlite3 usr/lib/libsqlite3.so*
popd
}
echo "========================================================================="
echo "Checking environments ..."
check_dirs
echo "========================================================================="
echo "Preparing kernel headers ..."
build_linux_headers linux-3.0.y
echo "========================================================================="
echo "Building host libs ..."
build_host_lib gmp-5.1.1
build_host_lib mpfr-3.1.2
build_host_lib mpc-1.0.1
build_host_lib isl-0.11.2
build_host_lib cloog-0.18.0
build_host_lib libelf-0.8.13
echo "========================================================================="
echo "Building cross toolchain ..."
build_binutils binutils-2.23.52
build_gcc gcc-4.8.1 stage1
build_glibc glibc-2.17 stage1
build_gcc gcc-4.8.1 stage2
build_glibc glibc-2.17 stage2
build_gcc gcc-4.8.1 stage3
build_glibc glibc-2.17 stage3
echo "========================================================================="
echo "Make links for arm-linux ..."
(
pushd "${TARGET_ROOT}/bin"
find . -type f -exec bash -c "ln -s {} \$(echo {} | sed 's/${TARGET}/arm-linux/')" \; || exit 1
popd
)
echo "========================================================================="
echo "Building libelf for target ..."
(
export ${TARGET_VARS} EXTRA_CONF="--enable-elf64";
build_target_lib libelf-0.8.13
)
echo "========================================================================="
echo "Building ncurses for target ..."
EXTRA_CONF="--with-shared" build_target_lib ncurses-5.9
echo "========================================================================="
echo "Building gdb for target ..."
(
EXTRA_CFLAGS="-I${TARGET_SYSROOT}/usr/include/ncurses"
build_target_app gdb-7.6
)
echo "========================================================================="
echo "Building libav for target ..."
#EXTRA_CONF="--cc=${TARGET}-gcc --enable-gpl --enable-pthreads --enable-cross-compile --host-cc=gcc --arch=arm --target-os=linux" build_target_app libav-9.6
echo "========================================================================="
echo "Building ltrace for target ..."
#EXTRA_CFLAGS="-D__LIBELF64=1" EXTRA_CONF="--enable-werror=no" build_target_app ltrace-0.7.2
echo "========================================================================="
echo "Building qt for target ..."
(
EXTRA_CONF="-shared -prefix ${TARGET_SYSROOT}/usr/local/qt-4.8.4"
build_target_lib_qt qt-everywhere-opensource-src-4.8.4
fix_install=${TARGET_SYSROOT}/usr/local/qt-4.8.4/fix_install.sh
echo "/bin/bash" > ${fix_install}
echo "echo \"/bin/bash\" > bin/qt.conf" >> ${fix_install}
echo "echo \"[Paths]\" >> bin/qt.conf" >> ${fix_install}
echo "echo \"Prefix=\$(pwd)\" >> bin/qt.conf" >> ${fix_install}
chmod a+x ${fix_install}
) || exit 1
echo "========================================================================="
echo "Building freetype2 for target ..."
build_target_lib freetype-2.4.12
echo "========================================================================="
echo "Building gdbm for target ..."
build_target_lib gdbm-1.10
echo "========================================================================="
echo "Building gettext for target ..."
build_target_lib gettext-0.18.2
echo "========================================================================="
echo "Building jansson for target ..."
build_target_lib jansson-2.4
echo "========================================================================="
echo "Building libevent for target ..."
EXTRA_CONF="--disable-openssl --disable-debug-mode --enable-function-sections" build_target_lib libevent-2.1.3-alpha
echo "========================================================================="
echo "Building libpcap for target ..."
EXTRA_CONF="--with-pcap=linux" build_target_lib libpcap-1.3.0
echo "========================================================================="
echo "Building openssl for target ..."
(
src=openssl-1.0.1e
[ -d "${src}" ] || exit 1
[ -f .${src}.${TARGET}.ok ] || {
pushd ${src}
export ${TARGET_VARS}
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
./Configure --prefix=/usr no-asm shared linux-elf
make || exit 1
make install INSTALL_PREFIX=${TARGET_SYSROOT} || exit 1
make clean
export PATH=${PATH_ORIG}
popd
touch .${src}.${TARGET}.ok
}
) || exit 1
echo "========================================================================="
echo "Building pcre for target ..."
build_target_lib pcre-8.32
echo "========================================================================="
echo "Building readline for target ..."
build_target_lib readline-6.2
echo "========================================================================="
echo "Building sqlite3 for target ..."
build_target_lib sqlite-autoconf-3071602
echo "========================================================================="
echo "Building zlib for target ..."
(
src=zlib-1.2.8
[ -d "${src}" ] || exit 1
[ -f .${src}.${TARGET}.ok ] || {
pushd ${src}
export ${TARGET_VARS}
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
./configure --prefix=${TARGET_SYSROOT}/usr
make -j4 -l || exit 1
make install || exit 1
make clean
export PATH=${PATH_ORIG}
popd
touch .${src}.${TARGET}.ok
}
) || exit 1
echo "========================================================================="
echo "Building boost for target ..."
(
src=boost_1_53_0
[ -d "${src}" ] || exit 1
[ -f .${src}.${TARGET}.ok ] || {
pushd ${src}
export ${TARGET_VARS}
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
./b2 toolset=gcc-arm variant=release link=static runtime-link=static --prefix=${TARGET_SYSROOT}/usr --without-mpi -sZLIB_SOURCE=${TOP_BUILD_DIR}/zlib-1.2.8 -sBZIP2_SOURCE=${TOP_BUILD_DIR}/bzip2-1.0.6 install
export PATH=${PATH_ORIG}
popd
touch .${src}.${TARGET}.ok
}
) || exit 1
echo "========================================================================="
echo "Building busybox for target ..."
build_target_busybox busybox-1.21.0 hi3531_defconfig
echo "========================================================================="
echo "Building bash for target ..."
(
export ${TARGET_VARS} EXTRA_CFLAGS="-static" EXTRA_CONF="--enable-job-control --enable-static-link --disable-nls --disable-rpath --without-bash-malloc"
#build_target_app bash-4.2
) || exit 1
echo "========================================================================="
echo "Building e2fsprogs for target ..."
EXTRA_CONF="--enable-symlink-install --enable-relative-symlinks --enable-symlink-build --disable-debugfs --disable-imager --disable-tls --disable-uuidd --disable-nls --disable-rpath" build_target_app e2fsprogs-1.42.7
echo "========================================================================="
echo "Building iperf for target ..."
build_target_app iperf-3.0b5
echo "========================================================================="
echo "Building Luajit for target ..."
(
src=LuaJIT-2.0.1
[ -d "${src}" ] || exit 1
[ -f .${src}.${TARGET}.ok ] || {
pushd ${src}
export ${TARGET_VARS}
PATH_ORIG=${PATH}
export PATH=${TARGET_ROOT}/bin:${PATH}
make HOST_CC="gcc -m32" CROSS=${TARGET}-
make install PREFIX=/usr DESTDIR="${TARGET_SYSROOT}"
make clean
export PATH=${PATH_ORIG}
popd
touch .${src}.${TARGET}.ok
}
) || exit 1
echo "========================================================================="
echo "Building tcpdump for target ..."
ac_cv_linux_vers=3.0 build_target_app tcpdump-4.3.0
echo "========================================================================="
echo "Strip all target binaries ..."
${TARGET_ROOT}/bin/${TARGET}-strip ${TARGET_SYSROOT}/usr/bin/*
${TARGET_ROOT}/bin/${TARGET}-strip ${TARGET_SYSROOT}/usr/sbin/*
echo "========================================================================="
echo "Fix perms of target libraries ..."
find ${TARGET_SYSROOT}/lib -type d -exec chmod 0775 {} \;
find ${TARGET_SYSROOT}/lib -type f -exec chmod 0664 {} \;
find ${TARGET_SYSROOT}/usr/lib -type d -exec chmod 0775 {} \;
find ${TARGET_SYSROOT}/usr/lib -type f -exec chmod 0664 {} \;
find ${TARGET_SYSROOT}/usr/share -type d -exec chmod 0775 {} \;
find ${TARGET_SYSROOT}/usr/share -type f -exec chmod 0664 {} \;
echo "========================================================================="
echo "Change timestamp of target files ..."
d=$(date "+%F %T")
find ${TARGET_ROOT} -exec touch -h -d "$d" {} \;
echo "Generate installation fixing tool ..."
echo "========================================================================="
cat > ${TARGET_ROOT}/fix-install.sh << EOF
#!/bin/bash
p1=${TARGET_ROOT}/
p2=\$(pwd)/
pp1=\$(echo "\${p1}" | sed 's/\//\\\\\\//g')
pp2=\$(echo "\${p2}" | sed 's/\//\\\\\\//g')
find . -name "*.la" -exec sed -i "s/\${pp1}/\${pp2}/g" {} \;
EOF
echo a+x ${TARGET_ROOT}/fix-install.sh
echo "Packing for glibc and stdc++ runtime libraries ..."
pack_runtime_libs
echo "========================================================================="
echo "Every things build ok"