samba.scm 19 KB

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