git » elfutils.git » main » tree

[main] / PKGBUILD

# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Laurent Carlier <lordheavym@gmail.com>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: Andrej Gelenberg <andrej.gelenberg@udo.edu>

pkgbase=elfutils
pkgname=(
  elfutils
  libelf
)
pkgver=0.190
if [ -z "$ARMLFS_MAKEPKG_CORE" ]; then
  pkgname+=(debuginfod)
# if you need to increment pkgrel, inc this one
# (the 1 below is only during system bootstrap)
  pkgrel=3
else
  pkgrel=1
fi
pkgdesc="Handle ELF object files and DWARF debugging information"
arch=('armv7h' 'aarch64')
url="https://sourceware.org/elfutils/"
makedepends=(
  bzip2
  curl
#  gcc-libs
  xz
  zlib
  zstd
)
if [ -z "$ARMLFS_MAKEPKG_CORE" ]; then
makedepends+=(
  libarchive
  libmicrohttpd
  sqlite
)
fi
options=(staticlibs)
source=(file:///sources/archives/core/$pkgbase-$pkgver.tar.bz2)

prepare() {
  # remove failing test due to missing glibc debug package during test: https://bugs.archlinux.org/task/74875
  sed -e 's/run-backtrace-native.sh//g' -i $pkgbase-$pkgver/tests/Makefile.am

  cd $pkgbase-$pkgver
  autoreconf -fiv
}

build() {
  local configure_options=(
    --prefix=/usr
    --sysconfdir=/etc
    --program-prefix="eu-"
    --enable-deterministic-archives
  )
  if [ ! -z "$ARMLFS_MAKEPKG_CORE" ]; then
	configure_options+=(
            --disable-debuginfod         \
            --enable-libdebuginfod=dummy
	)
  fi    

  # fat-lto-objects is required for non-mangled .a files in libelf
  CFLAGS+=" -ffat-lto-objects"

  # debugging information is required for test-suite
  CFLAGS+=" -g"

  cd $pkgbase-$pkgver
  ./configure "${configure_options[@]}"
  make
}

_pick() {
  local p="$1" f d; shift
  for f; do
    d="$srcdir/$p/${f#$pkgdir/}"
    mkdir -p "$(dirname "$d")"
    mv "$f" "$d"
    rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
  done
}

package_elfutils() {
  pkgdesc+=" (utilities)"
  license=(
    GPL-3.0-or-later
  )
  depends=(
  #  gcc-libs
    glibc
    libarchive 
    libelf=$pkgver
#    sh
  )

  make DESTDIR="$pkgdir" install -C $pkgbase-$pkgver

  # set the default DEBUGINFOD_URLS environment variable to the distribution's debuginfod URL
  # echo "https://debuginfod.archlinux.org" > "$pkgdir/etc/debuginfod/archlinux.urls"

  (
    cd "$pkgdir"

    _pick libelf etc/debuginfod
    _pick libelf etc/profile.d/*
    _pick libelf usr/{include,lib}
    _pick debuginfod usr/bin/debuginfod*
    _pick debuginfod usr/share/man/*/debuginfod*
  )

  install -vDm 644 $pkgbase-$pkgver/{AUTHORS,ChangeLog,NEWS,NOTES,README} -t "$pkgdir/usr/share/doc/$pkgname/"
}

package_libelf() {
  pkgdesc+=" (libraries)"
  license=(
    'GPL-2.0-or-later OR LGPL-3.0-or-later'
  )
  depends=(
    bzip2 
    curl 
    # gcc-libs
    glibc
    xz 
    zlib
    zstd 
  )
  # NOTE: the shared objects can not be added to provides as they are not versioned

  mv -v libelf/* "$pkgdir"
  install -vDm 644 $pkgbase-$pkgver/{AUTHORS,ChangeLog,NEWS,NOTES,README} -t "$pkgdir/usr/share/doc/$pkgname/"
}

package_debuginfod() {
  pkgdesc+=" (debuginfod)"
  license=(
    GPL-3.0-or-later
  )
  depends=(
#    gcc-libs
    glibc
    libarchive
    libelf=$pkgver
    libmicrohttpd
    sqlite
  )
  optdepends=("elfutils=$pkgver: for translations")

  mv -v debuginfod/* "$pkgdir"
  install -vDm 644 $pkgbase-$pkgver/{AUTHORS,ChangeLog,NEWS,NOTES,README} -t "$pkgdir/usr/share/doc/$pkgname/"
}

# vim:set sw=2 sts=-1 et:
sha256sums=('8e00a3a9b5f04bc1dc273ae86281d2d26ed412020b391ffcc23198f10231d692')