From 966341c88859fa13d268194fd52643377e039d6f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 2 Oct 2018 14:06:23 -0700 Subject: getconf: fix glibc NPROCESSORS_ONLN. glibc doesn't have _XOPEN_UUCP (though bionic does), which meant that the generated array of values was out of sync with the hand-written array of names. This patch removes that by using a unified array and the preprocessor. A side benefit of this for me is that it makes toybox easier to integrate in the AOSP build system (the less shell script magic, the better). --- scripts/make.sh | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'scripts') diff --git a/scripts/make.sh b/scripts/make.sh index a268eafd..06dec156 100755 --- a/scripts/make.sh +++ b/scripts/make.sh @@ -261,42 +261,6 @@ then generated/config2help Config.in $KCONFIG_CONFIG > generated/help.h || exit 1 fi -mksysconf() -{ - echo "int ${1}_vals[] = {" && - - # Extract names, remove blank lines, filter, replace unknown #defines - # with UNKNOWN - sed -n "/char [*]${1}_names[[]/"',/^}/s/[^"]*"\([^"]*\) *",*/\1\n/pg' \ - toys/posix/getconf.c | grep -v '^$' | $2 | - sed -e "$DEFINES" -e "t;d;a UNKNOWN" | xargs | tr ' ' ',' && - echo '};' -} - -if ! [ generated/getconf.h -nt toys/posix/getconf.c ] -then - echo generated/getconf.h - - # Dump #define list for limits.h and unistd.h, create sed expression to - # match known defines - DEFINES="$(echo -e '#include \n#include ' | \ - gcc -E -dM - | \ - sed -n 's@^#define[ \t][ \t]*\([^ \t(]*\)[ \t].*@s/^\1$/\&/@p' )" - - # Extract limit names, compare against limits.h #defines, replace unknown - # ones with UNKNOWN - - { - mksysconf sysconf \ - sed\ 's/^_POSIX2/2/;s/^PTHREAD/THREAD/;s/^_POSIX_//;s/^_XOPEN_/XOPEN_/;s/^/_SC_/' && - mksysconf confstr sed\ 's/.*/_CS_&/' && - mksysconf limit cat - } > generated/getconf.h - - unset HEADERS -fi - - [ ! -z "$NOBUILD" ] && exit 0 echo -n "Compile toybox" -- cgit v1.2.3