PKGBUILD 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. # Maintainer: gborzi <gborzi@ieee.org>
  2. # Contributor: mickele <mimocciola@yahoo.com>
  3. pkgname=('gmsh' 'gmsh-docs')
  4. pkgver=4.8.4
  5. pkgrel=4
  6. pkgdesc="An automatic 3D finite element mesh generator with pre and post-processing facilities."
  7. arch=('x86_64')
  8. url="http://gmsh.info/"
  9. license=('custom')
  10. makedepends=('cmake' 'desktop-file-utils' 'sed' 'swig' 'texlive-core' 'voro++'
  11. 'fltk' 'med' 'opencascade' 'cairo' 'metis' 'alglib'
  12. 'glu' "hypre=2.18.2")
  13. optdepends=(
  14. "openmpi: Parallel processing (not used for meshing)"
  15. "openmp: Parallel distributed tasks"
  16. "eigen: Lightweight C++ template library for vector and matrix math"
  17. "cgns: recording and recovering numerical data"
  18. "gmm: finite element library (alternative to PETSc)"
  19. "petsc: toolkit for scientific computation"
  20. "hypre=2.18.2: Large and sparse linear with massive parallel computing (for PETSc)"
  21. "mumps: sparse solver library"
  22. "hxt: haskell xml library (for reparametrization and meshing)"
  23. "lapack: linear algebra library (if Eigen unavailable)"
  24. "blas: linear algebra subroutines (if Eigen unavailable)")
  25. options=(!emptydirs)
  26. source=("${url}src/${pkgname}-${pkgver}-source.tgz"
  27. gmsh.desktop
  28. gmsh.completion)
  29. sha256sums=('760dbdc072eaa3c82d066c5ba3b06eacdd3304eb2a97373fe4ada9509f0b6ace'
  30. '43a8ca33ac917ee7196fdae305ff2c8cb9ae1072569ee546c0ce8ff580c966ae'
  31. '11605e97636a56cf51e445e65019526ee253bd2e0553fb71ba6d94488dcd34ef')
  32. # From UPC: Building And Using Static And Shared "C"
  33. # Libraries.html
  34. # #+begin_QUOTE
  35. # we need that all jump calls ("goto", in assembly speak)
  36. # and subroutine calls will use relative addresses, and not
  37. # absolute addresses. Thus, we need to use ... ~-fPIC~ or
  38. # ~-fpic~
  39. # #+end_QUOTE
  40. #
  41. # From makepkg.conf
  42. # -march (or -mcpu) builds exclusively for an architecture
  43. # -mtune optimizes for an architecture, but builds for
  44. # whole processor family
  45. #
  46. # -O3 optimises
  47. #
  48. # -D-FORTIFY-SOURCE=2
  49. # | https://stackoverflow.com/a/16604146
  50. # |- man 7 feature_test_macros
  51. # checks to be performed to detect some buffer overflow
  52. # errors when employing various string and memory
  53. # manipulation functions ... some conforming programs
  54. # might fail
  55. #
  56. # -fcf-protection
  57. # | Info pages for gcc (gnu compiler collection)
  58. # intended to protect against such threats as
  59. # Return-oriented Programming (ROP), and similarly
  60. # call/jmp-oriented programming (COP/JOP)
  61. #
  62. # -pipe
  63. # | Info pages for gcc (controlling the kind of output)
  64. # Use pipes rather than temporary files for communication
  65. # between the various stages of compilation
  66. #
  67. # -fno-plt
  68. # | Info pages for gcc (code generation conventions)
  69. # leads to more efficient code by eliminating PLT stubs and
  70. # exposing GOT loads to optimizations
  71. #
  72. # -fopenmp
  73. # | Info pages for gcc (controlling c dialect)
  74. # Enable handling of OpenMP directives
  75. #
  76. safe_flags="-Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS"
  77. safe_flags+=" -fcf-protection -fno-plt"
  78. safe_flags+=" -fstack-clash-protection -Wformat"
  79. safe_flags+=" -Werror=format-security"
  80. generic_flags="-pipe -fno-plt -fPIC -fopenmp -march=amdfam10"
  81. generic_flags+=" -mtune=native ${safe_flags}"
  82. opt_flags="${generic_flags} -O3"
  83. generic_flags="${generic_flags} -O2"
  84. COPTFLAGS="${opt_flags}"
  85. CXXOPTFLAGS="$COPTFLAGS"
  86. FOPTFLAGS="$COPTFLAGS"
  87. CPPFLAGS="$generic_flags"
  88. CXXFLAGS="$CPPFLAGS"
  89. CFLAGS="$generic_flags"
  90. FFLAGS="$generic_flags"
  91. FCFLAGS="$generic_flags"
  92. F90FLAGS="$generic_flags"
  93. F77FLAGS="$generic_flags"
  94. export LANG=en
  95. export MAKEFLAGS="-j4"
  96. _install_dir="/usr/local/petsc/${_config}"
  97. _petsc_arch="arch-${_config}"
  98. prepare() {
  99. cd "${srcdir}/${pkgname}-${pkgver}-source"
  100. # Help links to local doc (package gmsh-docs)
  101. sed -e "s|https://gmsh.info/doc/texinfo/|" \
  102. "file:///usr/share/doc/gmsh/gmsh.html|" \
  103. -i Fltk/graphicWindow.cpp
  104. sed -e "s|https://gmsh.info/|" \
  105. "file:///usr/share/licenses/gmsh/|" \
  106. -i Fltk/helpWindow.cpp
  107. }
  108. build() {
  109. cd "${srcdir}/${pkgname}-${pkgver}-source"
  110. mkdir -p build
  111. cd build
  112. # Read cmake_options.texi
  113. CONFOPTS=(
  114. -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo"
  115. -DCMAKE_INSTALL_PREFIX:PATH=/usr
  116. -DCMAKE_PREFIX_PATH:PATH="/usr"
  117. -DDMUMPS_INC:PATH="/usr/include"
  118. -DCGNS_LIB:FILEPATH="/usr/lib/lib/libcgns.so"
  119. -DENABLE_ANN:BOOL="0"
  120. -DENABLE_BUILD_DYNAMIC:BOOL="1"
  121. -DENABLE_BUILD_LIB:BOOL="1"
  122. -DENABLE_BUILD_SHARED:BOOL="1"
  123. -DENABLE_GRAPHICS:BOOL="1"
  124. -DENABLE_MPI:BOOL="1"
  125. -DENABLE_MUMPS:BOOL="1"
  126. -DENABLE_NCURSES:BOOL="1"
  127. -DENABLE_OCC_TBB:BOOL="1"
  128. -DENABLE_OPENMP:BOOL="1"
  129. -DENABLE_POPPLER:BOOL="1"
  130. -DENABLE_PETSC:BOOL="1"
  131. -DENABLE_SLEPC:BOOL="0"
  132. -DENABLE_ZIPPER:BOOL="1"
  133. # Disabled: private API is unsupported
  134. -DENABLE_PRIVATE_API:BOOL="0"
  135. -DENABLE_NUMPY:BOOL="0"
  136. -DENABLE_PETSC4PY:BOOL="0"
  137. -DENABLE_WRAP_PYTHON:BOOL="0"
  138. )
  139. cmake $(for (( i=1; i<=${#CONFOPTS[@]}; i++)); do
  140. echo "${CONFOPTS[$i]}";
  141. done) "${srcdir}/${pkgname}-${pkgver}-source"
  142. # make clean
  143. make
  144. LC_ALL=C make doc
  145. }
  146. package_gmsh() {
  147. depends=('fltk' 'med' 'opencascade' 'cairo' 'metis' 'alglib'
  148. 'glu' "petsc")
  149. optdepends=(
  150. 'gmsh-docs: docs for gmsh'
  151. 'python2: for gmsh.py'
  152. 'python: for gmsh.py'
  153. 'julia: for gmsh.jl'
  154. "hypre=2.18.2: Large and sparse linear with massive parallel computing (for PETSc)"
  155. 'ann: nearest neighbour'
  156. )
  157. # TODO make sure that "${srcdir}" is not in package
  158. _src_dir="${srcdir}/${pkgname}-${pkgver}-source"
  159. _build_dir="${_src_dir}"/build
  160. cd "${_build_dir}"
  161. # Install Python and Julia API
  162. make DESTDIR=${pkgdir} install
  163. install -D -m644 "${pkgdir}/usr/lib/gmsh.py" \
  164. "${pkgdir}"/usr/share/gmsh/api/python/gmsh.py
  165. install -D -m644 "${pkgdir}/usr/lib/gmsh.jl" \
  166. "${pkgdir}"/usr/share/gmsh/api/julia/gmsh.jl
  167. rm -f "${pkgdir}"/usr/lib/gmsh.{py,jl}
  168. install -d "${pkgdir}"/etc/profile.d
  169. cd "${pkgdir}"/etc/profile.d/
  170. printf "%s%s\n" 'export JULIA_LOAD_PATH=' \
  171. '"/usr/share/gmsh/api/julia/:$JULIA_LOAD_PATH"'\
  172. > gmsh.sh
  173. printf "%s%s\n" 'setenv JULIA_LOAD_PATH ' \
  174. '"/usr/share/gmsh/api/julia/:$JULIA_LOAD_PATH"' \
  175. > gmsh.csh
  176. cd "${_build_dir}"
  177. install -d "${pkgdir}"/usr/share/pixmaps/"${pkgname}"
  178. install -m644 "${_src_dir}"/utils/icons/*.png \
  179. "${pkgdir}/usr/share/pixmaps/${pkgname}"
  180. install -D -m644 "${_src_dir}"/utils/icons/gmsh-no-text.png \
  181. "${pkgdir}/usr/share/icons/${pkgname}.png"
  182. desktop-file-install --dir="${pkgdir}/usr/share/applications" \
  183. "${srcdir}/${pkgname}.desktop"
  184. install -D -m 644 "${_src_dir}"/LICENSE.txt \
  185. "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE.txt
  186. install -D -m 644 "${_src_dir}"/CREDITS.txt \
  187. "${pkgdir}"/usr/share/licenses/"${pkgname}"/CREDITS.txt
  188. install -D -m644 "${srcdir}"/gmsh.completion \
  189. "${pkgdir}"/etc/bash_completion.d/gmsh
  190. # Hackish way to save the documentation (for gmsh-docs)
  191. mv "${pkgdir}"/usr/share/doc "${pkgdir}"/..
  192. }
  193. package_gmsh-docs() {
  194. pkgdesc="TXT, HMTL and PDF doc for Gmsh"
  195. arch=('any')
  196. license=('GPL2')
  197. # TODO make sure that "${srcdir}" is not in package
  198. _src_dir="${srcdir}/${pkgbase}-${pkgver}-source"
  199. _build_dir="${_src_dir}"/build
  200. cd ${_build_dir}
  201. bsdtar -xf ${pkgbase}-${pkgver}-*.tgz
  202. cd "${_src_dir}"/build/doc/texinfo
  203. install -D -m644 gmsh.html "${pkgdir}"/usr/share/doc/gmsh/gmsh.html
  204. install -D -m644 gmsh.txt "${pkgdir}"/usr/share/doc/gmsh/gmsh.txt
  205. install -D -m644 gmsh.pdf "${pkgdir}"/usr/share/doc/gmsh/gmsh.pdf
  206. install -D -m644 gmsh.info "${pkgdir}"/usr/share/info/gmsh.info
  207. # Get the texinfo pages in the right place
  208. install -D -m644 "${_src_dir}/doc/texinfo/gmsh.info-1" \
  209. "${pkgdir}/usr/share/info/gmsh.info-1"
  210. install -D -m644 "${_src_dir}/doc/texinfo/gmsh.info-2" \
  211. "${pkgdir}/usr/share/info/gmsh.info-2"
  212. # Hackish way to retrieve the documentation (for gmsh-docs)
  213. [ -d "${pkgdir}"/../doc ] &&
  214. mv "${pkgdir}"/../doc/gmsh/* "${pkgdir}"/usr/share/doc/gmsh/
  215. # Generate and save Doxygen documentation
  216. cd "${_build_dir}"/
  217. doxygen "${_src_dir}"/doc/doxygen/Doxyfile
  218. cp -a doc/html "${pkgdir}"/usr/share/doc/gmsh/
  219. }