# Description: Device Tree Compiler and libfdt
# URL: https://github.com/dgibson/dtc
# Maintainer: Juergen Daubert, jue at crux dot nu

name=dtc
version=1.7.0
release=2
source=(https://www.kernel.org/pub/software/utils/$name/$name-$version.tar.xz
	pyscm.patch)

build() {
	sed '/version:/s/6/7/' -i $name-$version/{,libfdt}/meson.build
	CFLAGS+=" -ffat-lto-objects"
	patch -p1 -d $name-$version -i $SRC/pyscm.patch

	meson setup build $name-$version \
		--prefix=/usr \
		--buildtype=plain \
		--wrap-mode nodownload \
		-D b_lto=true \
		-D b_pie=true

	meson compile -C build -j ${JOBS:-1}
	DESTDIR=$PKG meson install -C build
}
