recipes: devel/elfutils: Build against cdefs.h header file
[dragora.git] / recipes / devel / elfutils / recipe
blob9a9c9e8e00cf4f34b8a7c3c1b32e85d35834b655
1 # Build recipe for elfutils.
3 # Copyright (c) 2020-2021 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
18 set -e
20 program=elfutils
21 version=0.180
22 release=2
24 # Define a category for the output of the package name
25 pkgcategory=devel
27 tarname=${program}-${version}.tar.bz2
29 # Remote source(s)
30 fetch=https://sourceware.org/elfutils/ftp/${version}/$tarname
32 description="
33 Libraries and utilities to handle ELF objects.
35 elfutils is a collection of utilities and libraries to read,
36 create and modify ELF binary files, find and handle DWARF
37 debug data, symbols, thread state and stacktraces for
38 processes and core files on GNU/Linux.
40 Note: This package has been configured to make use of the \"eu\"
41       prefix for elfutils utilities.
44 homepage=https://sourceware.org/elfutils/
45 license="GPLv2+, GPLv3+, LGPLv3"
47 # Source documentation
48 docs="AUTHORS CONTRIBUTING COPYING* src/ChangeLog NEWS NOTES README THANKS TODO"
49 docsdir="${docdir}/${program}-${version}"
51 build()
53     unpack "${tardir}/$tarname"
55     cd "$srcdir"
57     # Set sane permissions
58     chmod -R u+w,go-w,a+rX-s .
60     # Apply patches against Musl (Thanks to "noname-linux", xhebox)
61     # Url: https://github.com/xhebox/noname-linux/tree/master/ports/elfutils
62     patch -Np0 -i "${worktree}/patches/elfutils/fix-uninitialized.patch"
63     patch -Np0 -i "${worktree}/patches/elfutils/musl-asm_ptrace_h.patch"
64     patch -Np0 -i "${worktree}/patches/elfutils/musl-cdefs.patch"
65     patch -Np0 -i "${worktree}/patches/elfutils/musl-fts-obstack.patch"
66     patch -Np0 -i "${worktree}/patches/elfutils/musl-macros.patch"
67     patch -Np0 -i "${worktree}/patches/elfutils/musl-qsort_r.patch"
68     patch -Np0 -i "${worktree}/patches/elfutils/musl-strerror_r.patch"
69     patch -Np0 -i "${worktree}/patches/elfutils/musl-strndupa.patch"
71     cp -p -f "${worktree}"/archive/elfutils/error.h lib/
72     cp -p -f "${worktree}"/archive/elfutils/error.h src/
73     sed -i 's:-Werror::' ./*Makefile.in
74     autoreconf -vif
76     ./configure CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS -Wno-error=null-dereference" \
77     LDFLAGS="$QILDFLAGS" \
78      $configure_args \
79      --libdir=/usr/lib${libSuffix} \
80      --docdir=$docsdir \
81      --mandir=$mandir \
82      --enable-deterministic-archives \
83      --disable-debuginfod \
84      --program-prefix=eu- \
85      --build="$(gcc -dumpmachine)"
87     make -j${jobs} V=1
88     make -j${jobs} V=1 DESTDIR="$destdir" install-strip
90     # Compress and link man pages (if needed)
91     if test -d "${destdir}/$mandir"
92     then
93         (
94             cd "${destdir}/$mandir"
95             find . -type f -exec lzip -9 {} +
96             find . -type l | while read -r file
97             do
98                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
99                 rm -- "$file"
100             done
101         )
102     fi
104     # Copy documentation
105     mkdir -p "${destdir}${docsdir}"
106     cp -p $docs "${destdir}${docsdir}"