1
0
Fork 0
forked from nuttx/nuttx-update

tools/: Update to better support MSYS

This commit is contained in:
Gregory Nutt 2018-05-31 11:53:09 -06:00
parent 3373854183
commit 3146eb5d63
4 changed files with 88 additions and 28 deletions

View file

@ -73,12 +73,11 @@ ENVIRONMENTS
these alternatives.
- The MSYS environment. MSYS derives from an older version of Cygwin
adapted to work more naturally in the Windows environment. See
http://www.mingw.org/wiki/MSYS if you are interested in using MSYS.
People report to me that they have used MSYS successfully. I
suppose that the advantages of the MSYS environment is that it is
closer to a native Windows environment and uses only a minimal
number of add-on POSIX-land tools.
simplified and adapted to work more naturally in the Windows
environment. See http://www.mingw.org/wiki/MSYS if you are
interested in using MSYS. The advantages of the MSYS environment is
that it is closer to a native Windows environment and uses only a
minimal number of add-on POSIX-land tools.
The download link in that Wiki takes you to the SourceForge download
site. The SourceForge MSYS project has been stagnant for some time.
@ -168,11 +167,27 @@ Using MSYS
Here is it assumed that you have already downloaded and installed MSYS2
from https://www.msys2.org using the windows installer available at that
location. It is also assumed that you have brought in the necessary
tools using the 'pacman' package management tool Tools needed include:
tools using the 'pacman' package management tool Tools needed including:
pacman -S git
pacman -S make
pacman -S gcc
And possibly others depending upon your usage.
And possibly others depending upon your usage. Then you will need to
build and install kconfig-frontends per the instructions of the top-level
README.txt file in the tools repository. This required the following
additional tools:
pacman -S bison
pacman -S gperf
pacman -S ncurses-devel
pacman -S automake-wrapper
pacman -S autoconf
pacman -S pkg-config
Because of some versioning issues, I had to run 'aclocal' prior to
running the kconfig-frontends configure script. See "Configuring NuttX"
below for futher information.
Ubuntu Bash under Windows 10
----------------------------
@ -881,6 +896,10 @@ Make Sure that You are on the Right Platform
tools/sethost.sh -c
Or, for MSYS/MSYS2:
tools/sethost.sh -g
Other options are available from the help option built into the
script. You can see all options with:

View file

