summary refs log tree commit diff
path: root/pkgs/tools/networking/voms/default.nix
blob: a16648b9a8337c248679bef2cc487afc6dcb3d97 (plain) (blame)
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
{ lib
, stdenv
, fetchFromGitHub
  # Native build inputs
, autoreconfHook
, bison
, flex
, pkg-config
  # Build inputs
, expat
, gsoap
, openssl
, zlib
  # Configuration overridable with .override
  # If not null, the builder will
  # move "$out/etc" to "$out/etc.orig" and symlink "$out/etc" to externalEtc.
, externalEtc ? "/etc"
}:

stdenv.mkDerivation rec{
  pname = "voms-unstable";
  version = "2022-06-14";

  src = fetchFromGitHub {
    owner = "italiangrid";
    repo = "voms";
    rev = "8e99bb96baaf197f0f557836e2829084bb1bb00e"; # develop branch
    hash = "sha256-FG4fHO2lsQ3t/ZaKT9xY+xqdQHfdtzi5ULtxLhdPnss=";
  };

  passthru = {
    inherit externalEtc;
  };

  nativeBuildInputs = [
    autoreconfHook
    bison
    flex
    pkg-config
  ];

  buildInputs = [
    expat
    gsoap
    openssl
    zlib
  ];

  outputs = [ "bin" "out" "dev" "man" ];

  preAutoreconf = ''
    mkdir -p aux src/autogen
  '';

  postAutoreconf = ''
    # FHS patching
    substituteInPlace configure \
      --replace "/usr/bin/soapcpp2" "${gsoap}/bin/soapcpp2"

    # Tell gcc about the location of zlib
    # See https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=voms
    export GSOAP_SSL_PP_CFLAGS="$(pkg-config --cflags gsoapssl++ zlib)"
    export GSOAP_SSL_PP_LIBS="$(pkg-config --libs gsoapssl++ zlib)"
  '';

  configureFlags = [
    "--with-gsoap-wsdl2h=${gsoap}/bin/wsdl2h"
  ];

  postFixup = ''
    ${lib.optionalString (externalEtc != null) ''
      mv "$out"/etc{,.orig}
      ln -s ${lib.escapeShellArg externalEtc} "$out/etc"
    ''}
  '';

  meta = with lib; {
    description = "The C/C++ VOMS server, client and APIs v2.x";
    homepage = "https://italiangrid.github.io/voms/";
    changelog = "https://github.com/italiangrid/voms/blob/master/ChangeLog";
    license = licenses.asl20;
    platforms = platforms.linux; # gsoap is currently Linux-only in Nixpkgs
    maintainers = with maintainers; [ ShamrockLee ];
  };
}