blob: 6b7db92391d73b817f5fc6ffff4e1d0619de49a6 [file] [log] [blame]
Denis Vlasenko27e15012008-09-28 17:19:02 +00001#!/bin/sh
2
3# Select which libc to build against
4libc="glibc" # assumed native
Denis Vlasenko62e0dc22008-11-09 16:08:31 +00005# static, cross-compilation
Denis Vlasenko27e15012008-09-28 17:19:02 +00006libc="uclibc"
Denis Vlasenko62e0dc22008-11-09 16:08:31 +00007# x86 32-bit:
8uclibc_cross="i486-linux-uclibc-"
9# My system has strange prefix for x86 64-bit uclibc:
10#uclibc_cross="x86_64-pc-linux-gnu-"
Denis Vlasenko27e15012008-09-28 17:19:02 +000011
12test -d tree || exit 1
13
14dir=test.$$
15while test -e "$dir" -o -e failed."$dir"; do
16 dir=test."$RANDOM"
17done
18
19cp -dpr tree "$dir" || exit 1
20cd "$dir" || exit 1
21
22echo "Running randconfig test in $dir..." >&2
23
24make randconfig >/dev/null || exit 1
25
26cat .config \
27| grep -v ^CONFIG_DEBUG_PESSIMIZE= \
28| grep -v CONFIG_WERROR \
29| cat >.config.new
30mv .config.new .config
Denys Vlasenko2315c882010-01-24 23:33:06 +010031#echo CONFIG_WERROR=y >>.config
32echo '# CONFIG_WERROR is not set' >>.config
Denis Vlasenko27e15012008-09-28 17:19:02 +000033
34test "$libc" = glibc && {
35cat .config \
Denys Vlasenko2315c882010-01-24 23:33:06 +010036| grep -v CONFIG_STATIC \
37| grep -v CONFIG_SELINUX \
38| grep -v CONFIG_EFENCE \
39| grep -v CONFIG_DMALLOC \
Denis Vlasenko27e15012008-09-28 17:19:02 +000040| cat >.config.new
41mv .config.new .config
Denys Vlasenko2315c882010-01-24 23:33:06 +010042echo '# CONFIG_STATIC is not set' >>.config
Denis Vlasenko27e15012008-09-28 17:19:02 +000043}
44
45test "$libc" = uclibc && {
46cat .config \
47| grep -v ^CONFIG_SELINUX= \
48| grep -v ^CONFIG_EFENCE= \
49| grep -v ^CONFIG_DMALLOC= \
50| grep -v ^CONFIG_BUILD_LIBBUSYBOX= \
51| grep -v ^CONFIG_PAM= \
52| grep -v ^CONFIG_TASKSET= \
Denys Vlasenko19158a82010-03-26 14:06:56 +010053| grep -v ^CONFIG_UNICODE_SUPPORT= \
Denis Vlasenko27e15012008-09-28 17:19:02 +000054| grep -v ^CONFIG_PIE= \
55| grep -v CONFIG_STATIC \
56| grep -v CONFIG_CROSS_COMPILER_PREFIX \
57| cat >.config.new
58mv .config.new .config
Denis Vlasenko62e0dc22008-11-09 16:08:31 +000059echo 'CONFIG_CROSS_COMPILER_PREFIX="'"$uclibc_cross"'"' >>.config
Denis Vlasenko27e15012008-09-28 17:19:02 +000060echo 'CONFIG_STATIC=y' >>.config
61}
62
Denis Vlasenko27e15012008-09-28 17:19:02 +000063# If STATIC, remove some things
64# PAM with static linking is probably pointless
65# (but I need to try - now I don't have libpam.a on my system, only libpam.so)
66grep -q ^CONFIG_STATIC= .config && {
67cat .config \
68| grep -v ^CONFIG_PAM= \
69| cat >.config.new
70mv .config.new .config
71}
72
Denis Vlasenko27e15012008-09-28 17:19:02 +000073# Regenerate .config with default answers for yanked-off options
74{ yes "" | make oldconfig >/dev/null; } || exit 1
75
Denys Vlasenko31e2e7b2009-12-12 02:42:35 +010076nice -n 10 make $MAKEOPTS 2>&1 | tee -a make.log
Denis Vlasenko27e15012008-09-28 17:19:02 +000077
78test -x busybox && {
79 cd ..
80 rm -rf "$dir"
81 exit 0
82}
83
84cd ..
Denis Vlasenkoa2333c82009-03-28 19:08:23 +000085mv "$dir" "failed.$dir"
Denis Vlasenko27e15012008-09-28 17:19:02 +000086exit 1