recipes: Rename 'pkghashtag' variable to 'pkgcategory'
[dragora.git] / recipes / devel / valgrind / recipe
blob10ee4e66593a4c28cb0a8f36562150330c96d5dd
1 # Build recipe for valgrind.
3 # Copyright (c) 2017 Mateus P. Rodrigues <mprodrigues@dragora.org>.
4 # Copyright (c) 2017-2019 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.15.0
20 release=1
22 # Define a category for the output of the package name
23 pkgcategory=devel
25 tarname=${program}-${version}.tar.bz2
27 # Remote source(s)
28 fetch=ftp://sourceware.org/pub/valgrind/$tarname
30 description="
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/
40 license="GPLv2"
42 # Source documentation
43 docs="AUTHORS COPYING* FAQ.txt NEWS* README*"
44 docsdir="${docdir}/${program}-${version}"
46 build()
48     set -e
50     unpack "${tardir}/$tarname"
52     cd "$srcdir"
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
61     case $arch in
62     i?86)
63         arch_options="--enable-only32bit --build=$(cc -dumpmachine)"
64         ;;
65     x86_64*)
66         arch_options="--enable-only64bit --build=$(cc -dumpmachine)"
67         ;;
68     esac
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" \
75      $configure_args \
76      --libdir=/usr/lib${libSuffix} \
77      --infodir=$infodir \
78      --mandir=$mandir \
79      --docdir=$docsdir \
80      --enable-tls \
81      --enable-inner \
82      --disable-ubsan \
83      $arch_options
85     unset arch_options
87     make -j${jobs} V=1
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"
99     then
100         rm -f "${destdir}/${infodir}/dir"
101         lzip -9 "${destdir}/${infodir}"/*
102     fi
104     # Compress and link man pages (if needed)
105     if test -d "${destdir}/$mandir"
106     then
107         (
108             cd "${destdir}/$mandir"
109             find . -type f -exec lzip -9 '{}' +
110             find . -type l | while read -r file
111             do
112                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
113                 rm -- "$file"
114             done
115         )
116     fi
118     # Copy documentation
119     mkdir -p "${destdir}${docsdir}"
120     cp -p $docs "${destdir}${docsdir}"