Toolchain: use new function to check filename and sha256sum of packages (#4909)

This commit is contained in:
he-zilong 2026-03-09 15:57:56 +08:00 committed by GitHub
parent 9a4037812a
commit 0ca8b53e62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 133 additions and 267 deletions

View file

@ -358,9 +358,6 @@ It should be safe to terminate running of this script in the middle of a build
process. The script will know if a package has been successfully installed and
will just carry on and recompile and install the last package it is working on.
This is true even if you lose the content of the entire ./build directory.
However, if you terminate when downloading packages, you will have to delete the
incomplete tarball as toolchain don't check existing ones and will give error
due to failing to uncompress an incomplete tarball.
Some packages are sensitive to the environment variables of their dependencies.
Therefore, if you use --with-PKG_A=system but encounter an error indicating that
@ -402,36 +399,48 @@ some hints and observations that may be useful:
LMod and Environment Modules. Users can load or unload modules to control
active environment variables and paths in runtime without conflicts. It is
recommended to check for available modules (with "module avail", "module
show" or similar commands) beforehand, and activate desired compatible
packages when running the toolchain script with "--with-PKG=system" options
to avoid repeated labour.
show" or similar commands) beforehand, and activate desired packages when
running the toolchain script with "--with-PKG=system" options so as to
avoid repeated labour. That said, actual compatibility between modules and
CP2K to be built may still take rounds of trial-and-error to confirm, and
resorting to "--with-PKG=install" can sometimes resolve problems if modules
turn out to be outdated, or compiled inconsistently, or not registering
complete variables and paths, or not built with GPU support on GPU machine,
etc. Please forward complaints about faulty modules to whoever responsible
for the server first before submitting any bug report to program developer.
(4) If no internet connection is available for downloading packages from public
resources on the server, an offline installation of toolchain and CP2K may
be carried out by downloading all packages elsewhere, transferring them to
server and placing them under the ./build directory. The toolchain script
will not attempt to download packages if they are already present in the
build directory with filenames reflecting the correct versions.
build directory, with filenames and sha256sum strings matching the records.
(5) An important common feature of clusters is the distinction of node types:
"login node", where users log in and perform tasks with low workload; and
"compute node", where resource-intensive computation jobs are carried out.
They may be hosted on separate machines, and their hardware specifications
(CPU, RAM, disk space, etc.) may be similar or different. Therefore, care
must be taken especially for the latter case; for instance, running
toolchain scripts on login node with "--target-cpu=native" (which is
default too if omitted) and executing CP2K on compute node afterwards may
result in poor performance or illegal instruction errors due to
discrepancies in CPU architectures and supported instruction sets, In this
case, the option with best portability for compiling programs at the cost
of reduced (non-optimal) performance is "--target-cpu=generic".
must be taken especially for the latter case. For instance, discrepancies
in CPU architectures and supported instruction sets may cause poor program
performance or illegal instruction errors if toolchain script is executed
on login node with "--target-cpu=native" (which is default too if omitted)
but CP2K is executed on compute node(s) afterwards. In this case, an option
"--target-cpu=generic" with best portability for compiling programs at the
cost of reduced (non-optimized) performance may be necessary.
(6) Again, be careful about the environment if CP2K is to be executed with job
submission scripts to the job queue system handling resource allocation.
Active environment variables and paths on the login node (by loading
modules, sourcing scripts, editing ~/.bashrc or /etc/profile files, etc.)
may NOT be active on the compute node where CP2K actually runs, unless all
appropriate commands are explicitly written in the job submission script.
Active environment variables and paths on the login node seen by user (by
loading modules, sourcing scripts, editing ~/.bashrc or /etc/profile files,
or entering commands interactively in general) may NOT be effective on the
compute node where CP2K actually runs, unless all appropriate commands are
written explicitly in the batch job submission script. For example, a
frequently encountered scenario with corrupted, interleaved output messages
stems from incorrect MPI library configuration launching multiple instances
of CP2K simultaneously instead of multi-process parallel execution of one
single instance; some possible culprits are that the ./install/setup file
is not sourced or the wrong module for MPI library is loaded at runtime.
EOF
}

View file

@ -73,7 +73,7 @@ fi
# -------------------------
if [ "${dry_run}" = "__TRUE__" ]; then
cat << EOF
Suggested cmake command if toolchain is built with your options:
Suggested cmake command if toolchain is built with your options:
cmake .. ${CMAKE_OPTIONS}
EOF
else

View file

@ -35,11 +35,7 @@ echo "==================== Getting proc arch info using OpenBLAS tools =========
openblas_dir="$(find_openblas_dir)"
# if cannot find openblas source dir, try download one
if ! [ "$openblas_dir" ]; then
if [ -f ${openblas_pkg} ]; then
echo "${openblas_pkg} is found"
else
download_pkg_from_cp2k_org "${openblas_sha256}" "${openblas_pkg}"
fi
retrieve_package "${openblas_sha256}" "${openblas_pkg}"
tar -xzf ${openblas_pkg}
openblas_dir="$(find_openblas_dir)"
fi

View file

@ -47,11 +47,7 @@ case "${with_cmake}" in
if verify_checksums "${install_lock_file}"; then
echo "cmake-${cmake_ver} is already installed, skipping it."
else
if [ -f cmake-${cmake_ver}-${cmake_arch}.${cmake_ext} ]; then
echo "cmake-${cmake_ver}-${cmake_arch}.${cmake_ext} is found"
else
download_pkg_from_cp2k_org "${cmake_sha256}" "cmake-${cmake_ver}-${cmake_arch}.${cmake_ext}"
fi
retrieve_package "${cmake_sha256}" "cmake-${cmake_ver}-${cmake_arch}.${cmake_ext}"
echo "Installing from scratch into ${pkg_install_dir}"
mkdir -p ${pkg_install_dir}
if [ "${cmake_arch}" = "macos-universal" ]; then

View file

@ -30,15 +30,10 @@ case "${with_gcc}" in
if verify_checksums "${install_lock_file}"; then
echo "gcc-${gcc_ver} is already installed, skipping it."
else
if [ -f gcc-${gcc_ver}.tar.gz ]; then
echo "gcc-${gcc_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${gcc_sha256}" "gcc-${gcc_ver}.tar.gz"
fi
retrieve_package "${gcc_sha256}" "gcc-${gcc_ver}.tar.gz"
echo "Installing GCC from scratch into ${pkg_install_dir}"
[ -d gcc-${gcc_ver} ] && rm -rf gcc-${gcc_ver}
tar -xzf gcc-${gcc_ver}.tar.gz
echo "Installing GCC from scratch into ${pkg_install_dir}"
cd gcc-${gcc_ver}
# Download prerequisites from cp2k.org because gcc.gnu.org returns 403 when queried from GCP.

View file

@ -29,11 +29,7 @@ case "${with_ninja}" in
if verify_checksums "${install_lock_file}"; then
echo "ninja-v${ninja_ver} is already installed, skipping it."
else
if [ -f ninja-v${ninja_ver}.tar.gz ]; then
echo "ninja-v${ninja_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${ninja_sha256}" "ninja-v${ninja_ver}.tar.gz"
fi
retrieve_package "${ninja_sha256}" "ninja-v${ninja_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
mkdir -p ${pkg_install_dir}
tar -xzf ninja-v${ninja_ver}.tar.gz

View file

@ -30,11 +30,7 @@ case "${with_mpich}" in
if verify_checksums "${install_lock_file}"; then
echo "mpich-${mpich_ver} is already installed, skipping it."
else
if [ -f ${mpich_pkg} ]; then
echo "${mpich_pkg} is found"
else
download_pkg_from_cp2k_org "${mpich_sha256}" "${mpich_pkg}"
fi
retrieve_package "${mpich_sha256}" "${mpich_pkg}"
echo "Installing from scratch into ${pkg_install_dir} for MPICH device ${MPICH_DEVICE}"
[ -d mpich-${mpich_ver} ] && rm -rf mpich-${mpich_ver}
tar -xzf ${mpich_pkg}

View file

@ -30,11 +30,7 @@ case "${with_openmpi}" in
if verify_checksums "${install_lock_file}"; then
echo "openmpi-${openmpi_ver} is already installed, skipping it."
else
if [ -f ${openmpi_pkg} ]; then
echo "${openmpi_pkg} is found"
else
download_pkg_from_cp2k_org "${openmpi_sha256}" "${openmpi_pkg}"
fi
retrieve_package "${openmpi_sha256}" "${openmpi_pkg}"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d openmpi-${openmpi_ver} ] && rm -rf openmpi-${openmpi_ver}
tar -xjf ${openmpi_pkg}

