2021-02-24 19:53:45 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, libxslt, libaio, systemd, perl
|
2020-11-24 15:29:28 +00:00
|
|
|
, docbook_xsl, coreutils, lsof, rdma-core, makeWrapper, sg3_utils, util-linux
|
2019-07-30 00:21:00 +01:00
|
|
|
}:
|
2015-09-24 20:42:06 +01:00
|
|
|
|
2019-06-04 03:28:09 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "tgt";
|
2021-12-22 07:58:12 +00:00
|
|
|
version = "1.0.81";
|
2016-04-13 03:58:54 +01:00
|
|
|
|
2015-09-24 20:42:06 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fujita";
|
2019-06-04 03:28:09 +01:00
|
|
|
repo = pname;
|
2016-04-13 03:58:54 +01:00
|
|
|
rev = "v${version}";
|
2021-12-22 07:58:12 +00:00
|
|
|
sha256 = "sha256-SgMpoaVAuTbgpmnXRfQFWlK5gl01fsE9vJxu3C2ctPU=";
|
2015-09-24 20:42:06 +01:00
|
|
|
};
|
|
|
|
|
2019-07-30 00:21:00 +01:00
|
|
|
nativeBuildInputs = [ libxslt docbook_xsl makeWrapper ];
|
|
|
|
|
|
|
|
buildInputs = [ systemd libaio ];
|
2015-09-24 20:42:06 +01:00
|
|
|
|
2018-12-22 21:29:54 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=${placeholder "out"}"
|
|
|
|
"SD_NOTIFY=1"
|
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [
|
|
|
|
"sysconfdir=${placeholder "out"}/etc"
|
|
|
|
];
|
2015-09-24 20:42:06 +01:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
sed -i 's|/usr/bin/||' doc/Makefile
|
|
|
|
sed -i 's|/usr/include/libaio.h|${libaio}/include/libaio.h|' usr/Makefile
|
2016-08-30 01:11:09 +01:00
|
|
|
sed -i 's|/usr/include/sys/|${stdenv.glibc.dev}/include/sys/|' usr/Makefile
|
|
|
|
sed -i 's|/usr/include/linux/|${stdenv.glibc.dev}/include/linux/|' usr/Makefile
|
2015-09-24 20:42:06 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
2019-07-30 00:21:00 +01:00
|
|
|
substituteInPlace $out/sbin/tgt-admin \
|
2021-02-24 19:53:45 +00:00
|
|
|
--replace "#!/usr/bin/perl" "#! ${perl.withPackages (p: [ p.ConfigGeneral ])}/bin/perl"
|
2019-07-30 00:21:00 +01:00
|
|
|
wrapProgram $out/sbin/tgt-admin --prefix PATH : \
|
|
|
|
${lib.makeBinPath [ lsof sg3_utils (placeholder "out") ]}
|
|
|
|
|
|
|
|
install -D scripts/tgtd.service $out/etc/systemd/system/tgtd.service
|
|
|
|
substituteInPlace $out/etc/systemd/system/tgtd.service \
|
|
|
|
--replace "/usr/sbin/tgt" "$out/bin/tgt"
|
|
|
|
|
|
|
|
# See https://bugzilla.redhat.com/show_bug.cgi?id=848942
|
|
|
|
sed -i '/ExecStart=/a ExecStartPost=${coreutils}/bin/sleep 5' $out/etc/systemd/system/tgtd.service
|
2015-09-24 20:42:06 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2016-04-13 03:58:54 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-07-30 00:21:00 +01:00
|
|
|
description = "iSCSI Target daemon with RDMA support";
|
2021-12-26 04:51:59 +00:00
|
|
|
homepage = "https://github.com/fujita/tgt";
|
2019-07-30 00:21:00 +01:00
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ johnazoidberg ];
|
2015-09-24 20:42:06 +01:00
|
|
|
};
|
2015-10-12 11:27:54 +01:00
|
|
|
}
|