pkgbuilds/libdwarfpp/PKGBUILD

74 lines
1.8 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")
sha1sums=('SKIP'
'1bfc0b66e1c6bb4b0e284e29a50a1b4be6b3aa50')
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
}
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 -f "$pydir"
}
package() {
cd "$srcdir/${_pkgname}"
make DESTDIR="$pkgdir/" install
}