View file

@ -29,11 +29,7 @@ case "$with_gmp" in
if verify_checksums "${install_lock_file}"; then
echo "gmp-${gmp_ver} is already installed, skipping it."
else
if [ -f gmp-${gmp_ver}.tar.gz ]; then
echo "gmp-${gmp_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${gmp_sha256}" "gmp-${gmp_ver}.tar.gz"
fi
retrieve_package "${gmp_sha256}" "gmp-${gmp_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d gmp-${gmp_ver} ] && rm -rf gmp-${gmp_ver}
tar -xzf gmp-${gmp_ver}.tar.gz

View file

@ -29,12 +29,7 @@ case "${with_openblas}" in
if verify_checksums "${install_lock_file}"; then
echo "openblas-${openblas_ver} is already installed, skipping it."
else
if [ -f ${openblas_pkg} ]; then
echo "${openblas_pkg} is found"
else
download_pkg_from_cp2k_org "${openblas_sha256}" "${openblas_pkg}"
fi
retrieve_package "${openblas_sha256}" "${openblas_pkg}"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d OpenBLAS-${openblas_ver} ] && rm -rf OpenBLAS-${openblas_ver}
tar -zxf ${openblas_pkg}

View file

@ -31,11 +31,7 @@ case "$with_fftw" in
if verify_checksums "${install_lock_file}"; then
echo "fftw-${fftw_ver} is already installed, skipping it."
else
if [ -f ${fftw_pkg} ]; then
echo "${fftw_pkg} is found"
else
download_pkg_from_cp2k_org "${fftw_sha256}" "${fftw_pkg}"
fi
retrieve_package "${fftw_sha256}" "${fftw_pkg}"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d fftw-${fftw_ver} ] && rm -rf fftw-${fftw_ver}
tar -xzf ${fftw_pkg}

