pkgbuilds/libdwarfpp/PKGBUILD

78 lines
2.1 KiB
Bash

# Maintainer: Théophile Bastian <contact@tobast.fr>
pkgname=libdwarfpp-git
_pkgname="${pkgname%-git}"
pkgver=r289.d7df953
pkgrel=1
provides=($_pkgname)
conflicts=($_pkgname)
pkgdesc="A C++ wrapper around libdwarf"
arch=('x86_64')
url="https://github.com/stephenrkell/libdwarfpp"
license=('?')
depends=(libcxxfileno libsrk31cxx libdwarf)
makedepends=('git' 'make' 'autoconf')
install=
source=("git+https://github.com/stephenrkell/libdwarfpp"
"https://tobast.fr/files/libdwarfpp-dies.patch"
"https://tobast.fr/files/libdwarfpp-headers.patch")
sha1sums=('SKIP'
'1bfc0b66e1c6bb4b0e284e29a50a1b4be6b3aa50'
'bb6d91dc75981484814412382102c3c32664eeb5')
pkgver() {
cd "$srcdir/${_pkgname}"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "$srcdir/${_pkgname}"
git apply ../libdwarfpp-dies.patch
git apply ../libdwarfpp-headers.patch
sed -i 's@libdwarf.h@libdwarf/libdwarf.h@' include/dwarfpp/libdwarf.hpp
}
build() {
# Why the hell are those things needed :(
export LIBCXXFILENO_CXXFLAGS=" "
export LIBSRK31CXX_CXXFLAGS=" "
export LIBCXXFILENO_LIBS="-lc++fileno"
export LIBSRK31CXX_LIBS="-lsrk31c++"
libdwarf_include=$(echo "#include <libdwarf/libdwarf.h>" \
| gcc -H -fsyntax-only -x c - 2>&1 \
| awk '{ print $2 }' \
| xargs dirname)
libdwarf_lib=$(ldconfig -p \
| grep 'libdwarf.so$' \
| sed 's/^.*=> //g' \
| xargs dirname)
if [ -z "$libdwarf_include" ]; then
>&2 echo "libdwarf.h not found"
exit 1
fi
if [ -z "$libdwarf_lib" ]; then
>&2 echo "libdwarf.so not found"
exit 1
fi
# Use python2
pydir=$(mktemp -d)
ln -s "$(which python2)" "$pydir/python"
export PATH="$pydir:$PATH"
cd "$srcdir/${_pkgname}"
autoreconf -i
./configure --prefix=/usr \
--with-libdwarf-includes="$libdwarf_include" \
--with-libdwarf-libs="$libdwarf_lib"
make -j
rm -fr "$pydir"
}
package() {
cd "$srcdir/${_pkgname}"
make DESTDIR="$pkgdir/" install
}