summary refs log tree commit diff
path: root/gnu/packages/samba.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2017-05-12 11:53:08 +0200
committerLudovic Courtès <ludo@gnu.org>2017-05-12 13:31:34 +0200
commit602db62c7c746f777cda62aff9e5450d041f488f (patch)
tree6503c8de1d67b961ddf5c48f6ad446bbef1fdb0e /gnu/packages/samba.scm
parent864704212f4af3fba2ade784f9ac175bb685d53f (diff)
downloadguix-602db62c7c746f777cda62aff9e5450d041f488f.tar.gz
gnu: talloc: Add static variant.
* gnu/packages/samba.scm (talloc/static): New variable.
Diffstat (limited to 'gnu/packages/samba.scm')
-rw-r--r--gnu/packages/samba.scm41
1 files changed, 40 insertions, 1 deletions
diff --git a/gnu/packages/samba.scm b/gnu/packages/samba.scm
index 5bcd5980a1..623ef93a4e 100644
--- a/gnu/packages/samba.scm
+++ b/gnu/packages/samba.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <adfeno@openmailbox.org>
@@ -25,6 +25,7 @@
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix licenses)
+  #:use-module (guix utils)
   #:use-module (gnu packages acl)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages autotools)
@@ -252,6 +253,44 @@ Desktops into Active Directory environments using the winbind daemon.")
 destructors.  It is the core memory allocator used in Samba.")
     (license gpl3+))) ;; The bundled "replace" library uses LGPL3.
 
+(define-public talloc/static
+  (package
+    (inherit talloc)
+    (name "talloc-static")
+    (synopsis
+     "Hierarchical, reference counted memory pool system (static library)")
+    (arguments
+     (substitute-keyword-arguments (package-arguments talloc)
+       ((#:phases phases)
+        ;; Since Waf, the build system talloc uses, apparently does not
+        ;; support building static libraries from a ./configure flag, roll our
+        ;; own build process.  No need to be ashamed, we're not the only ones
+        ;; doing that:
+        ;; <https://github.com/proot-me/proot-static-build/blob/master/GNUmakefile>.
+        ;; :-)
+        `(modify-phases ,phases
+           (replace 'build
+             (lambda _
+               (letrec-syntax ((shell (syntax-rules ()
+                                        ((_ (command ...) rest ...)
+                                         (and (zero? (system* command ...))
+                                              (shell rest ...)))
+                                        ((_)
+                                         #t))))
+                 (shell ("gcc" "-c" "-Ibin/default" "-I" "lib/replace"
+                         "-I." "-Wall" "-g" "talloc.c")
+                        ("ar" "rc" "libtalloc.a" "talloc.o")))))
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out     (assoc-ref outputs "out"))
+                      (lib     (string-append out "/lib"))
+                      (include (string-append out "/include")))
+                 (mkdir-p lib)
+                 (install-file "libtalloc.a" lib)
+                 (install-file "talloc.h" include)
+                 #t)))
+           (delete 'check)))))))            ;XXX: tests rely on Python modules
+
 (define-public tevent
   (package
     (name "tevent")