summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/to/torque/package.nix
blob: 92d6ac3dd395345beaf7f0ad0e5de0478bda911f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{
  lib,
  stdenv,
  fetchFromGitHub,

  autoreconfHook,
  pkg-config,
  flex,
  bison,

  openssl,
  groff,
  libxml2,
  util-linux,
  libtool,
  which,
  coreutils,
  boost,
  zlib,
}:

stdenv.mkDerivation {
  pname = "torque";
  version = "6.1.3h2";

  src = fetchFromGitHub {
    owner = "adaptivecomputing";
    repo = "torque";
    # branch 6.1.3h2, as they aren't pushing tags
    # https://github.com/adaptivecomputing/torque/issues/467
    rev = "458883319157cfc5c509046d09f9eb8e68e8d398";
    sha256 = "1b56bc5j9wg87kcywzmhf7234byyrwax9v1pqsr9xmv2x7saakrr";
  };

  strictDeps = true;

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    flex
    bison
    libxml2
  ];

  buildInputs = [
    openssl
    groff
    libxml2
    util-linux
    libtool
    which
    boost
    zlib
  ];

  enableParallelBuilding = true;

  # added to fix build with gcc7
  env.NIX_CFLAGS_COMPILE = "-Wno-error -fpermissive";

  postPatch = ''
    substituteInPlace Makefile.am \
      --replace-fail "contrib/init.d contrib/systemd" ""
    substituteInPlace src/cmds/Makefile.am \
      --replace-fail "/etc/" "$out/etc/"
    substituteInPlace src/mom_rcp/pathnames.h \
      --replace-fail /bin/cp ${coreutils}/bin/cp
    substituteInPlace src/resmom/requests.c \
      --replace-fail /bin/cp ${coreutils}/bin/cp
  '';

  preConfigure = ''
    # fix broken libxml2 detection
    sed -i '/xmlLib\=/c\xmlLib=xml2' ./configure

    for s in fifo cray_t3e dec_cluster msic_cluster sgi_origin umn_cluster; do
      substituteInPlace src/scheduler.cc/samples/$s/Makefile.in \
        --replace-fail "schedprivdir = " "schedprivdir = $out/"
    done

    for f in $(find ./ -name Makefile.in); do
      echo patching $f...
      sed -i $f -e '/PBS_MKDIRS/d' -e '/chmod u+s/d'
    done

    patchShebangs buildutils
  '';

  postInstall = ''
    install -Dm755 torque.setup buildutils/pbs_mkdirs -t $out/bin/
  '';

  meta = {
    homepage = "https://github.com/adaptivecomputing/torque";
    description = "Resource management system for submitting and controlling jobs on supercomputers, clusters, and grids";
    platforms = lib.platforms.linux;
    license = lib.licenses.torque11;
  };
}