recipe 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # Build recipe for fftw.
  2. #
  3. # Copyright (c) 2021 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # Exit immediately on any error
  17. set -e
  18. program=fftw
  19. version=3.3.10
  20. release=1
  21. # Define a category for the output of the package name
  22. pkgcategory=libs
  23. description="
  24. A fast C library for computing the discrete Fourier transform.
  25. FFTW is a C subroutine library for computing the discrete Fourier
  26. transform (DFT) in one or more dimensions, of arbitrary input size,
  27. and of both real and complex data (as well as of even/odd data, i.e.
  28. the discrete cosine/sine transforms or DCT/DST).
  29. "
  30. homepage=https://fftw.org
  31. license=GPLv2+
  32. tarname=${program}-${version}.tar.gz
  33. # Remote source(s)
  34. fetch=http://www.fftw.org/$tarname
  35. # Source documentation
  36. docs="AUTHORS CONVENTIONS COPYING COPYRIGHT NEWS README* TODO"
  37. docsdir="${docdir}/${program}-${version}"
  38. _configure_argv()
  39. {
  40. ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" \
  41. LDFLAGS="$QILDFLAGS" \
  42. $configure_args \
  43. --libdir=/usr/lib${libSuffix} \
  44. --infodir=$infodir \
  45. --mandir=$mandir \
  46. --docdir=$docsdir \
  47. --enable-static=no \
  48. --enable-shared=yes \
  49. --build="$(gcc -dumpmachine)" "$@"
  50. }
  51. build()
  52. {
  53. unpack "${tardir}/$tarname"
  54. cd "$srcdir"
  55. # Set sane permissions
  56. chmod -R u+w,go-w,a+rX-s .
  57. # Set custom build options per architecture
  58. case $arch in
  59. i?86 | amd64 | x32 )
  60. _build_simd="--enable-sse2 --enable-avx"
  61. ;;
  62. esac
  63. # Build with double precision arithmetic support
  64. _configure_argv $_build_simd
  65. make -j${jobs} V=1
  66. make -j${jobs} DESTDIR="$destdir" install-strip
  67. # Build with single precision support
  68. make clean
  69. _configure_argv $_build_simd --enable-threads --enable-float
  70. make -j${jobs} V=1
  71. make -j${jobs} DESTDIR="$destdir" install-strip
  72. unset -v _build_simd
  73. # Build with long double support
  74. make clean
  75. _configure_argv --enable-threads --enable-long-double
  76. make -j${jobs} V=1
  77. make -j${jobs} DESTDIR="$destdir" install-strip
  78. # Build with quad precision support
  79. make clean
  80. _configure_argv --enable-threads --enable-quad-precision
  81. make -j${jobs} V=1
  82. make -j${jobs} DESTDIR="$destdir" install-strip
  83. unset -f _configure_argv
  84. # Compress info documents deleting index file for the package
  85. if test -d "${destdir}/$infodir"
  86. then
  87. rm -f "${destdir}/${infodir}/dir"
  88. lzip -9 "${destdir}/${infodir}"/*
  89. fi
  90. # Compress manual pages
  91. if [ -d "${destdir}/$mandir" ] ; then
  92. (
  93. cd "${destdir}/$mandir"
  94. find . -type f -exec lzip -9 {} +
  95. find . -type l | while read -r file
  96. do
  97. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  98. rm -- "$file"
  99. done
  100. )
  101. fi
  102. # Copy documentation
  103. mkdir -p "${destdir}/$docsdir"
  104. cp -p $docs "${destdir}/$docsdir"
  105. }