Denis Vlasenko | 27e1501 | 2008-09-28 17:19:02 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Select which libc to build against |
| 4 | libc="glibc" # assumed native |
Denis Vlasenko | 62e0dc2 | 2008-11-09 16:08:31 +0000 | [diff] [blame] | 5 | # static, cross-compilation |
Denis Vlasenko | 27e1501 | 2008-09-28 17:19:02 +0000 | [diff] [blame] | 6 | libc="uclibc" |
Denis Vlasenko | 62e0dc2 | 2008-11-09 16:08:31 +0000 | [diff] [blame] | 7 | # x86 32-bit: |
| 8 | uclibc_cross="i486-linux-uclibc-" |
| 9 | # My system has strange prefix for x86 64-bit uclibc: |
| 10 | #uclibc_cross="x86_64-pc-linux-gnu-" |
Denis Vlasenko | 27e1501 | 2008-09-28 17:19:02 +0000 | [diff] [blame] | 11 | |
| 12 | test -d tree || exit 1 |
| 13 | |
| 14 | dir=test.$$ |
| 15 | while test -e "$dir" -o -e failed."$dir"; do |
| 16 | dir=test."$RANDOM" |
| 17 | done |
| 18 | |
| 19 | cp -dpr tree "$dir" || exit 1 |
| 20 | cd "$dir" || exit 1 |
| 21 | |
| 22 | echo "Running randconfig test in $dir..." >&2 |
| 23 | |
| 24 | make randconfig >/dev/null || exit 1 |
| 25 | |
| 26 | cat .config \ |
| 27 | | grep -v ^CONFIG_DEBUG_PESSIMIZE= \ |
| 28 | | grep -v CONFIG_WERROR \ |
| 29 | | cat >.config.new |
| 30 | mv .config.new .config |
| 31 | echo CONFIG_WERROR=y >>.config |
| 32 | |
| 33 | test "$libc" = glibc && { |
| 34 | cat .config \ |
| 35 | | grep -v ^CONFIG_SELINUX= \ |
| 36 | | grep -v ^CONFIG_EFENCE= \ |
| 37 | | grep -v ^CONFIG_DMALLOC= \ |
| 38 | | cat >.config.new |
| 39 | mv .config.new .config |
| 40 | } |
| 41 | |
| 42 | test "$libc" = uclibc && { |
| 43 | cat .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 |
| 55 | mv .config.new .config |
Denis Vlasenko | 62e0dc2 | 2008-11-09 16:08:31 +0000 | [diff] [blame] | 56 | echo 'CONFIG_CROSS_COMPILER_PREFIX="'"$uclibc_cross"'"' >>.config |
Denis Vlasenko | 27e1501 | 2008-09-28 17:19:02 +0000 | [diff] [blame] | 57 | echo 'CONFIG_STATIC=y' >>.config |
| 58 | } |
| 59 | |
| 60 | # If NOMMU, remove some things |
| 61 | grep -q ^CONFIG_NOMMU= .config && { |
| 62 | cat .config \ |
| 63 | | grep -v ^CONFIG_ASH= \ |
| 64 | | grep -v ^CONFIG_FEATURE_SH_IS_ASH= \ |
| 65 | | cat >.config.new |
| 66 | mv .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) |
| 72 | grep -q ^CONFIG_STATIC= .config && { |
| 73 | cat .config \ |
| 74 | | grep -v ^CONFIG_PAM= \ |
| 75 | | cat >.config.new |
| 76 | mv .config.new .config |
| 77 | } |
| 78 | |
Denis Vlasenko | 27e1501 | 2008-09-28 17:19:02 +0000 | [diff] [blame] | 79 | # Regenerate .config with default answers for yanked-off options |
| 80 | { yes "" | make oldconfig >/dev/null; } || exit 1 |
| 81 | |
Denis Vlasenko | a2333c8 | 2009-03-28 19:08:23 +0000 | [diff] [blame] | 82 | nice -n 10 make 2>&1 | tee -a make.log |
Denis Vlasenko | 27e1501 | 2008-09-28 17:19:02 +0000 | [diff] [blame] | 83 | |
| 84 | test -x busybox && { |
| 85 | cd .. |
| 86 | rm -rf "$dir" |
| 87 | exit 0 |
| 88 | } |
| 89 | |
| 90 | cd .. |
Denis Vlasenko | a2333c8 | 2009-03-28 19:08:23 +0000 | [diff] [blame] | 91 | mv "$dir" "failed.$dir" |
Denis Vlasenko | 27e1501 | 2008-09-28 17:19:02 +0000 | [diff] [blame] | 92 | exit 1 |