# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Tuan M. Hoang <tmhoang@flatglobe.org>
pkgname=s390-tools
pkgver=1.37.0
pkgrel=0
pkgdesc="Utilities for Linux on IBM z Systems"
url="http://www.ibm.com/developerworks/linux/linux390/s390-tools.html"
arch="s390x"
license="GPL-2.0-or-later"
depends="linux-vanilla mkinitfs"
depends_dev=""
makedepends="$depends_dev linux-headers libexecinfo-dev zlib-dev fuse-dev ncurses-dev"
triggers="$pkgname.trigger=/boot"
install="$pkgname.post-install $pkgname.post-upgrade"
subpackages="$pkgname-doc"
source="http://download.boulder.ibm.com/ibmdl/pub/software/dw/linux390/ht_src/$pkgname-$pkgver.tar.bz2
	0001-zipl-flags.patch
	0002-musl-fixes.patch
	0003-major-minor.patch
	0004-missing-time-header.patch
	0005-dump2tar-linking-order.patch
	0006-define-path-mounted.patch
	0007-tunedasd-no-need-error-h.patch
	0008-iucvterm-no-nls.patch
	0009-zdev-libexecinfo.patch
	0010-musl-s390x-signal-def.patch

	0100-zipl-no-pie.patch
	0101-zipl-dont-optimize-size.patch

	0200-dasdinfo-gnu-ext-hack.patch
	0300-disable-program-using-gnu-ext.patch

	s390-tools-script
	"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	make -j1 V=1 CFLAGS="$CFLAGS -D_GNU_SOURCE" \
		HAVE_SNMP=0 \
		HAVE_PFM=0 \
		LIBEXECINFO_LIBS="-lexecinfo"
}

package() {
	cd "$builddir"
	make HAVE_SNMP=0 HAVE_PFM=0 DESTDIR="$pkgdir" install
	install -m 755 "$srcdir"/s390-tools-script "$pkgdir"/sbin/s390-tools-script
}

sha512sums="3667ba4eb7e2b74629958f530002953adebe6e41d6429c99ae5f82d1406d6963aacdc35b63114683c365b9fa40ac32b4c22f226918ecb53423e80f944d24cb9c  s390-tools-1.37.0.tar.bz2
3e1d0829e13bea69f48c556c2454b2927ffc59a7f4a04f7ebce41b9b5ed95ce963922fec9981e7ae62be801abbdc2cd27498399d0c4b8f9d10fae82dc3a9df85  0001-zipl-flags.patch
53917ef77142eb1304f7a900eb9a624b5bad5b263110f5875ab7710b52350e1b56d42d048b5bedc9ee6780d9f014c903f047f25d347ba677dfe141eb125b1543  0002-musl-fixes.patch
8a73e9d8e09af29cc04bc09a330ca019ec21bc49fe18468149458996c52e5c7951d9b917e2263162f1fd6e8a25f47c6ca737f7ceeec1d753d72f85e447a6ec01  0003-major-minor.patch
701d42e799bb7398b391ef299eb9f5488638cd162826ac8827205741159b746cbd6f4841b54fe6eb5f11dd143f63fb9689f7373b7df7adf9dcb1b3ed620820c8  0004-missing-time-header.patch
d4d707aadf095f48dd3ae79f60d17194e479d8a6ca08c6b6d64582e6d09b33d7d065a7349cc7fe61f2b20bad6d9436db5d736edd7fc673fc7982f8a22f48050a  0005-dump2tar-linking-order.patch
984fd24ff1bf2d77f6aca77e4a75334ad21a9e36ce27fabb848d82a8e68446e2effeb16a725d5b93ae178ac11379f83a003c8c0d9e408cf96419873741517c3e  0006-define-path-mounted.patch
61b58cd3763458fb2f8c58ec410398e807711734154843cc96cfcc3857757ec6374dd2c22cd5ef5dec1d30c2e8a4dd0c4064f36824e8734a8625fc58668faeb8  0007-tunedasd-no-need-error-h.patch
1ec287c4d5c5c3336adacd658640afe5538fd91b86b87d2d0b5f96118a27527b4cf2318ce4712d6c94aceafacf2691a937ddc3ea6e1ecde9e41419c6c72a7471  0008-iucvterm-no-nls.patch
6e17741908c34b12c24d806712e8033de742592dea0583c9d10955b8003729da8cbd4f5095b6fbd7788d7f1eedeafdcf5a2077f1908e28a4ddd7b34368aacd34  0009-zdev-libexecinfo.patch
2d5cd3709e0233a6b97270af687b89bbc55f208744437a8409fc38c6afc152a8ebbf60a3d0b837a7c01a36b9bbf5f69d376c89fafcbb8e4153b64a09dc49a23a  0010-musl-s390x-signal-def.patch
d879173250fc0cabef198785923248e6832158e38d6ea9ef615f14e2d6698810b54c38c8327f20b2c43d8d509a274b27a7c0ad999a0c0bed2743715f21ab859a  0100-zipl-no-pie.patch
1cbbe3fe265c7d4164143d24c532c18b354be4bc295ad24064d379660e43a475b7d678b458cdf74ffdb44d6cd38a497dbe00758d688c547c6ece63b6dee091b7  0101-zipl-dont-optimize-size.patch
4ce15b615ff08e5c0a23d3c3b19d1e9d6362239fb731e67fa68e6cd108cfdeaaf16186c5416cc211082aa60c4d1946b930b9ea4c300458da98e9a701feed99c3  0200-dasdinfo-gnu-ext-hack.patch
9ce268721f4648305b0fc81225c0f8b1dc4b0b79a11631d661b236bcee799accadd7581e60258d4c026e7d2e25fadcae0da69560e48e6c92e074308b9b49b5c2  0300-disable-program-using-gnu-ext.patch
a805dff7898f05cb2fb6059624bbe55ed5399fc82068bfa2c592245c0d09991eccc8664cc0325302f29e954edd2ff913e8131bb3c7114050667ad6466503e86d  s390-tools-script"
