remove the dup kconfig tweak in configure.sh, testbuild.sh and sethost.sh

Change-Id: I2027b6be55609d8828ff39b568d1f8ddcf333e9a
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-01-20 01:29:34 +08:00 committed by patacongo
parent f316c15769
commit e59f242f88
4 changed files with 83 additions and 231 deletions

View File

@ -887,19 +887,19 @@ sethost.sh
Or, if you are on a Windows/Cygwin 64-bit platform:
$ tools/sethost.sh -w
$ tools/sethost.sh -c
Other options are available:
$ ./sethost.sh -h
USAGE: ./sethost.sh [-w|l|m] [-c|u|g|n] [<config>]
USAGE: ./sethost.sh [-l|m|c|u|g|n] [<config>]
./sethost.sh -h
Where:
-w|l|m selects Windows (w), Linux (l), or macOS (m). Default: Linux
-c|u|g|n selects Windows environment option: Cygwin (c), Ubuntu under
Windows 10 (u), MSYS/MSYS2 (g) or Windows native (n). Default Cygwin
-l|m|c|u|g|n selects Linux (l), macOS (m), Cygwin (c),
Ubuntu under Windows 10 (u), MSYS/MSYS2 (g)
or Windows native (n). Default Linux
-h will show this help test and terminate
<config> selects configuration file. Default: .config
@ -935,15 +935,15 @@ testbuild.sh
$ ./testbuild.sh -h
USAGE: ./testbuild.sh [-w|l] [-c|u|n] [-a <appsdir>] [-n <nxdir>] <testlist-file>
USAGE: ./testbuild.sh [-l|m|c|u|g|n] [-d] [-x] [-j <ncpus>] [-a <appsdir>] [-t <topdir>] <testlist-file>
./testbuild.sh -h
Where:
-w|l selects Windows (w) or Linux (l). Default: Linux
-c|u|n selects Windows environment option: Cygwin (c), Ubuntu under
Windows 10 (u), or Windows native (n). Default Cygwin
-l|m|c|u|g|n selects Linux (l), macOS (m), Cygwin (c),
Ubuntu under Windows 10 (u), or Windows native (n). Default Linux
-a <appsdir> provides the relative path to the apps/ directory. Default ../apps
-n <nxdir> provides the relative path to the NxWidgets/ directory. Default ../NxWidgets
-t <topdir> provides the absolute path to top nuttx/ directory. Default $PWD/../nuttx
-j <ncpus> passed on to make. Default: No -j make option
-d enables script debug output
-x exit on build failures
-h will show this help test and terminate
@ -954,8 +954,8 @@ testbuild.sh
These script needs two pieces of information.
a. A description of the platform that you are testing on. This
description is provided by the optional -w, -l, -c, and -n options.
a. A description of the platform that you are testing on. This description
is provided by the optional -l, -m, -c, -u, -g and -n options.
b. A list of configurations to build. That list is provided by a test
list file. The final, non-optional parameter, <testlist-file>,
provides the path to that file.

View File

