1{ lib, stdenv, fetchFromGitHub, openssl, flex, bison, pkg-config, groff, libxml2, util-linux
2, coreutils, file, libtool, which, boost, autoreconfHook
3}:
4
5stdenv.mkDerivation rec {
6 pname = "torque";
7 version = "6.1.3h2";
8
9 src = fetchFromGitHub {
10 owner = "adaptivecomputing";
11 repo = pname;
12 # branch 6.1.3h2, as they aren't pushing tags
13 # https://github.com/adaptivecomputing/torque/issues/467
14 rev = "458883319157cfc5c509046d09f9eb8e68e8d398";
15 sha256 = "1b56bc5j9wg87kcywzmhf7234byyrwax9v1pqsr9xmv2x7saakrr";
16 };
17
18 strictDeps = true;
19 nativeBuildInputs = [ autoreconfHook pkg-config flex bison libxml2 ];
20 buildInputs = [
21 openssl groff libxml2 util-linux libtool
22 which boost
23 ];
24
25 enableParallelBuilding = true;
26
27 # added to fix build with gcc7
28 NIX_CFLAGS_COMPILE = "-Wno-error -fpermissive";
29
30 postPatch = ''
31 substituteInPlace Makefile.am \
32 --replace "contrib/init.d contrib/systemd" ""
33 substituteInPlace src/cmds/Makefile.am \
34 --replace "/etc/" "$out/etc/"
35 substituteInPlace src/mom_rcp/pathnames.h \
36 --replace /bin/cp ${coreutils}/bin/cp
37 substituteInPlace src/resmom/requests.c \
38 --replace /bin/cp ${coreutils}/bin/cp
39 '';
40
41 preConfigure = ''
42 substituteInPlace ./configure \
43 --replace '/usr/bin/file' '${file}/bin/file'
44
45 # fix broken libxml2 detection
46 sed -i '/xmlLib\=/c\xmlLib=xml2' ./configure
47
48 for s in fifo cray_t3e dec_cluster msic_cluster sgi_origin umn_cluster; do
49 substituteInPlace src/scheduler.cc/samples/$s/Makefile.in \
50 --replace "schedprivdir = " "schedprivdir = $out/"
51 done
52
53 for f in $(find ./ -name Makefile.in); do
54 echo patching $f...
55 sed -i $f -e '/PBS_MKDIRS/d' -e '/chmod u+s/d'
56 done
57
58 patchShebangs buildutils
59 '';
60
61 postInstall = ''
62 cp -v buildutils/pbs_mkdirs $out/bin/
63 cp -v torque.setup $out/bin/
64 chmod +x $out/bin/pbs_mkdirs $out/bin/torque.setup
65 '';
66
67 meta = with lib; {
68 homepage = "http://www.adaptivecomputing.com/products/open-source/torque";
69 description = "Resource management system for submitting and controlling jobs on supercomputers, clusters, and grids";
70 platforms = platforms.linux;
71 license = "TORQUEv1.1";
72 };
73}