@ -1,7 +1,7 @@
/****************************************************************************
* tools/configure.c
*
* Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2012, 2017-2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -71,6 +71,7 @@
#define WINDOWS_NATIVE 1
#define WINDOWS_CYGWIN 2
#define WINDOWS_UBUNTU 3
#define WINDOWS_MSYS 4
/****************************************************************************
* Private Data
@ -128,7 +129,7 @@ static const char *g_optfiles[] =
static void show_usage(const char *progname, int exitcode)
{
fprintf(stderr, "\nUSAGE: %s [-d] [-b] [-f] [-l|m|c|u|n] [-a <app-dir>] <board-name>[%c<config-name>]\n", progname, g_delim);
fprintf(stderr, "\nUSAGE: %s [-d] [-b] [-f] [-l|m|c|u|g|n] [-a <app-dir>] <board-name>[%c<config-name>]\n", progname, g_delim);
fprintf(stderr, "\nUSAGE: %s [-h]\n\n", progname);
fprintf(stderr, "\nWhere:\n");
fprintf(stderr, " -d:\n");
@ -151,13 +152,14 @@ static void show_usage(const char *progname, int exitcode)
fprintf(stderr, " instead of Windows style paths like C:\\Program Files are used. POSIX\n");
fprintf(stderr, " style paths are used by default.\n");
#endif
fprintf(stderr, " [-l|m|c|u|n]\n");
fprintf(stderr, " [-l|m|c|u|g|n]\n");
fprintf(stderr, " Selects the host environment.\n");
fprintf(stderr, " -l Selects the Linux (l) host environment.\n");
fprintf(stderr, " -m Selects the macOS (m) host environment.\n");
fprintf(stderr, " [-c|u|n] selects the Windows host and a Windows host environment:\n");
fprintf(stderr, " [-c|u|g|n] selects the Windows host and a Windows host environment:\n");
fprintf(stderr, " -c Selects the Windows host and Cygwin (c) environment.\n");
fprintf(stderr, " -u Selects the Windows host and Ubuntu under Windows 10 (u) environment.\n");
fprintf(stderr, " -g Selects the Windows host and the MinGW/MSYS environment.\n");
fprintf(stderr, " -n Selects the Windows host and Windows native (n) environment.\n");
fprintf(stderr, " Default: Use host setup in the defconfig file.\n");
fprintf(stderr, " Default Windows: Cygwin.\n");
@ -227,6 +229,11 @@ static void parse_args(int argc, char **argv)
g_winpaths = true;
break;
case 'g' :
g_host = HOST_WINDOWS;
g_windows = WINDOWS_MSYS;
break;
case 'h' :
show_usage(argv[0], EXIT_SUCCESS);
@ -1042,6 +1049,15 @@ static void set_host(const char *destconfig)
case WINDOWS_CYGWIN:
printf(" Select Windows/Cygwin host\n");
enable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
disable_feature(destconfig, "CONFIG_WINDOWS_MSYS");
disable_feature(destconfig, "CONFIG_WINDOWS_UBUNTU");
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
break;
case WINDOWS_MSYS:
printf(" Select Ubuntu for Windows 10 host\n");
disable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
enable_feature(destconfig, "CONFIG_WINDOWS_MSYS");
disable_feature(destconfig, "CONFIG_WINDOWS_UBUNTU");
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
break;
@ -1049,6 +1065,7 @@ static void set_host(const char *destconfig)
case WINDOWS_UBUNTU:
printf(" Select Ubuntu for Windows 10 host\n");
disable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
disable_feature(destconfig, "CONFIG_WINDOWS_MSYS");
enable_feature(destconfig, "CONFIG_WINDOWS_UBUNTU");
disable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
break;
@ -1056,6 +1073,7 @@ static void set_host(const char *destconfig)
case WINDOWS_NATIVE:
printf(" Select Windows native host\n");
disable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN");
disable_feature(destconfig, "CONFIG_WINDOWS_MSYS");
disable_feature(destconfig, "CONFIG_WINDOWS_UBUNTU");
enable_feature(destconfig, "CONFIG_WINDOWS_NATIVE");
break;

View file

@ -37,13 +37,14 @@ WD=`test -d ${0%/*} && cd ${0%/*}; pwd`
TOPDIR="${WD}/.."
USAGE="
USAGE: ${0} [-d] [-l|m|c|u|n] [-a <app-dir>] <board-name>/<config-name>
USAGE: ${0} [-d] [-l|m|c|u|g|n] [-a <app-dir>] <board-name>/<config-name>
Where:
-l selects the Linux (l) host environment.
-m selects the macOS (m) host environment.
-c selects the Windows host and Cygwin (c) environment.
-u selects the Windows host and Ubuntu under Windows 10 (u) environment.
-g selects the Windows host and MinGW/MSYS environment.
-n selects the Windows host and Windows native (n) environment.
Default: Use host setup in the defconfig file
Default Windows: Cygwin
@ -82,6 +83,10 @@ while [ ! -z "$1" ]; do
-d )
set -x
;;
-g )
host=windows
wenv=msys
;;
-h )
echo "$USAGE"
exit 0
@ -308,6 +313,11 @@ if [ ! -z "$host" ]; then
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}"

View file

@ -42,13 +42,13 @@ unset configfile
function showusage {
echo ""
echo "USAGE: $progname [-w|l] [-c|u|n] [-32|64] [<config>]"
echo "USAGE: $progname [-w|l] [-c|u|g|n] [-32|64] [<config>]"
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 " -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 " -32|64 selects 32- or 64-bit host. Default 64"
echo " -h will show this help test and terminate"
echo " <config> selects configuration file. Default: .config"
@ -69,6 +69,9 @@ while [ ! -z "$1" ]; do
host=windows
wenv=cygwin
;;
-c )
host=windows
wenv=msys
-u )
host=windows
wenv=ubuntu
@ -175,6 +178,9 @@ if [ "X$host" == "Xlinux" ]; then
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_SIM_X8664_MICROSOFT
kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_SYSTEMV
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
@ -189,30 +195,37 @@ else
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_WINDOWS
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_LINUX
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_WINDOWS_OTHER
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
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
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
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
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS
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
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
if [ "X$hsize" == "X32" ]; then
kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_M32
else