View file

@ -31,11 +31,7 @@ case "$with_greenx" in
if verify_checksums "${install_lock_file}"; then
echo "greenX-${greenx_ver} is already installed, skipping it."
else
if [ -f greenX-${greenx_ver}.tar.gz ]; then
echo "greenX-${greenx_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${greenx_sha256}" "greenX-${greenx_ver}.tar.gz"
fi
retrieve_package "${greenx_sha256}" "greenX-${greenx_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d greenX-${greenx_ver} ] && rm -rf greenX-${greenx_ver}
tar -xzf greenX-${greenx_ver}.tar.gz

View file

@ -47,16 +47,10 @@ case "$with_libint" in
if verify_checksums "${install_lock_file}"; then
echo "libint-${libint_ver} is already installed, skipping it."
else
if [ -f ${libint_pkg} ]; then
echo "${libint_pkg} is found"
else
download_pkg_from_cp2k_org "${libint_sha256}" "${libint_pkg}"
fi
retrieve_package "${libint_sha256}" "${libint_pkg}"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX} ] && rm -rf libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX}
tar -xJf ${libint_pkg}
echo "Installing from scratch into ${pkg_install_dir}"
cd libint-v${libint_ver}-cp2k-lmax-${LIBINT_LMAX}
# reduce debug information to level 1 since

View file

@ -27,11 +27,7 @@ case "$with_libxc" in
if verify_checksums "${install_lock_file}"; then
echo "libxc-${libxc_ver} is already installed, skipping it."
else
if [ -f libxc-${libxc_ver}.tar.bz2 ]; then
echo "libxc-${libxc_ver}.tar.bz2 is found"
else
download_pkg_from_cp2k_org "${libxc_sha256}" "libxc-${libxc_ver}.tar.bz2"
fi
retrieve_package "${libxc_sha256}" "libxc-${libxc_ver}.tar.bz2"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libxc-${libxc_ver} ] && rm -rf libxc-${libxc_ver}
tar -xjf libxc-${libxc_ver}.tar.bz2

View file

@ -36,13 +36,9 @@ case "$with_cosma" in
if verify_checksums "${install_lock_file}"; then
echo "COSMA-${cosma_ver} is already installed, skipping it."
else
if [ -f COSMA-v${cosma_ver}.tar.gz ]; then
echo "COSMA-v${cosma_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${cosma_sha256}" "COSMA-v${cosma_ver}.tar.gz"
download_pkg_from_cp2k_org "${costa_sha256}" "COSTA-v${costa_ver}.tar.gz"
download_pkg_from_cp2k_org "${tiled_mm_sha256}" "Tiled-MM-v${tiled_mm_ver}.tar.gz"
fi
retrieve_package "${cosma_sha256}" "COSMA-v${cosma_ver}.tar.gz"
retrieve_package "${costa_sha256}" "COSTA-v${costa_ver}.tar.gz"
retrieve_package "${tiled_mm_sha256}" "Tiled-MM-v${tiled_mm_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d COSMA-${cosma_ver} ] && rm -rf COSMA-${cosma_ver}
tar -xzf COSMA-v${cosma_ver}.tar.gz