@ -68,10 +68,10 @@ OPTFILES="\
# Parse command arguments
unset boardconfig
unset winnative
unset appdir
unset host
unset wenv
debug=n
unset debug
skip=0
while [ ! -z "$1" ]; do
@ -80,39 +80,25 @@ while [ ! -z "$1" ]; do
shift
appdir=$1
;;
-c )
host=windows
wenv=cygwin
-c | -g | -l | -m | -u )
winnative=n
host+=" $1"
;;
-n )
winnative=y
host+=" $1"
;;
-d )
debug=y
debug=-d
set -x
;;
-g )
host=windows
wenv=msys
;;
-h )
echo "$USAGE"
exit 0
;;
-l )
host=linux
;;
-m )
host=macos
;;
-n )
host=windows
wenv=native
;;
-s )
skip=1
;;
-u )
host=windows
wenv=ubuntu
;;
*)
if [ ! -z "${boardconfig}" ]; then
echo ""
@ -204,14 +190,11 @@ fi
# native host, then don't even check what is in the defconfig file.
oldnative=`grep CONFIG_WINDOWS_NATIVE= ${src_config} | cut -d'=' -f2`
if [ "X$host" != "Xwindows" -o "X$wenv" != "Xnative" ]; then
unset winnative
else
if [ "X$host" == "Xwindows" -a "X$wenv" == "Xnative" ]; then
winnative=y
else
winnative=$oldnative
fi
if [ -z "${oldnative}" ]; then
oldnative=n
fi
if [ -z "${winnative}" ]; then
winnative=$oldnative
fi
# If no application directory was provided on the command line and we are
@ -296,73 +279,9 @@ if [ "X${defappdir}" = "Xy" ]; then
fi
fi
if [ ! -z "$host" ]; then
sed -i -e "/CONFIG_HOST_LINUX/d" ${dest_config}
sed -i -e "/CONFIG_HOST_WINDOWS/d" ${dest_config}
sed -i -e "/CONFIG_HOST_MACOS/d" ${dest_config}
sed -i -e "/CONFIG_HOST_OTHER/d" ${dest_config}
sed -i -e "/CONFIG_WINDOWS_NATIVE/d" ${dest_config}
sed -i -e "/CONFIG_WINDOWS_CYGWIN/d" ${dest_config}
sed -i -e "/CONFIG_WINDOWS_MSYS/d" ${dest_config}
sed -i -e "/CONFIG_WINDOWS_UBUNTU/d" ${dest_config}
sed -i -e "/CONFIG_WINDOWS_OTHER/d" ${dest_config}
sed -i -e "/CONFIG_SIM_X8664_MICROSOFT/d" ${dest_config}
sed -i -e "/CONFIG_SIM_X8664_SYSTEMV/d" ${dest_config}
case "$host" in
"linux")
echo " Select CONFIG_HOST_LINUX=y"
echo "CONFIG_HOST_LINUX=y" >> "${dest_config}"
echo "CONFIG_SIM_X8664_SYSTEMV=y" >> "${dest_config}"
;;
"macos")
echo " Select CONFIG_HOST_MACOS=y"
echo "CONFIG_HOST_MACOS=y" >> "${dest_config}"
;;
"windows")
echo " Select CONFIG_HOST_WINDOWS=y"
echo "CONFIG_HOST_WINDOWS=y" >> "${dest_config}"
echo "CONFIG_SIM_X8664_MICROSOFT=y" >> "${dest_config}"
case "$wenv" in
"cygwin")
echo " Select CONFIG_WINDOWS_CYGWIN=y"
echo "CONFIG_WINDOWS_CYGWIN=y" >> "${dest_config}"
;;
"msys")
echo " Select CONFIG_WINDOWS_MSYS=y"
echo "CONFIG_WINDOWS_MSYS=y" >> "${dest_config}"
;;
"ubuntu")
echo " Select CONFIG_WINDOWS_UBUNTU=y"
echo "CONFIG_WINDOWS_UBUNTU=y" >> "${dest_config}"
;;
*)
echo " Select CONFIG_WINDOWS_NATIVE=y"
echo "CONFIG_WINDOWS_NATIVE=y" >> "${dest_config}"
;;
esac
esac
fi
# The saved defconfig files are all in compressed format and must be
# reconstitued before they can be used.
echo " Refreshing..."
cd ${TOPDIR} || { echo "Failed to cd to ${TOPDIR}"; exit 10; }
MAKE_BIN=make
if [ ! -z `which gmake 2>/dev/null` ]; then
MAKE_BIN=gmake
fi
if [ "X${debug}" = "Xy" ]; then
${MAKE_BIN} olddefconfig V=1
else
${MAKE_BIN} olddefconfig 1>/dev/null
fi
./tools/sethost.sh $debug $host

View File

