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