summary refs log tree commit diff
path: root/pkgs/development/libraries/openldap
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-19 01:35:39 +0100
committerGitHub <noreply@github.com>2021-02-19 01:35:39 +0100
commitdc7769bf7e94348158b626f163f03387b25f9715 (patch)
tree7f3ac55bda9d0a9d83c1464702ac42136a1a9e31 /pkgs/development/libraries/openldap
parent78f333489ef6f6dfce40ff749e9d07c236cc74ef (diff)
downloadnixpkgs-dc7769bf7e94348158b626f163f03387b25f9715.tar
nixpkgs-dc7769bf7e94348158b626f163f03387b25f9715.tar.gz
nixpkgs-dc7769bf7e94348158b626f163f03387b25f9715.tar.bz2
nixpkgs-dc7769bf7e94348158b626f163f03387b25f9715.tar.lz
nixpkgs-dc7769bf7e94348158b626f163f03387b25f9715.tar.xz
nixpkgs-dc7769bf7e94348158b626f163f03387b25f9715.tar.zst
nixpkgs-dc7769bf7e94348158b626f163f03387b25f9715.zip
openldap: fix build if openssl or cyrus_sasl are overridden to null, add flag for cyrus_sasl, require openssl (#108046)
Diffstat (limited to 'pkgs/development/libraries/openldap')
-rw-r--r--pkgs/development/libraries/openldap/default.nix24
1 files changed, 14 insertions, 10 deletions
diff --git a/pkgs/development/libraries/openldap/default.nix b/pkgs/development/libraries/openldap/default.nix
index a71b2a61910..44a0e017a2a 100644
--- a/pkgs/development/libraries/openldap/default.nix
+++ b/pkgs/development/libraries/openldap/default.nix
@@ -1,4 +1,7 @@
-{ lib, stdenv, fetchurl, openssl, cyrus_sasl, db, groff, libtool }:
+{ lib, stdenv, fetchurl, openssl, db, groff, libtool
+, withCyrusSasl ? true
+, cyrus_sasl
+}:
 
 stdenv.mkDerivation rec {
   pname = "openldap";
@@ -37,8 +40,7 @@ stdenv.mkDerivation rec {
   ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "--with-yielding_select=yes"
     "ac_cv_func_memcmp_working=yes"
-  ] ++ lib.optional (openssl == null) "--without-tls"
-    ++ lib.optional (cyrus_sasl == null) "--without-cyrus-sasl"
+  ] ++ lib.optional (!withCyrusSasl) "--without-cyrus-sasl"
     ++ lib.optional stdenv.isFreeBSD "--with-pic";
 
   postBuild = ''
@@ -54,19 +56,21 @@ stdenv.mkDerivation rec {
     "moduledir=$(out)/lib/modules"
   ];
 
-  # 1. Fixup broken libtool
-  # 2. Libraries left in the build location confuse `patchelf --shrink-rpath`
+  # 1. Libraries left in the build location confuse `patchelf --shrink-rpath`
   #    Delete these to let patchelf discover the right path instead.
   #    FIXME: that one can be removed when https://github.com/NixOS/patchelf/pull/98
   #    is in Nixpkgs patchelf.
+  # 2. Fixup broken libtool for openssl and cyrus_sasl (if it is not disabled)
   preFixup = ''
-    sed -e 's,-lsasl2,-L${cyrus_sasl.out}/lib -lsasl2,' \
-        -e 's,-lssl,-L${openssl.out}/lib -lssl,' \
-        -i $out/lib/libldap.la -i $out/lib/libldap_r.la
-
-    rm -rf $out/var
+    rm -r $out/var
     rm -r libraries/*/.libs
     rm -r contrib/slapd-modules/passwd/*/.libs
+    for f in $out/lib/libldap.la $out/lib/libldap_r.la; do
+      substituteInPlace "$f" --replace '-lssl' '-L${openssl.out}/lib -lssl'
+  '' + lib.optionalString withCyrusSasl ''
+      substituteInPlace "$f" --replace '-lsasl2' '-L${cyrus_sasl.out}/lib -lsasl2'
+  '' + ''
+    done
   '';
 
   postInstall = ''