View file

@ -34,19 +34,10 @@ EOF
if verify_checksums "${install_lock_file}"; then
echo "libxsmm-${libxsmm_ver} is already installed, skipping it."
else
if [ -f libxsmm-${libxsmm_ver}.tar.gz ]; then
echo "libxsmm-${libxsmm_ver}.tar.gz is found"
else
if ! download_pkg_from_cp2k_org "${libxsmm_sha256}" "libxsmm-${libxsmm_ver}.tar.gz"; then
download_pkg_from_urlpath "${libxsmm_sha256}" "${libxsmm_ver}.tar.gz" \
https://github.com/libxsmm/libxsmm/archive \
"libxsmm-${libxsmm_ver}.tar.gz"
fi
fi
retrieve_package "${libxsmm_sha256}" "libxsmm-${libxsmm_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libxsmm-${libxsmm_ver} ] && rm -rf libxsmm-${libxsmm_ver}
tar -xzf libxsmm-${libxsmm_ver}.tar.gz
echo "Installing from scratch into ${pkg_install_dir}"
# note that we do not have to set -L flags to ld for the
# linked math libraries for the libxsmm build, as for a
# library this is not required, you just have to provide

View file

@ -30,11 +30,7 @@ case "$with_scalapack" in
echo "scalapack-${scalapack_ver} is already installed, skipping it."
else
require_env MATH_LIBS
if [ -f ${scalapack_pkg} ]; then
echo "${scalapack_pkg} is found"
else
download_pkg_from_cp2k_org "${scalapack_sha256}" "${scalapack_pkg}"
fi
retrieve_package "${scalapack_sha256}" "${scalapack_pkg}"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d scalapack-${scalapack_ver} ] && rm -rf scalapack-${scalapack_ver}
tar -xzf ${scalapack_pkg}

View file

@ -49,11 +49,8 @@ case "${with_elpa}" in
echo "elpa-${elpa_ver} is already installed, skipping it."
else
require_env MATH_LIBS
if [ -f elpa-${elpa_ver}.tar.gz ]; then
echo "elpa-${elpa_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${elpa_sha256}" "elpa-${elpa_ver}.tar.gz"
fi
retrieve_package "${elpa_sha256}" "elpa-${elpa_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d elpa-${elpa_ver} ] && rm -rf elpa-${elpa_ver}
tar -xzf elpa-${elpa_ver}.tar.gz

View file

@ -35,13 +35,9 @@ case "$with_ace" in
if verify_checksums "${install_lock_file}"; then
echo "${ace_dir} aka Ace is already installed, skipping it."
else
if [ -f ${ace_pkg} ]; then
echo "${ace_pkg} is found"
else
download_pkg_from_cp2k_org "${ace_sha256}" "${ace_pkg}"
fi
[ -d ${ace_dir} ] && rm -rf ${ace_dir}
retrieve_package "${ace_sha256}" "${ace_pkg}"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d ${ace_dir} ] && rm -rf ${ace_dir}
tar -xzf ${ace_pkg}
cd ${ace_dir}

View file

@ -34,13 +34,9 @@ case "$with_deepmd" in
if verify_checksums "${install_lock_file}"; then
echo "libdeepmd_c-${deepmd_ver} is already installed, skipping it."
else
if [ -f ${deepmd_pkg} ]; then
echo "${deepmd_pkg} is found"
else
download_pkg_from_cp2k_org "${deepmd_sha256}" "${deepmd_pkg}"
fi
[ -d deepmd-kit-${deepmd_ver} ] && rm -rf deepmd-kit-${deepmd_ver}
retrieve_package "${deepmd_sha256}" "${deepmd_pkg}"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d deepmd-kit-${deepmd_ver} ] && rm -rf deepmd-kit-${deepmd_ver}
tar -xzf ${deepmd_pkg}
cd deepmd-kit-${deepmd_ver}/source

View file

