1 # Build recipe for valgrind.
3 # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
4 # Copyright (c) 2017-2018 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.
22 # Set 'outdir' for a nice and well-organized output directory
23 outdir="${outdir}/${arch}/devel"
25 tarname=${program}-${version}.tar.bz2
28 fetch=ftp://sourceware.org/pub/valgrind/$tarname
31 Generic framework for creating dynamic analysis tools.
33 Valgrind is an instrumentation framework for building dynamic analysis tools.
34 There are Valgrind tools that can automatically detect many memory management
35 and threading bugs, and profile your programs in detail. You can also use
36 Valgrind to build new tools.
39 homepage=http://valgrind.org/
42 # Source documentation
43 docs="AUTHORS COPYING* FAQ.txt NEWS* README*"
44 docsdir="${docdir}/${program}-${version}"
50 unpack "${tardir}/$tarname"
54 # Set sane permissions
55 chmod -R u+w,go-w,a+rX-s .
57 # Set installation for documentation directory
58 patch -p0 < "${worktree}/patches/valgrind/valgrind-docdir.patch"
60 # Set specific options for the architecture
63 arch_options="--enable-only32bit --build=$(cc -dumpmachine)"
66 arch_options="--enable-only64bit --build=$(cc -dumpmachine)"
70 # We do not try to strip any debugging symbol as
71 # suggested in README_PACKAGERS
73 ./configure CFLAGS="-no-pie -fno-PIE -fPIC" \
74 CXXFLAGS="-no-pie -fno-PIE -fPIC" \
76 --libdir=/usr/lib${libSuffix} \
88 make -j${jobs} DESTDIR="$destdir" install
90 # Remove installed Valgrind's documentation for reduce the package size
91 rm -rf "${destdir}${docsdir}"
93 # Strip ELF executables excluding shared objects (as suggested)
94 find "$destdir" -type f | xargs file | awk '/ELF/ && /executable/' | \
95 cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
97 # Compress info documents deleting index file for the package
98 if test -d "${destdir}/$infodir"
100 rm -f "${destdir}/${infodir}/dir"
101 lzip -9 "${destdir}/${infodir}"/*
104 # Compress and link man pages (if needed)
105 if test -d "${destdir}/$mandir"
108 cd "${destdir}/$mandir"
109 find . -type f -exec lzip -9 '{}' +
110 find . -type l | while read -r file
112 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
119 mkdir -p "${destdir}${docsdir}"
120 cp -p $docs "${destdir}${docsdir}"