aboutsummaryrefslogtreecommitdiff
path: root/etc/environments/default-x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'etc/environments/default-x86_64')
-rwxr-xr-xetc/environments/default-x86_6444
1 files changed, 44 insertions, 0 deletions
diff --git a/etc/environments/default-x86_64 b/etc/environments/default-x86_64
new file mode 100755
index 0000000..e324fa1
--- /dev/null
+++ b/etc/environments/default-x86_64
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# file : etc/environments/default-x86_64
+# license : MIT; see accompanying LICENSE file
+
+#
+# Environment setup script for C/C++ compilation.
+#
+
+# NOTE: don't forget to adjust the target mode selection below.
+#
+c=gcc
+cxx=g++
+
+# $1 - target
+# $2 - bbot executable (if absent, then run $SHELL)
+# $3+ - bbot options
+
+set -e # Exit on errors.
+
+# Based on target determine what we are building.
+#
+mode=
+case "$1" in
+ x86_64-*)
+ #mode=-m64
+ ;;
+ i?86-*)
+ mode=-m32
+ ;;
+ *)
+ echo "unknown target: '$1'" 1>&2
+ exit 1
+ ;;
+esac
+shift
+
+if test $# -ne 0; then
+ exec "$@" cc config.c="$c $mode" config.cxx="$cxx $mode"
+else
+ echo "config.c=$c $mode" 1>&2
+ echo "config.cxx=$cxx $mode" 1>&2
+ exec $SHELL -i
+fi