aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-10-19 10:31:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-19 10:37:28 +0200
commita6d27c3bca9e9ed591ae4a6e90666a027dcef2b0 (patch)
tree5380caf7773f7f827cdcabb3d93fb0a1d1894bf6
parente85f2d4e36ec56229b82f617fb8b9717927347ca (diff)
Pass compiler mode as part of config.{c,cxx} in environment scripts
-rw-r--r--doc/manual.cli25
-rwxr-xr-xetc/environments/default6
-rw-r--r--etc/environments/default-clang.bat8
-rw-r--r--etc/environments/default-mingw.bat6
4 files changed, 26 insertions, 19 deletions
diff --git a/doc/manual.cli b/doc/manual.cli
index 4cae4c8..d2457da 100644
--- a/doc/manual.cli
+++ b/doc/manual.cli
@@ -818,13 +818,13 @@ For details on configuring and testing installation refer to
\l{#arch-controller Controller Logic}.
As an example, the following POSIX shell script can be used to setup the
-environment for building C and C++ packages with GCC 6 on most Linux
+environment for building C and C++ packages with GCC 9 on most Linux
distributions.
\
#!/bin/sh
-# Environment setup script for C/C++ compilation with GCC 6.
+# Environment setup script for C/C++ compilation with GCC 9.
#
# $1 - target
# $2 - bbot executable
@@ -832,15 +832,22 @@ distributions.
set -e # Exit on errors.
-t=\"$1\"
+mode=
+case \"$1\" in
+ x86_64-*)
+ #mode=-m64
+ ;;
+ i?86-*)
+ mode=-m32
+ ;;
+ *)
+ echo \"unknown target: '$1'\" 1>&2
+ exit 1
+ ;;
+esac
shift
-if test -n \"$t\"; then
- echo \"unknown target: $t\" 1>&2
- exit 1
-fi
-
-exec \"$@\" cc config.c=gcc-6 config.cxx=g++-6
+exec \"$@\" cc config.c=\"gcc-9 $mode\" config.cxx=\"g++-9 $mode\"
\
\h#arch-controller|Controller Logic|
diff --git a/etc/environments/default b/etc/environments/default
index 16e39d1..2155f72 100755
--- a/etc/environments/default
+++ b/etc/environments/default
@@ -24,10 +24,10 @@ set -e # Exit on errors.
mode=
case "$1" in
x86_64-*)
- #mode="config.cc.coptions+=-m64"
+ #mode=-m64
;;
i?86-*)
- mode="config.cc.coptions+=-m32"
+ mode=-m32
;;
*)
echo "unknown target: '$1'" 1>&2
@@ -36,4 +36,4 @@ case "$1" in
esac
shift
-exec "$@" cc config.c="$c" config.cxx="$cxx" $mode
+exec "$@" cc config.c="$c $mode" config.cxx="$cxx $mode"
diff --git a/etc/environments/default-clang.bat b/etc/environments/default-clang.bat
index 78109a9..844372c 100644
--- a/etc/environments/default-clang.bat
+++ b/etc/environments/default-clang.bat
@@ -43,15 +43,15 @@ set "VCVARS="
set "MODE="
if "_%1_" == "_x86_64-microsoft-win32-msvc%MSVC_VER%_" (
set "VCVARS=%VCVARS64%"
- rem set "MODE=config.cc.coptions+=-m64"
+ rem set "MODE=-m64"
) else (
if "_%1_" == "_i686-microsoft-win32-msvc%MSVC_VER%_" (
set "VCVARS=%VCVARS32%"
- set "MODE=config.cc.coptions+=-m32"
+ set "MODE=-m32"
) else (
if "_%1_" == "_i386-microsoft-win32-msvc%MSVC_VER%_" (
set "VCVARS=%VCVARS32%"
- set "MODE=config.cc.coptions+=-m32"
+ set "MODE=-m32"
) else (
echo error: unknown target %1
goto error
@@ -66,7 +66,7 @@ if not "_%MSVC%_" == "__" (
)
)
-%2 %3 %4 %5 %6 %7 %8 %9 cc config.c=%C% config.cxx=%CXX% %MODE%
+%2 %3 %4 %5 %6 %7 %8 %9 cc "config.c=%C% %MODE%" "config.cxx=%CXX% %MODE%"
if errorlevel 1 goto error
goto end
diff --git a/etc/environments/default-mingw.bat b/etc/environments/default-mingw.bat
index 1d5427b..26d994c 100644
--- a/etc/environments/default-mingw.bat
+++ b/etc/environments/default-mingw.bat
@@ -26,17 +26,17 @@ rem Based on target determine what we are building.
rem
set "MODE="
if "_%1_" == "_x86_64-w64-mingw32_" (
- rem set "MODE=config.cc.coptions+=-m64"
+ rem set "MODE=-m64"
) else (
if "_%1_" == "_i686-w64-mingw32_" (
- set "MODE=config.cc.coptions+=-m32"
+ set "MODE=-m32"
) else (
echo error: unknown target %1
goto error
)
)
-%2 %3 %4 %5 %6 %7 %8 %9 cc config.c=%C% config.cxx=%CXX% %MODE%
+%2 %3 %4 %5 %6 %7 %8 %9 cc "config.c=%C% %MODE%" "config.cxx=%CXX% %MODE%"
if errorlevel 1 goto error
goto end