@ -33,19 +33,21 @@
#
progname=$0
debug=n
host=linux
wenv=cygwin
unset configfile
function showusage {
echo ""
echo "USAGE: $progname [-w|l|m] [-c|u|g|n] [-32|64] [<config>]"
echo "USAGE: $progname -d [-l|m|c|u|g|n] [<config>]"
echo " $progname -h"
echo ""
echo "Where:"
echo " -w|l|m selects Windows (w), Linux (l), or macOS (m). Default: Linux"
echo " -c|u|g|n selects Windows environment option: Cygwin (c), Ubuntu under"
echo " Windows 10 (u), MSYS/MSYS2 (g) or Windows native (n). Default Cygwin"
echo " -d enables script debug output"
echo " -l|m|c|u|g|n selects Linux (l), macOS (m), Cygwin (c),"
echo " Ubuntu under Windows 10 (u), MSYS/MSYS2 (g)"
echo " or Windows native (n). Default Linux"
echo " -h will show this help test and terminate"
echo " <config> selects configuration file. Default: .config"
exit 1
@ -55,8 +57,8 @@ function showusage {
while [ ! -z "$1" ]; do
case $1 in
-w )
host=windows
-d )
debug=y
;;
-l )
host=linux
@ -173,75 +175,79 @@ if [ "X$host" == "Xlinux" -o "X$host" == "Xmacos" ]; then
if [ "X$host" == "Xlinux" ]; then
echo " Select CONFIG_HOST_LINUX=y"
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_LINUX
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS
echo "CONFIG_HOST_LINUX=y" >> $nuttx/.config
sed -i -e "/CONFIG_HOST_MACOS/d" $nuttx/.config
else
echo " Select CONFIG_HOST_MACOS=y"
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_MACOS
sed -i -e "/CONFIG_HOST_LINUX/d" $nuttx/.config
echo "CONFIG_HOST_MACOS=y" >> $nuttx/.config
fi
# Disable all Windows options
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_WINDOWS
kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_MICROSOFT
kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_SYSTEMV
sed -i -e "/CONFIG_HOST_WINDOWS/d" $nuttx/.config
sed -i -e "/CONFIG_SIM_X8664_MICROSOFT/d" $nuttx/.config
echo "CONFIG_SIM_X8664_SYSTEMV=y" >> $nuttx/.config
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER
sed -i -e "/CONFIG_WINDOWS_NATIVE/d" $nuttx/.config
sed -i -e "/CONFIG_WINDOWS_CYGWIN/d" $nuttx/.config
sed -i -e "/CONFIG_WINDOWS_UBUNTU/d" $nuttx/.config
sed -i -e "/CONFIG_WINDOWS_MSYS/d" $nuttx/.config
sed -i -e "/CONFIG_WINDOWS_OTHER/d" $nuttx/.config
else
echo " Select CONFIG_HOST_WINDOWS=y"
# Enable Windows
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_WINDOWS
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS
echo "CONFIG_HOST_WINDOWS=y" >> $nuttx/.config
sed -i -e "/CONFIG_HOST_LINUX/d" $nuttx/.config
sed -i -e "/CONFIG_HOST_MACOS/d" $nuttx/.config
kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_MICROSOFT
kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_SYSTEMV
echo "CONFIG_SIM_X8664_MICROSOFT=y" >> $nuttx/.config
sed -i -e "/CONFIG_SIM_X8664_SYSTEMV/d" $nuttx/.config
# Enable Windows environment
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER
sed -i -e "/CONFIG_WINDOWS_OTHER/d" $nuttx/.config
if [ "X$wenv" == "Xcygwin" ]; then
echo " Select CONFIG_WINDOWS_CYGWIN=y"
kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_CYGWIN
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE
echo "CONFIG_WINDOWS_CYGWIN=y" >> $nuttx/.config
sed -i -e "/CONFIG_WINDOWS_MSYS/d" $nuttx/.config
sed -i -e "/CONFIG_WINDOWS_UBUNTU/d" $nuttx/.config
sed -i -e "/CONFIG_WINDOWS_NATIVE/d" $nuttx/.config
else
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN
sed -i -e "/CONFIG_WINDOWS_CYGWIN/d" $nuttx/.config
if [ "X$wenv" == "Xmsys" ]; then
echo " Select CONFIG_WINDOWS_MSYS=y"
kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_MSYS
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE
echo "CONFIG_WINDOWS_MSYS=y" >> $nuttx/.config
sed -i -e "/CONFIG_WINDOWS_UBUNTU/d" $nuttx/.config
sed -i -e "/CONFIG_WINDOWS_NATIVE/d" $nuttx/.config
else
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS
sed -i -e "/CONFIG_WINDOWS_MSYS/d" $nuttx/.config
if [ "X$wenv" == "Xubuntu" ]; then
echo " Select CONFIG_WINDOWS_UBUNTU=y"
kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_UBUNTU
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE
echo "CONFIG_WINDOWS_UBUNTU=y" >> $nuttx/.config
sed -i -e "/CONFIG_WINDOWS_NATIVE/d" $nuttx/.config
else
echo " Select CONFIG_WINDOWS_NATIVE=y"
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU
kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_NATIVE
sed -i -e "/CONFIG_WINDOWS_UBUNTU/d" $nuttx/.config
echo "CONFIG_WINDOWS_NATIVE=y" $nuttx/.config
fi
fi
fi
fi
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_OTHER
sed -i -e "/CONFIG_HOST_OTHER/d" $nuttx/.config
echo " Refreshing..."
cd $nuttx || { echo "ERROR: failed to cd to $nuttx"; exit 1; }
make clean_context 1>/dev/null 2>&1
make olddefconfig 1>/dev/null 2>&1
if [ "X${debug}" = "Xy" ]; then
make olddefconfig V=1
else
make olddefconfig 1>/dev/null 2>&1
fi
# Move config file to correct location and restore any previous .config
# and Make.defs files