@ -7,7 +7,7 @@
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
gsl_ver="2.8"
gls_sha256="6a99eeed15632c6354895b1dd542ed5a855c0f15d9ad1326c6fe2b2c9e423190"
gsl_sha256="6a99eeed15632c6354895b1dd542ed5a855c0f15d9ad1326c6fe2b2c9e423190"
source "${SCRIPT_DIR}"/common_vars.sh
source "${SCRIPT_DIR}"/tool_kit.sh
source "${SCRIPT_DIR}"/signal_trap.sh
@ -27,11 +27,7 @@ case "$with_gsl" in
if verify_checksums "${install_lock_file}"; then
echo "gsl-${gsl_ver} is already installed, skipping it."
else
if [ -f gsl-${gsl_ver}.tar.gz ]; then
echo "gsl-${gsl_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${gls_sha256}" "gsl-${gsl_ver}.tar.gz"
fi
retrieve_package "${gsl_sha256}" "gsl-${gsl_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d gsl-${gsl_ver} ] && rm -rf gsl-${gsl_ver}
tar -xzf gsl-${gsl_ver}.tar.gz

View file

@ -33,12 +33,7 @@ case "${with_libtorch}" in
if verify_checksums "${install_lock_file}"; then
echo "libtorch-${libtorch_ver} is already installed, skipping it."
else
if [ -f ${archive_file} ]; then
echo "${archive_file} is found"
else
download_pkg_from_cp2k_org "${libtorch_sha256}" "${archive_file}"
fi
retrieve_package "${libtorch_sha256}" "${archive_file}"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libtorch ] && rm -rf libtorch
[ -d ${pkg_install_dir} ] && rm -rf ${pkg_install_dir}

View file

@ -38,16 +38,10 @@ case "$with_plumed" in
if verify_checksums "${install_lock_file}"; then
echo "plumed-${plumed_ver} is already installed, skipping it."
else
if [ -f ${plumed_pkg} ]; then
echo "${plumed_pkg} is found"
else
download_pkg_from_cp2k_org "${plumed_sha256}" "${plumed_pkg}"
fi
retrieve_package "${plumed_sha256}" "${plumed_pkg}"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d plumed-${plumed_ver} ] && rm -rf plumed-${plumed_ver}
tar -xzf ${plumed_pkg}
echo "Installing from scratch into ${pkg_install_dir}"
cd plumed-${plumed_ver}
# disable generating debugging infos for now to work around an issue in gcc-10.2:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96354

View file

@ -28,11 +28,7 @@ case "$with_hdf5" in
if verify_checksums "${install_lock_file}"; then
echo "hdf5-${hdf5_ver} is already installed, skipping it."
else
if [ -f hdf5-${hdf5_ver}.tar.gz ]; then
echo "hdf5-${hdf5_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${hdf5_sha256}" "hdf5-${hdf5_ver}.tar.gz"
fi
retrieve_package "${hdf5_sha256}" "hdf5-${hdf5_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d hdf5-${hdf5_ver} ] && rm -rf hdf5-${hdf5_ver}
tar xf hdf5-${hdf5_ver}.tar.gz

View file

@ -32,11 +32,7 @@ case "${with_libsmeagol}" in
if verify_checksums "${install_lock_file}"; then
echo "libsmeagol-${libsmeagol_ver} is already installed, skipping it."
else
if [ -f libsmeagol-${libsmeagol_ver}.tar.gz ]; then
echo "libsmeagol-${libsmeagol_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${libsmeagol_sha256}" "libsmeagol-${libsmeagol_ver}.tar.gz"
fi
retrieve_package "${libsmeagol_sha256}" "libsmeagol-${libsmeagol_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libsmeagol-${libsmeagol_ver} ] && rm -rf libsmeagol-${libsmeagol_ver}
tar -xzf libsmeagol-${libsmeagol_ver}.tar.gz

View file

@ -35,12 +35,7 @@ case "$with_libvdwxc" in
if verify_checksums "${install_lock_file}"; then
echo "libvdwxc-${libvdwxc_ver} is already installed, skipping it."
else
if [ -f libvdwxc-${libvdwxc_ver}.tar.gz ]; then
echo "libvdwxc-${libvdwxc_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${libvdwxc_sha256}" "libvdwxc-${libvdwxc_ver}.tar.gz"
fi
retrieve_package "${libvdwxc_sha256}" "libvdwxc-${libvdwxc_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libvdwxc-${libvdwxc_ver} ] && rm -rf libvdwxc-${libvdwxc_ver}
tar -xzf libvdwxc-${libvdwxc_ver}.tar.gz

View file

