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. these alternatives.
- The MSYS environment. MSYS derives from an older version of Cygwin - The MSYS environment. MSYS derives from an older version of Cygwin
adapted to work more naturally in the Windows environment. See simplified and adapted to work more naturally in the Windows
http://www.mingw.org/wiki/MSYS if you are interested in using MSYS. environment. See http://www.mingw.org/wiki/MSYS if you are
People report to me that they have used MSYS successfully. I interested in using MSYS. The advantages of the MSYS environment is
suppose that the advantages of the MSYS environment is that it is that it is closer to a native Windows environment and uses only a
closer to a native Windows environment and uses only a minimal minimal number of add-on POSIX-land tools.
number of add-on POSIX-land tools.
The download link in that Wiki takes you to the SourceForge download The download link in that Wiki takes you to the SourceForge download
site. The SourceForge MSYS project has been stagnant for some time. 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 Here is it assumed that you have already downloaded and installed MSYS2
from https://www.msys2.org using the windows installer available at that from https://www.msys2.org using the windows installer available at that
location. It is also assumed that you have brought in the necessary 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 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 Ubuntu Bash under Windows 10
---------------------------- ----------------------------
@ -881,6 +896,10 @@ Make Sure that You are on the Right Platform
tools/sethost.sh -c tools/sethost.sh -c
Or, for MSYS/MSYS2:
tools/sethost.sh -g
Other options are available from the help option built into the Other options are available from the help option built into the
script. You can see all options with: script. You can see all options with:

View File

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

View File

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

View File

@ -42,13 +42,13 @@ unset configfile
function showusage { function showusage {
echo "" 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 " $progname -h"
echo "" echo ""
echo "Where:" echo "Where:"
echo " -w|l selects Windows (w) or Linux (l). Default: Linux" echo " -w|l selects Windows (w) or Linux (l). Default: Linux"
echo " -c|u|n selects Windows environment option: Cygwin (c), Ubuntu under" echo " -c|u|g|n selects Windows environment option: Cygwin (c), Ubuntu under"
echo " Windows 10 (u), or Windows native (n). Default Cygwin" 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 " -32|64 selects 32- or 64-bit host. Default 64"
echo " -h will show this help test and terminate" echo " -h will show this help test and terminate"
echo " <config> selects configuration file. Default: .config" echo " <config> selects configuration file. Default: .config"
@ -69,6 +69,9 @@ while [ ! -z "$1" ]; do
host=windows host=windows
wenv=cygwin wenv=cygwin
;; ;;
-c )
host=windows
wenv=msys
-u ) -u )
host=windows host=windows
wenv=ubuntu 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 --enable CONFIG_HOST_LINUX
kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_WINDOWS 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_NATIVE
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN 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_UBUNTU
@ -189,30 +195,37 @@ else
kconfig-tweak --file $nuttx/.config --enable CONFIG_HOST_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_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 if [ "X$wenv" == "Xcygwin" ]; then
echo " Select CONFIG_WINDOWS_CYGWIN=y" echo " Select CONFIG_WINDOWS_CYGWIN=y"
kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_CYGWIN 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_UBUNTU
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE
else else
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_CYGWIN
if [ "X$wenv" == "Xubuntu" ]; then if [ "X$wenv" == "Xmsys" ]; then
echo " Select CONFIG_WINDOWS_UBUNTU=y" echo " Select CONFIG_WINDOWS_MSYS=y"
kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_UBUNTU 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 kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_NATIVE
else else
echo " Select CONFIG_WINDOWS_NATIVE=y" kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS
kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU if [ "X$wenv" == "Xubuntu" ]; then
kconfig-tweak --file $nuttx/.config --enable CONFIG_WINDOWS_NATIVE 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
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 if [ "X$hsize" == "X32" ]; then
kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_M32 kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_M32
else else