# Contributor: Roger Pau Monne <roger.pau@entel.upc.edu>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=acpica
pkgver=20230628
pkgrel=0
pkgdesc="ACPI Component Architecture utilities"
url="https://www.acpica.org"
arch="all"
license="GPL-2.0-only OR BSD-3-Clause OR Intel-ACPI"
makedepends="flex bison"
subpackages="iasl"
options="!check"
source="acpica-unix-$pkgver.tar.gz::https://downloadmirror.intel.com/783549/acpica-unix-$pkgver.tar.gz"

builddir="$srcdir"/acpica-unix-$pkgver
build() {
	# binutils 2.40 has a bug specifically on this code
	# careful with the format here- in abuild.conf we append a new -Wl block for this
	export LDFLAGS="${LDFLAGS/-Wl,-z,pack-relative-relocs}"
	make NOWERROR=TRUE
}

package() {
	make install DESTDIR="$pkgdir"
}

iasl() {
	pkgdesc="ACPI ASL compiler"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/iasl "$subpkgdir"/usr/bin/
}

sha512sums="
d726e69ebd8b8110690e3aff8d1919b43b0a2185efdeb9131ea8d89d321ca3a318a89c721ea740ae366f31ed3d1c11c2906f8807ee8a190e6f67fe5b2023cea4  acpica-unix-20230628.tar.gz
"
