compile_pmodules.sh 1.29 KB
Newer Older
1 2 3 4 5
#!/bin/bash

declare -r BASE_DIR=$(cd "$(dirname $0)/../.." && pwd)
declare -r BOOTSTRAP_DIR="${BASE_DIR}/scripts/Bootstrap"

gsell's avatar
gsell committed
6 7
source "${BASE_DIR}/lib/lib.bash"

8
unset PMODULES_HOME
9 10 11
unset PMODULES_VERSION

read_versions "${BOOTSTRAP_DIR}/Pmodules_version.conf"
12 13
source "/opt/psi/config/environment.bash"

gsell's avatar
gsell committed
14 15 16 17 18 19 20 21 22
#if [[ -n ${PMODULES_DIR} ]] && [[ "${PMODULES_DIR}" != "/" ]] && [[ -d "${PMODULES_DIR}" ]]; then
#	rm -rf "${PMODULES_DIR}"
#fi

build () {
	local -r name="$1"
	local -r version="$2"

	"${BOOTSTRAP_DIR}/${name}/build" --bootstrap --disable-cleanup "${version}" || \
gsell's avatar
gsell committed
23
		std::die 3 "Compiling '${name}' failed!"
gsell's avatar
gsell committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
}

if [[ ! -f "${PMODULES_HOME}/bin/base64" ]]; then
	build coreutils "${COREUTILS_VERSION}"
fi

if [[ ! -f "${PMODULES_HOME}/bin/xgettext" ]]; then
	build gettext "${GETTEXT_VERSION}"
fi

if [[ ! -f "${PMODULES_HOME}/bin/getopt" ]]; then
	build getopt "${GETOPT_VERSION}"
fi

if [[ ! -f "${PMODULES_HOME}/bin/dialog" ]]; then
	build dialog "${DIALOG_VERSION}"
gsell's avatar
gsell committed
40 41
fi

gsell's avatar
gsell committed
42 43 44
if [[ ! -f "${PMODULES_HOME}/bin/bash" ]]; then
	build bash "4.3.30"
fi
gsell's avatar
gsell committed
45

gsell's avatar
gsell committed
46 47 48 49 50 51
if [[ ! -e "${PMODULES_HOME}/bin/tclsh" ]]; then
	build Tcl "${TCL_VERSION}"
fi

if [[ ! -e "${PMODULES_HOME}/bin/modulecmd.tcl" ]]; then
	build Modules "${MODULES_VERSION}"
52
	mv -v "${PMODULES_HOME}/bin/modulecmd" "${PMODULES_HOME}/libexec/modulecmd.tcl"
gsell's avatar
gsell committed
53
fi
gsell's avatar
gsell committed
54
echo "Done..."