# Contributor: Carlo Landmeter
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=iscsi-scst
pkgver=2.2.1
pkgrel=2
pkgdesc="ISCSI target for SCST - userspace tools"
url="http://scst.sourceforge.net/"
arch="all"
license="GPL-2.0"
depends=""
install=""
makedepends="linux-headers libressl-dev bash"
subpackages=""
source="http://downloads.sourceforge.net/scst/$pkgname-$pkgver.tar.bz2
		http://downloads.sourceforge.net/scst/scst-$pkgver.tar.bz2
		$pkgname.initd
		$pkgname.confd
		scst.conf
        "

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	cp Makefile_user_space_only Makefile
}

build() {
	cd "$_builddir"
	make all SCST_INC_DIR="$srcdir/scst-$pkgver/include" || return 1
}

package() {
	cd "$_builddir"
	# make install is broken
	install -D usr/iscsi-scstd "$pkgdir"/usr/sbin/iscsi-scstd
	install -D usr/iscsi-scst-adm "$pkgdir"/usr/sbin/iscsi-scst-adm
	install -D -m 755 "$srcdir"/iscsi-scst.initd "$pkgdir"/etc/init.d/iscsi-scst
	install -D -m 644 "$srcdir"/iscsi-scst.confd "$pkgdir"/etc/conf.d/iscsi-scst
	install -D -m 644 "$srcdir"/scst.conf "$pkgdir"/etc/scst.conf
}

md5sums="738bbe1ea5c9f83c2f5347e93a6154a3  iscsi-scst-2.2.1.tar.bz2
a0c50d8457075798df7d8d547ebeb356  scst-2.2.1.tar.bz2
f22c845b90e739419349e36f3da916cb  iscsi-scst.initd
6d8b6e27d47748f7805fdb318b62bb3b  iscsi-scst.confd
e8eda9872b3da3a55605c7fa17cb6c68  scst.conf"
sha256sums="469661d6bcb904ed5c8ed54f48439a95661822f470ac1e1c14faa1ed66c742d1  iscsi-scst-2.2.1.tar.bz2
1e3e887a8b915f6945ad168cdf7e8f506a050a05e9969e0e0f4098e2b25cdd93  scst-2.2.1.tar.bz2
02de12f93e5eccec6da2031b40582732044e80c679981cfb0a352341ef44d53a  iscsi-scst.initd
5d5bf53314e263a11d469085ed984888ebc33d937d91a22b2a49e7313bc77df4  iscsi-scst.confd
ce9bf6cd3a9a245c0a5c28dcd82c33cbe75012aac6eecead0376d82f77fc68ec  scst.conf"
sha512sums="3be7013a75c8f8145e70498b5e8aa6ade419d947e54350e856f4af7a6338741cec9b0f79e4e747b7187274b0c4de2d5c7d28f24a0a7d1549ab712da1068d6b39  iscsi-scst-2.2.1.tar.bz2
6e1b3e1ab92de2d46715a2db546419ff2d122c386756fda8000413f9b0416088947acc9441a6e18b74fe32f491c03a6fea325b70a9ae6a6888039dcffe093c3d  scst-2.2.1.tar.bz2
0082ff0bc46876d1a9a1672cdee25d951953d487255d7e5e6cb3c6a28722d2e614d35a8450cacd39dd7d1e4c205ffb360c7d41ba411f2c5670a5cd5e660e477e  iscsi-scst.initd
2cb3907fbe9e0685bb7fc7f7108a6834f04a0a1e46f9e2d440cfcc627678f02a8c91fc61cc0ac06b4b014f76bc46ab42c611ba3b76db4ae37688011a9684cce6  iscsi-scst.confd
bde98028689e075c07ae8b94ac94a76ca53142cd57f7dca6c209f46489ea66da4e50e56eab5405821008a5b4a72174faa3f45f39ec8844dfe0f18f8cd891195f  scst.conf"
