pkgbuilds/libdwarfpp/PKGBUILD

79 lines
2.1 KiB
Text
Raw Permalink Normal View History

2018-06-28 20:36:42 +02:00
# 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"
2018-07-02 12:51:44 +02:00
"https://tobast.fr/files/libdwarfpp-dies.patch"
"https://tobast.fr/files/libdwarfpp-headers.patch")
2018-06-28 20:36:42 +02:00
sha1sums=('SKIP'
2018-07-02 12:51:44 +02:00
'1bfc0b66e1c6bb4b0e284e29a50a1b4be6b3aa50'
'bb6d91dc75981484814412382102c3c32664eeb5')
2018-06-28 20:36:42 +02:00
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
2018-07-02 12:51:44 +02:00
git apply ../libdwarfpp-headers.patch
sed -i 's@libdwarf.h@libdwarf/libdwarf.h@' include/dwarfpp/libdwarf.hpp
2018-06-28 20:36:42 +02:00
}
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
2018-07-02 12:51:44 +02:00
rm -fr "$pydir"
2018-06-28 20:36:42 +02:00
}
package() {
cd "$srcdir/${_pkgname}"
make DESTDIR="$pkgdir/" install
}