strip remaining libraries for the distribution size
[dragora.git] / recipes / devel / valgrind / recipe
blobeacc6e6ba30fc44a7ba81bba656146845f73df18
1 # Build recipe for valgrind.
3 # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
4 # Copyright (c) 2017 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 program=valgrind
19 version=3.13.0
20 release=1
22 tarname=${program}-${version}.tar.bz2
24 # Remote source(s)
25 fetch=ftp://sourceware.org/pub/valgrind/$tarname
27 description="
28 Generic framework for creating dynamic analysis tools.
30 Valgrind is an instrumentation framework for building dynamic analysis tools.
31 There are Valgrind tools that can automatically detect many memory management
32 and threading bugs, and profile your programs in detail. You can also use
33 Valgrind to build new tools.
36 homepage=http://valgrind.org/
37 license="GPLv2"
39 # Source documentation
40 docs="AUTHORS COPYING* FAQ.txt NEWS* README*"
41 docsdir="${docdir}/${program}-${version}"
43 build()
45     set -e
47     unpack "${tardir}/$tarname"
49     cd "$srcdir"
51     # Set installation for documentation directory
52     patch -p0 < "${worktree}/patches/valgrind/valgrind-docdir.patch"
54     # We don't pass any C flags in order to preserve all the debugging
55     # information as suggested in README_PACKAGERS
57     ./configure $configure_args \
58      --libdir=/usr/lib${libSuffix} \
59      --infodir=$infodir \
60      --mandir=$mandir \
61      --docdir=$docsdir \
62      --build="$(cc -dumpmachine)" \
63      --enable-inner \
64      --enable-tls \
65      || true
67     make -j${jobs} V=1
68     make -j${jobs} DESTDIR="$destdir" install-strip
70     # Remove valgrind manual in order to reduce the package size
71     # considerably, we already provide the manual in HTML format
72     rm -f "${destdir}${docsdir}"/*.pdf "${destdir}${docsdir}"/*.ps
74     # Compress info documents deleting index file for the package
75     if test -d "${destdir}/$infodir"
76     then
77         rm -f "${destdir}/${infodir}/dir"
78         lzip -9 "${destdir}/${infodir}"/*
79     fi
81     # Compress and link man pages (if needed)
82     if test -d "${destdir}/$mandir"
83     then
84         (
85             cd "${destdir}/$mandir"
86             find . -type f -exec lzip -9 '{}' +
87             find . -type l | while read -r file
88             do
89                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
90                 rm -- "$file"
91             done
92         )
93     fi
95     # Copy documentation
96     mkdir -p "${destdir}${docsdir}"
98     for file in $docs
99     do
100         if test -e $file
101         then
102             cp -p $file "${destdir}${docsdir}"
103         fi
104     done