summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-03-12 17:34:22 -0700
committerWilliam A. Kennington III <william@wkennington.com>2015-03-12 17:34:59 -0700
commite07ea5cf77601325b16f51fb457b90d5aadfab6f (patch)
treec266be2a78a8ca8d74dc94ee1bfb3e582353aa01 /pkgs/servers
parentdecf15fd57c8f26079cdfc7572f1097decfc296f (diff)
downloadnixlib-e07ea5cf77601325b16f51fb457b90d5aadfab6f.tar
nixlib-e07ea5cf77601325b16f51fb457b90d5aadfab6f.tar.gz
nixlib-e07ea5cf77601325b16f51fb457b90d5aadfab6f.tar.bz2
nixlib-e07ea5cf77601325b16f51fb457b90d5aadfab6f.tar.lz
nixlib-e07ea5cf77601325b16f51fb457b90d5aadfab6f.tar.xz
nixlib-e07ea5cf77601325b16f51fb457b90d5aadfab6f.tar.zst
nixlib-e07ea5cf77601325b16f51fb457b90d5aadfab6f.zip
samba4: Fix linking and absolute paths
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/samba/4.x.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix
index 362885417b74..2cc3cc69d3f0 100644
--- a/pkgs/servers/samba/4.x.nix
+++ b/pkgs/servers/samba/4.x.nix
@@ -56,6 +56,11 @@ stdenv.mkDerivation rec {
     zlib ncurses libcap
   ];
 
+  postPatch = ''
+    # Removes absolute paths in scripts
+    sed -i 's,/sbin/,,g' ctdb/config/functions
+  '';
+
   enableParallelBuilding = true;
 
   configureFlags = [
@@ -111,6 +116,19 @@ stdenv.mkDerivation rec {
 
   stripAllList = [ "bin" "sbin" ];
 
+  postFixup = ''
+    export SAMBA_LIBS="$(find $out -type f -name \*.so -exec dirname {} \; | sort | uniq)"
+    read -r -d "" SCRIPT << EOF
+    [ -z "\$SAMBA_LIBS" ] && exit 1;
+    BIN='{}';
+    OLD_LIBS="\$(patchelf --print-rpath "\$BIN" 2>/dev/null | tr ':' '\n')";
+    ALL_LIBS="\$(echo -e "\$SAMBA_LIBS\n\$OLD_LIBS" | sort | uniq | tr '\n' ':')";
+    patchelf --set-rpath "\$ALL_LIBS" "\$BIN" 2>/dev/null || exit $?;
+    patchelf --shrink-rpath "\$BIN";
+    EOF
+    find $out -type f -exec $SHELL -c "$SCRIPT" \;
+  '';
+
   meta = with stdenv.lib; {
     homepage = http://www.samba.org/;
     description = "The standard Windows interoperability suite of programs for Linux and Unix";