Unverified Commit e6682127 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #195096 from ners/389ds

parents 06eb5dc7 53580d9f
Loading
Loading
Loading
Loading
+81 −103
Original line number Diff line number Diff line
{ stdenv
, autoreconfHook
{ lib
, stdenv
, fetchFromGitHub
, lib

, bzip2
, cmocka
, autoconf
, automake
, libtool
, pkg-config
, cracklib
, cyrus_sasl
, db
, doxygen
, icu
, lmdb
, json_c
, linux-pam
, libevent
, libkrb5
, lm_sensors
, net-snmp
, nspr
, nss
, openldap
, openssl
, pcre
, perl
, perlPackages
, pkg-config
, withOpenldap ? true
, db
, withBdb ? true
, cyrus_sasl
, icu
, net-snmp
, withNetSnmp ? true
, krb5
, pcre2
, python3
, svrcore
, rustPlatform
, openssl
, systemd
, withSystemd ? stdenv.isLinux
, zlib

, enablePamPassthru ? true
, pam

, enableCockpit ? true
, rsync

, enableDna ? true
, enableLdapi ? true
, enableAutobind ? false
, enableAutoDnSuffix ? false
, enableBitwise ? true
, enableAcctPolicy ? true
, enablePosixWinsync ? true
, withCockpit ? true
, withAsan ? false
}:

stdenv.mkDerivation rec {
  pname = "389-ds-base";
  version = "2.0.7";
  version = "2.3.0";

  src = fetchFromGitHub {
    owner = "389ds";
    repo = pname;
    rev = "${pname}-${version}";
    sha256 = "sha256-aM1qo+yHrCFespPWHv2f25ooqQVCIZGaZS43dY6kiC4=";
    sha256 = "sha256-GnntF0UaufDrgcM6FFFdwxwVoU9Hu2NXTW1A2lTb6T4=";
  };

  cargoDeps = rustPlatform.fetchCargoTarball {
    inherit src;
    sourceRoot = "source/src";
    name = "${pname}-${version}";
    hash = "sha256-OJXvNL7STNwvt6EiV2r8zv2ZoUGgNUj7UssAQNLN4KI=";
  };

  nativeBuildInputs = [ autoreconfHook pkg-config doxygen ];
  nativeBuildInputs = [
    autoconf
    automake
    libtool
    pkg-config
    python3
    rustPlatform.rust.cargo
    rustPlatform.rust.rustc
  ]
  ++ lib.optional withCockpit rsync;

  buildInputs = [
    bzip2
    cracklib
    cyrus_sasl
    db
    icu
    lmdb
    json_c
    linux-pam
    libevent
    libkrb5
    lm_sensors
    net-snmp
    nspr
    nss
    openldap
    cyrus_sasl
    icu
    krb5
    pcre2
    openssl
    pcre
    perl
    python3
    svrcore
    zlib

    # tests
    cmocka
    libevent

    # lib389
    (python3.withPackages (ps: with ps; [
      setuptools
      python-ldap
      six
      pyasn1
      pyasn1-modules
      python-dateutil
      argcomplete
      libselinux
    ]))

    # logconv.pl
    perlPackages.DBFile
    perlPackages.ArchiveTar
  ]
  ++ lib.optional enableCockpit rsync
  ++ lib.optional enablePamPassthru pam;
  ++ lib.optional withSystemd systemd
  ++ lib.optional withOpenldap openldap
  ++ lib.optional withBdb db
  ++ lib.optional withNetSnmp net-snmp;

  postPatch = ''
    substituteInPlace Makefile.am \
      --replace 's,@perlpath\@,$(perldir),g' 's,@perlpath\@,$(perldir) $(PERLPATH),g'

    patchShebangs ./buildnum.py ./ldap/servers/slapd/mkDBErrStrs.py
  '';

  preConfigure = ''
    # Create perl paths for library imports in perl scripts
    PERLPATH=""
    for P in $(echo $PERL5LIB | sed 's/:/ /g'); do
      PERLPATH="$PERLPATH $(echo $P/*/*)"
    done
    export PERLPATH
    ./autogen.sh --prefix="$out"
  '';

  preBuild = ''
    mkdir -p ./vendor
    tar -xzf ${cargoDeps} -C ./vendor --strip-components=1
  '';

  configureFlags =
    let
      mkEnable = cond: name: if cond then "--enable-${name}" else "--disable-${name}";
    in
    [
      "--enable-cmocka"
      "--localstatedir=/var"
      "--sysconfdir=/etc"
      "--with-db-inc=${db.dev}/include"
      "--with-db-lib=${db.out}/lib"
      "--with-db=yes"
  configureFlags = [
    "--enable-rust-offline"
    "--enable-autobind"
  ]
  ++ lib.optionals withSystemd [
    "--with-systemd"
    "--with-systemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
  ] ++ lib.optionals withOpenldap [
    "--with-openldap"
  ] ++ lib.optionals withBdb [
    "--with-db-inc=${lib.getDev db}/include"
    "--with-db-lib=${lib.getLib db}/lib"
  ] ++ lib.optionals withNetSnmp [
    "--with-netsnmp-inc=${lib.getDev net-snmp}/include"
    "--with-netsnmp-lib=${lib.getLib net-snmp}/lib"
      "--with-netsnmp=yes"
      "--with-openldap"

      "${mkEnable enableCockpit "cockpit"}"
      "${mkEnable enablePamPassthru "pam-passthru"}"
      "${mkEnable enableDna "dna"}"
      "${mkEnable enableLdapi "ldapi"}"
      "${mkEnable enableAutobind "autobind"}"
      "${mkEnable enableAutoDnSuffix "auto-dn-suffix"}"
      "${mkEnable enableBitwise "bitwise"}"
      "${mkEnable enableAcctPolicy "acctpolicy"}"
      "${mkEnable enablePosixWinsync "posix-winsync"}"
  ] ++ lib.optionals (!withCockpit) [
    "--disable-cockpit"
  ] ++ lib.optionals withAsan [
    "--enable-asan"
    "--enable-debug"
  ];

  enableParallelBuilding = true;
@@ -156,5 +133,6 @@ stdenv.mkDerivation rec {
    description = "Enterprise-class Open Source LDAP server for Linux";
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
    maintainers = [ maintainers.ners ];
  };
}
+2 −2
Original line number Diff line number Diff line
@@ -23069,6 +23069,8 @@ with pkgs;
  alps = callPackage ../servers/alps { };
  apache-directory-server = callPackage ../servers/ldap/apache-directory-server {};
  apacheHttpd_2_4 = callPackage ../servers/http/apache-httpd/2.4.nix { };
  apacheHttpd = apacheHttpd_2_4;
@@ -26974,8 +26976,6 @@ with pkgs;
  ao = libfive;
  apache-directory-server = callPackage ../servers/apache-directory-server {};
  apache-directory-studio = callPackage ../applications/networking/apache-directory-studio {};
  apkeep = callPackage ../tools/misc/apkeep {