gnu: Add wl-clipboard.
[jackhill/guix/guix.git] / gnu / packages / samba.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <adfeno@openmailbox.org>
6 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
7 ;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>
8 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages samba)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix licenses)
31 #:use-module (guix utils)
32 #:use-module (gnu packages acl)
33 #:use-module (gnu packages admin)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages backup)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages crypto)
38 #:use-module (gnu packages cups)
39 #:use-module (gnu packages databases)
40 #:use-module (gnu packages docbook)
41 #:use-module (gnu packages gnupg)
42 #:use-module (gnu packages kerberos)
43 #:use-module (gnu packages linux)
44 #:use-module (gnu packages openldap)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages popt)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages readline)
50 #:use-module (gnu packages tls)
51 #:use-module (gnu packages web)
52 #:use-module (gnu packages xml))
53
54 (define-public cifs-utils
55 (package
56 (name "cifs-utils")
57 (version "6.8")
58 (source
59 (origin
60 (method url-fetch)
61 (uri (string-append "https://download.samba.org/pub/linux-cifs/"
62 name "/" name "-" version ".tar.bz2"))
63 (sha256 (base32
64 "0ygz3pagjpaj5ky11hzh4byyymb7fpmqiqkprn11zwj31h2zdlg7"))))
65 (build-system gnu-build-system)
66 (native-inputs
67 `(("autoconf" ,autoconf)
68 ("automake" ,automake)
69 ("pkg-config" ,pkg-config)))
70 (inputs
71 `(("keytuils" ,keyutils)
72 ("linux-pam" ,linux-pam)
73 ("libcap-ng" ,libcap-ng)
74 ("mit-krb5" ,mit-krb5)
75 ("samba" ,samba)
76 ("talloc" ,talloc)))
77 (arguments
78 `(#:phases
79 (modify-phases %standard-phases
80 (add-before 'configure 'set-root-sbin
81 (lambda _ ; Don't try to install in "/sbin".
82 (setenv "ROOTSBINDIR"
83 (string-append (assoc-ref %outputs "out") "/sbin"))
84 #t)))))
85 (synopsis "User-space utilities for Linux CIFS (Samba) mounts")
86 (description "@code{cifs-utils} is a set of user-space utilities for
87 mounting and managing @dfn{Common Internet File System} (CIFS) shares using
88 the Linux kernel CIFS client.")
89 (home-page "https://wiki.samba.org/index.php/LinuxCIFS_utils")
90 ;; cifs-utils is licensed as GPL3 or later, but 3 files contain LGPL code.
91 (license gpl3+)))
92
93 (define-public iniparser
94 (package
95 (name "iniparser")
96 (version "4.1")
97 (source (origin
98 (method url-fetch)
99 (uri (string-append "https://github.com/ndevilla/iniparser/archive/v"
100 version ".tar.gz"))
101 (file-name (string-append name "-" version ".tar.gz"))
102 (sha256
103 (base32
104 "1bpk8dj9d5cl64lg6jsk0qlzrpg848nymwxc3fx707fk1n0al3cn"))))
105 (build-system gnu-build-system)
106 (arguments
107 `(#:make-flags
108 (list "CC=gcc")
109 #:phases
110 (modify-phases %standard-phases
111 (replace 'configure
112 (lambda* (#:key outputs #:allow-other-keys)
113 (substitute* '("Makefile" "test/Makefile")
114 (("/usr/lib")
115 (string-append (assoc-ref outputs "out") "/lib")))
116 #t))
117 (replace 'build
118 (lambda* (#:key make-flags #:allow-other-keys)
119 (apply invoke "make" "libiniparser.so.1"
120 make-flags)))
121 (replace 'install
122 (lambda* (#:key outputs #:allow-other-keys)
123 (let* ((out (assoc-ref outputs "out"))
124 (lib (string-append out "/lib"))
125 (inc (string-append out "/include"))
126 (doc (string-append out "/share/doc/" ,name))
127 (html (string-append doc "/html")))
128 (define (install dir)
129 (lambda (file)
130 (install-file file dir)))
131 (for-each (install lib)
132 (find-files "." "^lib.*\\.so"))
133 (with-directory-excursion lib
134 (symlink "libiniparser.so.1" "libiniparser.so"))
135 (for-each (install inc)
136 (find-files "src" "\\.h$"))
137 (for-each (install html)
138 (find-files "html" ".*"))
139 (for-each (install doc)
140 '("AUTHORS" "INSTALL" "LICENSE" "README.md"))
141 #t))))))
142 (home-page "https://github.com/ndevilla/iniparser")
143 (synopsis "Standalone ini file parsing library")
144 (description
145 "iniparser is a free stand-alone `ini' file parsing library (Windows
146 configuration files). It is written in portable ANSI C and should compile
147 anywhere.")
148 (license x11)))
149
150 (define-public samba
151 (package
152 (name "samba")
153 (version "4.9.4")
154 (source (origin
155 (method url-fetch)
156 (uri (string-append "https://download.samba.org/pub/samba/stable/"
157 "samba-" version ".tar.gz"))
158 (sha256
159 (base32
160 "0kqbzywlnh1skg6g78qilyn12qv7wri66h5v9f77igncpkcai63d"))))
161 (build-system gnu-build-system)
162 (arguments
163 `(#:phases
164 (modify-phases %standard-phases
165 (add-before 'configure 'locate-docbook-stylesheets
166 (lambda* (#:key inputs #:allow-other-keys)
167 ;; XXX for some reason XML_CATALOG_FILES is not respected.
168 (substitute* '("buildtools/wafsamba/samba_conftests.py"
169 "buildtools/wafsamba/wafsamba.py"
170 "docs-xml/xslt/man.xsl")
171 (("http://docbook.sourceforge.net/release/xsl/current/")
172 (string-append (assoc-ref inputs "docbook-xsl")
173 "/xml/xsl/docbook-xsl-"
174 ,(package-version docbook-xsl) "/")))
175 #t))
176 (replace 'configure
177 ;; samba uses a custom configuration script that runs waf.
178 (lambda* (#:key outputs #:allow-other-keys)
179 (let* ((out (assoc-ref outputs "out"))
180 (libdir (string-append out "/lib")))
181 (invoke "./configure"
182 "--enable-fhs"
183 ;; XXX: heimdal not packaged.
184 "--bundled-libraries=com_err"
185 (string-append "--prefix=" out)
186 "--sysconfdir=/etc"
187 ;; Install public and private libraries into
188 ;; a single directory to avoid RPATH issues.
189 (string-append "--libdir=" libdir)
190 (string-append "--with-privatelibdir=" libdir)))))
191 (add-before 'install 'disable-etc-samba-directory-creation
192 (lambda _
193 (substitute* "dynconfig/wscript"
194 (("bld\\.INSTALL_DIR\\(\"\\$\\{CONFIGDIR\\}\"\\)")
195 ""))
196 #t)))
197 ;; XXX: The test infrastructure attempts to set password with
198 ;; smbpasswd, which fails with "smbpasswd -L can only be used by root."
199 ;; So disable tests until there's a workaround.
200 #:tests? #f))
201 (inputs ; TODO: Add missing dependencies
202 `(("acl" ,acl)
203 ("cups" ,cups)
204 ;; ("gamin" ,gamin)
205 ("gpgme" ,gpgme)
206 ("gnutls" ,gnutls)
207 ("iniparser" ,iniparser)
208 ("jansson" ,jansson)
209 ("libaio" ,libaio)
210 ("libarchive" ,libarchive)
211 ("linux-pam" ,linux-pam)
212 ("lmdb" ,lmdb)
213 ("openldap" ,openldap)
214 ("popt" ,popt)
215 ("readline" ,readline)
216 ("tdb" ,tdb)))
217 (propagated-inputs
218 ;; In Requires or Requires.private of pkg-config files.
219 `(("ldb" ,ldb)
220 ("talloc" ,talloc)
221 ("tevent" ,tevent)))
222 (native-inputs
223 `(("docbook-xsl" ,docbook-xsl) ;for generating manpages
224 ("xsltproc" ,libxslt) ;ditto
225 ("perl" ,perl)
226 ("pkg-config" ,pkg-config)
227 ("python" ,python-2))) ; incompatible with Python 3
228 (home-page "https://www.samba.org/")
229 (synopsis
230 "The standard Windows interoperability suite of programs for GNU and Unix")
231 (description
232 "Since 1992, Samba has provided secure, stable and fast file and print
233 services for all clients using the SMB/CIFS protocol, such as all versions of
234 DOS and Windows, OS/2, GNU/Linux and many others.
235
236 Samba is an important component to seamlessly integrate Linux/Unix Servers and
237 Desktops into Active Directory environments using the winbind daemon.")
238 (license gpl3+)))
239
240 (define-public talloc
241 (package
242 (name "talloc")
243 (version "2.1.14")
244 (source (origin
245 (method url-fetch)
246 (uri (string-append "https://www.samba.org/ftp/talloc/talloc-"
247 version ".tar.gz"))
248 (sha256
249 (base32
250 "1kk76dyav41ip7ddbbf04yfydb4jvywzi2ps0z2vla56aqkn11di"))))
251 (build-system gnu-build-system)
252 (arguments
253 '(#:phases
254 (modify-phases %standard-phases
255 (replace 'configure
256 (lambda* (#:key outputs #:allow-other-keys)
257 ;; talloc uses a custom configuration script that runs a Python
258 ;; script called 'waf', and doesn't tolerate unknown options.
259 (setenv "CONFIG_SHELL" (which "sh"))
260 (let ((out (assoc-ref outputs "out")))
261 (invoke "./configure"
262 (string-append "--prefix=" out))))))))
263 (inputs
264 `(("python" ,python-2)))
265 (home-page "https://talloc.samba.org")
266 (synopsis "Hierarchical, reference counted memory pool system")
267 (description
268 "Talloc is a hierarchical, reference counted memory pool system with
269 destructors. It is the core memory allocator used in Samba.")
270 (license gpl3+))) ;; The bundled "replace" library uses LGPL3.
271
272 (define-public talloc/static
273 (package
274 (inherit talloc)
275 (name "talloc-static")
276 (synopsis
277 "Hierarchical, reference counted memory pool system (static library)")
278 (arguments
279 (substitute-keyword-arguments (package-arguments talloc)
280 ((#:phases phases)
281 ;; Since Waf, the build system talloc uses, apparently does not
282 ;; support building static libraries from a ./configure flag, roll our
283 ;; own build process. No need to be ashamed, we're not the only ones
284 ;; doing that:
285 ;; <https://github.com/proot-me/proot-static-build/blob/master/GNUmakefile>.
286 ;; :-)
287 `(modify-phases ,phases
288 (replace 'build
289 (lambda _
290 (letrec-syntax ((shell (syntax-rules ()
291 ((_ (command ...) rest ...)
292 (and (zero? (system* command ...))
293 (shell rest ...)))
294 ((_)
295 #t))))
296 (shell ("gcc" "-c" "-Ibin/default" "-I" "lib/replace"
297 "-I." "-Wall" "-g" "talloc.c")
298 ("ar" "rc" "libtalloc.a" "talloc.o")))))
299 (replace 'install
300 (lambda* (#:key outputs #:allow-other-keys)
301 (let* ((out (assoc-ref outputs "out"))
302 (lib (string-append out "/lib"))
303 (include (string-append out "/include")))
304 (mkdir-p lib)
305 (install-file "libtalloc.a" lib)
306 (install-file "talloc.h" include)
307 #t)))
308 (delete 'check))))))) ;XXX: tests rely on Python modules
309
310 (define-public tevent
311 (package
312 (name "tevent")
313 (version "0.9.37")
314 (source (origin
315 (method url-fetch)
316 (uri (string-append "https://www.samba.org/ftp/tevent/tevent-"
317 version ".tar.gz"))
318 (sha256
319 (base32
320 "1q77vbjic2bb79li2a54ffscnrnwwww55fbpry2kgh7acpnlb0qn"))))
321 (build-system gnu-build-system)
322 (arguments
323 '(#:phases
324 (modify-phases %standard-phases
325 (replace 'configure
326 ;; tevent uses a custom configuration script that runs waf.
327 (lambda* (#:key outputs #:allow-other-keys)
328 (let ((out (assoc-ref outputs "out")))
329 (zero? (system* "./configure"
330 (string-append "--prefix=" out)
331 "--bundled-libraries=NONE"))))))))
332 (native-inputs
333 `(("pkg-config" ,pkg-config)
334 ("python" ,python-2)))
335 (propagated-inputs
336 `(("talloc" ,talloc))) ; required by tevent.pc
337 (synopsis "Event system library")
338 (home-page "https://tevent.samba.org/")
339 (description
340 "Tevent is an event system based on the talloc memory management library.
341 It is the core event system used in Samba. The low level tevent has support for
342 many event types, including timers, signals, and the classic file descriptor events.")
343 (license lgpl3+)))
344
345 (define-public ldb
346 (package
347 (name "ldb")
348 (version "1.4.3")
349 (source (origin
350 (method url-fetch)
351 (uri (string-append "https://www.samba.org/ftp/ldb/ldb-"
352 version ".tar.gz"))
353 (sha256
354 (base32
355 "07vacwr941y2x31yl9knsr2rpffz5pqabvqds6sbyngqxy4r785c"))
356 (modules '((guix build utils)))
357 (snippet
358 '(begin
359 (for-each (lambda (file)
360 ;; Delete everything except the build tools.
361 (unless (or (string-prefix? "third_party/waf" file)
362 (string-suffix? "wscript" file))
363 (delete-file file)))
364 (find-files "third_party"))
365 #t))))
366 (build-system gnu-build-system)
367 (arguments
368 '(;; LMDB is only supported on 64-bit systems, yet the test suite
369 ;; requires it.
370 #:tests? (assoc-ref %build-inputs "lmdb")
371 #:phases
372 (modify-phases %standard-phases
373 (replace 'configure
374 ;; ldb use a custom configuration script that runs waf.
375 (lambda* (#:key outputs #:allow-other-keys)
376 (let ((out (assoc-ref outputs "out")))
377 (zero? (system* "./configure"
378 (string-append "--prefix=" out)
379 (string-append "--with-modulesdir=" out
380 "/lib/ldb/modules")
381 "--bundled-libraries=NONE"))))))))
382 (native-inputs
383 `(("cmocka" ,cmocka)
384 ("pkg-config" ,pkg-config)
385 ("python" ,python-2)))
386 (propagated-inputs
387 ;; ldb.pc refers to all these.
388 `(("talloc" ,talloc)
389 ("tdb" ,tdb)))
390 (inputs
391 `(,@(if (target-64bit?)
392 `(("lmdb" ,lmdb))
393 '())
394 ("popt" ,popt)
395 ("tevent" ,tevent)))
396 (synopsis "LDAP-like embedded database")
397 (home-page "https://ldb.samba.org/")
398 (description
399 "Ldb is a LDAP-like embedded database built on top of TDB. What ldb does
400 is provide a fast database with an LDAP-like API designed to be used within an
401 application. In some ways it can be seen as a intermediate solution between
402 key-value pair databases and a real LDAP database.")
403 (license lgpl3+)))
404
405 (define-public ppp
406 (package
407 (name "ppp")
408 (version "2.4.7")
409 (source (origin
410 (method url-fetch)
411 (uri (string-append "https://www.samba.org/ftp/ppp/ppp-"
412 version ".tar.gz"))
413 (patches
414 (list (origin
415 ;; Use OpenSSL for cryptography instead of the obsolete glibc
416 ;; crypto functions that were removed in glibc 2.28.
417 (method url-fetch)
418 (uri (string-append "https://github.com/paulusmack/ppp/commit/"
419 "3c7b86229f7bd2600d74db14b1fe5b3896be3875"
420 ".patch"))
421 (file-name "ppp-use-openssl-crypto.patch")
422 (sha256
423 (base32
424 "0qlbi247lx3injpy8a1gcij9yilik0vfaibkpvdp88k3sa1rs69z")))))
425 (sha256
426 (base32
427 "0c7vrjxl52pdwi4ckrvfjr08b31lfpgwf3pp0cqy76a77vfs7q02"))))
428 (build-system gnu-build-system)
429 (arguments
430 '(#:tests? #f ; no check target
431 #:make-flags '("CC=gcc")
432 #:phases
433 (modify-phases %standard-phases
434 (add-before 'configure 'patch-Makefile
435 (lambda* (#:key inputs #:allow-other-keys)
436 (let ((libc (assoc-ref inputs "libc"))
437 (openssl (assoc-ref inputs "openssl"))
438 (libpcap (assoc-ref inputs "libpcap")))
439 (substitute* "pppd/Makefile.linux"
440 (("/usr/include/crypt\\.h")
441 (string-append libc "/include/crypt.h"))
442 (("/usr/include/openssl")
443 (string-append openssl "/include/openssl"))
444 (("/usr/include/pcap-bpf.h")
445 (string-append libpcap "/include/pcap-bpf.h")))
446 #t))))))
447 (inputs
448 `(("libpcap" ,libpcap)
449 ("openssl" ,(@ (gnu packages tls) openssl))))
450 (synopsis "Implementation of the Point-to-Point Protocol")
451 (home-page "https://ppp.samba.org/")
452 (description
453 "The Point-to-Point Protocol (PPP) provides a standard way to establish
454 a network connection over a serial link. At present, this package supports IP
455 and IPV6 and the protocols layered above them, such as TCP and UDP.")
456 ;; pppd, pppstats and pppdump are under BSD-style notices.
457 ;; some of the pppd plugins are GPL'd.
458 ;; chat is public domain.
459 (license (list bsd-3 bsd-4 gpl2+ public-domain))))