PKGBUILD 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # Maintainer: Alexander Susha <isushik94@gmail.com>
  2. _base=xtensor-blas
  3. pkgname=xtensor-${_base}-git
  4. pkgver=0.19.1.9.g7ceb791
  5. pkgrel=1
  6. pkgdesc="QuantStack tools library - Multi-dimensional arrays with broadcasting and lazy computing."
  7. arch=('x86_64')
  8. url="https://github.com/QuantStack/${_base}"
  9. license=('BSD-3-Clause')
  10. depends=('xtensor>=0.19.0' 'blas' 'lapack')
  11. makedepends=('cmake')
  12. source=("git+${url}")
  13. md5sums=('SKIP')
  14. provides=("$[_base]=$(printf ${pkgver} | cut -d'.' -f1,2,3)")
  15. replaces=("$[_base]")
  16. conflicts=("${_base}")
  17. # From UPC: Building And Using Static And Shared "C"
  18. # Libraries.html
  19. # #+begin_QUOTE
  20. # we need that all jump calls ("goto", in assembly speak)
  21. # and subroutine calls will use relative addresses, and not
  22. # absolute addresses. Thus, we need to use ... ~-fPIC~ or
  23. # ~-fpic~
  24. # #+end_QUOTE
  25. #
  26. # From makepkg.conf
  27. # -march (or -mcpu) builds exclusively for an architecture
  28. # -mtune optimizes for an architecture, but builds for
  29. # whole processor family
  30. #
  31. # -O3 optimises
  32. #
  33. # -D-FORTIFY-SOURCE=2
  34. # | https://stackoverflow.com/a/16604146
  35. # |- man 7 feature_test_macros
  36. # checks to be performed to detect some buffer overflow
  37. # errors when employing various string and memory
  38. # manipulation functions ... some conforming programs
  39. # might fail
  40. #
  41. # -fcf-protection
  42. # | Info pages for gcc (gnu compiler collection)
  43. # intended to protect against such threats as
  44. # Return-oriented Programming (ROP), and similarly
  45. # call/jmp-oriented programming (COP/JOP)
  46. #
  47. # -pipe
  48. # | Info pages for gcc (controlling the kind of output)
  49. # Use pipes rather than temporary files for communication
  50. # between the various stages of compilation
  51. #
  52. # -fno-plt
  53. # | Info pages for gcc (code generation conventions)
  54. # leads to more efficient code by eliminating PLT stubs and
  55. # exposing GOT loads to optimizations
  56. #
  57. # -fopenmp
  58. # | Info pages for gcc (controlling c dialect)
  59. # Enable handling of OpenMP directives
  60. #
  61. safe_flags="-Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS"
  62. safe_flags+=" -fcf-protection -fno-plt"
  63. safe_flags+=" -fstack-clash-protection -Wformat"
  64. safe_flags+=" -Werror=format-security"
  65. generic_flags="-pipe -fno-plt -fPIC -fopenmp -march=native"
  66. generic_flags+=" -mtune=native ${safe_flags}"
  67. opt_flags="${generic_flags} -O3"
  68. generic_flags="${generic_flags} -O2"
  69. COPTFLAGS="${opt_flags}"
  70. CXXOPTFLAGS="$COPTFLAGS"
  71. FOPTFLAGS="$COPTFLAGS"
  72. CPPFLAGS="$generic_flags"
  73. CXXFLAGS="$CPPFLAGS"
  74. CFLAGS="$generic_flags"
  75. FFLAGS="$generic_flags"
  76. FCFLAGS="$generic_flags"
  77. F90FLAGS="$generic_flags"
  78. F77FLAGS="$generic_flags"
  79. export LANG=en_IE.UTF-8
  80. export LC_ALL=en_IE.UTF-8
  81. pkgver() {
  82. cd "${srcdir}/${_base}"
  83. git describe --tags --match '*.*' | tr '-' '.'
  84. }
  85. build() {
  86. cd "${_base}"
  87. [ ! -d build ] && mkdir build
  88. cd build
  89. cmake \
  90. -DCMAKE_INSTALL_PREFIX=${pkgdir}/usr \
  91. -DCMAKE_INSTALL_LIBDIR=lib \
  92. ..
  93. make
  94. }
  95. package() {
  96. cd "${_base}/build"
  97. make install
  98. }