blob: eebf1c524c227059882b4f1143962cd044a5e673 [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
31echo CONFIG_WERROR=y >>.config
32
33test "$libc" = glibc && {
34cat .config \
35| grep -v ^CONFIG_SELINUX= \
36| grep -v ^CONFIG_EFENCE= \
37| grep -v ^CONFIG_DMALLOC= \
38| cat >.config.new
39mv .config.new .config
40}
41
42test "$libc" = uclibc && {
43cat .config \
44| grep -v ^CONFIG_SELINUX= \
45| grep -v ^CONFIG_EFENCE= \
46| grep -v ^CONFIG_DMALLOC= \
47| grep -v ^CONFIG_BUILD_LIBBUSYBOX= \
48| grep -v ^CONFIG_PAM= \
49| grep -v ^CONFIG_TASKSET= \
50| grep -v ^CONFIG_FEATURE_ASSUME_UNICODE= \
51| grep -v ^CONFIG_PIE= \
52| grep -v CONFIG_STATIC \
53| grep -v CONFIG_CROSS_COMPILER_PREFIX \
54| cat >.config.new
55mv .config.new .config
Denis Vlasenko62e0dc22008-11-09 16:08:31 +000056echo 'CONFIG_CROSS_COMPILER_PREFIX="'"$uclibc_cross"'"' >>.config
Denis Vlasenko27e15012008-09-28 17:19:02 +000057echo 'CONFIG_STATIC=y' >>.config
58}
59
60# If NOMMU, remove some things
61grep -q ^CONFIG_NOMMU= .config && {
62cat .config \
63| grep -v ^CONFIG_ASH= \
64| grep -v ^CONFIG_FEATURE_SH_IS_ASH= \
65| cat >.config.new
66mv .config.new .config
67}
68
69# If STATIC, remove some things
70# PAM with static linking is probably pointless
71# (but I need to try - now I don't have libpam.a on my system, only libpam.so)
72grep -q ^CONFIG_STATIC= .config && {
73cat .config \
74| grep -v ^CONFIG_PAM= \
75| cat >.config.new
76mv .config.new .config
77}
78
Denis Vlasenko27e15012008-09-28 17:19:02 +000079# Regenerate .config with default answers for yanked-off options
80{ yes "" | make oldconfig >/dev/null; } || exit 1
81
Denis Vlasenkoa2333c82009-03-28 19:08:23 +000082nice -n 10 make 2>&1 | tee -a make.log
Denis Vlasenko27e15012008-09-28 17:19:02 +000083
84test -x busybox && {
85 cd ..
86 rm -rf "$dir"
87 exit 0
88}
89
90cd ..
Denis Vlasenkoa2333c82009-03-28 19:08:23 +000091mv "$dir" "failed.$dir"
Denis Vlasenko27e15012008-09-28 17:19:02 +000092exit 1