nixpkgs-suyu/pkgs/servers/samba/4.x.nix

167 lines
5.7 KiB
Nix
Raw Normal View History

2015-04-03 02:43:47 +02:00
{ stdenv, fetchurl, python, pkgconfig, perl, libxslt, docbook_xsl
, docbook_xml_dtd_42, docbook_xml_dtd_45, readline, talloc, ntdb, tdb, tevent
, ldb, popt, iniparser, subunit, libbsd, nss_wrapper, socket_wrapper
2015-04-03 02:43:47 +02:00
, uid_wrapper, libarchive
2015-01-03 06:21:34 +01:00
# source3/wscript optionals
2015-03-04 22:46:20 +01:00
, kerberos ? null
2015-04-04 03:33:36 +02:00
, zlib ? null
2015-01-03 06:21:34 +01:00
, openldap ? null
, cups ? null
, pam ? null
, avahi ? null
, acl ? null
, libaio ? null
, fam ? null
2015-04-22 00:05:00 +02:00
, libceph ? null
2015-01-03 06:21:34 +01:00
, glusterfs ? null
# buildtools/wafsamba/wscript optionals
, libiconv ? null
, gettext ? null
# source4/lib/tls/wscript optionals
, gnutls ? null
, libgcrypt ? null
, libgpgerror ? null
# other optionals
, ncurses ? null
, libunwind ? null
, dbus ? null
, libibverbs ? null
, librdmacm ? null
, systemd ? null
2015-01-03 06:21:34 +01:00
}:
2015-04-04 03:33:36 +02:00
assert kerberos != null -> zlib != null;
let
bundledLibs = if kerberos != null && kerberos.implementation == "heimdal" then "NONE" else "com_err";
hasGnutls = gnutls != null && libgcrypt != null && libgpgerror != null;
isKrb5OrNull = if kerberos != null && kerberos.implementation == "krb5" then true else null;
hasInfinibandOrNull = if libibverbs != null && librdmacm != null then true else null;
in
2015-05-22 22:33:08 +02:00
with stdenv.lib;
2015-01-03 06:21:34 +01:00
stdenv.mkDerivation rec {
2015-04-17 00:10:27 +02:00
name = "samba-4.2.1";
2015-01-03 06:21:34 +01:00
src = fetchurl {
url = "mirror://samba/pub/samba/stable/${name}.tar.gz";
2015-04-17 00:10:27 +02:00
sha256 = "1hsakc8h6rs48xr6i55m90pd53hpxcqjjnlwq8i2rp0nq4ws5sip";
2015-01-03 06:21:34 +01:00
};
2015-03-04 22:46:20 +01:00
patches = [
./4.x-no-persistent-install.patch
./4.x-fix-ctdb-deps.patch
2015-05-22 22:33:08 +02:00
] ++ optional (kerberos != null) ./4.x-heimdal-compat.patch;
2015-01-03 06:21:34 +01:00
buildInputs = [
2015-04-03 02:43:47 +02:00
python pkgconfig perl libxslt docbook_xsl docbook_xml_dtd_42
docbook_xml_dtd_45 readline talloc ntdb tdb tevent ldb popt iniparser
subunit libbsd nss_wrapper socket_wrapper uid_wrapper
2015-04-03 02:43:47 +02:00
libarchive
2015-01-03 06:21:34 +01:00
2015-04-22 00:05:00 +02:00
kerberos zlib openldap cups pam avahi acl libaio fam libceph glusterfs
2015-01-03 06:21:34 +01:00
libiconv gettext
gnutls libgcrypt libgpgerror
2015-04-04 03:33:36 +02:00
ncurses libunwind dbus libibverbs librdmacm systemd
2015-01-03 06:21:34 +01:00
];
2015-03-13 01:34:22 +01:00
postPatch = ''
# Removes absolute paths in scripts
sed -i 's,/sbin/,,g' ctdb/config/functions
2015-04-03 02:43:47 +02:00
# Fix the XML Catalog Paths
sed -i "s,\(XML_CATALOG_FILES=\"\),\1$XML_CATALOG_FILES ,g" buildtools/wafsamba/wafsamba.py
2015-03-13 01:34:22 +01:00
'';
2015-01-03 06:21:34 +01:00
enableParallelBuilding = true;
configureFlags = [
# source3/wscript options
2015-04-04 03:33:36 +02:00
(mkWith true "static-modules" "NONE")
(mkWith true "shared-modules" "ALL")
(mkWith true "winbind" null)
(mkWith (openldap != null) "ads" null)
(mkWith (openldap != null) "ldap" null)
(mkEnable (cups != null) "cups" null)
(mkEnable (cups != null) "iprint" null)
(mkWith (pam != null) "pam" null)
(mkWith (pam != null) "pam_smbpass" null)
(mkWith true "quotas" null)
(mkWith true "sendfile-support" null)
(mkWith true "utmp" null)
(mkWith true "utmp" null)
(mkEnable true "pthreadpool" null)
(mkEnable (avahi != null) "avahi" null)
(mkWith true "iconv" null)
(mkWith (acl != null) "acl-support" null)
(mkWith true "dnsupdate" null)
(mkWith true "syslog" null)
(mkWith true "automount" null)
(mkWith (libaio != null) "aio-support" null)
(mkWith (fam != null) "fam" null)
(mkWith (libarchive != null) "libarchive" null)
(mkWith true "cluster-support" null)
(mkWith (ncurses != null) "regedit" null)
2015-04-22 00:05:00 +02:00
(mkWith libceph "libcephfs" libceph)
2015-04-04 03:33:36 +02:00
(mkEnable (glusterfs != null) "glusterfs" null)
2015-03-04 22:46:20 +01:00
2015-01-03 06:21:34 +01:00
# dynconfig/wscript options
2015-04-04 03:33:36 +02:00
(mkEnable true "fhs" null)
(mkOther "sysconfdir" "/etc")
(mkOther "localstatedir" "/var")
2015-01-03 06:21:34 +01:00
# buildtools/wafsamba/wscript options
2015-04-04 03:33:36 +02:00
(mkOther "bundled-libraries" bundledLibs)
(mkOther "private-libraries" "NONE")
(mkOther "builtin-libraries" "replace")
(mkWith libiconv "libiconv" libiconv)
(mkWith (gettext != null) "gettext" gettext)
2015-03-04 22:46:20 +01:00
2015-01-03 06:21:34 +01:00
# source4/lib/tls/wscript options
2015-04-04 03:33:36 +02:00
(mkEnable hasGnutls "gnutls" null)
2015-03-04 22:46:20 +01:00
2015-01-03 06:21:34 +01:00
# wscript options
2015-04-04 03:33:36 +02:00
(mkWith isKrb5OrNull "system-mitkrb5" null)
(if hasGnutls then null else "--without-ad-dc")
2015-03-04 22:46:20 +01:00
# ctdb/wscript
2015-04-04 03:33:36 +02:00
(mkEnable hasInfinibandOrNull "infiniband" null)
(mkEnable null "pmda" null)
2015-03-04 22:46:20 +01:00
];
2015-01-03 06:21:34 +01:00
stripAllList = [ "bin" "sbin" ];
2015-04-03 03:07:22 +02:00
postInstall = ''
# Remove unecessary components
rm -r $out/{lib,share}/ctdb-tests
rm $out/bin/ctdb_run{_cluster,}_tests
'';
2015-03-13 01:34:22 +01:00
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" \;
'';
2015-05-22 22:33:08 +02:00
meta = {
2015-01-03 06:21:34 +01:00
homepage = http://www.samba.org/;
description = "The standard Windows interoperability suite of programs for Linux and Unix";
license = licenses.gpl3;
maintainers = with maintainers; [ wkennington ];
platforms = platforms.unix;
};
}