From 212455110afc0f3110579c1905d137af076b7733 Mon Sep 17 00:00:00 2001 From: MintoDA1 <51412913+MintoDA1@users.noreply.github.com> Date: Fri, 11 Aug 2023 16:52:55 -0400 Subject: [PATCH] Fixed issues with build scripts and the build directory --- buildscripts/build_all.sh | 20 +++++++++++++++----- buildscripts/fetch_dependencies.sh | 6 ++++-- buildscripts/make_build_environment.sh | 8 +++++++- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/buildscripts/build_all.sh b/buildscripts/build_all.sh index 02dfb8cdf..23c1bdfbd 100755 --- a/buildscripts/build_all.sh +++ b/buildscripts/build_all.sh @@ -25,7 +25,8 @@ # Determine the platform and architecture SCRIPT_DIR=$(realpath $(dirname $0)) ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) -BUILD_DIR=$(realpath ${ROOT_DIR}/build) +BUILD_DIR="${ROOT_DIR}/build" +mkdir -p ${BUILD_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 @@ -54,9 +55,15 @@ case $OS in exit 0 else echo "Docker not detected" + if [ "$ARCH" = "x86_64" ]; then + COMPILER="Intel" + else + COMPILER="GNU" + fi fi ;; MacOSX) + COMPILER="GNU" ;; *) echo "Swiftest is currently not configured to build for platform ${OS}-${ARCH}" @@ -64,9 +71,12 @@ case $OS in ;; esac -${SCRIPT_DIR}/fetch_dependencies.sh -${SCRIPT_DIR}/make_build_environment.sh -${SCRIPT_DIR}/build_dependencies.sh -${SCRIPT_DIR}/build_swiftest.sh +/bin/bash -lic "${SCRIPT_DIR}/fetch_dependencies.sh" +if [ "$COMPILER"="GNU" ]; then + /bin/bash -lic "${SCRIPT_DIR}/make_build_environment.sh" + conda activate swiftest-build-env +fi +/bin/bash -lic "${SCRIPT_DIR}/build_dependencies.sh $COMPILER" +/bin/bash -lic "${SCRIPT_DIR}/build_swiftest.sh $COMPILER" diff --git a/buildscripts/fetch_dependencies.sh b/buildscripts/fetch_dependencies.sh index 2330d3683..24337c095 100755 --- a/buildscripts/fetch_dependencies.sh +++ b/buildscripts/fetch_dependencies.sh @@ -11,8 +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)) -BUILD_DIR=$(realpath ${SCRIPT_DIR}/../build) - +ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) +BUILD_DIR="${ROOT_DIR}/build" mkdir -p ${BUILD_DIR} cd $BUILD_DIR @@ -20,3 +20,5 @@ wget -qO- https://www.zlib.net/zlib-1.2.13.tar.gz | tar xvz wget -qO- https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.1/src/hdf5-1.14.1-2.tar.gz | tar xvz wget -qO- https://github.com/Unidata/netcdf-c/archive/refs/tags/v4.9.2.tar.gz | tar xvz wget -qO- https://github.com/Unidata/netcdf-fortran/archive/refs/tags/v4.6.1.tar.gz | tar xvz + +echo "Files downloaded to ${BUILD_DIR}" \ No newline at end of file diff --git a/buildscripts/make_build_environment.sh b/buildscripts/make_build_environment.sh index fb42fc110..b32c6b705 100755 --- a/buildscripts/make_build_environment.sh +++ b/buildscripts/make_build_environment.sh @@ -36,7 +36,13 @@ else $INSTALL_DIR/condabin/$CONDABIN init $MYSHELL fi $INSTALL_DIR/condabin/$CONDABIN init bash - source ~/.bashrc + 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