aboutsummaryrefslogtreecommitdiff
path: root/reproduce/software/shell
diff options
context:
space:
mode:
Diffstat (limited to 'reproduce/software/shell')
-rwxr-xr-xreproduce/software/shell/apptainer.sh19
-rwxr-xr-xreproduce/software/shell/configure.sh21
-rwxr-xr-xreproduce/software/shell/prep-source.sh9
3 files changed, 41 insertions, 8 deletions
diff --git a/reproduce/software/shell/apptainer.sh b/reproduce/software/shell/apptainer.sh
index eb24e9e..2aa3535 100755
--- a/reproduce/software/shell/apptainer.sh
+++ b/reproduce/software/shell/apptainer.sh
@@ -73,7 +73,9 @@ set -e
# Default option values
sif=""
jobs=0
+debug=0
quiet=0
+host_cc=0
source_dir=
build_only=
base_sif=""
@@ -101,6 +103,10 @@ Top-level script to build and run a Maneage'd project within Apptainer.
--base-os=STR Base OS name (default: '$base_os').
--base-sif=STR Base OS apptainer image (a '.sif' file).
+ Configuration options
+ --host-cc Use containers's C compiler, don't build GCC.
+ -d, --debug[=FLAGS] Use -j1 and stop on first crash.
+
Interactive shell
--project-shell Open the project's shell within the container.
--container-shell Open the container shell.
@@ -162,6 +168,12 @@ do
--base-sif) base_sif="$2"; check_v "$1" "$base_sif"; shift;shift;;
--base-sif=*) base_sif="${1#*=}"; check_v "$1" "$base_sif"; shift;;
+ # Configuration options.
+ --host-cc) host_cc=1; shift;;
+ --host-cc=*) on_off_option_error --host-cc;;
+ -d|--debug) debug=1; shift;;
+ -d|--debug=*) on_off_option_error --debug;;
+
# Interactive shell.
--project-shell) project_shell=1; shift;;
--project_shell=*) on_off_option_error --project-shell;;
@@ -329,8 +341,11 @@ EOF
# software tarball directory, they will all be symbolic links that
# aren't valid when the user runs the container (since we only
# mount the software tarballs at build time).
+ confopts=""
intbuild=/home/maneager/build
maneage_def=$build_dir/maneage.def
+ if [ $host_cc = 1 ]; then confopts="--host-cc"; fi
+ if [ $debug = 1 ]; then confopts="$confopts --debug"; fi
cat <<EOF > $maneage_def
Bootstrap: localimage
From: $base_sif
@@ -343,7 +358,7 @@ From: $base_sif
%post
cd /home/maneager/source
- ./project configure --jobs=$jobs --no-pause \\
+ ./project configure --jobs=$jobs --no-pause $confopts \\
--input-dir=/home/maneager/input \\
--build-dir=$intbuild \\
--software-dir=/home/maneager/tarballs-software
@@ -351,7 +366,7 @@ From: $base_sif
%runscript
cd /home/maneager/source
- if ./project configure --build-dir=$intbuild \\
+ if ./project configure --build-dir=$intbuild $confopts \\
--existing-conf --no-pause \\
--offline --quiet; then \\
if [ x"\$maneage_apptainer_stat" = xshell ]; then \\
diff --git a/reproduce/software/shell/configure.sh b/reproduce/software/shell/configure.sh
index e17c9ad..19c14ac 100755
--- a/reproduce/software/shell/configure.sh
+++ b/reproduce/software/shell/configure.sh
@@ -1342,11 +1342,17 @@ elapsed_time_from_prev_step software-dir
# complete the configuration, we may also need to download the source code
# of some necessary software packages (including the downloaders). So we
# need to check the host's available tool for downloading at this step.
+#
+# NOTE: it is important that the name of the programs are not recorded to
+# be absolute (for example 'wget' instead of '/usr/bin/wget'). This is
+# because we build both 'wget' and 'curl' within 'basic.mk'. After they are
+# built, Maneage's built software have higher precedence in 'PATH'. So
+# without an absolute address, our own built software will be used as soon
+# as they are installed/available.
if [ $rewritelconfig = yes ]; then
- if type wget > /dev/null 2>/dev/null; then
- # 'which' isn't in POSIX, so we are using 'command -v' instead.
- name=$(command -v wget)
+ # First look for wget on the host.
+ if type wget > /dev/null 2>/dev/null; then
# See if the host wget has the '--no-use-server-timestamps' option
# (for example wget 1.12 doesn't have it). If not, we'll have to
@@ -1363,13 +1369,16 @@ if [ $rewritelconfig = yes ]; then
# By default Wget keeps the remote file's timestamp, so we'll have
# to disable it manually.
- downloader="$name $wgetts -O";
+ downloader="wget $wgetts -O";
+
+ # In case Wget doesn't exist, try cURL.
elif type curl > /dev/null 2>/dev/null; then
- name=$(command -v curl)
# - cURL doesn't keep the remote file's timestamp by default.
# - With the '-L' option, we tell cURL to follow redirects.
- downloader="$name -L -o"
+ downloader="curl -L -o"
+
+ # Neither Wget or cURL could be found.
else
cat <<EOF
diff --git a/reproduce/software/shell/prep-source.sh b/reproduce/software/shell/prep-source.sh
index 2959255..7f49b5c 100755
--- a/reproduce/software/shell/prep-source.sh
+++ b/reproduce/software/shell/prep-source.sh
@@ -32,6 +32,15 @@ set -e
+
+# Set the locale to C to make sure local language settings do not
+# interefere (especially with the SED command).
+export LC_ALL=C
+
+
+
+
+
# Read the first argument.
bindir="$1"
if [ x"$bindir" = x ]; then