diff --git a/scripts/Bootstrap/.gitignore b/Bootstrap/.gitignore similarity index 100% rename from scripts/Bootstrap/.gitignore rename to Bootstrap/.gitignore diff --git a/scripts/Bootstrap/Modules/build b/Bootstrap/Modules/build similarity index 93% rename from scripts/Bootstrap/Modules/build rename to Bootstrap/Modules/build index a7285bb..c2cb49c 100755 --- a/scripts/Bootstrap/Modules/build +++ b/Bootstrap/Modules/build @@ -1,6 +1,4 @@ -#!/bin/bash -#set -o functrace -source "$(dirname $0)/../../../lib/libpmodules.bash" +#!/usr/bin/env pbuild TCL_DIR="${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION}" diff --git a/scripts/Bootstrap/Pmodules/bash b/Bootstrap/Pmodules/bash similarity index 100% rename from scripts/Bootstrap/Pmodules/bash rename to Bootstrap/Pmodules/bash diff --git a/scripts/Bootstrap/Pmodules/bash_completion b/Bootstrap/Pmodules/bash_completion similarity index 100% rename from scripts/Bootstrap/Pmodules/bash_completion rename to Bootstrap/Pmodules/bash_completion diff --git a/scripts/Bootstrap/Pmodules/csh b/Bootstrap/Pmodules/csh similarity index 100% rename from scripts/Bootstrap/Pmodules/csh rename to Bootstrap/Pmodules/csh diff --git a/scripts/Bootstrap/Pmodules/dialog.bash b/Bootstrap/Pmodules/dialog.bash similarity index 100% rename from scripts/Bootstrap/Pmodules/dialog.bash rename to Bootstrap/Pmodules/dialog.bash diff --git a/scripts/Bootstrap/Pmodules/environment.bash.in b/Bootstrap/Pmodules/environment.bash.in similarity index 100% rename from scripts/Bootstrap/Pmodules/environment.bash.in rename to Bootstrap/Pmodules/environment.bash.in diff --git a/scripts/Bootstrap/Pmodules/environment.csh.in b/Bootstrap/Pmodules/environment.csh.in similarity index 100% rename from scripts/Bootstrap/Pmodules/environment.csh.in rename to Bootstrap/Pmodules/environment.csh.in diff --git a/scripts/Bootstrap/Pmodules/libmodules.tcl b/Bootstrap/Pmodules/libmodules.tcl similarity index 100% rename from scripts/Bootstrap/Pmodules/libmodules.tcl rename to Bootstrap/Pmodules/libmodules.tcl diff --git a/scripts/Bootstrap/Pmodules/libpmodules.bash b/Bootstrap/Pmodules/libpmodules.bash similarity index 100% rename from scripts/Bootstrap/Pmodules/libpmodules.bash rename to Bootstrap/Pmodules/libpmodules.bash diff --git a/scripts/Bootstrap/Pmodules/modmanage b/Bootstrap/Pmodules/modmanage similarity index 100% rename from scripts/Bootstrap/Pmodules/modmanage rename to Bootstrap/Pmodules/modmanage diff --git a/scripts/Bootstrap/Pmodules/modmanage.bash.in b/Bootstrap/Pmodules/modmanage.bash.in similarity index 100% rename from scripts/Bootstrap/Pmodules/modmanage.bash.in rename to Bootstrap/Pmodules/modmanage.bash.in diff --git a/scripts/Bootstrap/Pmodules/modsync.bash b/Bootstrap/Pmodules/modsync.bash similarity index 100% rename from scripts/Bootstrap/Pmodules/modsync.bash rename to Bootstrap/Pmodules/modsync.bash diff --git a/scripts/Bootstrap/Pmodules/modulecmd b/Bootstrap/Pmodules/modulecmd similarity index 100% rename from scripts/Bootstrap/Pmodules/modulecmd rename to Bootstrap/Pmodules/modulecmd diff --git a/scripts/Bootstrap/Pmodules/modulecmd.bash.in b/Bootstrap/Pmodules/modulecmd.bash.in similarity index 100% rename from scripts/Bootstrap/Pmodules/modulecmd.bash.in rename to Bootstrap/Pmodules/modulecmd.bash.in diff --git a/scripts/Bootstrap/Pmodules/profile.bash b/Bootstrap/Pmodules/profile.bash similarity index 100% rename from scripts/Bootstrap/Pmodules/profile.bash rename to Bootstrap/Pmodules/profile.bash diff --git a/scripts/Bootstrap/Pmodules/profile.csh b/Bootstrap/Pmodules/profile.csh similarity index 100% rename from scripts/Bootstrap/Pmodules/profile.csh rename to Bootstrap/Pmodules/profile.csh diff --git a/scripts/Bootstrap/Pmodules_version.conf b/Bootstrap/Pmodules_version.conf similarity index 100% rename from scripts/Bootstrap/Pmodules_version.conf rename to Bootstrap/Pmodules_version.conf diff --git a/scripts/Bootstrap/Tcl/build b/Bootstrap/Tcl/build similarity index 86% rename from scripts/Bootstrap/Tcl/build rename to Bootstrap/Tcl/build index 9dacb87..379122e 100755 --- a/scripts/Bootstrap/Tcl/build +++ b/Bootstrap/Tcl/build @@ -1,6 +1,4 @@ -#!/bin/bash - -source "$(dirname $0)/../../../lib/libpmodules.bash" +#!/usr/bin/env pbuild pmodules.configure() { case ${OS} in diff --git a/scripts/Bootstrap/dialog/build b/Bootstrap/bash/build similarity index 68% rename from scripts/Bootstrap/dialog/build rename to Bootstrap/bash/build index 02f522f..70cdb1a 100755 --- a/scripts/Bootstrap/dialog/build +++ b/Bootstrap/bash/build @@ -1,6 +1,4 @@ -#!/bin/bash - -source "$(dirname $0)/../../../lib/libpmodules.bash" +#!/usr/bin/env pbuild pmodules.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Bootstrap/bootstrap.sh b/Bootstrap/bootstrap.sh similarity index 71% rename from scripts/Bootstrap/bootstrap.sh rename to Bootstrap/bootstrap.sh index 3a8fea6..e63c140 100755 --- a/scripts/Bootstrap/bootstrap.sh +++ b/Bootstrap/bootstrap.sh @@ -1,6 +1,6 @@ #!/bin/bash declare -r BASE_DIR=$(cd "$(dirname $0)/../.." && pwd) -declare -r BOOTSTRAP_DIR="${BASE_DIR}/scripts/Bootstrap" +declare -r BOOTSTRAP_DIR="${BASE_DIR}/Bootstrap" ${BOOTSTRAP_DIR}/compile_pmodules.sh ${BOOTSTRAP_DIR}/install_pmodules.sh diff --git a/scripts/Bootstrap/compile_pmodules.sh b/Bootstrap/compile_pmodules.sh similarity index 91% rename from scripts/Bootstrap/compile_pmodules.sh rename to Bootstrap/compile_pmodules.sh index 6283c25..00fcdb2 100755 --- a/scripts/Bootstrap/compile_pmodules.sh +++ b/Bootstrap/compile_pmodules.sh @@ -1,7 +1,7 @@ #!/bin/bash -declare -r BASE_DIR=$(cd "$(dirname $0)/../.." && pwd) -declare -r BOOTSTRAP_DIR="${BASE_DIR}/scripts/Bootstrap" +declare -r BASE_DIR=$(cd "$(dirname $0)/.." && pwd) +declare -r BOOTSTRAP_DIR="${BASE_DIR}/Bootstrap" source "${BASE_DIR}/lib/lib.bash" diff --git a/scripts/Bootstrap/coreutils/build b/Bootstrap/coreutils/build similarity index 69% rename from scripts/Bootstrap/coreutils/build rename to Bootstrap/coreutils/build index 7b0a965..63030c7 100755 --- a/scripts/Bootstrap/coreutils/build +++ b/Bootstrap/coreutils/build @@ -1,6 +1,4 @@ -#!/bin/bash - -source "$(dirname $0)/../../../lib/libpmodules.bash" +#!/usr/bin/env pbuild pmodules.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/Bootstrap/coreutils/build.new b/Bootstrap/coreutils/build.new new file mode 100755 index 0000000..63030c7 --- /dev/null +++ b/Bootstrap/coreutils/build.new @@ -0,0 +1,10 @@ +#!/usr/bin/env pbuild + +pmodules.configure() { + "${MODULE_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + || exit 1 +} + +pmodules.add_to_group 'Tools' +pmodules.make_all diff --git a/scripts/Bootstrap/bash/build b/Bootstrap/dialog/build similarity index 68% rename from scripts/Bootstrap/bash/build rename to Bootstrap/dialog/build index 02f522f..70cdb1a 100755 --- a/scripts/Bootstrap/bash/build +++ b/Bootstrap/dialog/build @@ -1,6 +1,4 @@ -#!/bin/bash - -source "$(dirname $0)/../../../lib/libpmodules.bash" +#!/usr/bin/env pbuild pmodules.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Bootstrap/getopt/build b/Bootstrap/getopt/build similarity index 89% rename from scripts/Bootstrap/getopt/build rename to Bootstrap/getopt/build index 8bacc92..b7984cb 100755 --- a/scripts/Bootstrap/getopt/build +++ b/Bootstrap/getopt/build @@ -1,6 +1,4 @@ -#!/bin/bash - -source "$(dirname $0)/../../../lib/libpmodules.bash" +#!/usr/bin/env pbuild pmodules.configure() { : diff --git a/scripts/Bootstrap/gettext/build b/Bootstrap/gettext/build similarity index 88% rename from scripts/Bootstrap/gettext/build rename to Bootstrap/gettext/build index 9b355bd..ad631df 100755 --- a/scripts/Bootstrap/gettext/build +++ b/Bootstrap/gettext/build @@ -1,6 +1,4 @@ -#!/bin/bash - -source "$(dirname $0)/../../../lib/libpmodules.bash" +#!/usr/bin/env pbuild pmodules.configure() { "${MODULE_SRCDIR}"/configure \ diff --git a/scripts/Bootstrap/install_pmodules.sh b/Bootstrap/install_pmodules.sh similarity index 93% rename from scripts/Bootstrap/install_pmodules.sh rename to Bootstrap/install_pmodules.sh index a9e02f8..d6965c4 100755 --- a/scripts/Bootstrap/install_pmodules.sh +++ b/Bootstrap/install_pmodules.sh @@ -1,7 +1,7 @@ #!/bin/bash -declare -r BASE_DIR=$(cd "$(dirname $0)/../.." && pwd) -declare -r BOOTSTRAP_DIR="${BASE_DIR}/scripts/Bootstrap" +declare -r BASE_DIR=$(cd "$(dirname $0)/.." && pwd) +declare -r BOOTSTRAP_DIR="${BASE_DIR}/Bootstrap" declare -r SRC_DIR="${BOOTSTRAP_DIR}/Pmodules" source "${BASE_DIR}/lib/lib.bash" diff --git a/scripts/Bootstrap/mkindex.tcl b/Bootstrap/mkindex.tcl similarity index 100% rename from scripts/Bootstrap/mkindex.tcl rename to Bootstrap/mkindex.tcl diff --git a/bin/pbuild b/bin/pbuild new file mode 100755 index 0000000..4415733 --- /dev/null +++ b/bin/pbuild @@ -0,0 +1,8 @@ +#!/bin/bash + +source $(dirname $0)/../lib/lib.bash +declare -rx BUILD_BLOCK=$(std::abspath "$1") +declare -rx BUILD_BLOCK_DIR=$(dirname "${BUILD_BLOCK}") +shift 1 +source $(dirname $0)/../lib/libpmodules.bash +source "${BUILD_BLOCK}" diff --git a/lib/libpmodules.bash b/lib/libpmodules.bash index 04ca637..42ff8de 100644 --- a/lib/libpmodules.bash +++ b/lib/libpmodules.bash @@ -6,9 +6,12 @@ unset CDPATH shopt -s expand_aliases declare -rx ARGS="$@" +if [[ -z ${BUILD_BLOCK} ]]; then + # legacy support for 'old-style' build-blocks + declare -r BUILD_BLOCK_DIR=$( cd $(dirname "$0") && pwd ) + declare -r BUILD_BLOCK="${BUILD_BLOCK_DIR}"/$(basename "$0") +fi -declare -r BUILDSCRIPT_DIR=$( cd $(dirname "$0") && pwd ) -declare -r BUILDSCRIPT="${BUILDSCRIPT_DIR}"/$(basename "$0") declare -rx SHLIBDIR=$( cd $(dirname "$BASH_SOURCE") && pwd ) source "${SHLIBDIR}/lib.bash" @@ -115,7 +118,7 @@ is_release () { # # $1: OS (as printed by 'uname -s') # -pmodules.supported_os() { +pbuild::supported_os() { for os in "$@"; do [[ ${os} == ${OS} ]] && return 0 done @@ -128,7 +131,7 @@ pmodules.supported_os() { # # $1: group # -pmodules.add_to_group() { +pbuild::add_to_group() { if [[ -z ${1} ]]; then std::die 42 "${FUNCNAME}: Missing group argument." fi @@ -144,11 +147,11 @@ pmodules.add_to_group() { # # $@: dependencies # -pmodules.set_build_dependencies() { +pbuild::set_build_dependencies() { MODULE_BUILD_DEPENDENCIES=("$@") } -pmodules.set_runtime_dependencies() { +pbuild::set_runtime_dependencies() { MODULE_DEPENDENCIES=("$@") } @@ -158,7 +161,7 @@ pmodules.set_runtime_dependencies() { # # $@: documentation files relative to source # -pmodules.set_docfiles() { +pbuild::set_docfiles() { MODULE_DOCFILES=("$@") } @@ -168,7 +171,7 @@ pmodules.set_docfiles() { # # $@: compilers # -pmodules.set_supported_compilers() { +pbuild::set_supported_compilers() { MODULE_SUPPORTED_COMPILERS=("$@") } @@ -313,7 +316,7 @@ write_build_dependencies() { # # cleanup environment # -pmodules.cleanup_env() { +pbuild::cleanup_env() { C_INCLUDE_PATH='' CPLUS_INCLUDE_PATH='' @@ -585,31 +588,31 @@ prep() { } -pmodules.pre_configure() { +pbuild::pre_configure() { : } -pmodules.configure() { +pbuild::configure() { ${MODULE_SRCDIR}/configure \ --prefix="${PREFIX}" } -pmodules.build() { +pbuild::build() { make -j${JOBS} } -pmodules.install() { +pbuild::install() { make install } -pmodules.post_install() { +pbuild::post_install() { : } -pmodules.install_doc() { +pbuild::install_doc() { std::info "Installing documentation to ${DOCDIR}" install -m 0755 -d "${DOCDIR}" - install -m0444 "${MODULE_DOCFILES[@]/#/${MODULE_SRCDIR}/}" "${BUILDSCRIPT}" "${DOCDIR}" + install -m0444 "${MODULE_DOCFILES[@]/#/${MODULE_SRCDIR}/}" "${BUILD_BLOCK}" "${DOCDIR}" } set_legacy_link() { @@ -652,7 +655,7 @@ set_link() { echo "${MODULE_RELEASE}" > "${release_file}" } -pmodules.cleanup_build() { +pbuild::cleanup_build() { [[ -n "${MODULE_BUILDDIR}" ]] \ || std::die 1 "Oops: internal error: MODULE_BUILDDIR is set to empty string..." [[ "${MODULE_BUILDDIR}" == "/" ]] \ @@ -663,7 +666,7 @@ pmodules.cleanup_build() { rm -rf "/${MODULE_BUILDDIR}" } -pmodules.cleanup_src() { +pbuild::cleanup_src() { ( [[ -d /${MODULE_SRCDIR} ]] || return 0 cd "/${MODULE_SRCDIR}/.."; @@ -700,7 +703,7 @@ post_install() { return 0 } -pmodules.make_all() { +pbuild::make_all() { local building='no' echo "${P}:" _setup_env1 @@ -726,25 +729,25 @@ pmodules.make_all() { if [[ ! -e "${MODULE_BUILDDIR}/.configure" ]]; then cd "${MODULE_SRCDIR}" - pmodules.pre_configure + pbuild::pre_configure cd "${MODULE_BUILDDIR}" - pmodules.configure + pbuild::configure touch "${MODULE_BUILDDIR}/.configure" fi [[ "${target}" == "configure" ]] && return 0 if [[ ! -e "${MODULE_BUILDDIR}/.compile" ]]; then cd "${MODULE_BUILDDIR}" - pmodules.build + pbuild::build touch "${MODULE_BUILDDIR}/.compile" fi [[ "${target}" == "compile" ]] && return 0 if [[ ! -e "${MODULE_BUILDDIR}/.install" ]]; then cd "${MODULE_BUILDDIR}" - pmodules.install - pmodules.post_install - pmodules.install_doc + pbuild::install + pbuild::post_install + pbuild::install_doc post_install if [[ ${bootstrap} == 'no' ]]; then write_runtime_dependencies @@ -754,8 +757,8 @@ pmodules.make_all() { fi [[ "${target}" == "install" ]] && return 0 - [[ ${enable_cleanup_build} == yes ]] && pmodules.cleanup_build - [[ ${enable_cleanup_src} == yes ]] && pmodules.cleanup_src + [[ ${enable_cleanup_build} == yes ]] && pbuild::cleanup_build + [[ ${enable_cleanup_src} == yes ]] && pbuild::cleanup_src else echo "Not rebuilding $P/$V ..." @@ -769,6 +772,74 @@ pmodules.make_all() { return 0 } +# +# legacy functions, should be removed asap +# +pmodules.supported_os() { + pbuild::supported_os "$@" +} + +pmodules.add_to_group() { + pbuild::add_to_group "@" +} + +pmodules.set_build_dependencies() { + pbuild::set_build_dependencies "$@" +} + +pmodules.set_runtime_dependencies() { + pbuild::set_runtime_dependencies "$@" +} + +pmodules.set_docfiles() { + pbuild::set_docfiles "$@" +} + +pmodules.set_supported_compilers() { + pbuild::set_supported_compilers "$@" +} + +pmodules.cleanup_env() { + pbuild::cleanup_env "$@" +} + +pmodules.pre_configure() { + pbuild::pre_configure "$@" +} + +pmodules.configure() { + pbuild::configure "$@" +} + +pmodules.build() { + pbuild::build "$@" +} + +pmodules.install() { + pbuild::install "$@" +} + +pmodules.post_install() { + pbuild::post_install "$@" +} + +pmodules.install_doc() { + pbuild::install_doc "$@" +} + +pmodules.cleanup_build() { + pbuild::cleanup_build "$@" +} + +pmodules.cleanup_src() { + pbuild::cleanup_src "$@" +} + + +pmodules.make_all() { + pbuild::make_all "$@" +} + ############################################################################## # debug_on='no' @@ -781,7 +852,7 @@ enable_cleanup_src='no' target='all' -pmodules.cleanup_env +pbuild::cleanup_env # array collecting all modules specified on the command line via '--with=module' with_modules=() @@ -856,10 +927,10 @@ fi # while bootstraping the module command is not yet available if [[ ${bootstrap} == no ]]; then - if [[ -r "${BUILDSCRIPT_DIR}/with_modules-$V" ]]; then - with_modules+=( $(cat "${BUILDSCRIPT_DIR}/with_modules-$V") ) - elif [[ -r "${BUILDSCRIPT_DIR}/with_modules" ]]; then - with_modules+=( $(cat "${BUILDSCRIPT_DIR}/with_modules") ) + if [[ -r "${BUILD_BLOCK_DIR}/with_modules-$V" ]]; then + with_modules+=( $(cat "${BUILD_BLOCK_DIR}/with_modules-$V") ) + elif [[ -r "${BUILD_BLOCK_DIR}/with_modules" ]]; then + with_modules+=( $(cat "${BUILD_BLOCK_DIR}/with_modules") ) fi source "${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/profile.bash" @@ -880,11 +951,11 @@ if [[ ${bootstrap} == no ]]; then else unset PMODULES_HOME unset PMODULES_VERSION - read_versions "${BUILD_BASEDIR}/scripts/Bootstrap/Pmodules_version.conf" + read_versions "${BUILD_BASEDIR}/Bootstrap/Pmodules_version.conf" source "/opt/psi/config/environment.bash" fi -P=$(basename $(dirname "${BUILDSCRIPT}")) +P=$(basename $(dirname "${BUILD_BLOCK}")) P=${P%.*} _P=$(echo $P | tr [:lower:] [:upper:]) _P=${_P//-/_}