diff --git a/buildscripts/.gitignore b/buildscripts/.gitignore index 120c12345..e2ee4346f 100644 --- a/buildscripts/.gitignore +++ b/buildscripts/.gitignore @@ -1,2 +1 @@ -!*.sh -!*.yml \ No newline at end of file +!*.sh \ No newline at end of file diff --git a/buildscripts/_build_getopts.sh b/buildscripts/_build_getopts.sh new file mode 100755 index 000000000..acd3863e8 --- /dev/null +++ b/buildscripts/_build_getopts.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# This script will gets the arguments common to all the dependency build scripts +# +# Copyright 2023 - David Minton +# This file is part of Swiftest. +# Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +# Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# You should have received a copy of the GNU General Public License along with Swiftest. +# If not, see: https://www.gnu.org/licenses. +set -a +SCRIPT_DIR=$(realpath $(dirname $0)) +ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) + +# Parse arguments +USTMT="Usage: ${0} <-d /path/to/dependency/source> [-p /prefix/path|{/usr/local}] [-m MACOSX_DEPLOYMENT_TARGET|{13}]" +PREFIX=/usr/local +DEPENDENCY_DIR="${ROOT_DIR}/_dependencies" +MACOSX_DEPLOYMENT_TARGET=13 +while getopts ":d:p:m:h" ARG; do + case "${ARG}" in + d) + DEPENDENCY_DIR=$(realpath ${OPTARG}) + ;; + p) + PREFIX="${OPTARG}" + ;; + m) + MACOSX_DEPLOYMENT_TARGET="${OPTARG}" + ;; + :) + printf "Error: -${OPTARG} requires an argument.\n" + printf "$USTMT\n" + exit 1 + ;; + h) + printf "$USTMT\n" + exit 1 + ;; + *) + ;; + esac +done +read -r OS ARCH < <($SCRIPT_DIR/get_platform.sh) +case $OS in + MacOSX) + COMPILER="GNU-Mac" + ;; + Linux) + COMPILER="GNU-Linux" + ;; + *) + printf "This script is not tested for ${OS}-${ARCH}\n" + ;; +esac + +if [ -z ${DEPENDENCY_ENV_VARS+x} ]; then + CMD="${SCRIPT_DIR}/set_compilers.sh -c $COMPILER" + read -r CC CXX FC F77 CPP < <($CMD) + unset CMD + + LD_LIBRARY_PATH="${PREFIX}/lib" + CPPFLAGS="-isystem ${PREFIX}/include" + LDFLAGS="-L${PREFIX}/lib -fPIE" + CPATH="${PREFIX}/include}" + CFLAGS="-Wno-unused-but-set-variable -fPIC" + LIBS="-lgomp" + + if [ $COMPILER = "GNU-Mac" ]; then + LDFLAGS="${LDFLAGS} -Wl,-no_compact_unwind" + CFLAGS="${CFLAGS} -Wno-deprecated-non-prototype" + fi + + HDF5_ROOT="${PREFIX}" + HDF5_LIBDIR="${HDF5_ROOT}/lib" + HDF5_INCLUDE_DIR="${HDF5_ROOT}/include" + HDF5_PLUGIN_PATH="${HDF5_LIBDIR}/plugin" + NCDIR="${PREFIX}" + NFDIR="${PREFIX}" + NETCDF_FORTRAN_HOME=${NFDIR} + NETCDF_HOME=${NCDIR} + + DEPENDENCY_ENV_VARS=true +fi + +mkdir -p ${DEPENDENCY_DIR} \ No newline at end of file diff --git a/buildscripts/build_all.sh b/buildscripts/build_all.sh index c61faae73..6efa24914 100755 --- a/buildscripts/build_all.sh +++ b/buildscripts/build_all.sh @@ -11,59 +11,12 @@ # You should have received a copy of the GNU General Public License along with Swiftest. # If not, see: https://www.gnu.org/licenses. - # Determine the platform and architecture +set -a SCRIPT_DIR=$(realpath $(dirname $0)) -ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) -DEPENDENCY_DIR="${ROOT_DIR}/_dependencies" -PREFIX=/usr/local - -# Parse arguments -USTMT="Usage: ${0} [-d /path/to/dependancy/build] [-p {/usr/local}|/prefix/path]" -COMPILER="" -while getopts ":d:p:" ARG; do - case "${ARG}" in - d) - DEPENDENCY_DIR="${OPTARG}" - ;; - p) - PREFIX="${OPTARG}" - ;; - :) - echo "Error: -${OPTARG} requires an argument." - echo $USTMT - exit 1 - ;; - *) - ;; - esac -done - -read -r OS ARCH < <($SCRIPT_DIR/get_platform.sh) - -# Determine if we are in the correct directory (the script can either be run from the Swiftest project root directory or the -# buildscripts directory) -if [ ! -f "${ROOT_DIR}/setup.py" ]; then - echo "Error: setup.py not found" - exit 1 -fi -cd ${ROOT_DIR} -VERSION=$( cat version.txt ) - -case $OS in - MacOSX) - COMPILER="GNU-Mac" - ;; - Linux) - COMPILER="GNU-Linux" - ;; - *) - echo "This script is not tested for ${OS}-${ARCH}" - ;; -esac - -${SCRIPT_DIR}/build_dependencies.sh -p ${PREFIX} -d ${DEPENDENCY_DIR} -${SCRIPT_DIR}/build_swiftest.sh -c $COMPILER -p ${PREFIX} - - +. ${SCRIPT_DIR}/_build_getopts.sh +ARGS=$@ +set -e +${SCRIPT_DIR}/build_dependencies.sh ${ARGS} +${SCRIPT_DIR}/build_swiftest.sh ${ARGS} \ No newline at end of file diff --git a/buildscripts/build_dependencies.sh b/buildscripts/build_dependencies.sh index 921e5ea84..41530c213 100755 --- a/buildscripts/build_dependencies.sh +++ b/buildscripts/build_dependencies.sh @@ -13,55 +13,9 @@ # Determine the platform and architecture SCRIPT_DIR=$(realpath $(dirname $0)) -ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) -DEPENDENCY_DIR="${ROOT_DIR}/_dependencies" -PREFIX=/usr/local - -# Parse arguments -USTMT="Usage: ${0} [-d /path/to/dependancy/build] [-p {/usr/local}|/prefix/path]" -COMPILER="" -while getopts ":d:p:" ARG; do - case "${ARG}" in - d) - DEPENDENCY_DIR="${OPTARG}" - ;; - p) - PREFIX="${OPTARG}" - ;; - :) - echo "Error: -${OPTARG} requires an argument." - echo $USTMT - exit 1 - ;; - *) - ;; - esac -done - -mkdir -p ${DEPENDENCY_DIR} -read -r OS ARCH < <($SCRIPT_DIR/get_platform.sh) - -# Determine if we are in the correct directory (the script can either be run from the Swiftest project root directory or the -# buildscripts directory) -if [ ! -f "${ROOT_DIR}/setup.py" ]; then - echo "Error: setup.py not found" - exit 1 -fi -cd ${ROOT_DIR} -VERSION=$( cat version.txt ) -echo "Building Swiftest version ${VERSION} for ${OS}-${ARCH}" - -case $OS in - MacOSX) - COMPILER="GNU-Mac" - ;; - Linux) - COMPILER="GNU-Linux" - ;; - *) - echo "This script is not tested for ${OS}-${ARCH}" - ;; -esac +set -a +. ${SCRIPT_DIR}/_build_getopts.sh +ARGS=$@ printf "*********************************************************\n" printf "* FETCHING DEPENCENCY SOURCES *\n" @@ -77,22 +31,15 @@ wget -qO- https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.1.tar printf "*********************************************************\n" printf "* STARTING DEPENDENCY BUILD *\n" printf "*********************************************************\n" -CMD="${SCRIPT_DIR}/set_compilers.sh -c $COMPILER" -read -r CC CXX FC F77 CPP < <($CMD) -export CC=${CC} -export CXX=${CXX} -export FC=${FC} -export F77=${F77} -export CPP=${CPP} - printf "Using ${COMPILER} compilers:\nFC: ${FC}\nCC: ${CC}\nCXX: ${CXX}\n" printf "Installing to ${PREFIX}\n" printf "\n" -${SCRIPT_DIR}/build_zlib.sh -c $COMPILER -p $PREFIX -d $DEPENDENCY_DIR -${SCRIPT_DIR}/build_hdf5.sh -c $COMPILER -p $PREFIX -d $DEPENDENCY_DIR -${SCRIPT_DIR}/build_netcdf-c.sh -c $COMPILER -p $PREFIX -d $DEPENDENCY_DIR -${SCRIPT_DIR}/build_netcdf-fortran.sh -c $COMPILER -p $PREFIX -d $DEPENDENCY_DIR +set -e +${SCRIPT_DIR}/build_zlib.sh ${ARGS} +${SCRIPT_DIR}/build_hdf5.sh ${ARGS} +${SCRIPT_DIR}/build_netcdf-c.sh ${ARGS} +${SCRIPT_DIR}/build_netcdf-fortran.sh ${ARGS} printf "\n" printf "*********************************************************\n" diff --git a/buildscripts/build_hdf5.sh b/buildscripts/build_hdf5.sh index 0284d115f..5963deb77 100755 --- a/buildscripts/build_hdf5.sh +++ b/buildscripts/build_hdf5.sh @@ -11,59 +11,8 @@ # You should have received a copy of the GNU General Public License along with Swiftest. # If not, see: https://www.gnu.org/licenses. SCRIPT_DIR=$(realpath $(dirname $0)) - -# Parse arguments -USTMT="Usage: ${0} <-c Intel|GNU-Linux|GNU-Mac> <-d /path/to/dependency/source> [-p {/usr/local}|/prefix/path] " -PREFIX=/usr/local -COMPILER="" -DEPENCENCY_DIR="" -CARG="" -while getopts ":c:p:d:" ARG; do - case "${ARG}" in - c) - COMPILER="${OPTARG}" - ;; - p) - PREFIX="${OPTARG}" - ;; - d) - DEPENDENCY_DIR="${OPTARG}" - ;; - :) - echo "Error: -${OPTARG} requires an argument." - echo $USTMT - exit 1 - ;; - *) - ;; - esac -done - -CMD="${SCRIPT_DIR}/set_compilers.sh -c $COMPILER" -read -r CC CXX FC F77 CPP < <($CMD) -export CC=${CC} -export CXX=${CXX} -export FC=${FC} -export F77=${F77} -export CPP=${CPP} - -export HDF5_ROOT="${PREFIX}" -export HDF5_LIBDIR="${HDF5_ROOT}/lib" -export HDF5_INCLUDE_DIR="${HDF5_ROOT}/include" -export HDF5_PLUGIN_PATH="${HDF5_LIBDIR}/plugin" -export NCDIR="${PREFIX}" -export NFDIR="${PREFIX}" -export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH}" -export CPPFLAGS="${CPPFLAGS} -isystem ${PREFIX}/include" -export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib" -export CPATH="${PREFIX}/include:${CPATH}" -export CFLAGS="${CFLAGS} -Wno-unused-but-set-variable" - -if [ $COMPILER = "GNU-Mac" ]; then - export MACOSX_DEPLOYMENT_TARGET=13 - export LDFLAGS="${LDFLAGS} -Wl,-no_compact_unwind" - export CFLAGS="${CFLAGS} -Wno-deprecated-non-prototype" -fi +set -a +. ${SCRIPT_DIR}/_build_getopts.sh printf "\n" printf "*********************************************************\n" diff --git a/buildscripts/build_netcdf-c.sh b/buildscripts/build_netcdf-c.sh index e8017f123..aa5452270 100755 --- a/buildscripts/build_netcdf-c.sh +++ b/buildscripts/build_netcdf-c.sh @@ -12,58 +12,8 @@ # If not, see: https://www.gnu.org/licenses. SCRIPT_DIR=$(realpath $(dirname $0)) -# Parse arguments -USTMT="Usage: ${0} <-c Intel|GNU-Linux|GNU-Mac> <-d /path/to/dependency/source> [-p {/usr/local}|/prefix/path] " -PREFIX=/usr/local -COMPILER="" -DEPENCENCY_DIR="" -CARG="" -while getopts ":c:p:d:" ARG; do - case "${ARG}" in - c) - COMPILER="${OPTARG}" - ;; - p) - PREFIX="${OPTARG}" - ;; - d) - DEPENDENCY_DIR="${OPTARG}" - ;; - :) - echo "Error: -${OPTARG} requires an argument." - echo $USTMT - exit 1 - ;; - *) - ;; - esac -done - -CMD="${SCRIPT_DIR}/set_compilers.sh -c $COMPILER" -read -r CC CXX FC F77 CPP < <($CMD) -export CC=${CC} -export CXX=${CXX} -export FC=${FC} -export F77=${F77} -export CPP=${CPP} - -export HDF5_ROOT=${HDF5_ROOT:-$PREFIX} -export HDF5_LIBDIR="${HDF5_ROOT}/lib" -export HDF5_INCLUDE_DIR="${HDF5_ROOT}/include" -export HDF5_PLUGIN_PATH="${HDF5_LIBDIR}/plugin" -export NCDIR="${PREFIX}" -export NFDIR="${PREFIX}" -export LD_LIBRARY_PATH="${PREFIX}/lib:${HDF5_LIBDIR}:${LD_LIBRARY_PATH}" -export CPPFLAGS="${CPPFLAGS} -isystem ${PREFIX}/include -isystem ${HDF5_INCLUDE_DIR}" -export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib -L${HDF5_LIBDIR}" -export CPATH="${PREFIX}/include:${CPATH}" -export CFLAGS="${CFLAGS} -Wno-unused-but-set-variable" - -if [ $COMPILER = "GNU-Mac" ]; then - export MACOSX_DEPLOYMENT_TARGET=13 - export LDFLAGS="${LDFLAGS} -Wl,-no_compact_unwind" - export CFLAGS="${CFLAGS} -Wno-deprecated-non-prototype" -fi +set -a +. ${SCRIPT_DIR}/_build_getopts.sh printf "\n" printf "*********************************************************\n" diff --git a/buildscripts/build_netcdf-fortran.sh b/buildscripts/build_netcdf-fortran.sh index ba1c04d82..6f31cf6bf 100755 --- a/buildscripts/build_netcdf-fortran.sh +++ b/buildscripts/build_netcdf-fortran.sh @@ -11,62 +11,10 @@ # You should have received a copy of the GNU General Public License along with Swiftest. # If not, see: https://www.gnu.org/licenses. SCRIPT_DIR=$(realpath $(dirname $0)) +set -a +. ${SCRIPT_DIR}/_build_getopts.sh -# Parse arguments -USTMT="Usage: ${0} <-c Intel|GNU-Linux|GNU-Mac> <-d /path/to/dependency/source> [-p {/usr/local}|/prefix/path] " -PREFIX=/usr/local -COMPILER="" -DEPENCENCY_DIR="" -CARG="" -while getopts ":c:p:d:" ARG; do - case "${ARG}" in - c) - COMPILER="${OPTARG}" - ;; - p) - PREFIX="${OPTARG}" - ;; - d) - DEPENDENCY_DIR="${OPTARG}" - ;; - :) - echo "Error: -${OPTARG} requires an argument." - echo $USTMT - exit 1 - ;; - *) - ;; - esac -done - -CMD="${SCRIPT_DIR}/set_compilers.sh -c $COMPILER" -read -r CC CXX FC F77 CPP < <($CMD) -export CC=${CC} -export CXX=${CXX} -export FC=${FC} -export F77=${F77} -export CPP=${CPP} - - -export HDF5_ROOT="${PREFIX}" -export HDF5_LIBDIR="${HDF5_ROOT}/lib" -export HDF5_INCLUDE_DIR="${HDF5_ROOT}/include" -export HDF5_PLUGIN_PATH="${HDF5_LIBDIR}/plugin" -export NCDIR="${PREFIX}" -export NFDIR="${PREFIX}" -export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH}" -export CPPFLAGS="${CPPFLAGS} -isystem ${PREFIX}/include" -export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib" -export CPATH="${PREFIX}/include:${CPATH}" -export CFLAGS="${CFLAGS} -Wno-unused-but-set-variable" - -if [ $COMPILER = "GNU-Mac" ]; then - export MACOSX_DEPLOYMENT_TARGET=13 - export LDFLAGS="${LDFLAGS} -Wl,-no_compact_unwind" - export CFLAGS="${CFLAGS} -Wno-deprecated-non-prototype" -fi - -export LIBS="$(${PREFIX}/bin/nc-config --libs --static)" +LIBS="$(${PREFIX}/bin/nc-config --libs --static)" printf "\n" printf "*********************************************************\n" diff --git a/buildscripts/build_swiftest.sh b/buildscripts/build_swiftest.sh index fbd17cf8d..011df8d8e 100755 --- a/buildscripts/build_swiftest.sh +++ b/buildscripts/build_swiftest.sh @@ -9,79 +9,39 @@ # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # You should have received a copy of the GNU General Public License along with Swiftest. # If not, see: https://www.gnu.org/licenses. -SCRIPT_DIR=$(realpath $(dirname $0)) -ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) +set -a +if [ -z ${SCRIPT_DIR+x} ]; then SCRIPT_DIR=$(realpath $(dirname $0)); fi +. ${SCRIPT_DIR}/_build_getopts.sh -# Parse arguments -USTMT="Usage: ${0} <-c Intel|GNU-Linux|GNU-Mac> [-p {/usr/local}|/prefix/path]" -IFORT=false -PREFIX=/usr/local -COMPILER="" -CARG="" -while getopts ":c:p:" ARG; do - case "${ARG}" in - c) - COMPILER="${OPTARG}" - ;; - p) - PREFIX="${OPTARG}" - ;; - :) - echo "Error: -${OPTARG} requires an argument." - echo $USTMT - exit 1 - ;; - *) - ;; - esac -done -CMD="${SCRIPT_DIR}/set_compilers.sh -c $COMPILER -f" -read -r CC CXX FC F77 CPP < <($CMD) -export CC=${CC} -export CXX=${CXX} -export FC=${FC} -export F77=${F77} -export CPP=${CPP} +# Determine if we are in the correct directory (the script can either be run from the Swiftest project root directory or the +# buildscripts directory) +if [ ! -f "${ROOT_DIR}/setup.py" ]; then + echo "Error: setup.py not found" + exit 1 +fi printf "Using ${COMPILER} compilers:\nFC: ${FC}\nCC: ${CC}\nCXX: ${CXX}\n\n" printf "Installing to ${PREFIX}\n" printf "Dependency libraries in ${PREFIX}\n" -export DEPDIR=$PREFIX -export NETCDF_FORTRAN_HOME=$DEPDIR -export HDF_ROOT=$PREFIX -export HDF5_LIBDIR="${HDF5_ROOT}/lib" -export HDF5_INCLUDE_DIR="${HDF5_ROOT}/include" -export HDF5_PLUGIN_PATH="${HDF5_LIBDIR}/plugin" - -export LD_LIBRARY_PATH="${DEPDIR}/lib:${LD_LIBRARY_PATH}" -export CPPFLAGS="${CPPFLAGS} -isystem ${DEPDIR}/include" -export LDFLAGS="${LDFLAGS} -L${DEPDIR}/lib" -export CPATH="${DEPDIR}/include:${CPATH}" - -if [ $COMPILER = "GNU-Mac" ]; then - # export MACOSX_DEPLOYMENT_TARGET=13 - export LDFLAGS="${LDFLAGS} -Wl,-no_compact_unwind" - printf "MACOSX_DEPLOYMENT_TARGET: ${MACOSX_DEPLOYMENT_TARGET}\n" -fi -export SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=OFF" +SKBUILD_CONFIGURE_OPTIONS="-DBUILD_SHARED_LIBS=OFF" if [ $COMPILER = "Intel" ]; then - export FCFLAGS="${CFLAGS} -standard-semantics" - export FFLAGS=${CFLAGS} - export SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_CONFIGURE_OPTIONS} -DMACHINE_CODE_VALUE=\"SSE2\"" + FCFLAGS="${CFLAGS} -standard-semantics" + FFLAGS=${CFLAGS} + SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_CONFIGURE_OPTIONS} -DMACHINE_CODE_VALUE=\"SSE2\"" else - export FCFLAGS="${CFLAGS}" - export FFLAGS="${CFLAGS}" - export SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_CONFIGURE_OPTIONS} -DMACHINE_CODE_VALUE=\"generic\"" + FCFLAGS="${CFLAGS}" + FFLAGS="${CFLAGS}" + SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_CONFIGURE_OPTIONS} -DMACHINE_CODE_VALUE=\"generic\"" fi read -r OS ARCH < <($SCRIPT_DIR/get_platform.sh) echo $OS $ARCH if [ $OS = "MacOSX" ] && [ $ARCH = "arm64" ]; then printf "OpenMP not supported on Apple M1 Silicon quite yet\n" - export SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_CONFIGURE_OPTIONS} -DUSE_OPENMP=OFF -DUSE_SIMD=OFF" + SKBUILD_CONFIGURE_OPTIONS="${SKBUILD_CONFIGURE_OPTIONS} -DUSE_OPENMP=OFF -DUSE_SIMD=OFF" fi cd $ROOT_DIR @@ -102,6 +62,5 @@ printf "NETCDF_FORTRAN_HOME: ${NETCDF_FORTRAN_HOME}\n" printf "SKBUILD_CONFIGURE_OPTIONS: ${SKBUILD_CONFIGURE_OPTIONS}\n" printf "*********************************************************\n" -#pipx run cibuildwheel --platform macos python3 -m pip install build pip python3 -m build \ No newline at end of file diff --git a/buildscripts/build_zlib.sh b/buildscripts/build_zlib.sh index 2aa77ce93..f03ef13db 100755 --- a/buildscripts/build_zlib.sh +++ b/buildscripts/build_zlib.sh @@ -11,52 +11,8 @@ # You should have received a copy of the GNU General Public License along with Swiftest. # If not, see: https://www.gnu.org/licenses. SCRIPT_DIR=$(realpath $(dirname $0)) - -# Parse arguments -USTMT="Usage: ${0} <-c Intel|GNU-Linux|GNU-Mac> <-d /path/to/dependency/source> [-p {/usr/local}|/prefix/path] " -PREFIX=/usr/local -COMPILER="" -DEPENCENCY_DIR="" -CARG="" -while getopts ":c:p:d:" ARG; do - case "${ARG}" in - c) - COMPILER="${OPTARG}" - ;; - p) - PREFIX="${OPTARG}" - ;; - d) - DEPENDENCY_DIR="${OPTARG}" - ;; - :) - echo "Error: -${OPTARG} requires an argument." - echo $USTMT - exit 1 - ;; - *) - ;; - esac -done -CMD="${SCRIPT_DIR}/set_compilers.sh -c $COMPILER" -read -r CC CXX FC F77 CPP < <($CMD) -export CC=${CC} -export CXX=${CXX} -export FC=${FC} -export F77=${F77} -export CPP=${CPP} - -export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH}" -export CPPFLAGS="${CPPFLAGS} -isystem ${PREFIX}/include" -export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib" -export CPATH="${PREFIX}/include:${CPATH}" -export CFLAGS="${CFLAGS} -Wno-unused-but-set-variable" - -if [ $COMPILER = "GNU-Mac" ]; then - export MACOSX_DEPLOYMENT_TARGET=13 - export LDFLAGS="${LDFLAGS} -Wl,-no_compact_unwind" - export CFLAGS="${CFLAGS} -Wno-deprecated-non-prototype" -fi +set -a +. ${SCRIPT_DIR}/_build_getopts.sh printf "*********************************************************\n" printf "* BUILDING ZLIB STATIC LIBRARY *\n" @@ -72,7 +28,6 @@ printf "*********************************************************\n" cd ${DEPENDENCY_DIR}/zlib-* ./configure --prefix=${PREFIX} --static make - if [ -w ${PREFIX} ]; then make install else @@ -82,4 +37,4 @@ fi if [ $? -ne 0 ]; then printf "zlib could not be compiled.\n" exit 1 -fi +fi \ No newline at end of file diff --git a/buildscripts/make_build_environment.sh b/buildscripts/make_build_environment.sh deleted file mode 100755 index b32c6b705..000000000 --- a/buildscripts/make_build_environment.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -l -# This script will create a miniforge3 conda environment in order to execute the build -# Zlib, hdf5, netcdf-c, netcdf-fortran -# -# Copyright 2023 - David Minton -# This file is part of Swiftest. -# Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -# Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# You should have received a copy of the GNU General Public License along with Swiftest. -# If not, see: https://www.gnu.org/licenses. - -SCRIPT_DIR=$(realpath $(dirname $0)) - -# Determine if mamba/conda is already installed on the system. If not, install Mambaforge -if command -v mamba; then - CONDABIN="mamba" -elif command -v conda; then - CONDABIN="conda" -else - BUILD_DIR=$(realpath ${SCRIPT_DIR}/../build) - mkdir -p ${BUILD_DIR} - read -r OS ARCH < <(${SCRIPT_DIR}/get_platform.sh) - unset PYTHONPATH - cd $BUILD_DIR - wget https://github.com/conda-forge/miniforge/releases/download/23.1.0-4/Mambaforge-23.1.0-4-${OS}-${ARCH}.sh - - MYSHELL=$(basename $SHELL) - INSTALL_DIR=${HOME}/mambaforge - ${SHELL} Mambaforge-23.1.0-4-${OS}-${ARCH}.sh -b -p ${INSTALL_DIR} - rm Mambaforge-23.1.0-4-${OS}-${ARCH}.sh - - CONDABIN="mamba" - if [ $MYSHELL != "bash" ]; then - $INSTALL_DIR/condabin/$CONDABIN init $MYSHELL - fi - $INSTALL_DIR/condabin/$CONDABIN init bash - if [ -f ~/.bashrc ]; then - source ~/.bashrc - fi - if [ -f ~/.bash_profile ]; then - source ~/.bash_profile - fi - - export PATH=${INSTALL_DIR}/bin:$PATH -fi -cd $SCRIPT_DIR -${CONDABIN} update --name base ${CONDABIN} -y -${CONDABIN} env create --file swiftest-build-env.yml --name swiftest-build-env \ No newline at end of file diff --git a/buildscripts/swiftest-build-env.yml b/buildscripts/swiftest-build-env.yml deleted file mode 100644 index c61059d8e..000000000 --- a/buildscripts/swiftest-build-env.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: swiftest-build-env - -channels: - - conda-forge - - defaults - -dependencies: - - python>=3.8 - - compilers>=1.6 - - setuptools>=42 - - scikit-build>=0.17 - - cmake>=3.5.0 - - cython>=3.0.0 - - json5>=0.9 - - make - - m4 - - ninja \ No newline at end of file