diff options
| author | Ron Yorston <rmy@pobox.com> | 2023-06-04 10:56:34 +0100 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2023-06-04 10:56:34 +0100 |
| commit | 0b6aed138649cb843cbbdfe2ca5ff5e56f3a0825 (patch) | |
| tree | 35b3eba8e14d4c54d8af6a99e894783b9bb76531 /examples | |
| parent | e3bfe36959af3029fca49ca3eeb3e05edb7420ac (diff) | |
| download | busybox-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)
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/mswin-build/README | 6 | ||||
| -rwxr-xr-x | examples/mswin-build/mkprerelease | 48 | ||||
| -rwxr-xr-x | examples/mswin-build/mkrelease | 70 |
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 @@ | |||
| 1 | These are the scripts used to cross-compile busybox-w32. | ||
| 2 | |||
| 3 | The release build performs some additional optimisation and is | ||
| 4 | slightly slower as a result. It also includes information about | ||
| 5 | the build platform in the help message. This assumes the build is | ||
| 6 | done 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 | # | ||
| 5 | TARGETS="build_pre_32 build_pre_64" | ||
| 6 | |||
| 7 | # If an argument is supplied it overrides the default source directory. | ||
| 8 | SRC=busybox-w32 | ||
| 9 | if [ $# -eq 1 ] | ||
| 10 | then | ||
| 11 | SRC=$1 | ||
| 12 | fi | ||
| 13 | |||
| 14 | if [ ! -d $SRC ] | ||
| 15 | then | ||
| 16 | echo "$SRC doesn't exist" | ||
| 17 | exit 0 | ||
| 18 | fi | ||
| 19 | |||
| 20 | # remove old and make new build directories | ||
| 21 | for i in $TARGETS | ||
| 22 | do | ||
| 23 | rm -rf $i | ||
| 24 | cp -rp $SRC $i | ||
| 25 | done | ||
| 26 | |||
| 27 | # apply default configuration | ||
| 28 | for i in $TARGETS | ||
| 29 | do | ||
| 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}) | ||
| 39 | done | ||
| 40 | |||
| 41 | # perform build | ||
| 42 | for i in $TARGETS | ||
| 43 | do | ||
| 44 | ( | ||
| 45 | cd $i | ||
| 46 | make -j $(nproc) EXTRAVERSION="-$(git describe --match=FRP | sed 's/FRP/PRE/')" | ||
| 47 | ) | ||
| 48 | done | ||
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 | # | ||
| 5 | TARGETS="build_32 build_64" | ||
| 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 | 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 | ) | ||
| 47 | done | ||
| 48 | |||
| 49 | # perform build | ||
| 50 | for i in $TARGETS | ||
| 51 | do | ||
| 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 | ) | ||
| 70 | done | ||
