Add (guix build rpath).
[jackhill/guix/guix.git] / gnu / packages / samba.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages samba)
20 #:use-module (guix packages)
21 #:use-module (guix download)
22 #:use-module (guix build-system gnu)
23 #:use-module (guix licenses)
24 #:use-module (gnu packages acl)
25 #:use-module (gnu packages popt)
26 #:use-module (gnu packages openldap)
27 #:use-module (gnu packages readline)
28 #:use-module (gnu packages libunwind)
29 #:use-module (gnu packages linux)
30 #:use-module (gnu packages patchelf)
31 #:use-module (gnu packages perl)
32 #:use-module (gnu packages python))
33
34 (define-public iniparser
35 (package
36 (name "iniparser")
37 (version "3.1")
38 (source (origin
39 (method url-fetch)
40 (uri (string-append "http://ndevilla.free.fr/iniparser/iniparser-"
41 version ".tar.gz"))
42 (sha256
43 (base32
44 "1igmxzcy0s25zcy9vmcw0kd13lh60r0b4qg8lnp1jic33f427pxf"))))
45 (build-system gnu-build-system)
46 (arguments
47 '(#:phases (alist-replace
48 'configure
49 (lambda* (#:key outputs #:allow-other-keys)
50 (substitute* "Makefile"
51 (("/usr/lib")
52 (string-append (assoc-ref outputs "out") "/lib"))))
53 (alist-replace
54 'build
55 (lambda _
56 (and (zero? (system* "make" "libiniparser.so"))
57 (symlink "libiniparser.so.0" "libiniparser.so")))
58 (alist-replace
59 'install
60 (lambda* (#:key outputs #:allow-other-keys)
61 (let* ((out (assoc-ref outputs "out"))
62 (lib (string-append out "/lib"))
63 (inc (string-append out "/include"))
64 (doc (string-append out "/share/doc"))
65 (html (string-append doc "/html")))
66 (define (copy dir)
67 (lambda (file)
68 (copy-file file
69 (string-append dir "/"
70 (basename file)))))
71 (mkdir-p lib)
72 (for-each (copy lib)
73 (find-files "." "^lib.*\\.(so\\.|a)"))
74 (with-directory-excursion lib
75 (symlink "libiniparser.so.0" "libiniparser.so"))
76 (mkdir-p inc)
77 (for-each (copy inc)
78 (find-files "src" "\\.h$"))
79 (mkdir-p html)
80 (for-each (copy html)
81 (find-files "html" ".*"))
82 (for-each (copy doc)
83 '("AUTHORS" "INSTALL" "LICENSE"
84 "README"))))
85 %standard-phases)))))
86 (home-page "http://ndevilla.free.fr/iniparser")
87 (synopsis "Standalone ini file parsing library")
88 (description
89 "iniparser is a free stand-alone `ini' file parsing library (Windows
90 configuration files). It is written in portable ANSI C and should compile
91 anywhere.")
92 (license x11)))
93
94 (define-public samba
95 (package
96 (name "samba")
97 (version "3.6.8")
98 (source (origin
99 (method url-fetch)
100 (uri (string-append "http://us3.samba.org/samba/ftp/stable/samba-"
101 version ".tar.gz"))
102 (sha256
103 (base32
104 "1phl6mmrc72jyvbyrw6cv6b92cxq3v2pbn1fh97nnb4hild1fnjg"))))
105 (build-system gnu-build-system)
106 (arguments
107 '(#:phases (alist-cons-before
108 'configure 'chdir
109 (lambda _
110 (chdir "source3"))
111 (alist-cons-after
112 'strip 'add-lib-to-runpath
113 (lambda* (#:key outputs #:allow-other-keys)
114 (let* ((out (assoc-ref outputs "out"))
115 (lib (string-append out "/lib")))
116 ;; Add LIB to the RUNPATH of all the executables.
117 (with-directory-excursion out
118 (for-each (cut augment-rpath <> lib)
119 (append (find-files "bin" ".*")
120 (find-files "sbin" ".*"))))))
121 %standard-phases))
122
123 #:modules ((guix build gnu-build-system)
124 (guix build utils)
125 (guix build rpath)
126 (srfi srfi-26))
127 #:imported-modules ((guix build gnu-build-system)
128 (guix build utils)
129 (guix build rpath))
130
131 ;; This flag is required to allow for "make test".
132 #:configure-flags '("--enable-socket-wrapper")
133
134 #:test-target "test"
135
136 ;; XXX: The test infrastructure attempts to set password with
137 ;; smbpasswd, which fails with "smbpasswd -L can only be used by root."
138 ;; So disable tests until there's a workaround.
139 #:tests? #f))
140 (inputs ; TODO: Add missing dependencies
141 `(;; ("cups" ,cups)
142 ("acl" ,acl)
143 ;; ("gamin" ,gamin)
144 ("libunwind" ,libunwind)
145 ("iniparser" ,iniparser)
146 ("popt" ,popt)
147 ("openldap" ,openldap)
148 ("linux-pam" ,linux-pam)
149 ("readline" ,readline)
150 ("patchelf" ,patchelf))) ; for (guix build rpath)
151 (native-inputs ; for the test suite
152 `(("perl" ,perl)
153 ("python" ,python)))
154 (home-page "http://www.samba.org/")
155 (synopsis
156 "The standard Windows interoperability suite of programs for GNU and Unix")
157 (description
158 "Since 1992, Samba has provided secure, stable and fast file and print
159 services for all clients using the SMB/CIFS protocol, such as all versions of
160 DOS and Windows, OS/2, GNU/Linux and many others.
161
162 Samba is an important component to seamlessly integrate Linux/Unix Servers and
163 Desktops into Active Directory environments using the winbind daemon.")
164 (license gpl3+)))