Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixes to build scripts so that they can work with Docker or just cond…
Browse files Browse the repository at this point in the history
…a/mamba
  • Loading branch information
daminton committed Aug 11, 2023
1 parent e438bdd commit 4602c19
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ COPY . ./
RUN ${SCRIPT_DIR}/fetch_dependencies.sh
RUN if [ "$BUILDIMAGE" = "intel/oneapi-hpckit:2023.1.0-devel-ubuntu20.04" ]; then \
${SCRIPT_DIR}/build_dependencies.sh Intel; \
else \
conda init bash && \
conda update --name base conda -y && \
${SCRIPT_DIR}/make_environment.sh && \
else \
${SCRIPT_DIR}/make_build_environment.sh && \
echo "conda activate swiftest-build-env" >> ~/.bashrc && \
source ~/.bashrc && \
${SCRIPT_DIR}/build_dependencies.sh GNU; \
/bin/bash -lic "${SCRIPT_DIR}/build_dependencies.sh GNU"; \
fi

# ENV INSTALL_DIR="/usr/local"
Expand Down
14 changes: 6 additions & 8 deletions buildscripts/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,18 @@


# Determine the platform and architecture
SCRIPT_DIR=$(dirname "$0")
SCRIPT_DIR=$(realpath $(dirname $0))
ROOT_DIR=$(realpath ${SCRIPT_DIR}/..)
BUILD_DIR=$(realpath ${ROOT_DIR}/build)
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 "./setup.py" ]; then
if [ -f "../setup.py" ]; then
cd ..
else
echo "Error: setup.py not found in . or .."
if [ ! -f "${ROOT_DIR}/setup.py" ]; then
echo "Error: setup.py not found"
exit 1
fi
fi

cd ${ROOT_DIR}
VERSION=$( cat version.txt )
echo "Building Swiftest version ${VERSION} for ${OS}-${ARCH}"

Expand Down
4 changes: 2 additions & 2 deletions buildscripts/build_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# 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=$(dirname "$0")
BUILD_DIR=${SCRIPT_DIR}/../build
SCRIPT_DIR=$(realpath $(dirname $0))
BUILD_DIR=$(realpath ${SCRIPT_DIR}/../build)
mkdir -p ${BUILD_DIR}
cd $BUILD_DIR

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -l
# This script will create a miniforge3 conda environment in order to execute the build
# Zlib, hdf5, netcdf-c, netcdf-fortran
#
Expand Down Expand Up @@ -31,9 +31,14 @@ else
${SHELL} Mambaforge-23.1.0-4-${OS}-${ARCH}.sh -b -p ${INSTALL_DIR}
rm Mambaforge-23.1.0-4-${OS}-${ARCH}.sh

CONDABIN="${INSTALL_DIR}/condabin/mamba"
${CONDABIN} init $MYSHELL
${CONDABIN} update --name base mamba -y
CONDABIN="mamba"
if [ $MYSHELL != "bash" ]; then
$INSTALL_DIR/condabin/$CONDABIN init $MYSHELL
fi
$INSTALL_DIR/condabin/$CONDABIN init bash
source ~/.bashrc
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

0 comments on commit 4602c19

Please sign in to comment.