aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-06-04 10:56:34 +0100
committerRon Yorston <rmy@pobox.com>2023-06-04 10:56:34 +0100
commit0b6aed138649cb843cbbdfe2ca5ff5e56f3a0825 (patch)
tree35b3eba8e14d4c54d8af6a99e894783b9bb76531
parente3bfe36959af3029fca49ca3eeb3e05edb7420ac (diff)
downloadbusybox-w32-0b6aed138649cb843cbbdfe2ca5ff5e56f3a0825.tar.gz
busybox-w32-0b6aed138649cb843cbbdfe2ca5ff5e56f3a0825.tar.bz2
busybox-w32-0b6aed138649cb843cbbdfe2ca5ff5e56f3a0825.zip
Example build scripts
Supply the scripts used to build release and prerelease busybox-w32. (GitHub issue #330)
-rw-r--r--examples/mswin-build/README6
-rwxr-xr-xexamples/mswin-build/mkprerelease48
-rwxr-xr-xexamples/mswin-build/mkrelease70
3 files changed, 124 insertions, 0 deletions
diff --git a/examples/mswin-build/README b/examples/mswin-build/README
new file mode 100644
index 000000000..57a13d8d5
--- /dev/null
+++ b/examples/mswin-build/README
@@ -0,0 +1,6 @@
1These are the scripts used to cross-compile busybox-w32.
2
3The release build performs some additional optimisation and is
4slightly slower as a result. It also includes information about
5the build platform in the help message. This assumes the build is
6done on a Fedora Linux system.
diff --git a/examples/mswin-build/mkprerelease b/examples/mswin-build/mkprerelease
new file mode 100755
index 000000000..ea98785d7
--- /dev/null
+++ b/examples/mswin-build/mkprerelease
@@ -0,0 +1,48 @@
1#!/bin/sh
2#
3# Build busybox prerelease binaries
4#
5TARGETS="build_pre_32 build_pre_64"
6
7# If an argument is supplied it overrides the default source directory.
8SRC=busybox-w32
9if [ $# -eq 1 ]
10then
11 SRC=$1
12fi
13
14if [ ! -d $SRC ]
15then
16 echo "$SRC doesn't exist"
17 exit 0
18fi
19
20# remove old and make new build directories
21for i in $TARGETS
22do
23 rm -rf $i
24 cp -rp $SRC $i
25done
26
27# apply default configuration
28for i in $TARGETS
29do
30 if [ $i = "build_pre_64" ]
31 then
32 CONFIG=mingw64_defconfig;
33 elif [ $i = "build_pre_32" ]
34 then
35 CONFIG=mingw32_defconfig;
36 fi
37
38 (cd $i; git checkout master; make ${CONFIG})
39done
40
41# perform build
42for i in $TARGETS
43do
44 (
45 cd $i
46 make -j $(nproc) EXTRAVERSION="-$(git describe --match=FRP | sed 's/FRP/PRE/')"
47 )
48done
diff --git a/examples/mswin-build/mkrelease b/examples/mswin-build/mkrelease
new file mode 100755
index 000000000..7ce9094f6
--- /dev/null
+++ b/examples/mswin-build/mkrelease
@@ -0,0 +1,70 @@
1#!/bin/sh
2#
3# Build 32- and 64-bit busybox binaries for release
4#
5TARGETS="build_32 build_64"
6
7if [ ! -d busybox-w32 ]
8then
9 echo "busybox-w32 doesn't exist"
10 exit 0
11fi
12
13# remove old and make new build directories
14for i in $TARGETS
15do
16 rm -rf $i
17 cp -rp busybox-w32 $i
18done
19
20# apply default configuration
21for i in $TARGETS
22do
23 BITS=32
24 if [ $i = "build_64" ]
25 then
26 BITS=64;
27 fi
28
29 (
30 cd $i
31 make mingw${BITS}_defconfig
32 # link time optimisation, fortify, stack protection
33 sed -e 's/^CONFIG_EXTRA_CFLAGS="\(.*\)"$/CONFIG_EXTRA_CFLAGS="\1 -flto -fstack-protector --param=ssp-buffer-size=4"/' \
34 -e 's/^CONFIG_EXTRA_CFLAGS=" /CONFIG_EXTRA_CFLAGS="/' \
35 -e 's/^CONFIG_EXTRA_LDLIBS="\(.*\)"$/CONFIG_EXTRA_LDLIBS="\1 -l:libssp.a"/' \
36 -e 's/^CONFIG_EXTRA_LDLIBS=" /CONFIG_EXTRA_LDLIBS="/' \
37 -i .config
38 # does ld support --disable-reloc-section?
39 eval $(grep CONFIG_CROSS_COMPILER_PREFIX .config)
40 [ $BITS -eq 32 ] && [ -n "$CONFIG_CROSS_COMPILER_PREFIX" ] && \
41 ${CONFIG_CROSS_COMPILER_PREFIX}ld --help | \
42 grep -q disable-reloc-section &&
43 sed -e 's/^CONFIG_EXTRA_LDFLAGS="\(.*\)"$/CONFIG_EXTRA_LDFLAGS="\1 -Wl,--disable-reloc-section"/' \
44 -e 's/^CONFIG_EXTRA_LDFLAGS=" /CONFIG_EXTRA_LDFLAGS="/' \
45 -i .config
46 )
47done
48
49# perform build
50for i in $TARGETS
51do
52 BITS=32
53 if [ $i = "build_64" ]
54 then
55 BITS=64;
56 fi
57
58 (
59 cd $i
60 GCCV=`rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-gcc`
61 CRTV=`rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-crt`
62 GLOB="; noglob"
63 if grep -q ^CONFIG_GLOBBING=y .config
64 then
65 GLOB="; glob"
66 fi
67 VER="($GCCV; $CRTV$GLOB)"
68 make -j $(nproc) EXTRAVERSION="-`git describe --match=FRP`" MINGW_VER="$VER"
69 )
70done