@ -30,12 +30,7 @@ case "${with_libvori:=__INSTALL__}" in
if verify_checksums "${install_lock_file}"; then
echo "libvori-${libvori_ver} is already installed, skipping it."
else
if [ -f libvori-${libvori_ver}.tar.gz ]; then
echo "libvori-${libvori_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${libvori_sha256}" "libvori-${libvori_ver}.tar.gz"
fi
retrieve_package "${libvori_sha256}" "libvori-${libvori_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d libvori-${libvori_ver} ] && rm -rf libvori-${libvori_ver}
tar -xzf libvori-${libvori_ver}.tar.gz

View file

@ -27,12 +27,7 @@ case "$with_spglib" in
if verify_checksums "${install_lock_file}"; then
echo "spglib-${spglib_ver} is already installed, skipping it."
else
if [ -f spglib-${spglib_ver}.tar.gz ]; then
echo "spglib-${spglib_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${spglib_sha256}" "spglib-${spglib_ver}.tar.gz"
fi
retrieve_package "${spglib_sha256}" "spglib-${spglib_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
rm -rf spglib-${spglib_ver} "${pkg_install_dir}"
tar -xzf spglib-${spglib_ver}.tar.gz

View file

@ -34,12 +34,7 @@ case "$with_dftd4" in
if verify_checksums "${install_lock_file}"; then
echo "dftd4_dist-${dftd4_ver} is already installed, skipping it."
else
if [ -f dftd4-${dftd4_ver}.tar.gz ]; then
echo " dftd4-${dftd4_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${dftd4_sha256}" "dftd4-${dftd4_ver}.tar.gz"
fi
retrieve_package "${dftd4_sha256}" "dftd4-${dftd4_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d dftd4-${dftd4_ver} ] && rm -rf dftd4-${dftd4_ver}
tar -xzf dftd4-${dftd4_ver}.tar.gz
@ -125,7 +120,7 @@ export DFTD4="${DFTD4}"
export DFTD4_INCLUDE_DIRS="${DFTD4_INCLUDE_DIRS}"
export DFTD4_LINK_LIBRARIES="${DFTD4_LINK_LIBRARIES}"
export DFTD4_ROOT="${pkg_install_dir}"
export DFTD4_DFLAGS="${DFTD4_DFLAGS}"
export DFTD4_DFLAGS="${DFTD4_DFLAGS}"
export DFTD4_CFLAGS="${DFTD4_CFLAGS}"
export DFTD4_LDFLAGS="${DFTD4_LDFLAGS}"
export DFTD4_LIBS="${DFTD4_LIBS}"

View file

@ -30,12 +30,7 @@ case "${with_mcl:=__INSTALL__}" in
if verify_checksums "${install_lock_file}"; then
echo "libmcl-${mcl_ver} is already installed, skipping it."
else
if [ -f mcl-${mcl_ver}.tar.gz ]; then
echo "mcl-${mcl_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${mcl_sha256}" mcl-${mcl_ver}.tar.gz
fi
retrieve_package "${mcl_sha256}" mcl-${mcl_ver}.tar.gz
echo "Installing from scratch into ${pkg_install_dir}"
[ -d mcl-${mcl_ver} ] && rm -rf mcl-${mcl_ver}
tar -xzf mcl-${mcl_ver}.tar.gz

View file

@ -27,12 +27,7 @@ case "${with_pugixml}" in
if verify_checksums "${install_lock_file}"; then
echo "pugixml-${pugixml_ver} is already installed, skipping it."
else
if [ -f pugixml-${pugixml_ver}.tar.gz ]; then
echo "pugixml-${pugixml_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${pugixml_sha256}" "pugixml-${pugixml_ver}.tar.gz"
fi
retrieve_package "${pugixml_sha256}" "pugixml-${pugixml_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d pugixml-${pugixml_ver} ] && rm -rf pugixml-${pugixml_ver}
tar -xzf pugixml-${pugixml_ver}.tar.gz

View file

@ -101,12 +101,7 @@ case "$with_sirius" in
if verify_checksums "${install_lock_file}"; then
echo "sirius_dist-${sirius_ver} is already installed, skipping it."
else
if [ -f SIRIUS-${sirius_ver}.tar.gz ]; then
echo "sirius_${sirius_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${sirius_sha256}" "SIRIUS-${sirius_ver}.tar.gz"
fi
retrieve_package "${sirius_sha256}" "SIRIUS-${sirius_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d sirius-${sirius_ver} ] && rm -rf sirius-${sirius_ver}
tar -xzf SIRIUS-${sirius_ver}.tar.gz

View file

@ -27,18 +27,14 @@ case "${with_spfft}" in
if verify_checksums "${install_lock_file}"; then
echo "SpFFT-${spfft_ver} is already installed, skipping it."
else
if [ -f SpFFT-${spfft_ver}.tar.gz ]; then
echo "SpFFT-${spfft_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${spfft_sha256}" "SpFFT-${spfft_ver}.tar.gz"
fi
retrieve_package "${spfft_sha256}" "SpFFT-${spfft_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
if [ "${MATH_MODE}" = "mkl" ]; then
EXTRA_CMAKE_FLAGS="-DSPFFT_MKL=ON -DSPFFT_FFTW_LIB=MKL"
else
EXTRA_CMAKE_FLAGS=""
fi
echo "Installing from scratch into ${pkg_install_dir}"
[ -d SpFFT-${spfft_ver} ] && rm -rf SpFFT-${spfft_ver}
tar -xzf SpFFT-${spfft_ver}.tar.gz
cd SpFFT-${spfft_ver}

View file

@ -27,12 +27,7 @@ case "${with_spla}" in
if verify_checksums "${install_lock_file}"; then
echo "SpLA-${spla_ver} is already installed, skipping it."
else
if [ -f SpLA-${spla_ver}.tar.gz ]; then
echo "SpLA-${spla_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${spla_sha256}" "SpLA-${spla_ver}.tar.gz"
fi
retrieve_package "${spla_sha256}" "SpLA-${spla_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d SpLA-${spla_ver} ] && rm -rf SpLA-${spla_ver}
tar -xzf SpLA-${spla_ver}.tar.gz

View file

@ -34,12 +34,7 @@ case "$with_tblite" in
if verify_checksums "${install_lock_file}"; then
echo "tblite-${tblite_ver} is already installed, skipping it."
else
if [ -f tblite-${tblite_ver}.tar.xz ]; then
echo "tblite-${tblite_ver}.tar.xz is found"
else
download_pkg_from_cp2k_org "${tblite_sha256}" "tblite-${tblite_ver}.tar.xz"
fi
retrieve_package "${tblite_sha256}" "tblite-${tblite_ver}.tar.xz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d tblite-${tblite_ver} ] && rm -rf tblite-${tblite_ver}
tar -xJf tblite-${tblite_ver}.tar.xz
@ -144,7 +139,7 @@ export TBLITE="${TBLITE}"
export TBLITE_INCLUDE_DIRS="${TBLITE_INCLUDE_DIRS}"
export TBLITE_LINK_LIBRARIES="${TBLITE_LINK_LIBRARIES}"
export TBLITE_ROOT="${pkg_install_dir}"
export TBLITE_DFLAGS="${TBLITE_DFLAGS}"
export TBLITE_DFLAGS="${TBLITE_DFLAGS}"
export TBLITE_CFLAGS="${TBLITE_CFLAGS}"
export TBLITE_LDFLAGS="${TBLITE_LDFLAGS}"
export TBLITE_LIBS="${TBLITE_LIBS}"

View file

@ -34,15 +34,9 @@ case "$with_trexio" in
if verify_checksums "${install_lock_file}"; then
echo "trexio-${trexio_ver} is already installed, skipping it."
else
retrieve_package "${trexio_sha256}" "trexio-${trexio_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d trexio-${trexio_ver} ] && rm -rf trexio-${trexio_ver}
if [ -f trexio-${trexio_ver}.tar.gz ]; then
echo "trexio_${trexio_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${trexio_sha256}" "trexio-${trexio_ver}.tar.gz"
fi
tar -xzf trexio-${trexio_ver}.tar.gz
cd trexio-${trexio_ver}

View file

@ -27,11 +27,7 @@ case "${with_dbcsr}" in
if verify_checksums "${install_lock_file}"; then
echo "dbcsr-${dbcsr_ver} is already installed, skipping it."
else
if [ -f dbcsr-${dbcsr_ver}.tar.gz ]; then
echo "dbcsr-${dbcsr_ver}.tar.gz is found"
else
download_pkg_from_cp2k_org "${dbcsr_sha256}" "dbcsr-${dbcsr_ver}.tar.gz"
fi
retrieve_package "${dbcsr_sha256}" "dbcsr-${dbcsr_ver}.tar.gz"
echo "Installing from scratch into ${pkg_install_dir}"
[ -d dbcsr-${dbcsr_ver} ] && rm -rf dbcsr-${dbcsr_ver}
tar -xzf dbcsr-${dbcsr_ver}.tar.gz

View file

@ -615,25 +615,34 @@ read_with() {
esac
}
# helper routine to check integrity of downloaded files
# get checksum command based on OS type, inspired by part of gcc package
# (gcc-14.3.0/contrib/download_prerequisites)
get_checksum_cmd() {
local __os=$(uname)
local __chksum="sha256sum"
case $__os in
"Darwin" | "FreeBSD" | "DragonFly" | "AIX")
__chksum='shasum -a 256'
;;
"OpenBSD")
__chksum='sha256'
;;
*)
__chksum='sha256sum'
;;
esac
echo "$__chksum"
}
# helper routine to check integrity of files
# intended to be used as condition test in an if-then-else construct, because
# no extra actions are taken for missing file or failed match in this form
# usage: checksum sha256 filename
checksum() {
local __filename=$1
local __sha256=$2
local __shasum_command='sha256sum'
# check if we have sha256sum command, Mac OS X does not have
# sha256sum, but has an equivalent with shasum -a 256
if command -v "$__shasum_command" > /dev/null 2>&1 && ! ${__shasum_command} --version 2>&1 | grep -q 'Darwin'; then
__shasum_command='sha256sum'
else
__shasum_command="shasum -a 256"
fi
if echo "$__sha256 $__filename" | ${__shasum_command} --check; then
echo "Checksum of $__filename Ok"
else
rm -v ${__filename}
report_error "Checksum of $__filename could not be verified, abort."
return 1
fi
local __sha256="$1"
local __filename="$2"
local __shasum_command=$(get_checksum_cmd)
echo "$__sha256 $__filename" | ${__shasum_command} --check
}
# downloader for the package tars, includes checksum
@ -651,7 +660,13 @@ download_pkg_from_urlpath() {
return 1
fi
# checksum
checksum "${__outfile}" "${__sha256}"
if checksum "${__sha256}" "${__outfile}"; then
echo "Checksum of $__filename Ok"
else
rm -vf "${__outfile}"
report_error "Checksum of $__filename could not be verified, abort."
return 1
fi
}
# download from CP2K.org
@ -660,18 +675,30 @@ download_pkg_from_cp2k_org() {
download_pkg_from_urlpath "$1" "$2" https://www.cp2k.org/static/downloads
}
# retrieve package under current directory with filename and checksum verification
# if file exists and checksum is correct, only print a message
# if file exists but checksum is incorrect, delete and re-download from cp2k.org
# if file does not exist, download from cp2k.org
retrieve_package() {
local __sha256="$1"
local __filename="$2"
if ! [ -f "${__filename}" ]; then
download_pkg_from_cp2k_org "${__sha256}" "${__filename}"
else
if ! checksum "${__sha256}" "${__filename}"; then
echo "$__filename is found but checksum is wrong; delete and re-download"
rm -vf "${__filename}"
download_pkg_from_cp2k_org "${__sha256}" "${__filename}"
else
echo "$__filename is found and checksum is right"
fi
fi
}
# verify the checksums inside the given checksum file
verify_checksums() {
local __checksum_file=$1
local __shasum_command='sha256sum'
# check if we have sha256sum command, Mac OS X does not have
# sha256sum, but has an equivalent with shasum -a 256
if command -v "$__shasum_command" > /dev/null 2>&1 && ! ${__shasum_command} --version 2>&1 | grep -q 'Darwin'; then
__shasum_command='sha256sum'
else
__shasum_command="shasum -a 256"
fi
local __shasum_command=$(get_checksum_cmd)
${__shasum_command} --check "${__checksum_file}" > /dev/null 2>&1
}
@ -680,15 +707,7 @@ verify_checksums() {
write_checksums() {
local __checksum_file=$1
shift # remove output file from arguments to be able to pass them along properly quoted
local __shasum_command='sha256sum'
# check if we have sha256sum command, Mac OS X does not have
# sha256sum, but has an equivalent with shasum -a 256
if command -v "$__shasum_command" > /dev/null 2>&1 && ! ${__shasum_command} --version 2>&1 | grep -q 'Darwin'; then
__shasum_command='sha256sum'
else
__shasum_command="shasum -a 256"
fi
local __shasum_command=$(get_checksum_cmd)
${__shasum_command} "${VERSION_FILE}" "$@" > "${__checksum_file}"
}