1 # Build recipe for valgrind.
3 # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
4 # Copyright (c) 2017-2022 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 # Copy definition in order to build Valgrind (Thanks to "Alpine Linux")
75 cp -p "${worktree}/archive/valgrind/musl.supp" .
77 ./configure CPPFLAGS="-D_FORTIFY_SOURCE=0" \
78 CFLAGS="-no-pie -fno-PIE -fPIC" \
79 CXXFLAGS="-no-pie -fno-PIE -fPIC" \
82 --libdir=/usr/lib${libSuffix} \
94 make -j${jobs} DESTDIR="$destdir" install
96 # Remove installed Valgrind's documentation for reduce the package size
97 rm -rf "${destdir}${docsdir}"
99 # Strip ELF executables excluding shared objects (as suggested)
100 find "$destdir" -type f | xargs file | awk '/ELF/ && /executable/' | \
101 cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
103 # Compress info documents deleting index file for the package
104 if test -d "${destdir}/$infodir"
106 rm -f "${destdir}/${infodir}/dir"
107 lzip -9 "${destdir}/${infodir}"/*
110 # Compress and link man pages (if needed)
111 if test -d "${destdir}/$mandir"
114 cd "${destdir}/$mandir"
115 find . -type f -exec lzip -9 {} +
116 find . -type l | while read -r file
118 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
125 mkdir -p "${destdir}${docsdir}"
126 cp -p $docs "${destdir}${docsdir}"