samba: add darwin support (#207465)
This commit is contained in:
parent
c4abc231be
commit
5f40e9e178
|
@ -18,7 +18,6 @@
|
||||||
, zlib
|
, zlib
|
||||||
, liburing
|
, liburing
|
||||||
, gnutls
|
, gnutls
|
||||||
, libunwind
|
|
||||||
, systemd
|
, systemd
|
||||||
, samba
|
, samba
|
||||||
, jansson
|
, jansson
|
||||||
|
@ -41,6 +40,7 @@
|
||||||
, enableCephFS ? false, ceph
|
, enableCephFS ? false, ceph
|
||||||
, enableGlusterFS ? false, glusterfs, libuuid
|
, enableGlusterFS ? false, glusterfs, libuuid
|
||||||
, enableAcl ? (!stdenv.isDarwin), acl
|
, enableAcl ? (!stdenv.isDarwin), acl
|
||||||
|
, enableLibunwind ? (!stdenv.isDarwin), libunwind
|
||||||
, enablePam ? (!stdenv.isDarwin), pam
|
, enablePam ? (!stdenv.isDarwin), pam
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -75,11 +75,12 @@ stdenv.mkDerivation rec {
|
||||||
perl.pkgs.ParseYapp
|
perl.pkgs.ParseYapp
|
||||||
perl.pkgs.JSON
|
perl.pkgs.JSON
|
||||||
libxslt
|
libxslt
|
||||||
buildPackages.stdenv.cc
|
|
||||||
docbook_xsl
|
docbook_xsl
|
||||||
docbook_xml_dtd_45
|
docbook_xml_dtd_45
|
||||||
cmocka
|
cmocka
|
||||||
rpcsvc-proto
|
rpcsvc-proto
|
||||||
|
] ++ optionals stdenv.isLinux [
|
||||||
|
buildPackages.stdenv.cc
|
||||||
] ++ optional (stdenv.buildPlatform != stdenv.hostPlatform) samba # asn1_compile/compile_et
|
] ++ optional (stdenv.buildPlatform != stdenv.hostPlatform) samba # asn1_compile/compile_et
|
||||||
++ optionals stdenv.isDarwin [
|
++ optionals stdenv.isDarwin [
|
||||||
fixDarwinDylibNames
|
fixDarwinDylibNames
|
||||||
|
@ -98,7 +99,6 @@ stdenv.mkDerivation rec {
|
||||||
libbsd
|
libbsd
|
||||||
libarchive
|
libarchive
|
||||||
zlib
|
zlib
|
||||||
libunwind
|
|
||||||
gnutls
|
gnutls
|
||||||
libtasn1
|
libtasn1
|
||||||
tdb
|
tdb
|
||||||
|
@ -113,6 +113,7 @@ stdenv.mkDerivation rec {
|
||||||
++ optional (enableCephFS && stdenv.isLinux) (lib.getDev ceph)
|
++ optional (enableCephFS && stdenv.isLinux) (lib.getDev ceph)
|
||||||
++ optionals (enableGlusterFS && stdenv.isLinux) [ glusterfs libuuid ]
|
++ optionals (enableGlusterFS && stdenv.isLinux) [ glusterfs libuuid ]
|
||||||
++ optional enableAcl acl
|
++ optional enableAcl acl
|
||||||
|
++ optional enableLibunwind libunwind
|
||||||
++ optional enablePam pam;
|
++ optional enablePam pam;
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
@ -133,7 +134,6 @@ stdenv.mkDerivation rec {
|
||||||
wafConfigureFlags = [
|
wafConfigureFlags = [
|
||||||
"--with-static-modules=NONE"
|
"--with-static-modules=NONE"
|
||||||
"--with-shared-modules=ALL"
|
"--with-shared-modules=ALL"
|
||||||
"--with-libunwind"
|
|
||||||
"--enable-fhs"
|
"--enable-fhs"
|
||||||
"--sysconfdir=/etc"
|
"--sysconfdir=/etc"
|
||||||
"--localstatedir=/var"
|
"--localstatedir=/var"
|
||||||
|
@ -143,7 +143,8 @@ stdenv.mkDerivation rec {
|
||||||
++ optionals (!enableLDAP) [
|
++ optionals (!enableLDAP) [
|
||||||
"--without-ldap"
|
"--without-ldap"
|
||||||
"--without-ads"
|
"--without-ads"
|
||||||
] ++ optional enableProfiling "--with-profiling-data"
|
] ++ optional enableLibunwind "--with-libunwind"
|
||||||
|
++ optional enableProfiling "--with-profiling-data"
|
||||||
++ optional (!enableAcl) "--without-acl-support"
|
++ optional (!enableAcl) "--without-acl-support"
|
||||||
++ optional (!enablePam) "--without-pam"
|
++ optional (!enablePam) "--without-pam"
|
||||||
++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||||
|
@ -175,16 +176,25 @@ stdenv.mkDerivation rec {
|
||||||
# Use find -type f -executable -exec echo {} \; -exec sh -c 'ldd {} | grep "not found"' \;
|
# Use find -type f -executable -exec echo {} \; -exec sh -c 'ldd {} | grep "not found"' \;
|
||||||
# Looks like a bug in installer scripts.
|
# Looks like a bug in installer scripts.
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
export SAMBA_LIBS="$(find $out -type f -regex '.*\.so\(\..*\)?' -exec dirname {} \; | sort | uniq)"
|
export SAMBA_LIBS="$(find $out -type f -regex '.*\${stdenv.hostPlatform.extensions.sharedLibrary}\(\..*\)?' -exec dirname {} \; | sort | uniq)"
|
||||||
read -r -d "" SCRIPT << EOF || true
|
read -r -d "" SCRIPT << EOF || true
|
||||||
[ -z "\$SAMBA_LIBS" ] && exit 1;
|
[ -z "\$SAMBA_LIBS" ] && exit 1;
|
||||||
BIN='{}';
|
BIN='{}';
|
||||||
|
'' + lib.optionalString stdenv.isLinux ''
|
||||||
OLD_LIBS="\$(patchelf --print-rpath "\$BIN" 2>/dev/null | tr ':' '\n')";
|
OLD_LIBS="\$(patchelf --print-rpath "\$BIN" 2>/dev/null | tr ':' '\n')";
|
||||||
ALL_LIBS="\$(echo -e "\$SAMBA_LIBS\n\$OLD_LIBS" | sort | uniq | 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 --set-rpath "\$ALL_LIBS" "\$BIN" 2>/dev/null || exit $?;
|
||||||
patchelf --shrink-rpath "\$BIN";
|
patchelf --shrink-rpath "\$BIN";
|
||||||
|
'' + lib.optionalString stdenv.isDarwin ''
|
||||||
|
install_name_tool -id \$BIN \$BIN
|
||||||
|
for old_rpath in \$(otool -L \$BIN | grep /private/tmp/ | awk '{print \$1}'); do
|
||||||
|
new_rpath=\$(find \$SAMBA_LIBS -name \$(basename \$old_rpath) | head -n 1)
|
||||||
|
install_name_tool -change \$old_rpath \$new_rpath \$BIN
|
||||||
|
done
|
||||||
|
'' + ''
|
||||||
EOF
|
EOF
|
||||||
find $out -type f -regex '.*\.so\(\..*\)?' -exec $SHELL -c "$SCRIPT" \;
|
find $out -type f -regex '.*\${stdenv.hostPlatform.extensions.sharedLibrary}\(\..*\)?' -exec $SHELL -c "$SCRIPT" \;
|
||||||
|
find $out/bin -type f -exec $SHELL -c "$SCRIPT" \;
|
||||||
|
|
||||||
# Fix PYTHONPATH for some tools
|
# Fix PYTHONPATH for some tools
|
||||||
wrapPythonPrograms
|
wrapPythonPrograms
|
||||||
|
@ -209,10 +219,7 @@ stdenv.mkDerivation rec {
|
||||||
description = "The standard Windows interoperability suite of programs for Linux and Unix";
|
description = "The standard Windows interoperability suite of programs for Linux and Unix";
|
||||||
license = licenses.gpl3;
|
license = licenses.gpl3;
|
||||||
platforms = platforms.unix;
|
platforms = platforms.unix;
|
||||||
# N.B. enableGlusterFS does not build
|
broken = enableGlusterFS;
|
||||||
# TODO: darwin support needs newer SDK for "_futimens" and "_utimensat"
|
|
||||||
# see https://github.com/NixOS/nixpkgs/issues/101229
|
|
||||||
broken = stdenv.isDarwin || enableGlusterFS;
|
|
||||||
maintainers = with maintainers; [ aneeshusa ];
|
maintainers = with maintainers; [ aneeshusa ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -24794,7 +24794,7 @@ with pkgs;
|
||||||
|
|
||||||
deadpixi-sam-unstable = callPackage ../applications/editors/deadpixi-sam { };
|
deadpixi-sam-unstable = callPackage ../applications/editors/deadpixi-sam { };
|
||||||
|
|
||||||
samba4 = callPackage ../servers/samba/4.x.nix { };
|
samba4 = darwin.apple_sdk_11_0.callPackage ../servers/samba/4.x.nix { };
|
||||||
|
|
||||||
samba = samba4;
|
samba = samba4;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue