fenics-build.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env bash
  2. # Script to build and install dolfin_warp with its
  3. # dependencies (assumes that external packages are ready in
  4. # the directory)
  5. sudo torsocks pacman -Sy
  6. # Install PETSc's (optional and hard) dependencies (from
  7. # cache files)
  8. unset deps
  9. for i in gcc gcc-fortran cmake sowing pkgconf git cython chrpath openmpi lapack libpng libyaml fftw zlib python-mpi4py python-numpy eigen openblas boost cgns gdb hdf5 hwloc metis netcdf-openmpi opencl-headers opencl openmp scotch suitesparse superlu; do
  10. # Build list of cache files
  11. file=$(ls /var/cache/pacman/pkg/"${i}"-*.pkg.tar.{xz,zst} \
  12. 2>/dev/null |
  13. sort -r | head -n 1)
  14. # Inform which are found and which aren't
  15. printf "%s" "${file}... "
  16. [ -f "${file}" ] &&
  17. deps=( ${deps[@]} $file) && printf "ok\n" ||
  18. printf "${i} missing\n"
  19. done;
  20. # Download dependencies from repositories
  21. sudo torsocks pacman -Uw ${deps[@]}
  22. # Check type of package (zst, xz...)
  23. pkgtype=$(
  24. awk -F"=" \
  25. '/^[[:space:]]*[^#]*PKGEXT/{gsub("'"'"'", ""); print $NF}' \
  26. /etc/makepkg.conf)
  27. # These packages are not in Parabola's official repos
  28. printf "Make sure to have the ${pkgtype} of:\n"
  29. printf " hypre med mumps petsc scalapack \n"
  30. printf "Now, hit RET to continue\n"
  31. read
  32. deps=( ${deps[@]}
  33. $(ls {petsc,hypre,med,mumps,scalapack}*.pkg.tar.{xz,zst}\
  34. 2>/dev/null) )
  35. set -e
  36. sudo pacman -U --asdep ${deps[@]}
  37. unset deps
  38. # Build and install needed FEniCS packages
  39. for i in python-ufl-tar python-fiat-tar python-dijitso-tar python-ffc-tar dolfin-tar python-dolfin-tar dolfin_warp; do
  40. cd "$i";
  41. pwd;
  42. git checkout master 1>/dev/null;
  43. # Retrieve dependencies from PKGBUILD and install them
  44. # (skip local packages)
  45. sudo torsocks pacman -S --noconfirm --asdep --needed \
  46. $(makepkg --printsrcinfo |
  47. grep -v "\(dijitso\|dolfin\|fiat\|ffc\|ufl\|hypre\|med\|mumps\|petsc\|scalapack\)" |
  48. awk '/^[[:space:]]*(make)*depends =/{print $NF}')
  49. for pak in *"${pkgtype}"; do mv "$pak"{,.bak} || break; done
  50. # Build
  51. makepkg -moC && makepkg -er;
  52. # Install
  53. sudo pacman -U --noconfirm *"${pkgtype}"
  54. cd -
  55. done
  56. set +e