From 46d3cd449fcaf76c73570834ec4ecc1bb7adb6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 29 Nov 2011 22:54:00 +0000 Subject: [PATCH] Samba: Add a cross-compilable variant. svn path=/nixpkgs/trunk/; revision=30627 --- pkgs/servers/samba/default.nix | 45 +++++++++++++++++++-------------- pkgs/top-level/all-packages.nix | 9 +++++++ 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/pkgs/servers/samba/default.nix b/pkgs/servers/samba/default.nix index a6ade7400e86..42d577c55fa8 100644 --- a/pkgs/servers/samba/default.nix +++ b/pkgs/servers/samba/default.nix @@ -1,5 +1,6 @@ -{ stdenv, fetchurl, readline, pam, openldap, popt, iniparser, libunwind, fam -, acl, cups +{ stdenv, fetchurl, readline, pam ? null, openldap ? null +, popt, iniparser, libunwind +, fam ? null , acl ? null, cups ? null , useKerberos ? false, kerberos ? null, winbind ? true # Eg. smbclient and smbspool require a smb.conf file. @@ -14,11 +15,7 @@ }: -let - - useWith = flag: option: if flag then "--with-"+option else ""; - -in +assert useKerberos -> kerberos != null; stdenv.mkDerivation rec { name = "samba-3.6.1"; @@ -38,19 +35,29 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - preConfigure = "cd source3"; + postPatch = + # XXX: Awful hack to allow cross-compilation. + '' sed -i source3/configure \ + -e 's/^as_fn_error \("cannot run test program while cross compiling\)/$as_echo \1/g' + ''; - configureFlags = '' - --with-pam - --with-aio-support - --with-pam_smbpass - --disable-swat - --with-configdir=${configDir} - --with-fhs - --localstatedir=/var - ${useWith winbind "winbind"} - ${if stdenv.gcc.libc != null then "--with-libiconv=${stdenv.gcc.libc}" else ""} - ''; + preConfigure = + '' cd source3 + export samba_cv_CC_NEGATIVE_ENUM_VALUES=yes + export libreplace_cv_HAVE_GETADDRINFO=yes + export ac_cv_file__proc_sys_kernel_core_pattern=no # XXX: true on Linux, false elsewhere + ''; + + configureFlags = + stdenv.lib.optionals (pam != null) [ "--with-pam" "--with-pam_smbpass" ] + ++ [ "--with-aio-support" + "--disable-swat" + "--with-configdir=${configDir}" + "--with-fhs" + "--localstatedir=/var" + ] + ++ (stdenv.lib.optional winbind "--with-winbind") + ++ (stdenv.lib.optional (stdenv.gcc.libc != null) "--with-libiconv=${stdenv.gcc.libc}"); # Need to use a DESTDIR because `make install' tries to write in /var and /etc. installFlags = "DESTDIR=$(TMPDIR)/inst"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1df28d6f4328..79c3b6c59b1c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5054,6 +5054,15 @@ let samba = callPackage ../servers/samba { }; + # A lightweight Samba, useful for non-Linux-based OSes. + samba_light = callPackage ../servers/samba { + pam = null; + fam = null; + cups = null; + acl = null; + openldap = null; + }; + shishi = callPackage ../servers/shishi { # GNU Shishi 1.0.0 fails to build with GnuTLS 3.x. gnutls = gnutls2;