samba4: Fix linking and absolute paths

This commit is contained in:
William A. Kennington III 2015-03-12 17:34:22 -07:00
parent decf15fd57
commit e07ea5cf77

View file

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