commit 1671b3026feb16b0b8c77ecef26b876a8064052d Author: Achim Gsell Date: Fri Apr 18 22:58:13 2014 +0200 initial commit diff --git a/config/compiler.d/compiler.conf b/config/compiler.d/compiler.conf new file mode 120000 index 0000000..1262fcf --- /dev/null +++ b/config/compiler.d/compiler.conf @@ -0,0 +1 @@ +../gcc-4.7.3 \ No newline at end of file diff --git a/config/compiler.d/mpi.conf b/config/compiler.d/mpi.conf new file mode 120000 index 0000000..4cb2200 --- /dev/null +++ b/config/compiler.d/mpi.conf @@ -0,0 +1 @@ +../openmpi-1.6.5 \ No newline at end of file diff --git a/config/core.d/compiler.conf b/config/core.d/compiler.conf new file mode 120000 index 0000000..1262fcf --- /dev/null +++ b/config/core.d/compiler.conf @@ -0,0 +1 @@ +../gcc-4.7.3 \ No newline at end of file diff --git a/config/environment.bash b/config/environment.bash new file mode 120000 index 0000000..f551b30 --- /dev/null +++ b/config/environment.bash @@ -0,0 +1 @@ +/opt/psi/config/environment.bash \ No newline at end of file diff --git a/config/gcc-4.7.3 b/config/gcc-4.7.3 new file mode 100644 index 0000000..b62fcd3 --- /dev/null +++ b/config/gcc-4.7.3 @@ -0,0 +1,4 @@ +COMPILER='gcc' +COMPILER_VERSION='4.7.3' + +GCC_VERSION="${COMPILER_VERSION}" diff --git a/config/gcc-4.8.2 b/config/gcc-4.8.2 new file mode 100644 index 0000000..a4e120b --- /dev/null +++ b/config/gcc-4.8.2 @@ -0,0 +1,4 @@ +COMPILER='gcc' +COMPILER_VERSION='4.8.2' + +GCC_VERSION=${COMPILER_VERSION} diff --git a/config/hdf5-1.8.12 b/config/hdf5-1.8.12 new file mode 100644 index 0000000..95f7494 --- /dev/null +++ b/config/hdf5-1.8.12 @@ -0,0 +1,3 @@ +HDF5=hdf5 +HDF5_VERSION=1.8.12 + diff --git a/config/hdf5.d/compiler.conf b/config/hdf5.d/compiler.conf new file mode 120000 index 0000000..1262fcf --- /dev/null +++ b/config/hdf5.d/compiler.conf @@ -0,0 +1 @@ +../gcc-4.7.3 \ No newline at end of file diff --git a/config/hdf5.d/hdf5.conf b/config/hdf5.d/hdf5.conf new file mode 120000 index 0000000..4cc65f5 --- /dev/null +++ b/config/hdf5.d/hdf5.conf @@ -0,0 +1 @@ +../hdf5-1.8.12 \ No newline at end of file diff --git a/config/hdf5.d/mpi.conf b/config/hdf5.d/mpi.conf new file mode 120000 index 0000000..4cb2200 --- /dev/null +++ b/config/hdf5.d/mpi.conf @@ -0,0 +1 @@ +../openmpi-1.6.5 \ No newline at end of file diff --git a/config/hdf5_serial-1.8.12 b/config/hdf5_serial-1.8.12 new file mode 100644 index 0000000..1cd889f --- /dev/null +++ b/config/hdf5_serial-1.8.12 @@ -0,0 +1,3 @@ +HDF5_SERIAL=hdf5_serial +HDF5_SERIAL_VERSION=1.8.12 + diff --git a/config/hdf5_serial.d/compiler.conf b/config/hdf5_serial.d/compiler.conf new file mode 120000 index 0000000..1262fcf --- /dev/null +++ b/config/hdf5_serial.d/compiler.conf @@ -0,0 +1 @@ +../gcc-4.7.3 \ No newline at end of file diff --git a/config/hdf5_serial.d/hdf5.conf b/config/hdf5_serial.d/hdf5.conf new file mode 120000 index 0000000..925c62e --- /dev/null +++ b/config/hdf5_serial.d/hdf5.conf @@ -0,0 +1 @@ +../hdf5_serial-1.8.12 \ No newline at end of file diff --git a/config/modules b/config/modules new file mode 100644 index 0000000..147a35b --- /dev/null +++ b/config/modules @@ -0,0 +1,17 @@ +if [[ -z $EM_PREFIX ]]; then + EM_PREFIX_AFS='/afs/psi.ch/sys/@sys' + EM_PREFIX_LOCAL='/opt/em' + + if [[ -d ${EM_PREFIX_LOCAL} ]]; then + declare -x EM_PREFIX=${EM_PREFIX_LOCAL} + elif [[ -d ${EM_PREFIX_AFS} ]]; then + declare -x EM_PREFIX=${EM_PREFIX_AFS} + else + echo "Oops: cannot initialize Modules!" + return 1 + fi +fi + +declare -x MODULES_VERSION='3.2.10' + + diff --git a/config/mpi.d/compiler.conf b/config/mpi.d/compiler.conf new file mode 120000 index 0000000..1262fcf --- /dev/null +++ b/config/mpi.d/compiler.conf @@ -0,0 +1 @@ +../gcc-4.7.3 \ No newline at end of file diff --git a/config/mpi.d/hdf5.conf b/config/mpi.d/hdf5.conf new file mode 120000 index 0000000..4cc65f5 --- /dev/null +++ b/config/mpi.d/hdf5.conf @@ -0,0 +1 @@ +../hdf5-1.8.12 \ No newline at end of file diff --git a/config/mpi.d/mpi.conf b/config/mpi.d/mpi.conf new file mode 120000 index 0000000..4cb2200 --- /dev/null +++ b/config/mpi.d/mpi.conf @@ -0,0 +1 @@ +../openmpi-1.6.5 \ No newline at end of file diff --git a/config/openmpi-1.6.5 b/config/openmpi-1.6.5 new file mode 100644 index 0000000..31dbc3c --- /dev/null +++ b/config/openmpi-1.6.5 @@ -0,0 +1,5 @@ +MPI=openmpi +MPI_VERSION=1.6.5 + +OPENMPI_VERSION=${MPI_VERSION} + diff --git a/config/openmpi-1.8.0 b/config/openmpi-1.8.0 new file mode 100644 index 0000000..4cdda46 --- /dev/null +++ b/config/openmpi-1.8.0 @@ -0,0 +1,5 @@ +MPI=openmpi +MPI_VERSION=1.8.0 + +OPENMPI_VERSION=${MPI_VERSION} + diff --git a/config/versions.conf b/config/versions.conf new file mode 100644 index 0000000..8b1ed63 --- /dev/null +++ b/config/versions.conf @@ -0,0 +1,24 @@ +AUTOCONF_VERSION='2.69' +AUTOMAKE_VERSION='1.14' +CMAKE_VERSION='2.8.12.2' +EMACS_VERSION=24.3 +GCC_VERSION='4.7.3' +GCC_VERSION='4.8.2' +GMP_VERSION='5.1.1' +GNUPLOT_VERSION=4.6.3 +GSL_VERSION=1.15 +H5HUT_SERIAL_VERSION=1.99.13 +H5HUT_VERSION=1.99.13 +HDF5_SERIAL_VERSION=1.8.12 +HDF5_VERSION=1.8.12 +IPPL_VERSION=1.1.0 +LIBTOOL_VERSION='2.4.2' +M4_VERSION='1.4.17' +MATHLIB_VERSION=1.0.0 +MPC_VERSION='1.0.1' +MPFR_VERSION='3.1.2' +OPAL_VERSION=1.2.0 +PARMETIS_VERSION=3.2.0 +ROOT_VERSION=5.34.11 +TRILINOS_VERSION=11.4.1 +VTK_VERSION=5.10.1 diff --git a/lib/lib.bash b/lib/lib.bash new file mode 100644 index 0000000..8b06860 --- /dev/null +++ b/lib/lib.bash @@ -0,0 +1,82 @@ +shopt -s expand_aliases +unalias -a + +__path=$(which gdate 2>/dev/null) +if [[ $__path ]]; then + alias date=$__path +else + alias date=$(which date 2>/dev/null) +fi + +__path=$(which ginstall 2>/dev/null) +if [[ $__path ]]; then + alias install=$__path +else + alias install=$(which install 2>/dev/null) +fi + +__path=$(which greadlink 2>/dev/null) +if [[ $__path ]]; then + alias readlink=$__path +else + alias readlink=$(which readlink 2>/dev/null) +fi + +__path=$(which gsed 2>/dev/null) +if [[ $__path ]]; then + alias sed=$__path +else + alias sed=$(which sed 2>/dev/null) +fi + + +set -o errexit + +trap "error_handler" ERR + +function error_handler() { + local -i ec=$? + + exit ${ec} +} + +log() { + local -ri fd=$1 + local -r fmt="$2\n" + shift 2 + printf "$fmt" "$@" >> /dev/fd/$fd +} + +die() { + local -ri ec=$1 + shift + local cout + if (( ec == 0)); then + cout='1' + else + cout='2' + fi + if [[ -n $@ ]]; then + local -r fmt=$1 + shift + log $cout "$fmt" "$@" + fi + exit $ec +} + +abspath () { + (cd "$1" && pwd) +} + +append_path () { + local -r P=$1 + local -r d=$2 + + if ! echo ${!P} | egrep -q "(^|:)${d}($|:)" ; then + if [[ -z ${!P} ]]; then + eval $P=${d} + else + eval $P=${!P}:${d} + fi + fi +} diff --git a/lib/libem.bash b/lib/libem.bash new file mode 100644 index 0000000..02ed698 --- /dev/null +++ b/lib/libem.bash @@ -0,0 +1,320 @@ + +declare -rx SHLIBDIR=$( cd $(dirname "$BASH_SOURCE") && pwd ) + +declare -r OS=$(uname -s) + +PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin + +source "${SHLIBDIR}/lib.bash" + +# the module name might be set in the build script(!) +if [[ -z $P ]]; then + P=$(basename $0) + P=${P%.*} +fi + +# unset the version of the module +_P=$(echo $P | tr [:lower:] [:upper:]) +_V=${_P}_VERSION +unset ${_V} + +declare -rx CORE_VERSIONS_DIR="${SHLIBDIR}/../config/core.d" + +declare -i JOBS=3 + +#while read _name _version; do +# [[ -z ${_name} ]] && continue +# [[ -z ${_version} ]] && continue +# [[ "${_name:0:1}" == '#' ]] && continue +# _NAME=$(echo ${_name} | tr [:lower:] [:upper:]) +# eval ${_NAME}_VERSION=$_version +#done < "${VERSIONS}" + +DEBUG_ON='' +FORCE_REBUILD='' +ENVIRONMENT_ARGS='' +while (( $# > 0 )); do + case $1 in + -j ) + JOBS=$2 + shift + ;; + -v ) + DEBUG_ON=':' + ;; + -f | --force-rebuild ) + FORCE_REBUILD=':' + ;; + * ) + if [[ $1 =~ = ]]; then + eval $1 + ENVIRONMENT_ARGS="${ENVIRONMENT_ARGS} $1" + else + V=$1 + fi + ;; + esac + shift +done + +declare -rx EM_BASEDIR=$(abspath $SHLIBDIR/..) + +source "${EM_BASEDIR}/config/environment.bash" + +declare -x PREFIX='' +declare -x DOCDIR='' +declare -x EM_FAMILY='' +declare -x EM_MODULENAME='' + +declare -x EM_TMPDIR="${EM_BASEDIR}/tmp" +declare -x EM_SRCDIR='' +declare -x EM_BUILDDIR='' +declare -x CONFIG_DIR="${EM_BASEDIR}/config" + +declare -x EM_BUILD_DEPENDENCIES + +declare -x C_INCLUDE_PATH +declare -x CPLUS_INCLUDE_PATH +declare -x CPP_INCLUDE_PATH +declare -x LIBRARY_PATH +declare -x LD_LIBRARY_PATH +declare -x DYLD_LIBRARY_PATH + +module purge + +#unset _P _V + + +[[ $DEBUG_ON ]] && trap 'eval echo \\"$BASH_COMMAND\\"' DEBUG + +function em.set_build_dependencies() { + EM_BUILD_DEPENDENCIES=("$@") +} + +function _load_build_dependencies() { + for m in "${EM_BUILD_DEPENDENCIES[@]}"; do + [[ -z $m ]] && continue + if [[ ! $m =~ "*/*" ]]; then + local _V=${m^^}_VERSION + m=$m/${!_V} + fi + if module load "$m" 2>&1 | grep -q "Unable to locate"; then + echo "Oops: Module \"$m\" not available" + return 1 + fi + module load "$m" + done +} + +function em.load_family() { + if [[ -z ${1} ]]; then + printf "${FUNCNAME}: Missing family argument" + exit 42 + fi + if [[ ! -d ${EM_ETCDIR}/${1} ]]; then + printf "${FUNCNAME}: ${1}: family does not exist." + exit 42 + fi + + for f in "${CONFIG_DIR}/${1}.d/"*.conf; do + source "${f}" + done + eval ${ENVIRONMENT_ARGS} +} + +function em.add_to_family() { + EM_FAMILY=$1 + source "${CONFIG_DIR}/versions.conf" + em.load_family "$1" +} + +function em.set_runtime_dependencies() { + EM_DEPENDENCIES=("$@") +} + +function _write_runtime_dependencies() { + local -r fname="${PREFIX}/.dependencies" + local dep + echo -n "" > "${fname}" + for dep in "${EM_DEPENDENCIES[@]}"; do + [[ -z $dep ]] && continue + if [[ ! $dep =~ "*/*" ]]; then + local _V=${dep^^}_VERSION + dep=$dep/${!_V} + fi + echo "${dep}" >> "${fname}" + done +} + +function _write_build_dependencies() { + local -r fname="${PREFIX}/.build_dependencies" + local dep + echo -n "" > "${fname}" + for dep in "${EM_BUILD_DEPENDENCIES[@]}"; do + [[ -z $dep ]] && continue + if [[ ! $dep =~ "*/*" ]]; then + local _V=${dep^^}_VERSION + dep=$dep/${!_V} + fi + echo "${dep}" >> "${fname}" + done +} + +function _set_env() { + C_INCLUDE_PATH='' + CPLUS_INCLUDE_PATH='' + CPP_INCLUDE_PATH='' + LIBRARY_PATH='' + LD_LIBRARY_PATH='' + DYLD_LIBRARY_PATH='' + + if [[ -z ${EM_FAMILY} ]]; then + em.add_to_family 'core' + fi + + # overwrite environment variables with values we got on the cmd line + eval ${ENVIRONMENT_ARGS} + + # this allows us to specify the version as PKGNAME_VERSION=1.2.3 on the cmd-line + if [[ -z $V ]]; then + V=$(eval echo \$${_P}_VERSION) + fi + + # oops, we need a version + if [[ -z $V ]]; then + die 1 "$P: Missing version." + fi + EM_SRCDIR="${EM_TMPDIR}/src/${P/_serial}-$V" + EM_BUILDDIR="${EM_TMPDIR}/build/$P-$V/$COMPILER/$COMPILER_VERSION" + + declare -rx DOWNLOADDIR="${EM_BASEDIR}/Downloads" + + # build module name + case ${EM_FAMILY} in + core ) + EM_MODULENAME="${P}/${V}" + ;; + compiler ) + EM_MODULENAME="${COMPILER}/${COMPILER_VERSION}/${P}/${V}" + ;; + mpi ) + EM_MODULENAME="${COMPILER}/${COMPILER_VERSION}/${MPI}/${MPI_VERSION}/${P}/${V}" + ;; + hdf5 ) + EM_MODULENAME="${COMPILER}/${COMPILER_VERSION}/${MPI}/${MPI_VERSION}/${HDF5}/${HDF5_VERSION}/${P}/${V}" + ;; + hdf5_serial ) + EM_MODULENAME="${COMPILER}/${COMPILER_VERSION}/hdf5/${HDF5_SERIAL_VERSION}/${P}/${V}" + ;; + + esac + + # set PREFIX of module + PREFIX="${EM_BINDIR}/${EM_FAMILY}/${EM_MODULENAME}" + + DOCDIR="${PREFIX}/share/doc/$P" + + TARBALL="${DOWNLOADDIR}/${P/_serial}-$V.tar" + if [[ -r $TARBALL.gz ]]; then + TARBALL=${TARBALL}.gz + _UNTAR_FLAGS='xvzf' + elif [[ -r ${TARBALL}.bz2 ]]; then + TARBALL=${TARBALL}.bz2 + _UNTAR_FLAGS='xvjf' + else + printf "${FUNCNAME}: tarball for ${TARBALL} not found." + exit 43 + fi +} + +function em.set_env() { + : +} + +function em.prep() { + + # untar sources + if [[ ! -d ${EM_SRCDIR} ]]; then + mkdir -p "${EM_TMPDIR}/src" + (cd "${EM_TMPDIR}/src" && tar ${_UNTAR_FLAGS} "${TARBALL}") + fi + + # create build directory + mkdir -p "${EM_BUILDDIR}" + +} + +function em.pre_configure() { + : +} + +function em.configure() { + ${EM_SRCDIR}/configure \ + --prefix="${PREFIX}" +} + +function em.build() { + make -j${JOBS} +} + +function em.install() { + make install +} + +function em.post_install() { + : +} + +function em.install_doc() { + : +} + +function _set_link() { + (mkdir -p "${EM_MODULEROOT_PATH}" + cd "${EM_MODULEROOT_PATH}" + local _path="${EM_FAMILY}/${EM_MODULENAME%/*}" + mkdir -p "${_path}" + cd "${_path}" + + local x + IFS='/' x=(${_path}) + local -r _target="../"$(eval printf "../%.s" {1..${#x[@]}})${EM_ETCDIR##*/}/"${EM_FAMILY}/${P}" + ln -fs "${_target}" "${EM_MODULENAME##*/}" + ) +} + +function _cleanup_build() { + ( + [[ -d /${EM_BUILDDIR} ]] || return 0 + cd "/${EM_BUILDDIR}"; + if [[ $(pwd) != / ]]; then + echo "Cleaning up $(pwd)" + rm -rf * + fi + ); +} + +function em.make_all() { + _set_env + if [[ ! -d "${PREFIX}" ]] || [[ ${FORCE_REBUILD} ]]; then + _load_build_dependencies + em.prep + cd "${EM_SRCDIR}" + em.pre_configure + cd "${EM_BUILDDIR}" + em.configure + em.build + em.install + em.post_install + cd "${EM_SRCDIR}" + mkdir -p "${DOCDIR}" + em.install_doc + else + echo "Not rebuilding $P-$V ..." + fi + _write_runtime_dependencies + _write_build_dependencies + _set_link + _cleanup_build +} + diff --git a/scripts/H5hut.build b/scripts/H5hut.build new file mode 100755 index 0000000..4b446a4 --- /dev/null +++ b/scripts/H5hut.build @@ -0,0 +1,38 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + ( cd "${EM_SRCDIR}" && ./autogen.sh ) + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --enable-parallel \ + --enable-debug \ + --enable-vtkconverter \ + --with-hdf5=$HDF5_PREFIX \ + --with-pic \ + || exit 1 +} + +function em.build() { + make -C src + make -C tools +} + +function em.install() { + make -C src install + make -C tools install +} + +function em.install_doc() { + install -m 0444 \ + AUTHORS \ + COPYING \ + "${DOCDIR}" +} + +em.add_to_family 'hdf5' +em.set_runtime_dependencies "${COMPILER}" "${MPI}" 'hdf5' +em.set_build_dependencies "autoconf" "automake" "libtool" "${COMPILER}" "${MPI}" "vtk" "hdf5" +em.make_all + diff --git a/scripts/H5hut_serial.build b/scripts/H5hut_serial.build new file mode 100755 index 0000000..fb449a4 --- /dev/null +++ b/scripts/H5hut_serial.build @@ -0,0 +1,30 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + (cd "${EM_SRCDIR}" && ./autogen.sh) + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --enable-debug \ + --enable-vtkconverter \ + --with-hdf5="${HDF5_SERIAL_PREFIX}" \ + --with-pic \ + || exit 1 +} + +function em.build() { + make -C src + make -C tools +} + +function em.install() { + make -C src install + make -C tools install +} + +em.add_to_family 'hdf5_serial' +em.set_runtime_dependencies "${COMPILER}" 'hdf5_serial' +em.set_build_dependencies "autoconf" "automake" "libtool" "${COMPILER}" "vtk" "hdf5_serial" +em.make_all + diff --git a/scripts/H5root.build b/scripts/H5root.build new file mode 100755 index 0000000..0f7cc87 --- /dev/null +++ b/scripts/H5root.build @@ -0,0 +1,35 @@ +#!/bin/bash + +source $(dirname $0)/../lib/libem.bash + +ROOT='root' +HDF5='hdf5' +H5HUT='H5hut' +H5HUT_VERSION="${H5HUT_VERSION}" + +function em.pre_configure() { + ./autogen.sh +} + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --enable-h5hut \ + --enable-hdf5 \ + --enable-root \ + --with-pic +} + +em.set_group "alternatives.d/compiler" "${COMPILER}/${COMPILER_VERSION}" +em.set_dependencies \ + "root/${ROOT_VERSION}" +em.load_build_dependencies \ + "autoconf/${AUTOCONF_VERSION}" \ + "automake/${AUTOMAKE_VERSION}" \ + "libtool/${LIBTOOL_VERSION}" \ + "${COMPILER}/${COMPILER_VERSION}" \ + "${HDF5}/${HDF5_VERSION}" \ + "${H5HUT}/${H5HUT_VERSION}" \ + "${ROOT}/${ROOT_VERSION}" +em.make_all + diff --git a/scripts/Modules.build b/scripts/Modules.build new file mode 100755 index 0000000..1366623 --- /dev/null +++ b/scripts/Modules.build @@ -0,0 +1,20 @@ +#!/bin/bash + +source "$(dirname $0)/../config/environment.bash" +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${EM_BINDIR}/core" \ + --with-module-path="${EM_MODULEROOT_PATH}" \ + || exit 1 +} +# fake module command +module() { + : +} + +# use system gcc to compile +declare -rx CC=gcc + +em.make_all diff --git a/scripts/OPAL.build b/scripts/OPAL.build new file mode 100755 index 0000000..ca75376 --- /dev/null +++ b/scripts/OPAL.build @@ -0,0 +1,19 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + cmake \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ + -DCMAKE_BUILD_TYPE=RELEASE \ + -DENABLE_ML_SOLVER=TRUE \ + "${EM_SRCDIR}" +} + +em.add_to_family 'core' +em.load_family 'hdf5' +em.set_runtime_dependencies "${COMPILER}" "${MPI}" +em.set_build_dependencies 'cmake' "${COMPILER}" "${MPI}" 'hdf5' 'H5hut' 'trilinos' 'ippl' 'gsl' +em.make_all + + diff --git a/scripts/Python.build b/scripts/Python.build new file mode 100755 index 0000000..f53424b --- /dev/null +++ b/scripts/Python.build @@ -0,0 +1,14 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + || exit 1 +} + +em.set_build_dependencies "${COMPILER}" +em.set_env +em.make_all + diff --git a/scripts/autoconf.build b/scripts/autoconf.build new file mode 100755 index 0000000..f197b9a --- /dev/null +++ b/scripts/autoconf.build @@ -0,0 +1,28 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + || exit 1 +} + +function em.install_doc() { + install -m 0444 \ + AUTHORS \ + COPYING \ + COPYING.EXCEPTION \ + COPYINGv3 \ + NEWS \ + README \ + THANKS \ + "${DOCDIR}" +} + +# use system gcc to compile +declare -rx CC=gcc + +em.set_build_dependencies "m4" +em.make_all + diff --git a/scripts/automake.build b/scripts/automake.build new file mode 100755 index 0000000..70caaf7 --- /dev/null +++ b/scripts/automake.build @@ -0,0 +1,28 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + || exit 1 +} + +function em.install_doc() { + install -m 0444 \ + AUTHORS \ + COPYING \ + ChangeLog \ + HACKING \ + NEWS \ + README \ + THANKS \ + "${DOCDIR}" +} + +# use system gcc to compile +declare -rx CC=gcc + +em.set_build_dependencies "m4" "autoconf" +em.make_all + diff --git a/scripts/cmake.build b/scripts/cmake.build new file mode 100755 index 0000000..b96bb01 --- /dev/null +++ b/scripts/cmake.build @@ -0,0 +1,12 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}/bootstrap" --prefix="${PREFIX}" +} + +em.add_to_family 'core' +em.set_build_dependencies "${COMPILER}" +em.make_all + diff --git a/scripts/emacs.build b/scripts/emacs.build new file mode 100755 index 0000000..0cc9f67 --- /dev/null +++ b/scripts/emacs.build @@ -0,0 +1,33 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +build_dependencies="${COMPILER}" + +case ${OS} in +Darwin ) + configure_args='--with-ns' + build_dependencies='' + CC='' + CXX='' + COMPILER='' + COMPILER_VERSION='' + function em.post_install() { + mkdir -p "${PREFIX}" + cp -rv "${EM_BUILDDIR}"/nextstep/Emacs.app "${PREFIX}" + } + ;; +*) + ;; +esac + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + ${configure_args} \ + || exit 1 +} + +em.set_build_dependencies ${build_dependencies} +em.make_all + diff --git a/scripts/gcc.build b/scripts/gcc.build new file mode 100755 index 0000000..53d4e1d --- /dev/null +++ b/scripts/gcc.build @@ -0,0 +1,31 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --enable-languages=c,c++,objc,obj-c++,lto,fortran \ + --with-gmp="${GMP_PREFIX}" \ + --with-mpfr="${MPFR_PREFIX}" \ + --with-mpc="${MPC_PREFIX}" \ + --enable-lto \ + --disable-multilib \ + --with-pkgversion="PSI Environment Module $COMPILER $COMPILER_VERSION" \ + || exit 1 +} + +function em.install_doc() { + install -m 0444 \ + COPYING* \ + NEWS \ + README \ + "${DOCDIR}" +} + +# use system gcc to compile +declare -rx CC=gcc + +em.set_build_dependencies "gmp" "mpfr" "mpc" +em.make_all + diff --git a/scripts/gmp.build b/scripts/gmp.build new file mode 100755 index 0000000..989004c --- /dev/null +++ b/scripts/gmp.build @@ -0,0 +1,17 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --disable-shared \ + || exit 1 +} + +# use system gcc to compile +declare -rx CC=gcc +declare -rx CPP=/usr/bin/cpp + +em.make_all + diff --git a/scripts/gnuplot.build b/scripts/gnuplot.build new file mode 100755 index 0000000..bbef0dd --- /dev/null +++ b/scripts/gnuplot.build @@ -0,0 +1,24 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --with-gif=no \ + --with-tiff=no \ + || exit 1 +} + +function em.install_doc() { + install -m 0444 \ + Copyright \ + ChangeLog \ + NEWS \ + README \ + README.1ST \ + "${DOCDIR}" +} + +em.set_build_dependencies "${COMPILER}" +em.make_all diff --git a/scripts/gsl.build b/scripts/gsl.build new file mode 100755 index 0000000..dbf84b4 --- /dev/null +++ b/scripts/gsl.build @@ -0,0 +1,27 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + || exit 1 +} + +function em.install_doc() { + install -m 0444 \ + AUTHORS \ + BUGS \ + COPYING \ + ChangeLog \ + INSTALL \ + NEWS \ + README \ + THANKS \ + TODO \ + "${DOCDIR}" +} + +em.add_to_family "compiler" +em.set_build_dependencies "${COMPILER}" +em.make_all diff --git a/scripts/hdf5.build b/scripts/hdf5.build new file mode 100755 index 0000000..a15cab3 --- /dev/null +++ b/scripts/hdf5.build @@ -0,0 +1,29 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --enable-shared \ + --enable-parallel \ + --enable-cxx \ + --enable-unsupported \ + --with-pic \ + || exit 1 +} + +function em.install_doc() { + install -m 0444 \ + ACKNOWLEDGMENTS \ + COPYING \ + MANIFEST \ + README.txt \ + "${DOCDIR}" +} + +em.add_to_family "mpi" +em.set_runtime_dependencies "${COMPILER}" "${MPI}" +em.set_build_dependencies "${COMPILER}" "${MPI}" +em.make_all + diff --git a/scripts/hdf5_serial.build b/scripts/hdf5_serial.build new file mode 100755 index 0000000..a857dec --- /dev/null +++ b/scripts/hdf5_serial.build @@ -0,0 +1,18 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --enable-shared \ + --enable-cxx \ + --enable-unsupported \ + --with-pic \ + || exit 1 +} + +em.set_family "compiler" +em.set_build_dependencies "${COMPILER}" +em.make_all + diff --git a/scripts/ippl.build b/scripts/ippl.build new file mode 100755 index 0000000..be8798b --- /dev/null +++ b/scripts/ippl.build @@ -0,0 +1,26 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + rm -f CMakeCache.txt + cmake \ + -DCMAKE_BUILD_TYPE=RELEASE \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ + "${EM_SRCDIR}" \ + || exit 1 +} + +function em.install_doc() { + install -m 0444 \ + LICENSE \ + README \ + "${DOCDIR}" +} + +em.add_to_family "mpi" +em.set_runtime_dependencies "${MPI}" +em.set_build_dependencies "cmake" "${COMPILER}" "${MPI}" +em.make_all + + diff --git a/scripts/libtool.build b/scripts/libtool.build new file mode 100755 index 0000000..4dd289f --- /dev/null +++ b/scripts/libtool.build @@ -0,0 +1,26 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + || exit 1 +} + +function em.install_doc() { + install -m 0444 \ + AUTHORS \ + COPYING \ + NEWS \ + README \ + THANKS \ + "${DOCDIR}" +} + +# use system gcc to compile +declare -rx CC=gcc + +em.set_build_dependencies "autoconf" "automake" +em.make_all + diff --git a/scripts/m4.build b/scripts/m4.build new file mode 100755 index 0000000..634070b --- /dev/null +++ b/scripts/m4.build @@ -0,0 +1,14 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + || exit 1 +} + +# use system gcc to compile +declare -rx CC=gcc + +em.make_all diff --git a/scripts/mathlib.build b/scripts/mathlib.build new file mode 100755 index 0000000..5ad2f8d --- /dev/null +++ b/scripts/mathlib.build @@ -0,0 +1,54 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + : +} + +function em.build() { + cd "${EM_SRCDIR}" + + + install -m 0755 -d "${PREFIX}/include" + install -m 0755 -d "${PREFIX}/lib" + install -m 0755 -d "${DOCDIR}/lapack" + + ( + cp make.inc.blas BLAS/make.inc + cd BLAS + make -e -j3 || exit 1 + install -m 0644 libblas.a "${PREFIX}/lib" || exit 1 + ) || exit 1 + + ( + cp make.inc.cblas CBLAS/Makefile.in + cd CBLAS + make -e || exit 1 + install -m 0644 include/* "${PREFIX}/include" || exit 1 + install -m 0644 lib/* "${PREFIX}/lib" || exit 1 + ) || exit 1 + ( + cp make.inc.lapack lapack/make.inc + cd lapack + make -e -j3 || exit 1 + make -e -j3 lapackelib || exit 1 + install -m 0644 lapacke/include/* "${PREFIX}/include" || exit 1 + install -m 0644 lib*.a "${PREFIX}/lib" || exit 1 + install -m 0444 README LICENSE "${DOCDIR}/lapack" + ) || exit 1 +} + +function em.install() { + : +} + +function em.install_doc() { + : +} + +em.add_to_family "compiler" +em.set_runtime_dependencies "${COMPILER}" +em.set_build_dependencies "${COMPILER}" +em.make_all + diff --git a/scripts/mpc.build b/scripts/mpc.build new file mode 100755 index 0000000..7f164ac --- /dev/null +++ b/scripts/mpc.build @@ -0,0 +1,19 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --with-gmp=$GMP_PREFIX \ + --with-mpfr=$MPFR_PREFIX \ + --disable-shared \ + || exit 1 +} + +# use system gcc to compile +declare -rx CC=gcc + +em.set_build_dependencies "gmp" "mpfr" +em.make_all + diff --git a/scripts/mpfr.build b/scripts/mpfr.build new file mode 100755 index 0000000..b58606f --- /dev/null +++ b/scripts/mpfr.build @@ -0,0 +1,17 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --with-gmp=$GMP_PREFIX \ + --disable-shared \ + || exit 1 +} + +# use system gcc to compile +declare -rx CC=gcc + +em.set_build_dependencies "gmp" +em.make_all diff --git a/scripts/openmpi.build b/scripts/openmpi.build new file mode 100755 index 0000000..43729d0 --- /dev/null +++ b/scripts/openmpi.build @@ -0,0 +1,29 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --prefix="${PREFIX}" \ + --enable-mpi-cxx \ + --enable-mpi-cxx-seek \ + --enable-mpi-f90 \ + --enable-mpi-profile \ + --enable-shared \ + --enable-smp-locks \ + || exit 1 +} + +function em.install_doc() { + install -m 0444 \ + AUTHORS \ + LICENSE \ + NEWS \ + README \ + "${DOCDIR}" +} + +em.add_to_family "compiler" +em.set_runtime_dependencies "${COMPILER}" +em.set_build_dependencies "${COMPILER}" +em.make_all diff --git a/scripts/parmetis.build b/scripts/parmetis.build new file mode 100755 index 0000000..68d6454 --- /dev/null +++ b/scripts/parmetis.build @@ -0,0 +1,56 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +function em.configure() { + : # nothing to configure +} + +function em.build() { + local -ri MAJOR_VERSION=${V%%.*} + if (( MAJOR_VERSION == 3 )) ; then + cd "${EM_SRCDIR}" + make -e -j3 || exit 1 + + mkdir -p $PREFIX/include/metis + mkdir -p $PREFIX/lib + + cp *.h $PREFIX/include + cp METISLib/*.h $PREFIX/include/metis + cp lib*.a $PREFIX/lib + elif (( MAJOR_VERSION == 4 )); then + cd "${EM_SRCDIR}" + make config prefix=$PREFIX || exit 1 + make -j3 || exit 1 + make install + + LIBMETIS_A=$(find . -name libmetis.a) + METIS_H=$(find . -name metis.h) + + install -m 0644 $METIS_H $PREFIX/include + install -m 0644 $LIBMETIS_A $PREFIX/lib + else + die 42 "Unsupported version: $V" + fi +} + +function em.install() { + : +} + +function em.install_doc() { + install -m 0444 \ + CHANGES \ + INSTALL \ + LICENSE.txt \ + README \ + VERSION \ + "${DOCDIR}" +} + +em.add_to_family "mpi" +em.set_runtime_dependencies "${MPI}" +em.set_build_dependencies "${COMPILER}" "${MPI}" +em.make_all + + diff --git a/scripts/root.build b/scripts/root.build new file mode 100755 index 0000000..e75086e --- /dev/null +++ b/scripts/root.build @@ -0,0 +1,67 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +case ${OS} in +Darwin ) + # cocoa doesn't work with GCC!? + #config_args='--enable-cocoa --disable-x11' + config_args='--with-finkdir=/opt/X11 --disable-cocoa' + ;; +*) + ;; +esac + +function em.configure() { + "${EM_SRCDIR}"/configure \ + --disable-python \ + --disable-mysql \ + --disable-ldap \ + --enable-fftw3 \ + --with-cc=${CC} \ + --with-cxx=${CXX} \ + --with-f77=${F77} \ + --with-ld=${CXX} \ + ${config_args} \ + || exit 1 +} + +function em.install() { + make clean + + rm -f Makefile + rm -rf config.* + rm -rf core + rm -rf io + rm -rf math + rm -rf net + rm -rf hist + rm -rf tree + rm -rf graf2d + rm -rf graf3d + rm -rf gui + rm -rf html + rm -rf montecarlo + rm -rf geom + rm -rf proof + rm -rf sql + rm -rf misc + rm -rf test + rm -rf tmva + rm -rf tutorials + rm -rf rootx + + mkdir -p share + mv man share + + mkdir -p "${PREFIX}" + cp -rv * "${PREFIX}" + mkdir -p "${DOCDIR}" + mv "${PREFIX}/LICENSE" "${DOCDIR}" + mv "${PREFIX}/README" "${DOCDIR}" +} + +em.add_to_family "compiler" +em.set_runtime_dependencies "${COMPILER}" +em.set_build_dependencies "${COMPILER}" +em.make_all diff --git a/scripts/toolchain.build b/scripts/toolchain.build new file mode 100755 index 0000000..79d1c10 --- /dev/null +++ b/scripts/toolchain.build @@ -0,0 +1,12 @@ +#!/bin/bash +declare -r SCRIPTS_DIR=$(dirname $0) + +bash "${SCRIPTS_DIR}/m4.build" "$@" || exit 1 +bash "${SCRIPTS_DIR}/autoconf.build" "$@" || exit 1 +bash "${SCRIPTS_DIR}/automake.build" "$@" || exit 2 +bash "${SCRIPTS_DIR}/libtool.build" "$@" || exit 3 +bash "${SCRIPTS_DIR}/gmp.build" "$@" || exit 4 +bash "${SCRIPTS_DIR}/mpfr.build" "$@" || exit 5 +bash "${SCRIPTS_DIR}/mpc.build" "$@" || exit 6 +bash "${SCRIPTS_DIR}/gcc.build" "$@" || exit 7 + diff --git a/scripts/trilinos.build b/scripts/trilinos.build new file mode 100755 index 0000000..de508a5 --- /dev/null +++ b/scripts/trilinos.build @@ -0,0 +1,78 @@ +#!/bin/bash + +source "$(dirname $0)/../lib/libem.bash" + +declare -rx AR=ar + +function em.configure() { + BLAS_PREFIX=$MATHLIB_PREFIX + LAPACK_PREFIX=$MATHLIB_PREFIX + + PARMETIS_INCLUDE_DIRS=$PARMETIS_PREFIX/include + PARMETIS_LIBRARIES=$PARMETIS_PREFIX/lib/libparmetis.a + + METIS_INCLUDE_DIRS=$PARMETIS_PREFIX/include/metis + METIS_LIBRARIES=$PARMETIS_PREFIX/lib/libmetis.a + + BLAS_INCLUDE_DIRS="$BLAS_PREFIX/include" + BLAS_LIBRARY_DIRS="$BLAS_PREFIX/lib" + BLAS_LIBRARY_NAMES="blas" + + LAPACK_INCLUDE_DIRS="$LAPACK_PREFIX/include" + LAPACK_LIBRARY_DIRS="$LAPACK_PREFIX/lib" + LAPACK_LIBRARY_NAMES="lapacke;lapack" + + cmake \ + --prefix=$PREFIX \ + -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX \ + -DCMAKE_CXX_FLAGS:STRING="-DMPICH_IGNORE_CXX_SEEK -fPIC" \ + -DCMAKE_C_FLAGS:STRING="-DMPICH_IGNORE_CXX_SEEK -fPIC" \ + -DCMAKE_Fortran_FLAGS:STRING="-fPIC" \ + -D CMAKE_BUILD_TYPE:STRING=DEBUG \ + -D TPL_ENABLE_QT:BOOL=OFF \ + -D TPL_ENABLE_MPI:BOOL=ON \ + -D TPL_ENABLE_BLAS:BOOL=ON \ + -D TPL_ENABLE_LAPACK:BOOL=ON \ + -D TPL_ENABLE_METIS:BOOL=ON \ + -D TPL_ENABLE_ParMETIS:BOOL=ON \ + -D BLAS_LIBRARY_DIRS:PATH="$BLAS_LIBRARY_DIRS" \ + -D BLAS_INCLUDE_DIRS:PATH="$BLAS_LIBRARY_DIRS" \ + -D BLAS_LIBRARY_NAMES:STRING="$BLAS_LIBRARY_NAMES" \ + -D LAPACK_LIBRARY_DIRS:PATH="$LAPACK_LIBRARY_DIRS" \ + -D LAPACK_INCLUDE_DIRS:PATH="$LAPACK_INCLUDE_DIRS" \ + -D LAPACK_LIBRARY_NAMES:STRING="$LAPACK_LIBRARY_NAMES" \ + -D TPL_METIS_INCLUDE_DIRS:PATH=$METIS_INCLUDE_DIRS \ + -D TPL_METIS_LIBRARIES:PATH=$METIS_LIBRARIES \ + -D TPL_ParMETIS_INCLUDE_DIRS:PATH=$PARMETIS_INCLUDE_DIRS \ + -D TPL_ParMETIS_LIBRARIES:PATH=$PARMETIS_LIBRARIES \ + -D Trilinos_ENABLE_Amesos:BOOL=ON \ + -D Trilinos_ENABLE_AztecOO:BOOL=ON \ + -D Trilinos_ENABLE_Belos:BOOL=ON \ + -D Trilinos_ENABLE_Epetra:BOOL=ON \ + -D Trilinos_ENABLE_EpetraExt:BOOL=ON \ + -D Trilinos_ENABLE_Galeri:BOOL=ON \ + -D Trilinos_ENABLE_Ifpack:BOOL=ON \ + -D Trilinos_ENABLE_Isorropia:BOOL=ON \ + -D Trilinos_ENABLE_ML:BOOL=ON \ + -D Trilinos_ENABLE_NOX:BOOL=ON \ + -D Trilinos_ENABLE_Optika:BOOL=OFF \ + -D Trilinos_ENABLE_Teuchos:BOOL=ON \ + -D Trilinos_ENABLE_Tpetra:BOOL=ON \ + -D Trilinos_ENABLE_TESTS:BOOL=OFF \ + "${EM_SRCDIR}" || exit 1 +} + +function em.install_doc() { + install -m 0444 \ + Copyright.txt \ + LICENSE \ + README \ + RELEASE_NOTES \ + "${DOCDIR}" +} + +em.add_to_family "mpi" +em.set_runtime_dependencies "${MPI}" +em.set_build_dependencies "cmake" "${COMPILER}" "${MPI}" "hdf5" "mathlib" "parmetis" +em.make_all + diff --git a/scripts/vtk.build b/scripts/vtk.build new file mode 100755 index 0000000..88f3fca --- /dev/null +++ b/scripts/vtk.build @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Notes: +# On Mac OS X VTK does not compile out of the box with self-compiled GCC. +# grep vor "long-branch" and "pascal-string" in the cmake configuration +# and remove these strings. +# + +source "$(dirname $0)/../lib/libem.bash" + +case ${OS} in +Darwin ) + em.pre_configure() { + # for the time being: on Mac OS X we need GL/gl.h from MacPorts: + append_path C_INLCUDE_PATH '/opt/local/include' + append_path CPLUS_INCLUDE_PATH '/opt/local/include' + } + ;; +esac + +function em.configure() { + cmake -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX \ + -DVTK_INSTALL_INCLUDE_DIR:PATH=include \ + -DVTK_INSTALL_LIB_DIR:PATH=lib \ + -DVTK_USE_COCOA:BOOL=OFF \ + "${EM_SRCDIR}" +} + +em.add_to_family "compiler" +em.set_runtime_dependencies "${COMPILER}" +em.set_build_dependencies "cmake" "${COMPILER}" +em.make_all +