Files
applets
applets_sh
arch
archival
configs
console-tools
coreutils
debianutils
docs
e2fsprogs
editors
examples
findutils
include
init
libbb
libpwdgrp
loginutils
mailutils
miscutils
modutils
networking
printutils
procps
runit
scripts
basic
kconfig
Kbuild.include
Kbuild.src
Makefile.IMA
Makefile.build
Makefile.clean
Makefile.host
Makefile.lib
bb_release
bloat-o-meter
checkhelp.awk
checkstack.pl
cleanup_printf2puts
echo.c
find_bad_common_bufsiz
find_stray_common_vars
find_stray_empty_lines
fix_ws.sh
gcc-version.sh
gen_build_files.sh
memusage
mkconfigs
mkdiff_obj
mkdiff_obj_bloat
mkmakefile
objsizes
randomtest
randomtest.loop
sample_pmap
showasm
test_make_O
test_make_clean
trylink
selinux
shell
sysklogd
testsuite
util-linux
.gitignore
.indent.pro
AUTHORS
Config.in
INSTALL
LICENSE
Makefile
Makefile.custom
Makefile.flags
Makefile.help
README
TODO
TODO_unicode
busybox/scripts/randomtest
2010-07-06 02:26:35 +02:00

97 lines
2.7 KiB
Bash
Executable File

#!/bin/sh
# If not specified in environment...
if ! test "$LIBC"; then
# Select which libc to build against
LIBC="glibc"
LIBC="uclibc"
fi
# x86 32-bit:
#CROSS_COMPILER_PREFIX="i486-linux-uclibc-"
# My system has strange prefix for x86 64-bit uclibc:
#CROSS_COMPILER_PREFIX="x86_64-pc-linux-gnu-"
if test $# -lt 2 || ! test -d "$1" || test -e "$2"; then
echo "Usage: $0 SRC_DIR TMP_DIR"
echo
echo "SRC_DIR will be copied to TMP_DIR directory."
echo "Then a random build will be performed."
echo
echo "Useful variables:"
echo "\$LIBC, \$CROSS_COMPILER_PREFIX, \$MAKEOPTS"
exit 1
fi
cp -dpr -- "$1" "$2" || { echo "copy error"; exit 1; }
cd -- "$2" || { echo "cd $dir error"; exit 1; }
# Generate random config
make randconfig >/dev/null || { echo "randconfig error"; exit 1; }
# Tweak resulting config
cat .config \
| grep -v CONFIG_DEBUG_PESSIMIZE \
| grep -v CONFIG_WERROR \
| grep -v CONFIG_CROSS_COMPILER_PREFIX \
| grep -v CONFIG_SELINUX \
| grep -v CONFIG_EFENCE \
| grep -v CONFIG_DMALLOC \
\
| grep -v CONFIG_RFKILL \
>.config.new
mv .config.new .config
echo '# CONFIG_DEBUG_PESSIMIZE is not set' >>.config
echo '# CONFIG_WERROR is not set' >>.config
echo "CONFIG_CROSS_COMPILER_PREFIX=\"${CROSS_COMPILER_PREFIX}\"" >>.config
echo '# CONFIG_SELINUX is not set' >>.config
echo '# CONFIG_EFENCE is not set' >>.config
echo '# CONFIG_DMALLOC is not set' >>.config
echo '# CONFIG_RFKILL is not set' >>.config
# If glibc, don't build static
if test x"$LIBC" = x"glibc"; then
cat .config \
| grep -v CONFIG_STATIC \
>.config.new
mv .config.new .config
echo '# CONFIG_STATIC is not set' >>.config
fi
# If uclibc, build static, and remove some things
# likely to not work on uclibc.
if test x"$LIBC" = x"uclibc"; then
cat .config \
| grep -v CONFIG_STATIC \
| grep -v CONFIG_BUILD_LIBBUSYBOX \
| grep -v CONFIG_PIE \
\
| grep -v CONFIG_FEATURE_2_4_MODULES \
>.config.new
mv .config.new .config
echo 'CONFIG_STATIC=y' >>.config
echo '# CONFIG_BUILD_LIBBUSYBOX is not set' >>.config
echo '# CONFIG_PIE is not set' >>.config
echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
fi
# If STATIC, remove some things.
# PAM with static linking is probably pointless
# (but I need to try - now I don't have libpam.a on my system, only libpam.so)
if grep -q "^CONFIG_STATIC=y" .config; then
cat .config \
| grep -v CONFIG_PAM \
>.config.new
mv .config.new .config
echo '# CONFIG_PAM is not set' >>.config
fi
# Regenerate .config with default answers for yanked-off options
# (most of default answers are "no").
{ yes "" | make oldconfig >/dev/null; } || { echo "oldconfig error"; exit 1; }
# Build!
nice -n 10 make $MAKEOPTS 2>&1 | tee make.log
# Return exitcode 1 if busybox executable does not exist
test -x busybox