1 # Build recipe for valgrind.
3 # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
4 # Copyright (c) 2017-2021 Matias Fonzo, <selk@dragora.org>.
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 # Exit immediately on any error
25 # Define a category for the output of the package name
28 tarname=${program}-${version}.tar.bz2
31 fetch=ftp://sourceware.org/pub/valgrind/$tarname
34 Generic framework for creating dynamic analysis tools.
36 Valgrind is an instrumentation framework for building dynamic analysis tools.
37 There are Valgrind tools that can automatically detect many memory management
38 and threading bugs, and profile your programs in detail. You can also use
39 Valgrind to build new tools.
42 homepage=https://valgrind.org/
45 # Source documentation
46 docs="AUTHORS COPYING* FAQ.txt NEWS* README*"
47 docsdir="${docdir}/${program}-${version}"
51 unpack "${tardir}/$tarname"
55 # Set sane permissions
56 chmod -R u+w,go-w,a+rX-s .
58 # Set installation for documentation directory
59 patch -p0 < "${worktree}/patches/valgrind/valgrind-docdir.patch"
61 # Set specific options for the architecture
64 arch_options="--enable-only32bit --build=$(gcc -dumpmachine)"
67 arch_options="--enable-only64bit --build=$(gcc -dumpmachine)"
71 # We do not try to strip any debugging symbol as
72 # suggested in README_PACKAGERS
74 ./configure CPPFLAGS="-D_FORTIFY_SOURCE=0" \
75 CFLAGS="-no-pie -fno-PIE -fPIC" \
76 CXXFLAGS="-no-pie -fno-PIE -fPIC" \
79 --libdir=/usr/lib${libSuffix} \
91 make -j${jobs} DESTDIR="$destdir" install
93 # Remove installed Valgrind's documentation for reduce the package size
94 rm -rf "${destdir}${docsdir}"
96 # Strip ELF executables excluding shared objects (as suggested)
97 find "$destdir" -type f | xargs file | awk '/ELF/ && /executable/' | \
98 cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
100 # Compress info documents deleting index file for the package
101 if test -d "${destdir}/$infodir"
103 rm -f "${destdir}/${infodir}/dir"
104 lzip -9 "${destdir}/${infodir}"/*
107 # Compress and link man pages (if needed)
108 if test -d "${destdir}/$mandir"
111 cd "${destdir}/$mandir"
112 find . -type f -exec lzip -9 {} +
113 find . -type l | while read -r file
115 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
122 mkdir -p "${destdir}${docsdir}"
123 cp -p $docs "${destdir}${docsdir}"