diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index e260c0b..e4e37a2 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -3,6 +3,16 @@ name: Build all on: workflow_dispatch: inputs: + ubuntu_codename: + description: "Ubuntu LTS" + required: true + type: choice + default: "resolute" + options: + - "jammy" + - "noble" + - "resolute" + boost_ver: description: "Boost version" required: true @@ -63,7 +73,13 @@ jobs: setup: name: Build all dependencies - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + + container: + image: "ubuntu:${{ github.event.inputs.ubuntu_codename }}" + env: + RUNNER_OFF: 1 + options: --user 0 steps: - name: Checkout @@ -89,7 +105,7 @@ jobs: - name: Setup OS run: | - sudo ./setup_custom.sh + ./setup_custom.sh - name: List environment modules run: | diff --git a/.github/workflows/build-boost.yml b/.github/workflows/build-boost.yml index 74f270d..05031f5 100644 --- a/.github/workflows/build-boost.yml +++ b/.github/workflows/build-boost.yml @@ -9,6 +9,16 @@ on: type: string default: "1.83.0" + ubuntu_codename: + description: "Ubuntu LTS" + required: true + type: choice + default: "resolute" + options: + - "jammy" + - "noble" + - "resolute" + defaults: run: shell: bash --login -e -o pipefail {0} # login for environment modules @@ -18,7 +28,13 @@ jobs: setup: name: Build Boost ${{ github.event.inputs.boost_ver }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + + container: + image: "ubuntu:${{ github.event.inputs.ubuntu_codename }}" + env: + RUNNER_OFF: 1 + options: --user 0 steps: - name: Checkout @@ -31,7 +47,7 @@ jobs: - name: Setup OS run: | - sudo ./setup_custom.sh + ./setup_custom.sh - name: List environment modules run: | diff --git a/.github/workflows/build-hdf5.yml b/.github/workflows/build-hdf5.yml index 542868c..dda5e26 100644 --- a/.github/workflows/build-hdf5.yml +++ b/.github/workflows/build-hdf5.yml @@ -9,6 +9,16 @@ on: type: string default: "1.10.10" + ubuntu_codename: + description: "Ubuntu LTS" + required: true + type: choice + default: "resolute" + options: + - "jammy" + - "noble" + - "resolute" + defaults: run: shell: bash --login -e -o pipefail {0} # login for environment modules @@ -18,7 +28,13 @@ jobs: setup: name: Build HDF5 ${{github.event.inputs.hdf5_ver }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + + container: + image: "ubuntu:${{ github.event.inputs.ubuntu_codename }}" + env: + RUNNER_OFF: 1 + options: --user 0 steps: - name: Checkout @@ -31,7 +47,7 @@ jobs: - name: Setup OS run: | - sudo ./setup_custom.sh + ./setup_custom.sh - name: List environment modules run: | diff --git a/.github/workflows/build-petsc.yml b/.github/workflows/build-petsc.yml index 639e6d5..cfbd6b1 100644 --- a/.github/workflows/build-petsc.yml +++ b/.github/workflows/build-petsc.yml @@ -18,6 +18,16 @@ on: - "linux-gnu-opt" default: "linux-gnu" + ubuntu_codename: + description: "Ubuntu LTS" + required: true + type: choice + default: "resolute" + options: + - "jammy" + - "noble" + - "resolute" + defaults: run: shell: bash --login -e -o pipefail {0} # login for environment modules @@ -27,7 +37,13 @@ jobs: setup: name: Build PETSc ${{ github.event.inputs.petsc_ver }}/${{github.event.inputs.petsc_arch }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + + container: + image: "ubuntu:${{ github.event.inputs.ubuntu_codename }}" + env: + RUNNER_OFF: 1 + options: --user 0 steps: - name: Checkout @@ -41,7 +57,7 @@ jobs: - name: Setup OS run: | - sudo ./setup_custom.sh + ./setup_custom.sh - name: List environment modules run: | diff --git a/.github/workflows/build-sundials.yml b/.github/workflows/build-sundials.yml index 8183a26..2101250 100644 --- a/.github/workflows/build-sundials.yml +++ b/.github/workflows/build-sundials.yml @@ -9,6 +9,16 @@ on: type: string default: "6.4.1" + ubuntu_codename: + description: "Ubuntu LTS" + required: true + type: choice + default: "resolute" + options: + - "jammy" + - "noble" + - "resolute" + defaults: run: shell: bash --login -e -o pipefail {0} # login for environment modules @@ -18,7 +28,13 @@ jobs: setup: name: Build SUNDIALS ${{ github.event.inputs.sundials_ver }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + + container: + image: "ubuntu:${{ github.event.inputs.ubuntu_codename }}" + env: + RUNNER_OFF: 1 + options: --user 0 steps: - name: Checkout @@ -31,8 +47,8 @@ jobs: - name: Setup OS run: | - sudo ./setup_custom.sh && \ - sudo apt-get install -y mpi-default-bin mpi-default-dev + ./setup_custom.sh && \ + apt-get install -y mpi-default-bin mpi-default-dev - name: List environment modules run: | diff --git a/.github/workflows/build-vtk.yml b/.github/workflows/build-vtk.yml index b71bbab..55a1478 100644 --- a/.github/workflows/build-vtk.yml +++ b/.github/workflows/build-vtk.yml @@ -9,6 +9,16 @@ on: type: string default: "9.1.0" + ubuntu_codename: + description: "Ubuntu LTS" + required: true + type: choice + default: "resolute" + options: + - "jammy" + - "noble" + - "resolute" + defaults: run: shell: bash --login -e -o pipefail {0} # login for environment modules @@ -18,7 +28,13 @@ jobs: setup: name: Build VTK ${{ github.event.inputs.vtk_ver }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + + container: + image: "ubuntu:${{ github.event.inputs.ubuntu_codename }}" + env: + RUNNER_OFF: 1 + options: --user 0 steps: - name: Checkout @@ -31,8 +47,8 @@ jobs: - name: Setup OS run: | - sudo ./setup_custom.sh && \ - sudo apt-get install -y libboost-dev mpi-default-bin mpi-default-dev + ./setup_custom.sh && \ + apt-get install -y libboost-dev mpi-default-bin mpi-default-dev - name: List environment modules run: | diff --git a/.github/workflows/build-xercesc.yml b/.github/workflows/build-xercesc.yml index 09d680d..91bd722 100644 --- a/.github/workflows/build-xercesc.yml +++ b/.github/workflows/build-xercesc.yml @@ -9,6 +9,16 @@ on: type: string default: "3.2.4" + ubuntu_codename: + description: "Ubuntu LTS" + required: true + type: choice + default: "resolute" + options: + - "jammy" + - "noble" + - "resolute" + defaults: run: shell: bash --login -e -o pipefail {0} # login for environment modules @@ -18,7 +28,13 @@ jobs: setup: name: Build Xerces-C ${{ github.event.inputs.xercesc_ver }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + + container: + image: "ubuntu:${{ github.event.inputs.ubuntu_codename }}" + env: + RUNNER_OFF: 1 + options: --user 0 steps: - name: Checkout @@ -31,7 +47,7 @@ jobs: - name: Setup OS run: | - sudo ./setup_custom.sh + ./setup_custom.sh - name: List environment modules run: | diff --git a/.github/workflows/build-xsd.yml b/.github/workflows/build-xsd.yml index 57ccde2..c1291bb 100644 --- a/.github/workflows/build-xsd.yml +++ b/.github/workflows/build-xsd.yml @@ -9,6 +9,16 @@ on: type: string default: "4.0.0" + ubuntu_codename: + description: "Ubuntu LTS" + required: true + type: choice + default: "resolute" + options: + - "jammy" + - "noble" + - "resolute" + defaults: run: shell: bash --login -e -o pipefail {0} # login for environment modules @@ -18,7 +28,13 @@ jobs: setup: name: Build XSD ${{ github.event.inputs.xsd_ver }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + + container: + image: "ubuntu:${{ github.event.inputs.ubuntu_codename }}" + env: + RUNNER_OFF: 1 + options: --user 0 steps: - name: Checkout @@ -31,7 +47,7 @@ jobs: - name: Setup OS run: | - sudo ./setup_custom.sh + ./setup_custom.sh - name: List environment modules run: | diff --git a/.github/workflows/docker-portability-custom.yml b/.github/workflows/docker-portability-custom.yml index 79ba210..8b05f88 100644 --- a/.github/workflows/docker-portability-custom.yml +++ b/.github/workflows/docker-portability-custom.yml @@ -9,6 +9,16 @@ on: type: string default: "dev" + ubuntu_codename: + description: "Ubuntu LTS" + required: true + type: choice + default: "resolute" + options: + - "jammy" + - "noble" + - "resolute" + boost_ver: description: "Boost version" required: true @@ -60,6 +70,7 @@ jobs: include: - tags: chaste/runner:portability-${{github.event.inputs.tag_suffix }} build-args: | + BASE=${{ github.event.inputs.ubuntu_codename }} BOOST=${{ github.event.inputs.boost_ver }} HDF5=${{ github.event.inputs.hdf5_ver }} PETSC=${{ github.event.inputs.petsc_ver }} diff --git a/.github/workflows/docker-portability-system.yml b/.github/workflows/docker-portability-system.yml index 648614c..bb8bf5a 100644 --- a/.github/workflows/docker-portability-system.yml +++ b/.github/workflows/docker-portability-system.yml @@ -7,7 +7,7 @@ on: description: "Ubuntu codename" required: true type: string - default: "jammy" + default: "resolute" jobs: docker: diff --git a/Dockerfile.custom b/Dockerfile.custom index 800d44c..2402c31 100755 --- a/Dockerfile.custom +++ b/Dockerfile.custom @@ -1,5 +1,5 @@ # Build the image: -# docker build -f Dockerfile.custom --build-arg BOOST=1.74.0 ... -t chaste/runner:custom . +# docker build -f Dockerfile.custom --build-arg BASE=resolute --build-arg BOOST=1.74.0 ... -t chaste/runner:custom . # Run the container in interactive mode: # docker run --init -it -e RUNNER_OFF=1 chaste/runner:custom /bin/bash @@ -7,7 +7,9 @@ # Run the container as a GitHub Actions runner: # docker run --init -it chaste/runner:custom -FROM ubuntu:jammy +ARG BASE=resolute + +FROM ubuntu:${BASE} ARG BOOST ARG HDF5 @@ -28,7 +30,20 @@ ENV DEFAULT_USER="runner" \ MODULES_DIR="/home/runner/modules" # Copy scripts -COPY scripts/custom/ scripts/*.sh /usr/local/bin/ +COPY scripts/ /usr/local/bin/ +RUN ln -s \ + /usr/local/bin/custom/install_boost.sh \ + /usr/local/bin/custom/install_hdf5.sh \ + /usr/local/bin/custom/install_petsc_hdf5.sh \ + /usr/local/bin/custom/install_petsc.sh \ + /usr/local/bin/custom/install_sundials.sh \ + /usr/local/bin/custom/install_vtk.sh \ + /usr/local/bin/custom/install_xercesc.sh \ + /usr/local/bin/custom/install_xsd.sh \ + /usr/local/bin/custom/setup_custom.sh \ + /usr/local/bin/system/install_modulefiles.sh \ + /usr/local/bin/system/setup_system.sh \ + /usr/local/bin/ # Setup base dependencies and install actions runner RUN useradd -r -m -d ${DEFAULT_HOME} -s /bin/bash ${DEFAULT_USER} && \ diff --git a/Dockerfile.system b/Dockerfile.system index 0f4582d..b667d43 100755 --- a/Dockerfile.system +++ b/Dockerfile.system @@ -1,5 +1,5 @@ # Build the image: -# docker build -f Dockerfile.system --build-arg BASE=jammy -t chaste/runner:system . +# docker build -f Dockerfile.system --build-arg BASE=resolute -t chaste/runner:system . # Run the container in interactive mode: # docker run --init -it -e RUNNER_OFF=1 chaste/runner:system /bin/bash @@ -7,7 +7,7 @@ # Run the container as a GitHub Actions runner: # docker run --init -it chaste/runner:system -ARG BASE=jammy +ARG BASE=resolute FROM ubuntu:${BASE} @@ -22,7 +22,20 @@ ENV DEFAULT_USER="runner" \ MODULES_DIR="/home/runner/modules" # Copy scripts -COPY scripts/system/ scripts/*.sh /usr/local/bin/ +COPY scripts/ /usr/local/bin/ +RUN ln -s \ + /usr/local/bin/custom/install_boost.sh \ + /usr/local/bin/custom/install_hdf5.sh \ + /usr/local/bin/custom/install_petsc_hdf5.sh \ + /usr/local/bin/custom/install_petsc.sh \ + /usr/local/bin/custom/install_sundials.sh \ + /usr/local/bin/custom/install_vtk.sh \ + /usr/local/bin/custom/install_xercesc.sh \ + /usr/local/bin/custom/install_xsd.sh \ + /usr/local/bin/custom/setup_custom.sh \ + /usr/local/bin/system/install_modulefiles.sh \ + /usr/local/bin/system/setup_system.sh \ + /usr/local/bin/ # Setup Chaste dependencies and install actions runner RUN useradd -r -m -d ${DEFAULT_HOME} -s /bin/bash ${DEFAULT_USER} && \ diff --git a/scripts/common.sh b/scripts/common.sh index 3ab4f1d..13d6e9d 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -1,143 +1,8 @@ #!/bin/bash -eu -# Split version string, setting minor and patch to 0 if missing. -# -# Usage: split_version -# -# Returns: version major minor patch[ rc] -# -# Examples: -# `split_version 1` -> 1.0.0 1 0 0 -# `split_version 1.2` -> 1.2.0 1 2 0 -# `split_version 1.2.3` -> 1.2.3 1 2 3 -# `split_version 1.2.3-rc1` -> 1.2.3-rc1 1 2 3 rc1 -split_version() -{ - local varr="" parr="" major="" minor="0" patch="0" rc="" - varr=(${1//\./ }) # split version string on '.' - major=${varr[0]} - if [ ${#varr[@]} -ge 2 ]; then - minor=${varr[1]} - if [ ${#varr[@]} -ge 3 ]; then - parr=(${varr[2]//-/ }) # split patch substring on '-' - patch=${parr[0]} - if [ ${#parr[@]} -ge 2 ]; then - rc=${parr[1]} - fi - fi - fi - if [ -z "${rc}" ]; then - echo "${major}.${minor}.${patch}" "${major}" "${minor}" "${patch}" - else - echo "${major}.${minor}.${patch}-${rc}" "${major}" "${minor}" "${patch}" "${rc}" - fi -} +common_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 -# Compare two version strings, ignoring release candidate. -# -# Usage: compare_version -# -# Returns: -# -1 if version_x < version_y -# 0 if version_x == version_y -# 1 if version_x > version_y -# -# Examples: -# `compare_version 1.2.3 1.2.3` -> 0 -# `compare_version 1.2.3 1.2.4` -> -1 -# `compare_version 1.2.4 1.2.3` -> 1 -compare_version() -{ - local arr_x maj_x min_x patch_x - local arr_y maj_y min_y patch_y +. ${common_dir}/env.sh +. ${common_dir}/functions.sh - read -r _ maj_x min_x patch_x _ < <(split_version $1) - read -r _ maj_y min_y patch_y _ < <(split_version $2) - - arr_x=("${maj_x}" "${min_x}" "${patch_x}") - arr_y=("${maj_y}" "${min_y}" "${patch_y}") - - for i in $(seq 0 2); do - if ((arr_x[i] > arr_y[i])); then - echo 1 - return - elif ((arr_x[i] < arr_y[i])); then - echo -1 - return - fi - done - - echo 0 -} - -# Check if version_x is equal to version_y. -# -# Usage: version_eq -# -# Returns: true if version_x == version_y, false otherwise -# -# Examples: -# `version_eq 1.2.3 1.2.3` -> true -# `version_eq 1.2.3 1.2.4` -> false -version_eq() -{ - test "$(compare_version $1 $2)" -eq 0 -} - -# Check if version_x is less than version_y. -# -# Usage: version_lt -# -# Returns: true if version_x < version_y, false otherwise -# -# Examples: -# `version_lt 1.2.3 1.2.3` -> false -# `version_lt 1.2.3 1.2.4` -> true -version_lt() -{ - test "$(compare_version $1 $2)" -eq -1 -} - -# Check if version_x is greater than version_y. -# -# Usage: version_gt -# -# Returns: true if version_x > version_y, false otherwise -# -# Examples: -# `version_gt 1.2.3 1.2.3` -> false -# `version_gt 1.2.4 1.2.3` -> true -version_gt() -{ - test "$(compare_version $1 $2)" -eq 1 -} - -# Check if version_x is less than or equal to version_y. -# -# Usage: version_le -# -# Returns: true if version_x <= version_y, false otherwise -# -# Examples: -# `version_le 1.2.3 1.2.3` -> true -# `version_le 1.2.3 1.2.4` -> true -# `version_le 1.2.4 1.2.3` -> false -version_le() -{ - ! version_gt $1 $2 -} - -# Check if version_x is greater than or equal to version_y. -# -# Usage: version_ge -# -# Returns: true if version_x >= version_y, false otherwise -# -# Examples: -# `version_ge 1.2.3 1.2.3` -> true -# `version_ge 1.2.4 1.2.3` -> true -# `version_ge 1.2.3 1.2.4` -> false -version_ge() -{ - ! version_lt $1 $2 -} +unset common_dir diff --git a/scripts/custom/common.sh b/scripts/custom/common.sh deleted file mode 120000 index f918132..0000000 --- a/scripts/custom/common.sh +++ /dev/null @@ -1 +0,0 @@ -../common.sh \ No newline at end of file diff --git a/scripts/custom/install_boost.sh b/scripts/custom/install_boost.sh index 3accdf7..4ae2a5d 100755 --- a/scripts/custom/install_boost.sh +++ b/scripts/custom/install_boost.sh @@ -2,7 +2,7 @@ # Installs Boost from source and creates a modulefile for it. # Arguments: -# --version=version: The Boost version to install (e.g., 1.74.0). +# --version=version: The Boost version to install (e.g. 1.74.0). # --modules-dir=path: The base directory for the installation and modulefile. # --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). # Example usage: @@ -15,8 +15,10 @@ usage() exit 1 } -script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/common.sh +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh + +patch_dir="${script_dir}/patches/boost" # Parse arguments version= @@ -76,21 +78,21 @@ fi # https://github.com/boostorg/python/commit/660487c43fde76f3e64f1cb2e644500da92fe582 if version_le "${version}" '1.66'; then # Boost <= 1.66.x cd ${src_dir}/libs/python - patch -t -p1 < ${script_dir}/patches/boost/1.66/boost_166-python37-unicode-as-string.patch + patch -t -p1 < ${patch_dir}/1.66/boost_166-python37-unicode-as-string.patch fi # Patch for serialization in Boost <= 1.64.x # https://github.com/boostorg/serialization/commit/1d86261581230e2dc5d617a9b16287d326f3e229 if version_le "${version}" '1.64'; then # Boost <= 1.64.x cd ${src_dir} - patch -t -p2 < ${script_dir}/patches/boost/1.64/boost_164-serialization-array-wrapper.patch + patch -t -p2 < ${patch_dir}/1.64/boost_164-serialization-array-wrapper.patch fi # Patch for pthread in 1.69.x <= Boost <= 1.72.x # https://github.com/boostorg/thread/pull/297/commits/74fb0a26099bc51d717f5f154b37231ce7df3e98 if version_ge "${version}" '1.69' && version_le "${version}" '1.72'; then # 1.69.x <= Boost <= 1.72.x cd ${src_dir} - patch -t -p2 < ${script_dir}/patches/boost/1.69/boost_169-pthread.patch + patch -t -p2 < ${patch_dir}/1.69/boost_169-pthread.patch fi # Build and install diff --git a/scripts/custom/install_cmake.sh b/scripts/custom/install_cmake.sh index de74474..a0847ab 100755 --- a/scripts/custom/install_cmake.sh +++ b/scripts/custom/install_cmake.sh @@ -2,7 +2,7 @@ # Installs CMake from source and creates a modulefile for it. # Arguments: -# --version=version: The CMake version to install (e.g., 3.21.2). +# --version=version: The CMake version to install (e.g. 3.21.2). # --modules-dir=path: The base directory for the installation and modulefile. # --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). # Example usage: @@ -15,8 +15,8 @@ usage() exit 1 } -script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/common.sh +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh # Parse arguments version= diff --git a/scripts/custom/install_hdf5.sh b/scripts/custom/install_hdf5.sh index 6be6658..e2b6106 100755 --- a/scripts/custom/install_hdf5.sh +++ b/scripts/custom/install_hdf5.sh @@ -2,7 +2,7 @@ # Installs HDF5 from source and creates a modulefile for it. # Arguments: -# --version=version: The HDF5 version to install (e.g., 1.12.0). +# --version=version: The HDF5 version to install (e.g. 1.12.0). # --modules-dir=path: The base directory for the installation and modulefile. # --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). # Example usage: @@ -15,11 +15,8 @@ usage() exit 1 } -script_dir="$( - cd "$(dirname "$0")" - pwd -)" -. ${script_dir}/common.sh +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh # Parse arguments version= diff --git a/scripts/custom/install_petsc.sh b/scripts/custom/install_petsc.sh index defb803..d0098b2 100755 --- a/scripts/custom/install_petsc.sh +++ b/scripts/custom/install_petsc.sh @@ -2,7 +2,7 @@ # Installs PETSc from source and adds a modulefile for it. # Arguments: -# --version=version: The PETSc version to install (e.g., 3.15.0). +# --version=version: The PETSc version to install (e.g. 3.15.0). # --arch=[{linux-gnu|linux-gnu-opt}]: The build type (default: linux-gnu). # --modules-dir=path: The base directory for the installation and modulefile. # --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). @@ -17,8 +17,8 @@ usage() exit 1 } -script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/common.sh +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh # Parse arguments version= diff --git a/scripts/custom/install_petsc_hdf5.sh b/scripts/custom/install_petsc_hdf5.sh index 4f07260..84c2cd9 100755 --- a/scripts/custom/install_petsc_hdf5.sh +++ b/scripts/custom/install_petsc_hdf5.sh @@ -11,8 +11,8 @@ usage() exit 1 } -script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/common.sh +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh # Parse arguments petsc_version= diff --git a/scripts/custom/install_python.sh b/scripts/custom/install_python.sh index a0e108e..78c498b 100755 --- a/scripts/custom/install_python.sh +++ b/scripts/custom/install_python.sh @@ -6,8 +6,8 @@ usage() exit 1 } -script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/common.sh +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh # Parse arguments version= diff --git a/scripts/custom/install_sundials.sh b/scripts/custom/install_sundials.sh index 21b9a94..5163751 100755 --- a/scripts/custom/install_sundials.sh +++ b/scripts/custom/install_sundials.sh @@ -2,7 +2,7 @@ # Installs Sundials from source and creates a modulefile for it. # Arguments: -# --version=version: The Sundials version to install (e.g., 5.7.0). +# --version=version: The Sundials version to install (e.g. 5.7.0). # --modules-dir=path: The base directory for the installation and modulefile. # --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). # Example usage: @@ -15,8 +15,8 @@ usage() exit 1 } -script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/common.sh +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh # Parse arguments version= diff --git a/scripts/custom/install_vtk.sh b/scripts/custom/install_vtk.sh index 4e93f61..caa736e 100755 --- a/scripts/custom/install_vtk.sh +++ b/scripts/custom/install_vtk.sh @@ -2,7 +2,7 @@ # Installs VTK from source and creates a modulefile for it. # Arguments: -# --version=version: The VTK version to install (e.g., 9.3.0). +# --version=version: The VTK version to install (e.g. 9.3.0). # --modules-dir=path: The base directory for the installation and modulefile. # --parallel=value: The number of parallel jobs to use for building (default: number of CPU cores). # Example usage: @@ -15,8 +15,10 @@ usage() exit 1 } -script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/common.sh +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh + +patch_dir="${script_dir}/patches/vtk" # Parse arguments version= @@ -70,102 +72,102 @@ tar -xzf v${version}.tar.gz -C ${src_dir} --strip-components=1 # VTK 6.3.x patches: https://sources.debian.org/patches/vtk6/ if version_eq "${major}.${minor}" '6.3'; then # VTK == 6.3.x cd ${src_dir} - patch -t -p1 < ${script_dir}/patches/vtk/6.3/10_allpatches.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/20_soversion-sharedlib.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/30_matplotlib.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/60_use_system_mpi4py.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/70_fix_ftbfs_gcc49.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/90_gdal-2.0.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/95_ffmpeg_2.9.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/97_fix_latex_doxygen.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/99-hdf5-1.10-compatibility - patch -t -p1 < ${script_dir}/patches/vtk/6.3/100_javac-heap.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/101_java_install_path.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/105_unforce_embedded_glew.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/106_install_doxygen_scripts_in_nodoc_build.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/108_Doxygen-use-mathjax.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/109_infovis_boost.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/110_remove_nonfree_from_build.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/120_fix_ftbfs_qtpainter.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/3edc0de2b04ae1e100c229e592d6b9fa94f2915a.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/581d9eb874b2b80a3fb21c739a96fa6f955ffb5e.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/new-freetype.patch - patch -t -p1 < ${script_dir}/patches/vtk/6.3/vtk6-gcc11-support.patch + patch -t -p1 < ${patch_dir}/6.3/10_allpatches.patch + patch -t -p1 < ${patch_dir}/6.3/20_soversion-sharedlib.patch + patch -t -p1 < ${patch_dir}/6.3/30_matplotlib.patch + patch -t -p1 < ${patch_dir}/6.3/60_use_system_mpi4py.patch + patch -t -p1 < ${patch_dir}/6.3/70_fix_ftbfs_gcc49.patch + patch -t -p1 < ${patch_dir}/6.3/90_gdal-2.0.patch + patch -t -p1 < ${patch_dir}/6.3/95_ffmpeg_2.9.patch + patch -t -p1 < ${patch_dir}/6.3/97_fix_latex_doxygen.patch + patch -t -p1 < ${patch_dir}/6.3/99-hdf5-1.10-compatibility + patch -t -p1 < ${patch_dir}/6.3/100_javac-heap.patch + patch -t -p1 < ${patch_dir}/6.3/101_java_install_path.patch + patch -t -p1 < ${patch_dir}/6.3/105_unforce_embedded_glew.patch + patch -t -p1 < ${patch_dir}/6.3/106_install_doxygen_scripts_in_nodoc_build.patch + patch -t -p1 < ${patch_dir}/6.3/108_Doxygen-use-mathjax.patch + patch -t -p1 < ${patch_dir}/6.3/109_infovis_boost.patch + patch -t -p1 < ${patch_dir}/6.3/110_remove_nonfree_from_build.patch + patch -t -p1 < ${patch_dir}/6.3/120_fix_ftbfs_qtpainter.patch + patch -t -p1 < ${patch_dir}/6.3/3edc0de2b04ae1e100c229e592d6b9fa94f2915a.patch + patch -t -p1 < ${patch_dir}/6.3/581d9eb874b2b80a3fb21c739a96fa6f955ffb5e.patch + patch -t -p1 < ${patch_dir}/6.3/new-freetype.patch + patch -t -p1 < ${patch_dir}/6.3/vtk6-gcc11-support.patch fi # VTK 7.1.x patches: https://sources.debian.org/patches/vtk7/ if version_eq "${major}.${minor}" '7.1'; then # VTK == 7.1.x cd ${src_dir} - patch -t -p1 < ${script_dir}/patches/vtk/7.1/10_allpatches.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/20_soversion-sharedlib.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/30_matplotlib.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/40_use_system_sqlite.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/60_use_system_mpi4py.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/70_fix_ftbfs_gcc49.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/80_fix_arm_compilation.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/99-hdf5-1.10-compatibility - patch -t -p1 < ${script_dir}/patches/vtk/7.1/100_javac-heap.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/101_java_install_path.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/105_unforce_embedded_glew.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/106_install_doxygen_scripts_in_nodoc_build.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/108_Doxygen-use-mathjax.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/109_java-jar-nonjavafiles.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/110_python-371.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/111_fix_perl.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/112_riscv_support.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/113_fix_python_equal.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/115_support-gcc10.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/mysq8_my_bool.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/3edc0de2b04ae1e100c229e592d6b9fa94f2915a.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/581d9eb874b2b80a3fb21c739a96fa6f955ffb5e.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/gcc-11.patch - patch -t -p1 < ${script_dir}/patches/vtk/7.1/ffmpeg-5.patch + patch -t -p1 < ${patch_dir}/7.1/10_allpatches.patch + patch -t -p1 < ${patch_dir}/7.1/20_soversion-sharedlib.patch + patch -t -p1 < ${patch_dir}/7.1/30_matplotlib.patch + patch -t -p1 < ${patch_dir}/7.1/40_use_system_sqlite.patch + patch -t -p1 < ${patch_dir}/7.1/60_use_system_mpi4py.patch + patch -t -p1 < ${patch_dir}/7.1/70_fix_ftbfs_gcc49.patch + patch -t -p1 < ${patch_dir}/7.1/80_fix_arm_compilation.patch + patch -t -p1 < ${patch_dir}/7.1/99-hdf5-1.10-compatibility + patch -t -p1 < ${patch_dir}/7.1/100_javac-heap.patch + patch -t -p1 < ${patch_dir}/7.1/101_java_install_path.patch + patch -t -p1 < ${patch_dir}/7.1/105_unforce_embedded_glew.patch + patch -t -p1 < ${patch_dir}/7.1/106_install_doxygen_scripts_in_nodoc_build.patch + patch -t -p1 < ${patch_dir}/7.1/108_Doxygen-use-mathjax.patch + patch -t -p1 < ${patch_dir}/7.1/109_java-jar-nonjavafiles.patch + patch -t -p1 < ${patch_dir}/7.1/110_python-371.patch + patch -t -p1 < ${patch_dir}/7.1/111_fix_perl.patch + patch -t -p1 < ${patch_dir}/7.1/112_riscv_support.patch + patch -t -p1 < ${patch_dir}/7.1/113_fix_python_equal.patch + patch -t -p1 < ${patch_dir}/7.1/115_support-gcc10.patch + patch -t -p1 < ${patch_dir}/7.1/mysq8_my_bool.patch + patch -t -p1 < ${patch_dir}/7.1/3edc0de2b04ae1e100c229e592d6b9fa94f2915a.patch + patch -t -p1 < ${patch_dir}/7.1/581d9eb874b2b80a3fb21c739a96fa6f955ffb5e.patch + patch -t -p1 < ${patch_dir}/7.1/gcc-11.patch + patch -t -p1 < ${patch_dir}/7.1/ffmpeg-5.patch fi # VTK 8.1.x patches if version_eq "${major}.${minor}" '8.1'; then # VTK == 8.1.x cd ${src_dir} - patch -t -p1 < ${script_dir}/patches/vtk/8.1/20_soversion-sharedlib.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/30_matplotlib.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/60_use_system_mpi4py.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/70_vtk8_fix_ftbfs_gcc49.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/100_javac-heap.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/101_java_install_path.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/106_install_doxygen_scripts_in_nodoc_build.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/108_Doxygen-use-mathjax.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/109_java-jar-nonjavafiles.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/110_python-371.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/111_fix_perl.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/112_riscv_support.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/113_vtk8_fix_python_equal.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/115_support-gcc10.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/mysq8_my_bool.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/3edc0de2b04ae1e100c229e592d6b9fa94f2915a.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/581d9eb874b2b80a3fb21c739a96fa6f955ffb5e.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.1/vtk8-gcc-11-exodus.patch + patch -t -p1 < ${patch_dir}/8.1/20_soversion-sharedlib.patch + patch -t -p1 < ${patch_dir}/8.1/30_matplotlib.patch + patch -t -p1 < ${patch_dir}/8.1/60_use_system_mpi4py.patch + patch -t -p1 < ${patch_dir}/8.1/70_vtk8_fix_ftbfs_gcc49.patch + patch -t -p1 < ${patch_dir}/8.1/100_javac-heap.patch + patch -t -p1 < ${patch_dir}/8.1/101_java_install_path.patch + patch -t -p1 < ${patch_dir}/8.1/106_install_doxygen_scripts_in_nodoc_build.patch + patch -t -p1 < ${patch_dir}/8.1/108_Doxygen-use-mathjax.patch + patch -t -p1 < ${patch_dir}/8.1/109_java-jar-nonjavafiles.patch + patch -t -p1 < ${patch_dir}/8.1/110_python-371.patch + patch -t -p1 < ${patch_dir}/8.1/111_fix_perl.patch + patch -t -p1 < ${patch_dir}/8.1/112_riscv_support.patch + patch -t -p1 < ${patch_dir}/8.1/113_vtk8_fix_python_equal.patch + patch -t -p1 < ${patch_dir}/8.1/115_support-gcc10.patch + patch -t -p1 < ${patch_dir}/8.1/mysq8_my_bool.patch + patch -t -p1 < ${patch_dir}/8.1/3edc0de2b04ae1e100c229e592d6b9fa94f2915a.patch + patch -t -p1 < ${patch_dir}/8.1/581d9eb874b2b80a3fb21c739a96fa6f955ffb5e.patch + patch -t -p1 < ${patch_dir}/8.1/vtk8-gcc-11-exodus.patch fi # VTK 8.2.x patches if version_eq "${major}.${minor}" '8.2'; then # VTK == 8.2.x cd ${src_dir} - patch -t -p1 < ${script_dir}/patches/vtk/8.2/20_soversion-sharedlib.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/30_matplotlib.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/60_vtk8_use_system_mpi4py.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/70_vtk8_fix_ftbfs_gcc49.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/100_javac-heap.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/101_java_install_path.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/106_install_doxygen_scripts_in_nodoc_build.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/108_Doxygen-use-mathjax.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/109_java-jar-nonjavafiles.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/110_python-371.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/111_fix_perl.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/112_riscv_support.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/113_vtk8_fix_python_equal.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/115_support-gcc10.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/mysq8_my_bool.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/3edc0de2b04ae1e100c229e592d6b9fa94f2915a.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/581d9eb874b2b80a3fb21c739a96fa6f955ffb5e.patch - patch -t -p1 < ${script_dir}/patches/vtk/8.2/vtk8-gcc-11-exodus.patch + patch -t -p1 < ${patch_dir}/8.2/20_soversion-sharedlib.patch + patch -t -p1 < ${patch_dir}/8.2/30_matplotlib.patch + patch -t -p1 < ${patch_dir}/8.2/60_vtk8_use_system_mpi4py.patch + patch -t -p1 < ${patch_dir}/8.2/70_vtk8_fix_ftbfs_gcc49.patch + patch -t -p1 < ${patch_dir}/8.2/100_javac-heap.patch + patch -t -p1 < ${patch_dir}/8.2/101_java_install_path.patch + patch -t -p1 < ${patch_dir}/8.2/106_install_doxygen_scripts_in_nodoc_build.patch + patch -t -p1 < ${patch_dir}/8.2/108_Doxygen-use-mathjax.patch + patch -t -p1 < ${patch_dir}/8.2/109_java-jar-nonjavafiles.patch + patch -t -p1 < ${patch_dir}/8.2/110_python-371.patch + patch -t -p1 < ${patch_dir}/8.2/111_fix_perl.patch + patch -t -p1 < ${patch_dir}/8.2/112_riscv_support.patch + patch -t -p1 < ${patch_dir}/8.2/113_vtk8_fix_python_equal.patch + patch -t -p1 < ${patch_dir}/8.2/115_support-gcc10.patch + patch -t -p1 < ${patch_dir}/8.2/mysq8_my_bool.patch + patch -t -p1 < ${patch_dir}/8.2/3edc0de2b04ae1e100c229e592d6b9fa94f2915a.patch + patch -t -p1 < ${patch_dir}/8.2/581d9eb874b2b80a3fb21c739a96fa6f955ffb5e.patch + patch -t -p1 < ${patch_dir}/8.2/vtk8-gcc-11-exodus.patch fi # VTK 9.0.x patches: @@ -173,22 +175,22 @@ fi # https://github.com/gentoo/gentoo/tree/4893345530421b0d6168b5278d57d69fc08f7fdf/sci-libs/vtk/files if version_eq "${major}.${minor}" '9.0'; then # VTK == 9.0.x cd ${src_dir} - patch -t -p1 < ${script_dir}/patches/vtk/9.0/50_fix_python-modules_path.patch - patch -t -p1 < ${script_dir}/patches/vtk/9.0/70_fix_python_numpy_warning.patch - patch -t -p1 < ${script_dir}/patches/vtk/9.0/fix-limits.patch - patch -t -p1 < ${script_dir}/patches/vtk/9.0/vtk-9.0.3-proj-api-fix-upstream-commit-03256388.patch + patch -t -p1 < ${patch_dir}/9.0/50_fix_python-modules_path.patch + patch -t -p1 < ${patch_dir}/9.0/70_fix_python_numpy_warning.patch + patch -t -p1 < ${patch_dir}/9.0/fix-limits.patch + patch -t -p1 < ${patch_dir}/9.0/vtk-9.0.3-proj-api-fix-upstream-commit-03256388.patch fi # VTK 9.1.x patches: https://sources.debian.org/patches/vtk9/ if version_eq "${major}.${minor}" '9.1'; then # VTK == 9.1.x cd ${src_dir} - patch -t -p1 < ${script_dir}/patches/vtk/9.1/gcc-13.patch + patch -t -p1 < ${patch_dir}/9.1/gcc-13.patch fi # VTK 9.2.x patches if version_eq "${major}.${minor}" '9.2'; then # VTK == 9.2.x cd ${src_dir} - patch -t -p1 < ${script_dir}/patches/vtk/9.2/gcc-13.patch + patch -t -p1 < ${patch_dir}/9.2/gcc-13.patch fi # Build and install diff --git a/scripts/custom/install_xercesc.sh b/scripts/custom/install_xercesc.sh index 7049918..3172dbb 100755 --- a/scripts/custom/install_xercesc.sh +++ b/scripts/custom/install_xercesc.sh @@ -2,7 +2,7 @@ # Installs Xerces-C++ from source and creates a modulefile for it. # Arguments: -# --version=version: Version of Xerces-C++ to install (e.g., 3.2.3) +# --version=version: Version of Xerces-C++ to install (e.g. 3.2.3) # --modules-dir=path: The base directory for the installation and modulefile. # --parallel=value: Number of parallel jobs for building (default: number of CPU cores) # Example usage: @@ -15,8 +15,8 @@ usage() exit 1 } -script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/common.sh +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh # Parse arguments version= diff --git a/scripts/custom/install_xsd.sh b/scripts/custom/install_xsd.sh index dd62ee4..4969cfe 100755 --- a/scripts/custom/install_xsd.sh +++ b/scripts/custom/install_xsd.sh @@ -2,7 +2,7 @@ # Installs XSD from source and creates a modulefile for it. # Arguments: -# --version=version: Version of XSD to install (e.g., 4.0.0) +# --version=version: Version of XSD to install (e.g. 4.0.0) # --modules-dir=path: The base directory for the installation and modulefile. # Example usage: # ./install_xsd.sh --version=4.0.0 --modules-dir=/path/to/modules @@ -14,8 +14,8 @@ usage() exit 1 } -script_dir="$(cd "$(dirname "$0")"; pwd)" -. ${script_dir}/common.sh +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh # Parse arguments version= diff --git a/scripts/custom/patches/README.md b/scripts/custom/patches/README.md new file mode 100644 index 0000000..c7b711a --- /dev/null +++ b/scripts/custom/patches/README.md @@ -0,0 +1,11 @@ +## Patches + +This directory contains patches for fixing issues with various versions of dependencies. + +**Sources** + +- https://github.com/boostorg/python/ +- https://github.com/boostorg/serialization/ +- https://github.com/boostorg/thread/ +- https://github.com/gentoo/gentoo/tree/master/sci-libs/vtk/files/ +- https://sources.debian.org/patches/ diff --git a/scripts/custom/setup_custom.sh b/scripts/custom/setup_custom.sh index 3d745de..973bbdb 100755 --- a/scripts/custom/setup_custom.sh +++ b/scripts/custom/setup_custom.sh @@ -1,131 +1,21 @@ -#!/bin/sh +#!/bin/bash -eu -# Setup required libraries for building Chaste dependencies on Ubuntu 22.04 Jammy +# Setup required libraries for building Chaste dependencies on Ubuntu LTS -export DEBIAN_FRONTEND=noninteractive +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 -# Base dependencies -apt-get update -apt-get install -y --no-install-recommends \ - apt-transport-https \ - apt-utils \ - ca-certificates \ - curl \ - environment-modules \ - gnupg \ - jq \ - openssl \ - rsync \ - wget +. ${script_dir}/../common.sh -# Build/dev dependencies -apt-get install -y --no-install-recommends \ - build-essential \ - doxygen \ - git \ - lcov \ - python3 \ - python3-dev \ - python3-pip \ - python3-venv \ - valgrind +if [ "${OS_VERSION_CODENAME}" = 'jammy' ]; then + ${script_dir}/setup_ubuntu_2204.sh -# Install cmake 3.26+ for HDF5 2.0+ (Ubuntu 22.04 has cmake 3.22) -python3 -m pip install --no-cache-dir "cmake>=3.26,<5" +elif [ "${OS_VERSION_CODENAME}" = 'noble' ]; then + ${script_dir}/setup_ubuntu_2404.sh -# Chaste dependencies -apt-get install -y --no-install-recommends \ - libfftw3-3 \ - libfftw3-bin \ - libfftw3-dev \ - mpi-default-bin \ - mpi-default-dev +elif [ "${OS_VERSION_CODENAME}" = 'resolute' ]; then + ${script_dir}/setup_ubuntu_2604.sh -# VTK dependencies -apt-get install -y --no-install-recommends \ - freeglut3 \ - freeglut3-dev \ - libavcodec-dev \ - libavcodec58 \ - libavformat-dev \ - libavformat58 \ - libavutil-dev \ - libavutil56 \ - libdouble-conversion-dev \ - libdouble-conversion3 \ - libeigen3-dev \ - libfmt-dev \ - libfmt8 \ - libfontconfig1 \ - libfreetype6 \ - libfreetype6-dev \ - libgl1-mesa-dev \ - libgl1-mesa-glx \ - libgl2ps-dev \ - libgl2ps1.4 \ - libglew-dev \ - libglew2.2 \ - libglu1-mesa \ - libglu1-mesa-dev \ - libglx0 \ - libjpeg-dev \ - libjpeg8 \ - libjsoncpp-dev \ - libjsoncpp25 \ - liblz4-1 \ - liblz4-dev \ - liblzma5 \ - libmysqlclient-dev \ - libmysqlclient21 \ - libnetcdf-c++4 \ - libnetcdf-cxx-legacy-dev \ - libnetcdf-dev \ - libnetcdf19 \ - libodbc2 \ - libogg-dev \ - libogg0 \ - libopengl0 \ - libpng-dev \ - libpng16-16 \ - libpq-dev \ - libpq5 \ - libproj-dev \ - libproj22 \ - libsqlite3-0 \ - libsqlite3-dev \ - libswscale-dev \ - libswscale5 \ - libtbb-dev \ - libtbb12 \ - libtcl8.6 \ - libtheora-dev \ - libtheora0 \ - libtiff-dev \ - libtiff5 \ - libtk8.6 \ - libutfcpp-dev \ - libx11-6 \ - libx11-dev \ - libxcursor-dev \ - libxcursor1 \ - libxft-dev \ - libxml2 \ - libxml2-dev \ - libxss-dev \ - libxt-dev \ - libxt6 \ - sqlite3 \ - tcl-dev \ - tk-dev \ - x11proto-core-dev \ - zlib1g \ - zlib1g-dev - -# libexpat1-dev libexpat1: -# To be supplied by custom VTK build due to version conflicts. - -# libgdal-dev libgdal30: -# To be supplied by custom VTK build due to reliance on system boost. - -update-alternatives --install /usr/local/bin/python python /usr/bin/python3 10 -update-alternatives --install /usr/local/bin/pip pip /usr/bin/pip3 10 +else + echo "Unsupported Ubuntu version: ${OS_VERSION_CODENAME}" + exit 1 +fi diff --git a/scripts/custom/setup_ubuntu_2204.sh b/scripts/custom/setup_ubuntu_2204.sh new file mode 100755 index 0000000..d7d2066 --- /dev/null +++ b/scripts/custom/setup_ubuntu_2204.sh @@ -0,0 +1,129 @@ +#!/bin/bash -eu + +# Setup required libraries for building Chaste dependencies on Ubuntu 22.04 Jammy LTS + +export DEBIAN_FRONTEND=noninteractive + +# Base dependencies +apt-get update +apt-get install -y --no-install-recommends \ + apt-transport-https \ + apt-utils \ + ca-certificates \ + curl \ + environment-modules \ + gnupg \ + jq \ + openssl \ + rsync \ + wget + +# Build/dev dependencies +apt-get install -y --no-install-recommends \ + build-essential \ + doxygen \ + git \ + lcov \ + python-is-python3 \ + python3 \ + python3-dev \ + python3-pip \ + python3-venv \ + valgrind + +# Install cmake 3.26+ for HDF5 2.0+ (Ubuntu 22.04 has cmake 3.22) +python3 -m pip install --no-cache-dir "cmake>=3.26,<5" + +# Chaste dependencies +apt-get install -y --no-install-recommends \ + libfftw3-3 \ + libfftw3-bin \ + libfftw3-dev \ + mpi-default-bin \ + mpi-default-dev + +# VTK dependencies +apt-get install -y --no-install-recommends \ + freeglut3 \ + freeglut3-dev \ + libavcodec-dev \ + libavcodec58 \ + libavformat-dev \ + libavformat58 \ + libavutil-dev \ + libavutil56 \ + libdouble-conversion-dev \ + libdouble-conversion3 \ + libeigen3-dev \ + libfmt-dev \ + libfmt8 \ + libfontconfig1 \ + libfreetype6 \ + libfreetype6-dev \ + libgl1-mesa-dev \ + libgl1-mesa-glx \ + libgl2ps-dev \ + libgl2ps1.4 \ + libglew-dev \ + libglew2.2 \ + libglu1-mesa \ + libglu1-mesa-dev \ + libglx0 \ + libjpeg-dev \ + libjpeg8 \ + libjsoncpp-dev \ + libjsoncpp25 \ + liblz4-1 \ + liblz4-dev \ + liblzma5 \ + libmysqlclient-dev \ + libmysqlclient21 \ + libnetcdf-c++4 \ + libnetcdf-cxx-legacy-dev \ + libnetcdf-dev \ + libnetcdf19 \ + libodbc2 \ + libogg-dev \ + libogg0 \ + libopengl0 \ + libpng-dev \ + libpng16-16 \ + libpq-dev \ + libpq5 \ + libproj-dev \ + libproj22 \ + libsqlite3-0 \ + libsqlite3-dev \ + libswscale-dev \ + libswscale5 \ + libtbb-dev \ + libtbb12 \ + libtcl8.6 \ + libtheora-dev \ + libtheora0 \ + libtiff-dev \ + libtiff5 \ + libtk8.6 \ + libutfcpp-dev \ + libx11-6 \ + libx11-dev \ + libxcursor-dev \ + libxcursor1 \ + libxft-dev \ + libxml2 \ + libxml2-dev \ + libxss-dev \ + libxt-dev \ + libxt6 \ + sqlite3 \ + tcl-dev \ + tk-dev \ + x11proto-core-dev \ + zlib1g \ + zlib1g-dev + +# libexpat1-dev libexpat1: +# To be supplied by custom VTK build due to version conflicts. + +# libgdal-dev libgdal30: +# To be supplied by custom VTK build due to reliance on system boost. diff --git a/scripts/custom/setup_ubuntu_2404.sh b/scripts/custom/setup_ubuntu_2404.sh new file mode 100755 index 0000000..35f6559 --- /dev/null +++ b/scripts/custom/setup_ubuntu_2404.sh @@ -0,0 +1,125 @@ +#!/bin/bash -eu + +# Setup required libraries for building Chaste dependencies on Ubuntu 24.04 Noble LTS + +export DEBIAN_FRONTEND=noninteractive + +# Base dependencies +apt-get update +apt-get install -y --no-install-recommends \ + apt-transport-https \ + apt-utils \ + ca-certificates \ + curl \ + environment-modules \ + gnupg \ + jq \ + openssl \ + rsync \ + wget + +# Build/dev dependencies +apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + cmake-curses-gui \ + doxygen \ + git \ + lcov \ + python-is-python3 \ + python3 \ + python3-dev \ + python3-pip \ + python3-venv \ + valgrind + +# Chaste dependencies +apt-get install -y --no-install-recommends \ + libfftw3-3 \ + libfftw3-bin \ + libfftw3-dev \ + mpi-default-bin \ + mpi-default-dev + +# VTK dependencies +apt-get install -y --no-install-recommends \ + freeglut3-dev \ + libavcodec-dev \ + libavcodec60 \ + libavformat-dev \ + libavformat60 \ + libavutil-dev \ + libavutil58 \ + libdouble-conversion-dev \ + libdouble-conversion3 \ + libeigen3-dev \ + libfmt-dev \ + libfmt9 \ + libfontconfig1 \ + libfreetype6 \ + libfreetype-dev \ + libgl1-mesa-dev \ + libgl2ps-dev \ + libgl2ps1.4 \ + libglew-dev \ + libglew2.2 \ + libglu1-mesa \ + libglu1-mesa-dev \ + libglx0 \ + libjpeg-dev \ + libjpeg8 \ + libjsoncpp-dev \ + libjsoncpp25 \ + liblz4-1 \ + liblz4-dev \ + liblzma5 \ + libmysqlclient-dev \ + libmysqlclient21 \ + libnetcdf-c++4-1 \ + libnetcdf-dev \ + libnetcdf19t64 \ + libodbc2 \ + libogg-dev \ + libogg0 \ + libopengl0 \ + libpng-dev \ + libpng16-16t64 \ + libpq-dev \ + libpq5 \ + libproj-dev \ + libproj25 \ + libsqlite3-0 \ + libsqlite3-dev \ + libswscale-dev \ + libswscale7 \ + libtbb-dev \ + libtbb12 \ + libtcl8.6 \ + libtheora-dev \ + libtheora0 \ + libtiff-dev \ + libtiff6 \ + libtk8.6 \ + libutfcpp-dev \ + libx11-6 \ + libx11-dev \ + libxcursor-dev \ + libxcursor1 \ + libxft-dev \ + libxml2 \ + libxml2-dev \ + libxss-dev \ + libxt-dev \ + libxt6t64 \ + sqlite3 \ + tcl-dev \ + tk-dev \ + x11proto-core-dev \ + zlib1g \ + zlib1g-dev + +# libexpat1-dev libexpat1: +# To be supplied by custom VTK build due to version conflicts. + +# libgdal-dev libgdal30: +# To be supplied by custom VTK build due to reliance on system boost. diff --git a/scripts/custom/setup_ubuntu_2604.sh b/scripts/custom/setup_ubuntu_2604.sh new file mode 100755 index 0000000..ba0b487 --- /dev/null +++ b/scripts/custom/setup_ubuntu_2604.sh @@ -0,0 +1,125 @@ +#!/bin/bash -eu + +# Setup required libraries for building Chaste dependencies on Ubuntu 26.04 Resolute LTS + +export DEBIAN_FRONTEND=noninteractive + +# Base dependencies +apt-get update +apt-get install -y --no-install-recommends \ + apt-transport-https \ + apt-utils \ + ca-certificates \ + curl \ + environment-modules \ + gnupg \ + jq \ + openssl \ + rsync \ + wget + +# Build/dev dependencies +apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + cmake-curses-gui \ + doxygen \ + git \ + lcov \ + python-is-python3 \ + python3 \ + python3-dev \ + python3-pip \ + python3-venv \ + valgrind + +# Chaste dependencies +apt-get install -y --no-install-recommends \ + libfftw3-double3 \ + libfftw3-bin \ + libfftw3-dev \ + mpi-default-bin \ + mpi-default-dev + +# VTK dependencies +apt-get install -y --no-install-recommends \ + freeglut3-dev \ + libavcodec-dev \ + libavcodec62 \ + libavformat-dev \ + libavformat62 \ + libavutil-dev \ + libavutil60 \ + libdouble-conversion-dev \ + libdouble-conversion3 \ + libeigen3-dev \ + libfmt-dev \ + libfmt10 \ + libfontconfig1 \ + libfreetype6 \ + libfreetype-dev \ + libgl1-mesa-dev \ + libgl2ps-dev \ + libgl2ps1.4 \ + libglew-dev \ + libglew2.2 \ + libglu1-mesa \ + libglu1-mesa-dev \ + libglx0 \ + libjpeg-dev \ + libjpeg8 \ + libjsoncpp-dev \ + libjsoncpp26 \ + liblz4-1 \ + liblz4-dev \ + liblzma5 \ + libmysqlclient-dev \ + libmysqlclient24 \ + libnetcdf-c++4-1 \ + libnetcdf-dev \ + libnetcdf22 \ + libodbc2 \ + libogg-dev \ + libogg0 \ + libopengl0 \ + libpng-dev \ + libpng16-16t64 \ + libpq-dev \ + libpq5 \ + libproj-dev \ + libproj25 \ + libsqlite3-0 \ + libsqlite3-dev \ + libswscale-dev \ + libswscale9 \ + libtbb-dev \ + libtbb12 \ + libtcl8.6 \ + libtheora-dev \ + libtheora1 \ + libtiff-dev \ + libtiff6 \ + libtk8.6 \ + libutfcpp-dev \ + libx11-6 \ + libx11-dev \ + libxcursor-dev \ + libxcursor1 \ + libxft-dev \ + libxml++2.6-2v5 \ + libxml++2.6-dev \ + libxss-dev \ + libxt-dev \ + libxt6 \ + sqlite3 \ + tcl-dev \ + tk-dev \ + x11proto-core-dev \ + zlib1g \ + zlib1g-dev + +# libexpat1-dev libexpat1: +# To be supplied by custom VTK build due to version conflicts. + +# libgdal-dev libgdal30: +# To be supplied by custom VTK build due to reliance on system boost. diff --git a/scripts/env.sh b/scripts/env.sh new file mode 100644 index 0000000..5c0dec3 --- /dev/null +++ b/scripts/env.sh @@ -0,0 +1,13 @@ +#!/bin/bash -eu + +OS_VERSION_ID="" +OS_VERSION_CODENAME="" + +if [[ "$OSTYPE" =~ ^linux ]]; then + OS_VERSION_ID="$(. /etc/os-release && echo ${VERSION_ID})" + OS_VERSION_CODENAME="$(. /etc/os-release && echo ${VERSION_CODENAME})" + +elif [[ "$OSTYPE" =~ ^darwin ]]; then + OS_VERSION_ID="$(sw_vers -productVersion)" + OS_VERSION_CODENAME="$(sw_vers -productName)$(echo ${OS_VERSION_ID} | cut -d. -f1)" +fi diff --git a/scripts/functions.sh b/scripts/functions.sh new file mode 100644 index 0000000..3ab4f1d --- /dev/null +++ b/scripts/functions.sh @@ -0,0 +1,143 @@ +#!/bin/bash -eu + +# Split version string, setting minor and patch to 0 if missing. +# +# Usage: split_version +# +# Returns: version major minor patch[ rc] +# +# Examples: +# `split_version 1` -> 1.0.0 1 0 0 +# `split_version 1.2` -> 1.2.0 1 2 0 +# `split_version 1.2.3` -> 1.2.3 1 2 3 +# `split_version 1.2.3-rc1` -> 1.2.3-rc1 1 2 3 rc1 +split_version() +{ + local varr="" parr="" major="" minor="0" patch="0" rc="" + varr=(${1//\./ }) # split version string on '.' + major=${varr[0]} + if [ ${#varr[@]} -ge 2 ]; then + minor=${varr[1]} + if [ ${#varr[@]} -ge 3 ]; then + parr=(${varr[2]//-/ }) # split patch substring on '-' + patch=${parr[0]} + if [ ${#parr[@]} -ge 2 ]; then + rc=${parr[1]} + fi + fi + fi + if [ -z "${rc}" ]; then + echo "${major}.${minor}.${patch}" "${major}" "${minor}" "${patch}" + else + echo "${major}.${minor}.${patch}-${rc}" "${major}" "${minor}" "${patch}" "${rc}" + fi +} + +# Compare two version strings, ignoring release candidate. +# +# Usage: compare_version +# +# Returns: +# -1 if version_x < version_y +# 0 if version_x == version_y +# 1 if version_x > version_y +# +# Examples: +# `compare_version 1.2.3 1.2.3` -> 0 +# `compare_version 1.2.3 1.2.4` -> -1 +# `compare_version 1.2.4 1.2.3` -> 1 +compare_version() +{ + local arr_x maj_x min_x patch_x + local arr_y maj_y min_y patch_y + + read -r _ maj_x min_x patch_x _ < <(split_version $1) + read -r _ maj_y min_y patch_y _ < <(split_version $2) + + arr_x=("${maj_x}" "${min_x}" "${patch_x}") + arr_y=("${maj_y}" "${min_y}" "${patch_y}") + + for i in $(seq 0 2); do + if ((arr_x[i] > arr_y[i])); then + echo 1 + return + elif ((arr_x[i] < arr_y[i])); then + echo -1 + return + fi + done + + echo 0 +} + +# Check if version_x is equal to version_y. +# +# Usage: version_eq +# +# Returns: true if version_x == version_y, false otherwise +# +# Examples: +# `version_eq 1.2.3 1.2.3` -> true +# `version_eq 1.2.3 1.2.4` -> false +version_eq() +{ + test "$(compare_version $1 $2)" -eq 0 +} + +# Check if version_x is less than version_y. +# +# Usage: version_lt +# +# Returns: true if version_x < version_y, false otherwise +# +# Examples: +# `version_lt 1.2.3 1.2.3` -> false +# `version_lt 1.2.3 1.2.4` -> true +version_lt() +{ + test "$(compare_version $1 $2)" -eq -1 +} + +# Check if version_x is greater than version_y. +# +# Usage: version_gt +# +# Returns: true if version_x > version_y, false otherwise +# +# Examples: +# `version_gt 1.2.3 1.2.3` -> false +# `version_gt 1.2.4 1.2.3` -> true +version_gt() +{ + test "$(compare_version $1 $2)" -eq 1 +} + +# Check if version_x is less than or equal to version_y. +# +# Usage: version_le +# +# Returns: true if version_x <= version_y, false otherwise +# +# Examples: +# `version_le 1.2.3 1.2.3` -> true +# `version_le 1.2.3 1.2.4` -> true +# `version_le 1.2.4 1.2.3` -> false +version_le() +{ + ! version_gt $1 $2 +} + +# Check if version_x is greater than or equal to version_y. +# +# Usage: version_ge +# +# Returns: true if version_x >= version_y, false otherwise +# +# Examples: +# `version_ge 1.2.3 1.2.3` -> true +# `version_ge 1.2.4 1.2.3` -> true +# `version_ge 1.2.3 1.2.4` -> false +version_ge() +{ + ! version_lt $1 $2 +} diff --git a/scripts/system/common.sh b/scripts/system/common.sh deleted file mode 120000 index f918132..0000000 --- a/scripts/system/common.sh +++ /dev/null @@ -1 +0,0 @@ -../common.sh \ No newline at end of file diff --git a/scripts/system/setup_system.sh b/scripts/system/setup_system.sh index 9601e3c..5afd8b1 100755 --- a/scripts/system/setup_system.sh +++ b/scripts/system/setup_system.sh @@ -1,6 +1,8 @@ -#!/bin/sh +#!/bin/bash # Setup Chaste system dependency versions on Ubuntu +script_dir="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" # https://stackoverflow.com/a/246128 +. ${script_dir}/../common.sh export DEBIAN_FRONTEND=noninteractive @@ -26,6 +28,7 @@ apt-get install -y --no-install-recommends \ doxygen \ git \ lcov \ + python-is-python3 \ python3 \ python3-dev \ python3-pip \ @@ -33,9 +36,8 @@ apt-get install -y --no-install-recommends \ valgrind # Chaste dependencies -codename="$(. /etc/os-release && echo ${VERSION_CODENAME} | sed 's/\.//')" -if [ "${codename}" = 'plucky' ]; then +if [ "${OS_VERSION_CODENAME}" = 'plucky' ]; then # Install manually: Ubuntu 25.04 Plucky Puffin repository not yet available apt-get install -y --no-install-recommends \ hdf5-tools \ @@ -55,7 +57,7 @@ if [ "${codename}" = 'plucky' ]; then libxerces-c-dev \ petsc-dev \ xsdcxx -elif [ "${codename}" = 'questing' ]; then +elif [ "${OS_VERSION_CODENAME}" = 'questing' ]; then # Install manually: Ubuntu 25.10 Questing Quokka repository not yet available apt-get install -y --no-install-recommends \ hdf5-tools \ @@ -78,17 +80,14 @@ elif [ "${codename}" = 'questing' ]; then else # Install from repository wget -O /usr/share/keyrings/chaste.asc https://chaste.github.io/chaste.asc - repo="deb [signed-by=/usr/share/keyrings/chaste.asc] https://chaste.github.io/ubuntu ${codename}/" + repo="deb [signed-by=/usr/share/keyrings/chaste.asc] https://chaste.github.io/ubuntu ${OS_VERSION_CODENAME}/" echo "${repo}" >/etc/apt/sources.list.d/chaste.list apt-get update && apt-get install -y --no-install-recommends chaste-dependencies fi # Workaround for libexpat1 issue on Ubuntu Jammy # https://bugs.launchpad.net/ubuntu/+source/expat/+bug/2058415 -if [ "${codename}" = 'jammy' ]; then +if [ "${OS_VERSION_CODENAME}" = 'jammy' ]; then apt-get install -y --allow-downgrades libexpat1=2.4.7-1 libexpat1-dev=2.4.7-1 apt-mark hold libexpat1 libexpat1-dev fi - -update-alternatives --install /usr/local/bin/python python /usr/bin/python3 10 -update-alternatives --install /usr/local/bin/pip pip /usr/bin/pip3 10 diff --git a/tests/test_common.sh b/tests/test_common.sh index b8351e3..3caf306 100644 --- a/tests/test_common.sh +++ b/tests/test_common.sh @@ -1,6 +1,6 @@ #!/bin/bash -eu -script_dir="$(cd "$(dirname "$0")"; pwd)" +script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . ${script_dir}/../scripts/common.sh test_split_version()