diff options
Diffstat (limited to '')
-rwxr-xr-x | examples/mswin-build/mkrelease | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/examples/mswin-build/mkrelease b/examples/mswin-build/mkrelease new file mode 100755 index 000000000..2f59dce13 --- /dev/null +++ b/examples/mswin-build/mkrelease | |||
@@ -0,0 +1,104 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Build 32- and 64-bit busybox binaries for release | ||
4 | # | ||
5 | TARGETS="build_32 build_64 build_64a build_64u" | ||
6 | |||
7 | if [ ! -d busybox-w32 ] | ||
8 | then | ||
9 | echo "busybox-w32 doesn't exist" | ||
10 | exit 0 | ||
11 | fi | ||
12 | |||
13 | # remove old and make new build directories | ||
14 | for i in $TARGETS | ||
15 | do | ||
16 | rm -rf $i | ||
17 | cp -rp busybox-w32 $i | ||
18 | done | ||
19 | |||
20 | # apply default configuration | ||
21 | for i in $TARGETS | ||
22 | do | ||
23 | ( | ||
24 | if [ $i = "build_64" ] | ||
25 | then | ||
26 | CONFIG=mingw64_defconfig | ||
27 | BITS=64 | ||
28 | elif [ $i = "build_64a" ] | ||
29 | then | ||
30 | PATH="/data2/llvm/current/bin:$PATH" | ||
31 | CONFIG=mingw64a_defconfig | ||
32 | BITS=64 | ||
33 | elif [ $i = "build_64u" ] | ||
34 | then | ||
35 | CONFIG=mingw64u_defconfig | ||
36 | BITS=64 | ||
37 | elif [ $i = "build_32" ] | ||
38 | then | ||
39 | CONFIG=mingw32_defconfig | ||
40 | BITS=32 | ||
41 | fi | ||
42 | |||
43 | cd $i | ||
44 | git checkout master | ||
45 | SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) TZ=UTC0 \ | ||
46 | make ${CONFIG} | ||
47 | |||
48 | # The clang/aarch64 build is not subject to optimisation. The | ||
49 | # '-flto' option increased the size of the binary slightly (0.23%) | ||
50 | # and decreased the time to run the testsuite slightly (0.33%). | ||
51 | # It hardly seems worth bothering about. | ||
52 | # | ||
53 | if [ $i != "build_64a" ] | ||
54 | then | ||
55 | # link time optimisation, stack protection | ||
56 | sed -e 's/^CONFIG_EXTRA_CFLAGS="\(.*\)"$/CONFIG_EXTRA_CFLAGS="\1 -flto -fstack-protector --param=ssp-buffer-size=4"/' \ | ||
57 | -e 's/^CONFIG_EXTRA_CFLAGS=" /CONFIG_EXTRA_CFLAGS="/' \ | ||
58 | -e 's/^CONFIG_EXTRA_LDLIBS="\(.*\)"$/CONFIG_EXTRA_LDLIBS="\1 -l:libssp.a"/' \ | ||
59 | -e 's/^CONFIG_EXTRA_LDLIBS=" /CONFIG_EXTRA_LDLIBS="/' \ | ||
60 | -i .config | ||
61 | # does ld support --disable-reloc-section? | ||
62 | eval $(grep CONFIG_CROSS_COMPILER_PREFIX .config) | ||
63 | [ $BITS -eq 32 ] && [ -n "$CONFIG_CROSS_COMPILER_PREFIX" ] && \ | ||
64 | ${CONFIG_CROSS_COMPILER_PREFIX}ld --help | \ | ||
65 | grep -q disable-reloc-section && | ||
66 | sed -e 's/^CONFIG_EXTRA_LDFLAGS="\(.*\)"$/CONFIG_EXTRA_LDFLAGS="\1 -Wl,--disable-reloc-section"/' \ | ||
67 | -e 's/^CONFIG_EXTRA_LDFLAGS=" /CONFIG_EXTRA_LDFLAGS="/' \ | ||
68 | -i .config | ||
69 | fi | ||
70 | ) | ||
71 | done | ||
72 | |||
73 | # perform build | ||
74 | for i in $TARGETS | ||
75 | do | ||
76 | BITS=64 | ||
77 | if [ $i = "build_32" ] | ||
78 | then | ||
79 | BITS=32 | ||
80 | fi | ||
81 | |||
82 | ( | ||
83 | cd $i | ||
84 | if [ $i = "build_64a" ] | ||
85 | then | ||
86 | # /data2/llvm/current should be a symlink | ||
87 | PATH="/data2/llvm/current/bin:$PATH" | ||
88 | VERSION=$(readlink /data2/llvm/current) | ||
89 | else | ||
90 | GCCV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-gcc) | ||
91 | CRTV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-crt) | ||
92 | VERSION="$GCCV; $CRTV" | ||
93 | fi | ||
94 | SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) TZ=UTC0 \ | ||
95 | make -j $(nproc) EXTRAVERSION="-`git describe --match=FRP`" MINGW_VER="$VERSION" | ||
96 | ) | ||
97 | done | ||
98 | |||
99 | # Check the expected binaries exist | ||
100 | echo | ||
101 | for i in $TARGETS | ||
102 | do | ||
103 | ls -l $i/busybox.exe | ||
104 | done | ||