blob: 2f59dce1341e8e6bc494320b180ca31bf62eb335 (
plain)
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
|
#!/bin/sh
#
# Build 32- and 64-bit busybox binaries for release
#
TARGETS="build_32 build_64 build_64a build_64u"
if [ ! -d busybox-w32 ]
then
echo "busybox-w32 doesn't exist"
exit 0
fi
# remove old and make new build directories
for i in $TARGETS
do
rm -rf $i
cp -rp busybox-w32 $i
done
# apply default configuration
for i in $TARGETS
do
(
if [ $i = "build_64" ]
then
CONFIG=mingw64_defconfig
BITS=64
elif [ $i = "build_64a" ]
then
PATH="/data2/llvm/current/bin:$PATH"
CONFIG=mingw64a_defconfig
BITS=64
elif [ $i = "build_64u" ]
then
CONFIG=mingw64u_defconfig
BITS=64
elif [ $i = "build_32" ]
then
CONFIG=mingw32_defconfig
BITS=32
fi
cd $i
git checkout master
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) TZ=UTC0 \
make ${CONFIG}
# The clang/aarch64 build is not subject to optimisation. The
# '-flto' option increased the size of the binary slightly (0.23%)
# and decreased the time to run the testsuite slightly (0.33%).
# It hardly seems worth bothering about.
#
if [ $i != "build_64a" ]
then
# link time optimisation, stack protection
sed -e 's/^CONFIG_EXTRA_CFLAGS="\(.*\)"$/CONFIG_EXTRA_CFLAGS="\1 -flto -fstack-protector --param=ssp-buffer-size=4"/' \
-e 's/^CONFIG_EXTRA_CFLAGS=" /CONFIG_EXTRA_CFLAGS="/' \
-e 's/^CONFIG_EXTRA_LDLIBS="\(.*\)"$/CONFIG_EXTRA_LDLIBS="\1 -l:libssp.a"/' \
-e 's/^CONFIG_EXTRA_LDLIBS=" /CONFIG_EXTRA_LDLIBS="/' \
-i .config
# does ld support --disable-reloc-section?
eval $(grep CONFIG_CROSS_COMPILER_PREFIX .config)
[ $BITS -eq 32 ] && [ -n "$CONFIG_CROSS_COMPILER_PREFIX" ] && \
${CONFIG_CROSS_COMPILER_PREFIX}ld --help | \
grep -q disable-reloc-section &&
sed -e 's/^CONFIG_EXTRA_LDFLAGS="\(.*\)"$/CONFIG_EXTRA_LDFLAGS="\1 -Wl,--disable-reloc-section"/' \
-e 's/^CONFIG_EXTRA_LDFLAGS=" /CONFIG_EXTRA_LDFLAGS="/' \
-i .config
fi
)
done
# perform build
for i in $TARGETS
do
BITS=64
if [ $i = "build_32" ]
then
BITS=32
fi
(
cd $i
if [ $i = "build_64a" ]
then
# /data2/llvm/current should be a symlink
PATH="/data2/llvm/current/bin:$PATH"
VERSION=$(readlink /data2/llvm/current)
else
GCCV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-gcc)
CRTV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-crt)
VERSION="$GCCV; $CRTV"
fi
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) TZ=UTC0 \
make -j $(nproc) EXTRAVERSION="-`git describe --match=FRP`" MINGW_VER="$VERSION"
)
done
# Check the expected binaries exist
echo
for i in $TARGETS
do
ls -l $i/busybox.exe
done
|