PKGBUILD 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. # Maintainer: eDgar contact edgar At open mail Dot Cc
  2. pkgname=(
  3. "getfem-git"
  4. "getfem-docs"
  5. # "getfem-git-docs"
  6. )
  7. realname=getfem
  8. pkgver=5.4.1.r41.g9ac4e7f2
  9. pkgrel=1
  10. pkgdesc="A finite element framework to solve partial differential equations"
  11. arch=('x86_64')
  12. url="http://getfem.org"
  13. license=('LGPL3')
  14. makedepends=("m4" "automake" "doxygen" "parallel")
  15. source=("${realname}::git+https://git.savannah.nongnu.org/git/${realname}.git"
  16. "http://download-mirror.savannah.gnu.org/releases/getfem/doc/getfem-5.4.1-docs-html.tar.gz")
  17. md5sums=('SKIP'
  18. '98a8df7266f4237b5ff896dc8701bc61')
  19. generic_flags="-fPIC -fopenmp -O3 -march=x86_64 -mtune=generic"
  20. export COPTFLAGS=-O3
  21. export CPPOPTFLAGS=-O3
  22. export CXXOPTFLAGS=-O3
  23. export CFLAGS="$generic_flags -I/usr/include/scotch -L/usr/lib/openmpi/"
  24. # Fortify is optional
  25. export CPPFLAGS="$generic_flags -O2 -D_FORTIFY_SOURCE=2 -I/usr/include/scotch"
  26. export CXXFLAGS="$generic_flags -O2 -D_FORTIFY_SOURCE=2 -I/usr/include/scotch"
  27. export FFLAGS="$generic_flags"
  28. export FCFLAGS="$generic_flags"
  29. export F90FLAGS="$generic_flags"
  30. export F77FLAGS="$generic_flags"
  31. [[ -f /usr/bin/mpicxx ]] &&
  32. export MPICXX=/usr/bin/mpicxx # CXX=/usr/bin/mpicxx CPP=/usr/bin/mpicxx
  33. [[ -f /usr/bin/mpicc ]] &&
  34. export MPICC=/usr/bin/mpicc # CC=/usr/bin/mpicc
  35. export LANG=en_IE.UTF-8 LANGUAGE=en_IE.UTF-8 LC_ALL=en_IE.UTF-8
  36. # to allow mpi (not working from config) ########
  37. export LIBS="-ldmumps -lmpi -fopenmp -Wl,-rpath -Wl,/usr/lib -Wl,-rpath -Wl,/lib -Wl,-rpath -Wl,/usr/lib -Wl,-rpath -Wl,/usr/lib/openmpi -lmpi -lpord -lblas -lscotch -lmumps_common -llapack -lopenblas -lesmumps -lptscotch -lptscotcherr -lmetis -lpthread -lstdc++ -fopenmp"
  38. export MUMPS_LIBS="-ldmumps -lmpi -fopenmp -Wl,-rpath -Wl,/usr/lib -Wl,-rpath -Wl,/lib -Wl,-rpath -Wl,/usr/lib -Wl,-rpath -Wl,/usr/lib/openmpi -lmpi -lpord -lblas -lscotch -lmumps_common -llapack -lopenblas -lesmumps -lptscotch -lptscotcherr -lmetis -lpthread -lstdc++ -fopenmp"
  39. #################################################
  40. pkgver() {
  41. cd "${srcdir}/${realname}"
  42. git describe --long --tags --match '*.*' | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/_//;s/^v//g;'
  43. }
  44. prepare(){
  45. cd "${realname}"
  46. ./autogen.sh
  47. }
  48. build() {
  49. cd "${realname}"
  50. local config_file="${srcdir}/${realname}"/configure
  51. local CONFOPTS=(
  52. # Less verbose
  53. --quiet
  54. --enable-silent-rules
  55. # Directories configuratoin
  56. --srcdir="${srcdir}/${realname}"
  57. # target directory
  58. --prefix=/usr
  59. # read-only single-machine data (Make.common)
  60. --sysconfdir=/etc
  61. # Binary directory
  62. --bindir=/usr/bin
  63. # Base data dir (affects doc and others)
  64. --datadir=/usr/share
  65. # Make sure that the documentation is in the right place
  66. --docdir=/usr/share/doc/${realname}
  67. # use relative addresses for jumps
  68. --with-pic
  69. # get -march flag for this system
  70. --enable-march
  71. # shared libraries
  72. --enable-shared
  73. # Python interface
  74. --enable-python
  75. )
  76. # BLAS: calls for basic algebra routines
  77. if [[ "$(ldconfig -p | grep libopenblas.so)" \
  78. =~ "libopenblas.so" ]]; then
  79. CONFOPTS=( "${CONFOPTS[@]}"
  80. --enable-blas-interface
  81. --enable-blas64-support)
  82. fi
  83. # METIS support (automatic meshing partitioning)
  84. if [[ $(ldconfig -p | grep libmetis.so) \
  85. =~ "libmetis.so" ]]; then
  86. CONFOPTS=( "${CONFOPTS[@]}" --enable-metis)
  87. fi
  88. # Parallel support
  89. if [[ $(ldconfig -p | grep libmpi.so) =~ "libmpi.so" ]] &&
  90. [[ "$(ldconfig -p | grep libomp.so)" \
  91. =~ "libomp.so" ]]; then
  92. CONFOPTS=( "${CONFOPTS[@]}"
  93. --enable-paralevel
  94. --enable-multithread-blas)
  95. fi
  96. # MUMPS library. A direct solver for large sparse linear
  97. # systems.
  98. if [[ "$(ldconfig -p | grep libmumps_common.so )" \
  99. =~ "libmumps_common.so" ]]; then
  100. if [[ "${CONFOPTS[@]}" \
  101. =~ "--enable-paralevel" ]]; then
  102. CONFOPTS=( "${CONFOPTS[@]}" --enable-par-mumps )
  103. # CONFOPTS=( "${CONFOPTS[@]}"
  104. # # doc/sphinx/source/userdoc/linalg.rst
  105. # --with-mumps-include-dir="-I/usr/include"
  106. # --with-mumps="-lmumps_common"
  107. # )
  108. elif [[ ! "$(ldconfig -p | grep libmumps_seq.so )" \
  109. =~ "libmumps_seq.so" ]]; then
  110. --enable-mumps=no
  111. fi;
  112. fi;
  113. # OpenMP: 64 bits integer blas and lapack
  114. if [[ "$(ldconfig -p | grep libomp.so)" \
  115. =~ "libomp.so" ]]; then
  116. CONFOPTS=( "${CONFOPTS[@]}" )
  117. fi
  118. # OpenMP: Multi-threaded version of GetFEM
  119. if [[ "$(ldconfig -p | grep libomp.so)" \
  120. =~ "libomp.so" ]]; then
  121. CONFOPTS=( "${CONFOPTS[@]} --enable-openmp" )
  122. fi
  123. # qhull library (required for generation of non regular
  124. # meshes)
  125. if [[ "$(ldconfig -p | grep libqhull.so)" \
  126. =~ "libqhull.so" ]]; then
  127. CONFOPTS=( "${CONFOPTS[@]} --enable-qhull")
  128. fi
  129. # SuperLU (sparse linear systems)
  130. if [[ "$(ldconfig -p | grep libsuperlu.so)" \
  131. =~ "libsuperlu.so" ]]; then
  132. CONFOPTS=( "${CONFOPTS[@]} --enable-superlu")
  133. fi
  134. for (( i=1; i<=${#CONFOPTS[@]}; i++)); do
  135. echo "${CONFOPTS[$i]}";
  136. done
  137. $config_file $(for (( i=1; i<=${#CONFOPTS[@]}; i++)); do
  138. echo "${CONFOPTS[$i]}";
  139. done)
  140. make
  141. }
  142. package_getfem-git() {
  143. # package() {
  144. depends=('python-numpy' 'python-scipy')
  145. optdepends=('blas' 'lapack' 'metis' 'mumps' 'openblas'
  146. 'openmp' 'qd' 'qhull' 'superlu' "getfem-docs")
  147. provides=('gmm')
  148. conflicts=('gmm' 'getfem')
  149. cd "${realname}"
  150. make DESTDIR="$pkgdir/" install
  151. [[ -d "${pkgdir}/etc/share/getfem" ]] ||
  152. mkdir -p "${pkgdir}/etc/share/getfem"
  153. mv "${pkgdir}/usr/getfem_toolbox" "${pkgdir}/etc/share/getfem"
  154. }
  155. # ==== Work in progress ====
  156. # # package() {
  157. # package_getfem-git-docs() {
  158. # provides=('getfem-docs')
  159. # conflicts=('getfem-docs')
  160. # depends=('getfem-git')
  161. # cd "${realname}"
  162. # mkdir -p ${pkgdir}/usr/share/doc/getfem
  163. # sed -i "s%OUTPUT_DIRECTORY.*%OUTPUT_DIRECTORY=${pkgdir}/usr/share/doc/getfem%g" doc/doxygen/Doxyfile
  164. # doxygen doc/doxygen/Doxyfile
  165. # # make -f doc/sphinx/Makefile # cd doc/sphinx
  166. # # make DESTDIR="${pkgdir}"/usr/share/doc/"${realname}"/ html
  167. # # make DESTDIR="${pkgdir}"/usr/share/doc/"${realname}"/ latex
  168. # }
  169. package_getfem-docs() {
  170. provides=('getfem-docs')
  171. conflicts=('getfem-docs')
  172. depends=('getfem-git')
  173. # Documentation from the web
  174. version=$(printf "%s" "${pkgver}" |
  175. sed 's_\([[:digit:]].[[:digit:]].[[:digit:]]\).*_\1_g')
  176. cd "${srcdir}"/"${realname}"-${version}-docs-html
  177. install -d "${pkgdir}"/usr/share/doc/getfem/html/
  178. # Try to get the number of cpus for parallel
  179. ncpus="$(printf "%s" "${MAKEFLAGS}" | sed 's_.*\(-j[[:digit:]]+\).*_\1_g')"
  180. parallel "${ncpus}" install \
  181. -D {} "${pkgdir}"/usr/share/doc/getfem/html/{}\
  182. ::: "$(find . -type f)"
  183. # Doxygen (reference)
  184. cd "${srcdir}"/"${realname}"
  185. mkdir -p ${pkgdir}/usr/share/doc/getfem
  186. sed -i "s%OUTPUT_DIRECTORY.*%OUTPUT_DIRECTORY=${pkgdir}/usr/share/doc/getfem%g" doc/doxygen/Doxyfile
  187. doxygen doc/doxygen/Doxyfile
  188. }