# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Contributor: Cody P Schafer <archlinux@codyps.com>
# Contributor: John Eivind Helset <jehelset@gmail.com>

pkgname=debugedit
pkgver=5.0
pkgrel=6.1
pkgdesc='Tool to mangle source locations in .debug files'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='https://sourceware.org/debugedit/'
license=('GPL-3.0-or-later' 'GPL-2.0-or-later' 'LGPL-2.0-or-later')
depends=('glibc' 'libelf')
makedepends=('help2man')
source=("https://sourceware.org/ftp/debugedit/${pkgver}/debugedit-${pkgver}.tar.xz"{,.sig}
        "debugedit-use-elfstrptr.patch::https://sourceware.org/git/?p=debugedit.git;a=patch;h=7497274aed00c459a0d74bf171e1b11358b0210c"
        "debugedit-support-debugstr.patch::https://sourceware.org/git/?p=debugedit.git;a=patch;h=3e7aeeab4f744ad15108775685db68d3a35b0735"
        "debugedit-limit-write.patch::https://sourceware.org/git/?p=debugedit.git;a=patch;h=6dd28bb30320e5236b3b5f79b6b2b41d2b2317bd")
validpgpkeys=('EC3CFE88F6CA0788774F5C1D1AA44BE649DE760A')
sha512sums=('7e7f529eafe41b53f0b5bfc58282fdbfa0dfa93ed7908b70e81942d6d2b6f80fc9c6bff2ed9674fd98947e5750b615f4c8b222544989e2900c5f8ff5ae0efb92'
            'SKIP'
            '8f56fc24fae6424d244508a29fb992a106ce91a4115a7429024db66fd9ef0d5e9a6ff5a473312ebb83726061193692cc56564b84c4b4bb553a6210a912fbf738'
            '967da3adb66857a37056f8d0678d5fdc761704b74f6ca35d4631be1ee099683c2ea40cdd1a59f34eab3bbc33bb846009325403552519b3c300b76493f5c4dcf1'
            '68b8d7388143da464a248b11555b08a708ea367b241317c622d76bd2b4b16473885d249ea9931af4ae438f6553beff7d9919c5ecd44fcbaf128b4d1f1bcdae82')

prepare() {
    cd "debugedit-${pkgver}"
    patch -Np1 < "$srcdir/debugedit-use-elfstrptr.patch"
    patch -Np1 < "$srcdir/debugedit-support-debugstr.patch"
    patch -Np1 < "$srcdir/debugedit-limit-write.patch"
    autoreconf -fiv
}

build() {
    cd "debugedit-${pkgver}"
    ./configure --prefix=/usr
    make
}

package() {
    cd "debugedit-${pkgver}"
    make DESTDIR="${pkgdir}" install
}
