<commit_before>{ lib
, stdenv
, fetchFromGitHub
  # Native build inputs
, autoreconfHook
, bison
, flex
, pkg-config
  # Build inputs
, expat
, gsoap
, openssl
, zlib
}:

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=";
  };

  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"
  ];

  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 ];<commit_msg>voms: default to symlink $out/etc to /etc<commit_after>{ 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 ];
{'fraction_non_alphanumeric': 0.13670886075949368, 'fraction_numerical': 0.0270042194092827, 'mean_word_length': 3.054732041049031, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4539579', 'n_tokens_mistral': 1442, 'n_tokens_neox': 1349, 'n_words': 269}