v0.15.0
Loading...
Searching...
No Matches
mofem_installation_v0_15_0.sh
Go to the documentation of this file.
1#!/bin/bash
2
3set -e # Exit on error
4set -u # Treat unset variables as errors
5
6# === CONFIGURATION ===
7export MOFEM_INSTALL_DIR=$HOME/mofem_install
8export SPACK_ROOT=$MOFEM_INSTALL_DIR/spack
9export MOFEM_REPO=$MOFEM_INSTALL_DIR/mofem-cephas
10export MOFEM_SRC_DIR=$MOFEM_REPO
11export MOFEM_BRANCH=Version0.15.0
12export TZ=Europe/London
13export DEBIAN_FRONTEND=noninteractive
14
15# === CREATE DIRECTORIES ===
16mkdir -p "$MOFEM_INSTALL_DIR"
17mkdir -p "$MOFEM_REPO"
18
19# === INSTALL SYSTEM PACKAGES ===
20sudo apt-get update
21sudo apt-get install -y \
22 file \
23 zlib1g-dev \
24 openssh-server \
25 wget \
26 valgrind \
27 curl \
28 git \
29 g++ \
30 gfortran \
31 gdb \
32 m4 \
33 automake \
34 build-essential \
35 libtool \
36 libsigsegv2 \
37 libjpeg-dev \
38 graphviz \
39 doxygen \
40 cmake \
41 pkg-config \
42 gnuplot \
43 ca-certificates \
44 libx11-dev \
45 xauth \
46 xterm \
47 unzip \
48 mesa-common-dev \
49 libglu1-mesa-dev \
50 libxmu-dev \
51 libxi-dev \
52 libssl-dev \
53 gawk \
54 locales \
55 gettext
56
57sudo locale-gen en_US.UTF-8
58
59# === INSTALL SPACK ===
60if [ ! -d "$SPACK_ROOT" ]; then
61 curl -L https://github.com/spack/spack/archive/refs/tags/v0.23.1.tar.gz | \
62 tar -xz -C "$MOFEM_INSTALL_DIR" && \
63 mv "$MOFEM_INSTALL_DIR/spack-0.23.1" "$SPACK_ROOT"
64fi
65
66# === SETUP SHELL ENV ===
67export PATH="$SPACK_ROOT/bin:$PATH"
68. "$SPACK_ROOT/share/spack/setup-env.sh"
69
70# === ADD TO BASHRC ===
71SPACK_ENV_LINE=". $SPACK_ROOT/share/spack/setup-env.sh"
72grep -qxF "$SPACK_ENV_LINE" ~/.bashrc || echo "$SPACK_ENV_LINE" >> ~/.bashrc
73
74# === SETUP SPACK ENVIRONMENT ===
75spack compiler find
76spack external find
77spack config add "packages:all:target:[x86_64]"
78spack config add "packages:all:variants:build_type=Release"
79
80# === CLONE MoFEM SOURCES ===
81git clone -b "$MOFEM_BRANCH" https://bitbucket.org/mofem/mofem-cephas.git "$MOFEM_SRC_DIR"
82
83# === REGISTER MoFEM REPO ===
84spack repo add "$MOFEM_REPO"
85
86# === CREATE SPACK ENV ===
87spack env create mofem
88spack env activate mofem
89spack add python
90spack add py-numpy ^python
91spack add boost+python+numpy ^python ^py-numpy
92spack add mofem-cephas@0.15.0+adol-c+med+mgis~shared+slepc+tetgen install_id=0 ^petsc+X
93spack develop -p "$MOFEM_SRC_DIR" mofem-cephas@0.15.0
94spack concretize -f
95spack install -v --test=root mofem-cephas@0.15.0+adol-c+med+mgis~shared+slepc+tetgen install_id=0 ^petsc+X
96spack clean -a
97
98# === CREATE VIEW ===
99spack env view enable $HOME/mofem_view
100
101# === FINAL MESSAGE ===
102echo
103echo "✅ MoFEM installed successfully"
104echo "🔁 You can activate the Spack environment with:"
105echo " spack env activate mofem"
106echo " Access MoFEM executables in the view directory:"
107echo " $HOME/mofem_view"
108echo