View File

@ -36,23 +36,21 @@ WD=$PWD
nuttx=$WD/../nuttx
progname=$0
host=linux
wenv=cygwin
APPSDIR=../apps
MAKE_FLAGS=-i
MAKE=make
unset testfile
unset HOPTION
unset JOPTION
function showusage {
echo ""
echo "USAGE: $progname [-w|l] [-c|u|n] [-d] [-x] [-j <ncpus>] [-a <appsdir>] [-t <topdir>] <testlist-file>"
echo "USAGE: $progname [-l|m|c|u|g|n] [-d] [-x] [-j <ncpus>] [-a <appsdir>] [-t <topdir>] <testlist-file>"
echo " $progname -h"
echo ""
echo "Where:"
echo " -w|l selects Windows (w) or Linux (l). Default: Linux"
echo " -c|u|n selects Windows environment option: Cygwin (c), Ubuntu under"
echo " Windows 10 (u), or Windows native (n). Default Cygwin"
echo " -l|m|c|u|g|n selects Linux (l), macOS (m), Cygwin (c),"
echo " Ubuntu under Windows 10 (u), MSYS/MSYS2 (g) or Windows native (n). Default Linux"
echo " -d enables script debug output"
echo " -x exit on build failures"
echo " -j <ncpus> passed on to make. Default: No -j make option."
@ -71,27 +69,12 @@ function showusage {
while [ ! -z "$1" ]; do
case $1 in
-w )
host=windows
;;
-l )
host=linux
;;
-c )
host=windows
wenv=cygwin
-l | -m | -c | -u | -g | -n )
HOPTION+=" $1"
;;
-d )
set -x
;;
-u )
host=windows
wenv=ubuntu
;;
-n )
host=windows
wenv=native
;;
-x )
MAKE_FLAGS='--silent --no-print-directory'
set -e
@ -155,75 +138,19 @@ function distclean {
function configure {
cd $nuttx/tools || { echo "ERROR: failed to CD to $nuttx/tools"; exit 1; }
echo " Configuring..."
./configure.sh $config
cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; }
if [ "X$host" == "Xlinux" ]; then
echo " Select CONFIG_HOST_LINUX=y"
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_LINUX
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_WINDOWS
kconfig-tweak --file $nuttx/.config --disable CONFIG_TOOLCHAIN_WINDOWS
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER
kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_SYSTEMV
kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_MICROSOFT
kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32
else
echo " Select CONFIG_HOST_WINDOWS=y"
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_WINDOWS
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX
if [ "X$wenv" == "Xcygwin" ]; then
echo " Select CONFIG_WINDOWS_CYGWIN=y"
kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_CYGWIN
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE
else
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN
if [ "X$wenv" == "Xubuntu" ]; then
echo " Select CONFIG_WINDOWS_UBUNTU=y"
kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_UBUNTU
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE
else
echo " Select CONFIG_WINDOWS_NATIVE=y"
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU
kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_NATIVE
fi
fi
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER
kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_MICROSOFT
kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_SYSTEMV
kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32
fi
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_OTHER
./configure.sh ${HOPTION} $config
if [ "X$toolchain" != "X" ]; then
setting=`grep TOOLCHAIN $nuttx/.config | grep -v CONFIG_ARCH_TOOLCHAIN_GNU=y | grep =y`
setting=`grep _TOOLCHAIN_ $nuttx/.config | grep -v CONFIG_ARCH_TOOLCHAIN_*=y | grep =y`
varname=`echo $setting | cut -d'=' -f1`
if [ ! -z "$varname" ]; then
echo " Disabling $varname"
kconfig-tweak --file $nuttx/.config --disable $varname
sed -i -e "/$varname/d" $nuttx/.config
fi
echo " Enabling $toolchain"
kconfig-tweak --file $nuttx/.config --enable $toolchain
echo "$toolchain=y" >> $nuttx/.config
fi
echo " Refreshing..."
cd $nuttx || { echo "ERROR: failed to CD to $nuttx"; exit 1; }
${MAKE} ${MAKE_FLAGS} olddefconfig 1>/dev/null 2>&1
}
# Perform the next build