recipe 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # Build recipe for valgrind.
  2. #
  3. # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
  4. # Copyright (c) 2017-2019 Matias Fonzo, <selk@dragora.org>.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. program=valgrind
  18. version=3.15.0
  19. release=1
  20. # Set 'outdir' for a nice and well-organized output directory
  21. outdir="${outdir}/${arch}/devel"
  22. tarname=${program}-${version}.tar.bz2
  23. # Remote source(s)
  24. fetch=ftp://sourceware.org/pub/valgrind/$tarname
  25. description="
  26. Generic framework for creating dynamic analysis tools.
  27. Valgrind is an instrumentation framework for building dynamic analysis tools.
  28. There are Valgrind tools that can automatically detect many memory management
  29. and threading bugs, and profile your programs in detail. You can also use
  30. Valgrind to build new tools.
  31. "
  32. homepage=http://valgrind.org/
  33. license="GPLv2"
  34. # Source documentation
  35. docs="AUTHORS COPYING* FAQ.txt NEWS* README*"
  36. docsdir="${docdir}/${program}-${version}"
  37. build()
  38. {
  39. set -e
  40. unpack "${tardir}/$tarname"
  41. cd "$srcdir"
  42. # Set sane permissions
  43. chmod -R u+w,go-w,a+rX-s .
  44. # Set installation for documentation directory
  45. patch -p0 < "${worktree}/patches/valgrind/valgrind-docdir.patch"
  46. # Set specific options for the architecture
  47. case $arch in
  48. i?86)
  49. arch_options="--enable-only32bit --build=$(cc -dumpmachine)"
  50. ;;
  51. x86_64*)
  52. arch_options="--enable-only64bit --build=$(cc -dumpmachine)"
  53. ;;
  54. esac
  55. # We do not try to strip any debugging symbol as
  56. # suggested in README_PACKAGERS
  57. ./configure CFLAGS="-no-pie -fno-PIE -fPIC" \
  58. CXXFLAGS="-no-pie -fno-PIE -fPIC" \
  59. $configure_args \
  60. --libdir=/usr/lib${libSuffix} \
  61. --infodir=$infodir \
  62. --mandir=$mandir \
  63. --docdir=$docsdir \
  64. --enable-tls \
  65. --enable-inner \
  66. --disable-ubsan \
  67. $arch_options
  68. unset arch_options
  69. make -j${jobs} V=1
  70. make -j${jobs} DESTDIR="$destdir" install
  71. # Remove installed Valgrind's documentation for reduce the package size
  72. rm -rf "${destdir}${docsdir}"
  73. # Strip ELF executables excluding shared objects (as suggested)
  74. find "$destdir" -type f | xargs file | awk '/ELF/ && /executable/' | \
  75. cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  76. # Compress info documents deleting index file for the package
  77. if test -d "${destdir}/$infodir"
  78. then
  79. rm -f "${destdir}/${infodir}/dir"
  80. lzip -9 "${destdir}/${infodir}"/*
  81. fi
  82. # Compress and link man pages (if needed)
  83. if test -d "${destdir}/$mandir"
  84. then
  85. (
  86. cd "${destdir}/$mandir"
  87. find . -type f -exec lzip -9 '{}' +
  88. find . -type l | while read -r file
  89. do
  90. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  91. rm -- "$file"
  92. done
  93. )
  94. fi
  95. # Copy documentation
  96. mkdir -p "${destdir}${docsdir}"
  97. cp -p $docs "${destdir}${docsdir}"
  98. }