gnu: gdb: patch-makefile-SHELL for all Makefile.in files.
[jackhill/guix/guix.git] / gnu / packages / linux.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
e47e3eff 2;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
233e7676 3;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
fd76c904 4;;;
233e7676 5;;; This file is part of GNU Guix.
fd76c904 6;;;
233e7676 7;;; GNU Guix is free software; you can redistribute it and/or modify it
fd76c904
LC
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
233e7676 12;;; GNU Guix is distributed in the hope that it will be useful, but
fd76c904
LC
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
233e7676 18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
fd76c904 19
1ffa7090 20(define-module (gnu packages linux)
4a44e743 21 #:use-module (guix licenses)
59a43334 22 #:use-module (gnu packages)
1ffa7090 23 #:use-module ((gnu packages compression)
4a44e743 24 #:renamer (symbol-prefix-proc 'guix:))
1ffa7090 25 #:use-module (gnu packages flex)
90a0048f 26 #:use-module (gnu packages bison)
1ffa7090
LC
27 #:use-module (gnu packages libusb)
28 #:use-module (gnu packages ncurses)
90a0048f 29 #:use-module (gnu packages bdb)
1ffa7090
LC
30 #:use-module (gnu packages perl)
31 #:use-module (gnu packages pkg-config)
e7b38500 32 #:use-module (gnu packages algebra)
85e0dc6a
LC
33 #:use-module ((gnu packages gettext)
34 #:renamer (symbol-prefix-proc 'g:))
17b293a0 35 #:use-module (gnu packages pulseaudio)
c762e82e 36 #:use-module (gnu packages attr)
17b293a0 37 #:use-module (gnu packages xml)
215b6431 38 #:use-module (gnu packages autotools)
02b80c3f
NK
39 #:use-module (guix packages)
40 #:use-module (guix download)
0ded70f3 41 #:use-module (guix build-system gnu))
fd76c904 42
aaf4cb20
LC
43(define-public (system->linux-architecture arch)
44 "Return the Linux architecture name for ARCH, a Guix system name such as
45\"x86_64-linux\"."
618cea69
NK
46 (let ((arch (car (string-split arch #\-))))
47 (cond ((string=? arch "i686") "i386")
48 ((string-prefix? "mips" arch) "mips")
aaf4cb20 49 ((string-prefix? "arm" arch) "arm")
618cea69
NK
50 (else arch))))
51
6023cc74
LC
52(define (linux-libre-urls version)
53 "Return a list of URLs for Linux-Libre VERSION."
54 (list (string-append
55 "http://linux-libre.fsfla.org/pub/linux-libre/releases/"
56 version "-gnu/linux-libre-" version "-gnu.tar.xz")
57
58 ;; XXX: Work around <http://bugs.gnu.org/14851>.
59 (string-append
60 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
61 version "-gnu.tar.xz")
62
63 ;; Maybe this URL will become valid eventually.
64 (string-append
65 "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
66 version "-gnu.tar.xz")))
67
80fe5c60 68(define-public linux-libre-headers
dfb52abb 69 (let* ((version "3.3.8")
80fe5c60 70 (build-phase
618cea69
NK
71 (lambda (arch)
72 `(lambda _
73 (setenv "ARCH" ,(system->linux-architecture arch))
74 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
45298f8f 75
618cea69
NK
76 (and (zero? (system* "make" "defconfig"))
77 (zero? (system* "make" "mrproper" "headers_check"))))))
80fe5c60
LC
78 (install-phase
79 `(lambda* (#:key outputs #:allow-other-keys)
80 (let ((out (assoc-ref outputs "out")))
81 (and (zero? (system* "make"
82 (string-append "INSTALL_HDR_PATH=" out)
83 "headers_install"))
84 (mkdir (string-append out "/include/config"))
85 (call-with-output-file
86 (string-append out
87 "/include/config/kernel.release")
88 (lambda (p)
dfb52abb 89 (format p "~a-default~%" ,version))))))))
80fe5c60
LC
90 (package
91 (name "linux-libre-headers")
dfb52abb 92 (version version)
80fe5c60
LC
93 (source (origin
94 (method url-fetch)
6023cc74 95 (uri (linux-libre-urls version))
80fe5c60
LC
96 (sha256
97 (base32
98 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
99 (build-system gnu-build-system)
100 (native-inputs `(("perl" ,perl)))
101 (arguments
102 `(#:modules ((guix build gnu-build-system)
103 (guix build utils)
56c092ce 104 (srfi srfi-1))
80fe5c60 105 #:phases (alist-replace
fb6c2fa8
LC
106 'build ,(build-phase (or (%current-target-system)
107 (%current-system)))
80fe5c60
LC
108 (alist-replace
109 'install ,install-phase
56c092ce 110 (alist-delete 'configure %standard-phases)))
80fe5c60
LC
111 #:tests? #f))
112 (synopsis "GNU Linux-Libre kernel headers")
113 (description "Headers of the Linux-Libre kernel.")
38bbd61d 114 (license gpl2)
80fe5c60
LC
115 (home-page "http://www.gnu.org/software/linux-libre/"))))
116
b4fcb735
LC
117(define-public module-init-tools
118 (package
119 (name "module-init-tools")
120 (version "3.16")
121 (source (origin
122 (method url-fetch)
123 (uri (string-append
124 "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
125 version ".tar.bz2"))
126 (sha256
127 (base32
128 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))))
129 (build-system gnu-build-system)
b4fcb735 130 (arguments
5c413a9c
LC
131 ;; FIXME: The upstream tarball lacks man pages, and building them would
132 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
133 ;; but they vanished. In the meantime, fake it.
b4fcb735 134 '(#:phases (alist-cons-before
5c413a9c
LC
135 'configure 'fake-docbook
136 (lambda _
137 (substitute* "Makefile.in"
138 (("^DOCBOOKTOMAN.*$")
139 "DOCBOOKTOMAN = true\n")))
b4fcb735
LC
140 %standard-phases)))
141 (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
142 (synopsis "Tools for loading and managing Linux kernel modules")
143 (description
144 "Tools for loading and managing Linux kernel modules, such as `modprobe',
145`insmod', `lsmod', and more.")
146 (license gpl2+)))
147
beacfcab 148(define-public linux-libre
dfb52abb 149 (let* ((version "3.11")
beacfcab
LC
150 (build-phase
151 '(lambda* (#:key system #:allow-other-keys #:rest args)
152 (let ((arch (car (string-split system #\-))))
153 (setenv "ARCH"
154 (cond ((string=? arch "i686") "i386")
155 (else arch)))
156 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
157
158 (let ((build (assoc-ref %standard-phases 'build)))
2e48455d
LC
159 (and (zero? (system* "make" "defconfig"))
160 (begin
161 (format #t "enabling additional modules...~%")
162 (substitute* ".config"
163 (("^# CONFIG_CIFS.*$")
164 "CONFIG_CIFS=m\n"))
165 (zero? (system* "make" "oldconfig")))
beacfcab
LC
166
167 ;; Call the default `build' phase so `-j' is correctly
168 ;; passed.
169 (apply build #:make-flags "all" args)))))
170 (install-phase
171 `(lambda* (#:key inputs outputs #:allow-other-keys)
172 (let* ((out (assoc-ref outputs "out"))
173 (moddir (string-append out "/lib/modules"))
174 (mit (assoc-ref inputs "module-init-tools")))
175 (mkdir-p moddir)
176 (for-each (lambda (file)
177 (copy-file file
178 (string-append out "/" (basename file))))
179 (find-files "." "^(bzImage|System\\.map)$"))
180 (copy-file ".config" (string-append out "/config"))
181 (zero? (system* "make"
182 (string-append "DEPMOD=" mit "/sbin/depmod")
183 (string-append "MODULE_DIR=" moddir)
184 (string-append "INSTALL_PATH=" out)
185 (string-append "INSTALL_MOD_PATH=" out)
186 "modules_install"))))))
187 (package
188 (name "linux-libre")
dfb52abb 189 (version version)
beacfcab
LC
190 (source (origin
191 (method url-fetch)
6023cc74 192 (uri (linux-libre-urls version))
beacfcab
LC
193 (sha256
194 (base32
e7b38500 195 "1vlk04xkvyy1kc9zz556md173rn1qzlnvhz7c9sljv4bpk3mdspl"))))
beacfcab
LC
196 (build-system gnu-build-system)
197 (native-inputs `(("perl" ,perl)
e7b38500 198 ("bc" ,bc)
beacfcab
LC
199 ("module-init-tools" ,module-init-tools)))
200 (arguments
201 `(#:modules ((guix build gnu-build-system)
202 (guix build utils)
203 (srfi srfi-1)
204 (ice-9 match))
205 #:phases (alist-replace
206 'build ,build-phase
207 (alist-replace
208 'install ,install-phase
209 (alist-delete 'configure %standard-phases)))
210 #:tests? #f))
f50d2669 211 (synopsis "100% free redistribution of a cleaned Linux kernel")
a22dc0c4
LC
212 (description
213 "Linux Libre is a free (as in freedom) variant of the Linux kernel. It
214has been modified to remove any non-free binary blobs.")
beacfcab
LC
215 (license gpl2)
216 (home-page "http://www.gnu.org/software/linux-libre/"))))
217
c84d0eca
LC
218\f
219;;;
220;;; Pluggable authentication modules (PAM).
221;;;
222
fd76c904
LC
223(define-public linux-pam
224 (package
225 (name "linux-pam")
226 (version "1.1.6")
227 (source
228 (origin
229 (method url-fetch)
230 (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
231 version ".tar.bz2")
232 (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
233 version ".tar.bz2")))
234 (sha256
235 (base32
236 "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
237 (build-system gnu-build-system)
238 (inputs
239 `(("flex" ,flex)
240
241 ;; TODO: optional dependencies
242 ;; ("libxcrypt" ,libxcrypt)
243 ;; ("cracklib" ,cracklib)
244 ))
245 (arguments
c134056a
LC
246 '(;; Most users, such as `shadow', expect the headers to be under
247 ;; `security'.
248 #:configure-flags (list (string-append "--includedir="
249 (assoc-ref %outputs "out")
250 "/include/security"))
251
252 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
253 ;; isn't available.
254 #:tests? #f))
fd76c904
LC
255 (home-page "http://www.linux-pam.org/")
256 (synopsis "Pluggable authentication modules for Linux")
257 (description
258 "A *Free* project to implement OSF's RFC 86.0.
259Pluggable authentication modules are small shared object files that can
260be used through the PAM API to perform tasks, like authenticating a user
261at login. Local and dynamic reconfiguration are its key features")
4a44e743 262 (license bsd-3)))
686f14e8 263
c84d0eca
LC
264\f
265;;;
266;;; Miscellaneous.
267;;;
268
686f14e8
LC
269(define-public psmisc
270 (package
271 (name "psmisc")
272 (version "22.20")
273 (source
274 (origin
275 (method url-fetch)
276 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
277 version ".tar.gz"))
278 (sha256
279 (base32
280 "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
281 (build-system gnu-build-system)
282 (inputs `(("ncurses" ,ncurses)))
283 (home-page "http://psmisc.sourceforge.net/")
284 (synopsis
285 "set of utilities that use the proc filesystem, such as fuser, killall, and pstree")
286 (description
287 "This PSmisc package is a set of some small useful utilities that
288use the proc filesystem. We're not about changing the world, but
289providing the system administrator with some help in common tasks.")
4a44e743 290 (license gpl2+)))
02b80c3f
NK
291
292(define-public util-linux
293 (package
294 (name "util-linux")
295 (version "2.21")
296 (source
297 (origin
298 (method url-fetch)
299 (uri (string-append "mirror://kernel.org/linux/utils/"
300 name "/v" version "/"
301 name "-" version ".2" ".tar.xz"))
302 (sha256
303 (base32
304 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
305 (build-system gnu-build-system)
306 (arguments
307 `(#:configure-flags '("--disable-use-tty-group")
308 #:phases (alist-cons-after
309 'install 'patch-chkdupexe
310 (lambda* (#:key outputs #:allow-other-keys)
311 (let ((out (assoc-ref outputs "out")))
312 (substitute* (string-append out "/bin/chkdupexe")
313 ;; Allow 'patch-shebang' to do its work.
314 (("@PERL@") "/bin/perl"))))
315 %standard-phases)))
4a44e743 316 (inputs `(("zlib" ,guix:zlib)
02b80c3f
NK
317 ("ncurses" ,ncurses)
318 ("perl" ,perl)))
319 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
35ec07c7 320 (synopsis "Collection of utilities for the Linux kernel")
02b80c3f
NK
321 (description
322 "util-linux is a random collection of utilities for the Linux kernel.")
fe8ccfcc 323
02b80c3f 324 ;; Note that util-linux doesn't use the same license for all the
fe8ccfcc 325 ;; code. GPLv2+ is the default license for a code without an
02b80c3f 326 ;; explicitly defined license.
fe8ccfcc
LC
327 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
328 bsd-4 public-domain))))
5d5c4278 329
e47e3eff
LC
330(define-public procps
331 (package
332 (name "procps")
333 (version "3.2.8")
334 (source (origin
335 (method url-fetch)
336 (uri (string-append "http://procps.sourceforge.net/procps-"
337 version ".tar.gz"))
338 (sha256
339 (base32
01eafd38
LC
340 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))
341 (patches (list (search-patch "procps-make-3.82.patch")))))
e47e3eff 342 (build-system gnu-build-system)
01eafd38 343 (inputs `(("ncurses" ,ncurses)))
e47e3eff 344 (arguments
01eafd38 345 '(#:phases (alist-replace
e47e3eff
LC
346 'configure
347 (lambda* (#:key outputs #:allow-other-keys)
348 ;; No `configure', just a single Makefile.
349 (let ((out (assoc-ref outputs "out")))
350 (substitute* "Makefile"
351 (("/usr/") "/")
352 (("--(owner|group) 0") "")
353 (("ldconfig") "true")
354 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
355 ;; Add libproc to the RPATH.
356 (string-append "LDFLAGS := -Wl,-rpath="
357 out "/lib" value))))
358 (setenv "CC" "gcc"))
359 (alist-replace
360 'install
361 (lambda* (#:key outputs #:allow-other-keys)
362 (let ((out (assoc-ref outputs "out")))
363 (and (zero?
364 (system* "make" "install"
365 (string-append "DESTDIR=" out)))
366
367 ;; Sanity check.
368 (zero?
369 (system* (string-append out "/bin/ps")
370 "--version")))))
371 %standard-phases))
372
373 ;; What did you expect? Tests?
374 #:tests? #f))
375 (home-page "http://procps.sourceforge.net/")
35ec07c7 376 (synopsis "Utilities that give information about processes")
e47e3eff
LC
377 (description
378 "procps is the package that has a bunch of small useful utilities
379that give information about processes using the Linux /proc file system.
380The package includes the programs ps, top, vmstat, w, kill, free,
381slabtop, and skill.")
382 (license gpl2)))
383
5d5c4278
NK
384(define-public usbutils
385 (package
386 (name "usbutils")
387 (version "006")
388 (source
389 (origin
390 (method url-fetch)
391 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
392 "usbutils-" version ".tar.xz"))
393 (sha256
394 (base32
395 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
396 (build-system gnu-build-system)
397 (inputs
398 `(("libusb" ,libusb) ("pkg-config" ,pkg-config)))
399 (home-page "http://www.linux-usb.org/")
400 (synopsis
401 "Tools for working with USB devices, such as lsusb")
402 (description
403 "Tools for working with USB devices, such as lsusb.")
4050e5d6 404 (license gpl2+)))
0750452a
LC
405
406(define-public e2fsprogs
407 (package
408 (name "e2fsprogs")
409 (version "1.42.7")
410 (source (origin
411 (method url-fetch)
412 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
413 version ".tar.gz"))
414 (sha256
415 (base32
416 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
417 (build-system gnu-build-system)
418 (inputs `(("util-linux" ,util-linux)
419 ("pkg-config" ,pkg-config)))
420 (arguments
421 '(#:phases (alist-cons-before
422 'configure 'patch-shells
423 (lambda _
424 (substitute* "configure"
425 (("/bin/sh (.*)parse-types.sh" _ dir)
426 (string-append (which "sh") " " dir
427 "parse-types.sh")))
428 (substitute* (find-files "." "^Makefile.in$")
429 (("#!/bin/sh")
430 (string-append "#!" (which "sh")))))
431 %standard-phases)
432
433 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
434 ;; they fail because we get an extra line that says "Can't check if
435 ;; filesystem is mounted due to missing mtab file".
436 #:tests? #f))
437 (home-page "http://e2fsprogs.sourceforge.net/")
35ec07c7 438 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
0750452a
LC
439 (description
440 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
441 (license (list gpl2 ; programs
442 lgpl2.0 ; libext2fs
443 x11)))) ; libuuid
d8482ad0
LC
444
445(define-public strace
446 (package
447 (name "strace")
448 (version "4.7")
449 (source (origin
450 (method url-fetch)
451 (uri (string-append "mirror://sourceforge/strace/strace-"
452 version ".tar.xz"))
453 (sha256
454 (base32
455 "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
456 (build-system gnu-build-system)
457 (inputs `(("perl" ,perl)))
458 (home-page "http://strace.sourceforge.net/")
459 (synopsis "System call tracer for Linux")
460 (description
461 "strace is a system call tracer, i.e. a debugging tool which prints out a
462trace of all the system calls made by a another process/program.")
463 (license bsd-3)))
ba04571a
LC
464
465(define-public alsa-lib
466 (package
467 (name "alsa-lib")
468 (version "1.0.27.1")
469 (source (origin
470 (method url-fetch)
471 (uri (string-append
472 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
473 version ".tar.bz2"))
474 (sha256
475 (base32
476 "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))))
477 (build-system gnu-build-system)
478 (home-page "http://www.alsa-project.org/")
479 (synopsis "The Advanced Linux Sound Architecture libraries")
480 (description
481 "The Advanced Linux Sound Architecture (ALSA) provides audio and
482MIDI functionality to the Linux-based operating system.")
483 (license lgpl2.1+)))
10afdf50 484
17b293a0
LC
485(define-public alsa-utils
486 (package
487 (name "alsa-utils")
488 (version "1.0.27.2")
489 (source (origin
490 (method url-fetch)
491 (uri (string-append "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-"
492 version ".tar.bz2"))
493 (sha256
494 (base32
495 "1sjjngnq50jv5ilwsb4zys6smifni3bd6fn28gbnhfrg14wsrgq2"))))
496 (build-system gnu-build-system)
497 (arguments
498 ;; XXX: Disable man page creation until we have DocBook.
499 '(#:configure-flags (list "--disable-xmlto"
500 (string-append "--with-udev-rules-dir="
501 (assoc-ref %outputs "out")
502 "/lib/udev/rules.d"))
503 #:phases (alist-cons-before
504 'install 'pre-install
505 (lambda _
506 ;; Don't try to mkdir /var/lib/alsa.
507 (substitute* "Makefile"
508 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
509 "true\n")))
510 %standard-phases)))
511 (inputs
512 `(("libsamplerate" ,libsamplerate)
513 ("ncurses" ,ncurses)
514 ("alsa-lib" ,alsa-lib)
515 ("xmlto" ,xmlto)
516 ("gettext" ,g:gettext)))
517 (home-page "http://www.alsa-project.org/")
518 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
519 (description
520 "The Advanced Linux Sound Architecture (ALSA) provides audio and
521MIDI functionality to the Linux-based operating system.")
522
523 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
524 ;; GPLv2-only.
525 (license gpl2)))
526
10afdf50
LC
527(define-public iptables
528 (package
529 (name "iptables")
530 (version "1.4.16.2")
531 (source (origin
532 (method url-fetch)
533 (uri (string-append
534 "http://www.netfilter.org/projects/iptables/files/iptables-"
535 version ".tar.bz2"))
536 (sha256
537 (base32
538 "0vkg5lzkn4l3i1sm6v3x96zzvnv9g7mi0qgj6279ld383mzcws24"))))
539 (build-system gnu-build-system)
540 (arguments '(#:tests? #f)) ; no test suite
541 (home-page "http://www.netfilter.org/projects/iptables/index.html")
542 (synopsis "Program to configure the Linux IP packet filtering rules")
543 (description
544 "iptables is the userspace command line program used to configure the
545Linux 2.4.x and later IPv4 packet filtering ruleset. It is targeted towards
546system administrators. Since Network Address Translation is also configured
547from the packet filter ruleset, iptables is used for this, too. The iptables
548package also includes ip6tables. ip6tables is used for configuring the IPv6
549packet filter.")
550 (license gpl2+)))
90a0048f
LC
551
552(define-public iproute
553 (package
554 (name "iproute2")
555 (version "3.8.0")
556 (source (origin
557 (method url-fetch)
558 (uri (string-append
559 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
560 version ".tar.xz"))
561 (sha256
562 (base32
563 "0kqy30wz2krbg4y7750hjq5218hgy2vj9pm5qzkn1bqskxs4b4ap"))))
564 (build-system gnu-build-system)
565 (arguments
566 `(#:tests? #f ; no test suite
567 #:make-flags (let ((out (assoc-ref %outputs "out")))
568 (list "DESTDIR="
569 (string-append "LIBDIR=" out "/lib")
570 (string-append "SBINDIR=" out "/sbin")
571 (string-append "CONFDIR=" out "/etc")
572 (string-append "DOCDIR=" out "/share/doc/"
573 ,name "-" ,version)
574 (string-append "MANDIR=" out "/share/man")))
575 #:phases (alist-cons-before
576 'install 'pre-install
577 (lambda _
578 ;; Don't attempt to create /var/lib/arpd.
579 (substitute* "Makefile"
580 (("^.*ARPDDIR.*$") "")))
581 %standard-phases)))
582 (inputs
583 `(("iptables" ,iptables)
584 ("db4" ,bdb)
585 ("pkg-config" ,pkg-config)
586 ("flex" ,flex)
587 ("bison" ,bison)))
588 (home-page
589 "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2")
590 (synopsis
591 "A collection of utilities for controlling TCP/IP networking and traffic control in Linux")
592 (description
593 "Iproute2 is a collection of utilities for controlling TCP/IP
594networking and traffic with the Linux kernel.
595
596Most network configuration manuals still refer to ifconfig and route as the
597primary network configuration tools, but ifconfig is known to behave
598inadequately in modern network environments. They should be deprecated, but
599most distros still include them. Most network configuration systems make use
600of ifconfig and thus provide a limited feature set. The /etc/net project aims
601to support most modern network technologies, as it doesn't use ifconfig and
602allows a system administrator to make use of all iproute2 features, including
603traffic control.
604
605iproute2 is usually shipped in a package called iproute or iproute2 and
606consists of several tools, of which the most important are ip and tc. ip
607controls IPv4 and IPv6 configuration and tc stands for traffic control. Both
608tools print detailed usage messages and are accompanied by a set of
609manpages.")
610 (license gpl2+)))
85e0dc6a
LC
611
612(define-public net-tools
613 ;; XXX: This package is basically unmaintained, but it provides a few
614 ;; commands not yet provided by Inetutils, such as 'route', so we have to
615 ;; live with it.
616 (package
617 (name "net-tools")
618 (version "1.60")
619 (home-page "http://www.tazenda.demon.co.uk/phil/net-tools/")
620 (source (origin
621 (method url-fetch)
622 (uri (string-append home-page "/" name "-"
623 version ".tar.bz2"))
624 (sha256
625 (base32
626 "0yvxrzk0mzmspr7sa34hm1anw6sif39gyn85w4c5ywfn8inxvr3s"))))
627 (build-system gnu-build-system)
628 (arguments
629 '(#:phases (alist-replace
630 'patch
631 (lambda* (#:key inputs #:allow-other-keys)
632 (define (apply-patch file)
633 (zero? (system* "patch" "-p1" "--batch"
634 "--input" file)))
635
636 (let ((patch.gz (assoc-ref inputs "patch")))
637 (format #t "applying Debian patch set '~a'...~%"
638 patch.gz)
639 (system (string-append "gunzip < " patch.gz " > the-patch"))
640 (pk 'here)
641 (and (apply-patch "the-patch")
642 (for-each apply-patch
643 (find-files "debian/patches"
644 "\\.patch")))))
645 (alist-replace
646 'configure
647 (lambda* (#:key outputs #:allow-other-keys)
648 (let ((out (assoc-ref outputs "out")))
649 (mkdir-p (string-append out "/bin"))
650 (mkdir-p (string-append out "/sbin"))
651
652 ;; Pretend we have everything...
653 (system "yes | make config")
654
655 ;; ... except we don't have libdnet, so remove that
656 ;; definition.
657 (substitute* '("config.make" "config.h")
658 (("^.*HAVE_AFDECnet.*$") ""))))
659 %standard-phases))
660
661 ;; Binaries that depend on libnet-tools.a don't declare that
662 ;; dependency, making it parallel-unsafe.
663 #:parallel-build? #f
664
665 #:tests? #f ; no test suite
666 #:make-flags (list "CC=gcc"
667 (string-append "BASEDIR="
668 (assoc-ref %outputs "out")))))
669
670 ;; Use the big Debian patch set (the thing does not even compile out of
671 ;; the box.)
672 (inputs `(("patch" ,(origin
673 (method url-fetch)
674 (uri
675 "http://ftp.de.debian.org/debian/pool/main/n/net-tools/net-tools_1.60-24.2.diff.gz")
676 (sha256
677 (base32
678 "0p93lsqx23v5fv4hpbrydmfvw1ha2rgqpn2zqbs2jhxkzhjc030p"))))))
679 (native-inputs `(("gettext" ,g:gettext)))
680
681 (synopsis "Tools for controlling the network subsystem in Linux")
682 (description
683 "This package includes the important tools for controlling the network
684subsystem of the Linux kernel. This includes arp, hostname, ifconfig,
685netstat, rarp and route. Additionally, this package contains utilities
686relating to particular network hardware types (plipconfig, slattach) and
687advanced aspects of IP configuration (iptunnel, ipmaddr).")
688 (license gpl2+)))
c762e82e
LC
689
690(define-public libcap
691 (package
692 (name "libcap")
693 (version "2.22")
694 (source (origin
695 (method url-fetch)
696
697 ;; Tarballs used to be available from
698 ;; <https://www.kernel.org/pub/linux/libs/security/linux-privs/>
699 ;; but they never came back after kernel.org was compromised.
700 (uri (string-append
701 "mirror://debian/pool/main/libc/libcap2/libcap2_"
702 version ".orig.tar.gz"))
703 (sha256
704 (base32
705 "07vjhkznm82p8dm4w6j8mmg7h5c70lp5s9bwwfdmgwpbixfydjp1"))))
706 (build-system gnu-build-system)
707 (arguments '(#:phases (alist-delete 'configure %standard-phases)
708 #:tests? #f ; no 'check' target
709 #:make-flags (list "lib=lib"
710 (string-append "prefix="
711 (assoc-ref %outputs "out"))
712 "RAISE_SETFCAP=no")))
713 (native-inputs `(("perl" ,perl)))
714 (inputs `(("attr" ,attr)))
715 (home-page "https://sites.google.com/site/fullycapable/")
716 (synopsis "Library for working with POSIX capabilities")
717 (description
718 "libcap2 provides a programming interface to POSIX capabilities on
719Linux-based operating systems.")
720
721 ;; License is BSD-3 or GPLv2, at the user's choice.
722 (license gpl2)))
215b6431
LC
723
724(define-public bridge-utils
725 (package
726 (name "bridge-utils")
727 (version "1.5")
728 (source (origin
729 (method url-fetch)
730 (uri (string-append "mirror://sourceforge/bridge/bridge-utils-"
731 version ".tar.gz"))
732 (sha256
733 (base32
734 "12367cwqmi0yqphi6j8rkx97q8hw52yq2fx4k0xfclkcizxybya2"))))
735 (build-system gnu-build-system)
736
737 ;; The tarball lacks all the generated files.
738 (native-inputs `(("autoconf" ,autoconf)
739 ("automake" ,automake)))
740 (arguments
741 '(#:phases (alist-cons-before
742 'configure 'bootstrap
743 (lambda _
744 (zero? (system* "autoreconf" "-vf")))
745 %standard-phases)
746 #:tests? #f)) ; no 'check' target
747
748 (home-page
749 "http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge")
750 (synopsis "Manipulate Ethernet bridges")
751 (description
752 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
753to connect two Ethernet segments together in a protocol independent way.
754Packets are forwarded based on Ethernet address, rather than IP address (like
755a router). Since forwarding is done at Layer 2, all protocols can go
756transparently through a bridge.")
757 (license gpl2+)))