gnu: make-bootstrap: Add missing inputs for Canadian cross of '%gcc-static'.
[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)
1dba6407 33 #:use-module (gnu packages gettext)
17b293a0 34 #:use-module (gnu packages pulseaudio)
c762e82e 35 #:use-module (gnu packages attr)
17b293a0 36 #:use-module (gnu packages xml)
215b6431 37 #:use-module (gnu packages autotools)
02b80c3f
NK
38 #:use-module (guix packages)
39 #:use-module (guix download)
0ded70f3 40 #:use-module (guix build-system gnu))
fd76c904 41
aaf4cb20
LC
42(define-public (system->linux-architecture arch)
43 "Return the Linux architecture name for ARCH, a Guix system name such as
44\"x86_64-linux\"."
618cea69
NK
45 (let ((arch (car (string-split arch #\-))))
46 (cond ((string=? arch "i686") "i386")
47 ((string-prefix? "mips" arch) "mips")
aaf4cb20 48 ((string-prefix? "arm" arch) "arm")
618cea69
NK
49 (else arch))))
50
6023cc74
LC
51(define (linux-libre-urls version)
52 "Return a list of URLs for Linux-Libre VERSION."
53 (list (string-append
54 "http://linux-libre.fsfla.org/pub/linux-libre/releases/"
55 version "-gnu/linux-libre-" version "-gnu.tar.xz")
56
57 ;; XXX: Work around <http://bugs.gnu.org/14851>.
58 (string-append
59 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
60 version "-gnu.tar.xz")
61
62 ;; Maybe this URL will become valid eventually.
63 (string-append
64 "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
65 version "-gnu.tar.xz")))
66
80fe5c60 67(define-public linux-libre-headers
dfb52abb 68 (let* ((version "3.3.8")
80fe5c60 69 (build-phase
618cea69
NK
70 (lambda (arch)
71 `(lambda _
72 (setenv "ARCH" ,(system->linux-architecture arch))
73 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
45298f8f 74
618cea69
NK
75 (and (zero? (system* "make" "defconfig"))
76 (zero? (system* "make" "mrproper" "headers_check"))))))
80fe5c60
LC
77 (install-phase
78 `(lambda* (#:key outputs #:allow-other-keys)
79 (let ((out (assoc-ref outputs "out")))
80 (and (zero? (system* "make"
81 (string-append "INSTALL_HDR_PATH=" out)
82 "headers_install"))
83 (mkdir (string-append out "/include/config"))
84 (call-with-output-file
85 (string-append out
86 "/include/config/kernel.release")
87 (lambda (p)
dfb52abb 88 (format p "~a-default~%" ,version))))))))
80fe5c60
LC
89 (package
90 (name "linux-libre-headers")
dfb52abb 91 (version version)
80fe5c60
LC
92 (source (origin
93 (method url-fetch)
6023cc74 94 (uri (linux-libre-urls version))
80fe5c60
LC
95 (sha256
96 (base32
97 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
98 (build-system gnu-build-system)
99 (native-inputs `(("perl" ,perl)))
100 (arguments
101 `(#:modules ((guix build gnu-build-system)
102 (guix build utils)
56c092ce 103 (srfi srfi-1))
80fe5c60 104 #:phases (alist-replace
fb6c2fa8
LC
105 'build ,(build-phase (or (%current-target-system)
106 (%current-system)))
80fe5c60
LC
107 (alist-replace
108 'install ,install-phase
56c092ce 109 (alist-delete 'configure %standard-phases)))
80fe5c60
LC
110 #:tests? #f))
111 (synopsis "GNU Linux-Libre kernel headers")
112 (description "Headers of the Linux-Libre kernel.")
38bbd61d 113 (license gpl2)
80fe5c60
LC
114 (home-page "http://www.gnu.org/software/linux-libre/"))))
115
b4fcb735
LC
116(define-public module-init-tools
117 (package
118 (name "module-init-tools")
119 (version "3.16")
120 (source (origin
121 (method url-fetch)
122 (uri (string-append
123 "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
124 version ".tar.bz2"))
125 (sha256
126 (base32
127 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))))
128 (build-system gnu-build-system)
b4fcb735 129 (arguments
5c413a9c
LC
130 ;; FIXME: The upstream tarball lacks man pages, and building them would
131 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
132 ;; but they vanished. In the meantime, fake it.
b4fcb735 133 '(#:phases (alist-cons-before
5c413a9c
LC
134 'configure 'fake-docbook
135 (lambda _
136 (substitute* "Makefile.in"
137 (("^DOCBOOKTOMAN.*$")
138 "DOCBOOKTOMAN = true\n")))
b4fcb735
LC
139 %standard-phases)))
140 (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
141 (synopsis "Tools for loading and managing Linux kernel modules")
142 (description
143 "Tools for loading and managing Linux kernel modules, such as `modprobe',
144`insmod', `lsmod', and more.")
145 (license gpl2+)))
146
beacfcab 147(define-public linux-libre
257f5601 148 (let* ((version "3.12")
beacfcab
LC
149 (build-phase
150 '(lambda* (#:key system #:allow-other-keys #:rest args)
151 (let ((arch (car (string-split system #\-))))
152 (setenv "ARCH"
153 (cond ((string=? arch "i686") "i386")
154 (else arch)))
155 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
156
157 (let ((build (assoc-ref %standard-phases 'build)))
2e48455d
LC
158 (and (zero? (system* "make" "defconfig"))
159 (begin
160 (format #t "enabling additional modules...~%")
161 (substitute* ".config"
162 (("^# CONFIG_CIFS.*$")
163 "CONFIG_CIFS=m\n"))
164 (zero? (system* "make" "oldconfig")))
beacfcab
LC
165
166 ;; Call the default `build' phase so `-j' is correctly
167 ;; passed.
168 (apply build #:make-flags "all" args)))))
169 (install-phase
170 `(lambda* (#:key inputs outputs #:allow-other-keys)
171 (let* ((out (assoc-ref outputs "out"))
172 (moddir (string-append out "/lib/modules"))
173 (mit (assoc-ref inputs "module-init-tools")))
174 (mkdir-p moddir)
175 (for-each (lambda (file)
176 (copy-file file
177 (string-append out "/" (basename file))))
178 (find-files "." "^(bzImage|System\\.map)$"))
179 (copy-file ".config" (string-append out "/config"))
180 (zero? (system* "make"
181 (string-append "DEPMOD=" mit "/sbin/depmod")
182 (string-append "MODULE_DIR=" moddir)
183 (string-append "INSTALL_PATH=" out)
184 (string-append "INSTALL_MOD_PATH=" out)
185 "modules_install"))))))
186 (package
187 (name "linux-libre")
dfb52abb 188 (version version)
beacfcab
LC
189 (source (origin
190 (method url-fetch)
6023cc74 191 (uri (linux-libre-urls version))
beacfcab
LC
192 (sha256
193 (base32
257f5601 194 "0drjxm9h2k9bik2mhrqqqi6cm5rn2db647wf0zvb58xldj0zmhb6"))))
beacfcab
LC
195 (build-system gnu-build-system)
196 (native-inputs `(("perl" ,perl)
e7b38500 197 ("bc" ,bc)
beacfcab
LC
198 ("module-init-tools" ,module-init-tools)))
199 (arguments
200 `(#:modules ((guix build gnu-build-system)
201 (guix build utils)
202 (srfi srfi-1)
203 (ice-9 match))
204 #:phases (alist-replace
205 'build ,build-phase
206 (alist-replace
207 'install ,install-phase
208 (alist-delete 'configure %standard-phases)))
209 #:tests? #f))
f50d2669 210 (synopsis "100% free redistribution of a cleaned Linux kernel")
a22dc0c4
LC
211 (description
212 "Linux Libre is a free (as in freedom) variant of the Linux kernel. It
213has been modified to remove any non-free binary blobs.")
beacfcab
LC
214 (license gpl2)
215 (home-page "http://www.gnu.org/software/linux-libre/"))))
216
c84d0eca
LC
217\f
218;;;
219;;; Pluggable authentication modules (PAM).
220;;;
221
fd76c904
LC
222(define-public linux-pam
223 (package
224 (name "linux-pam")
225 (version "1.1.6")
226 (source
227 (origin
228 (method url-fetch)
229 (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
230 version ".tar.bz2")
231 (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
232 version ".tar.bz2")))
233 (sha256
234 (base32
235 "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
236 (build-system gnu-build-system)
237 (inputs
238 `(("flex" ,flex)
239
240 ;; TODO: optional dependencies
241 ;; ("libxcrypt" ,libxcrypt)
242 ;; ("cracklib" ,cracklib)
243 ))
244 (arguments
c134056a
LC
245 '(;; Most users, such as `shadow', expect the headers to be under
246 ;; `security'.
247 #:configure-flags (list (string-append "--includedir="
248 (assoc-ref %outputs "out")
249 "/include/security"))
250
251 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
252 ;; isn't available.
253 #:tests? #f))
fd76c904
LC
254 (home-page "http://www.linux-pam.org/")
255 (synopsis "Pluggable authentication modules for Linux")
256 (description
257 "A *Free* project to implement OSF's RFC 86.0.
258Pluggable authentication modules are small shared object files that can
259be used through the PAM API to perform tasks, like authenticating a user
260at login. Local and dynamic reconfiguration are its key features")
4a44e743 261 (license bsd-3)))
686f14e8 262
c84d0eca
LC
263\f
264;;;
265;;; Miscellaneous.
266;;;
267
686f14e8
LC
268(define-public psmisc
269 (package
270 (name "psmisc")
271 (version "22.20")
272 (source
273 (origin
274 (method url-fetch)
275 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
276 version ".tar.gz"))
277 (sha256
278 (base32
279 "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
280 (build-system gnu-build-system)
281 (inputs `(("ncurses" ,ncurses)))
282 (home-page "http://psmisc.sourceforge.net/")
283 (synopsis
284 "set of utilities that use the proc filesystem, such as fuser, killall, and pstree")
285 (description
286 "This PSmisc package is a set of some small useful utilities that
287use the proc filesystem. We're not about changing the world, but
288providing the system administrator with some help in common tasks.")
4a44e743 289 (license gpl2+)))
02b80c3f
NK
290
291(define-public util-linux
292 (package
293 (name "util-linux")
294 (version "2.21")
295 (source
296 (origin
297 (method url-fetch)
298 (uri (string-append "mirror://kernel.org/linux/utils/"
299 name "/v" version "/"
300 name "-" version ".2" ".tar.xz"))
301 (sha256
302 (base32
303 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
304 (build-system gnu-build-system)
305 (arguments
306 `(#:configure-flags '("--disable-use-tty-group")
307 #:phases (alist-cons-after
308 'install 'patch-chkdupexe
309 (lambda* (#:key outputs #:allow-other-keys)
310 (let ((out (assoc-ref outputs "out")))
311 (substitute* (string-append out "/bin/chkdupexe")
312 ;; Allow 'patch-shebang' to do its work.
313 (("@PERL@") "/bin/perl"))))
314 %standard-phases)))
4a44e743 315 (inputs `(("zlib" ,guix:zlib)
02b80c3f
NK
316 ("ncurses" ,ncurses)
317 ("perl" ,perl)))
318 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
35ec07c7 319 (synopsis "Collection of utilities for the Linux kernel")
02b80c3f
NK
320 (description
321 "util-linux is a random collection of utilities for the Linux kernel.")
fe8ccfcc 322
02b80c3f 323 ;; Note that util-linux doesn't use the same license for all the
fe8ccfcc 324 ;; code. GPLv2+ is the default license for a code without an
02b80c3f 325 ;; explicitly defined license.
fe8ccfcc
LC
326 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
327 bsd-4 public-domain))))
5d5c4278 328
e47e3eff
LC
329(define-public procps
330 (package
331 (name "procps")
332 (version "3.2.8")
333 (source (origin
334 (method url-fetch)
335 (uri (string-append "http://procps.sourceforge.net/procps-"
336 version ".tar.gz"))
337 (sha256
338 (base32
01eafd38
LC
339 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))
340 (patches (list (search-patch "procps-make-3.82.patch")))))
e47e3eff 341 (build-system gnu-build-system)
01eafd38 342 (inputs `(("ncurses" ,ncurses)))
e47e3eff 343 (arguments
01eafd38 344 '(#:phases (alist-replace
e47e3eff
LC
345 'configure
346 (lambda* (#:key outputs #:allow-other-keys)
347 ;; No `configure', just a single Makefile.
348 (let ((out (assoc-ref outputs "out")))
349 (substitute* "Makefile"
350 (("/usr/") "/")
351 (("--(owner|group) 0") "")
352 (("ldconfig") "true")
353 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
354 ;; Add libproc to the RPATH.
355 (string-append "LDFLAGS := -Wl,-rpath="
356 out "/lib" value))))
357 (setenv "CC" "gcc"))
358 (alist-replace
359 'install
360 (lambda* (#:key outputs #:allow-other-keys)
361 (let ((out (assoc-ref outputs "out")))
362 (and (zero?
363 (system* "make" "install"
364 (string-append "DESTDIR=" out)))
365
366 ;; Sanity check.
367 (zero?
368 (system* (string-append out "/bin/ps")
369 "--version")))))
370 %standard-phases))
371
372 ;; What did you expect? Tests?
373 #:tests? #f))
374 (home-page "http://procps.sourceforge.net/")
35ec07c7 375 (synopsis "Utilities that give information about processes")
e47e3eff
LC
376 (description
377 "procps is the package that has a bunch of small useful utilities
378that give information about processes using the Linux /proc file system.
379The package includes the programs ps, top, vmstat, w, kill, free,
380slabtop, and skill.")
381 (license gpl2)))
382
5d5c4278
NK
383(define-public usbutils
384 (package
385 (name "usbutils")
386 (version "006")
387 (source
388 (origin
389 (method url-fetch)
390 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
391 "usbutils-" version ".tar.xz"))
392 (sha256
393 (base32
394 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
395 (build-system gnu-build-system)
396 (inputs
397 `(("libusb" ,libusb) ("pkg-config" ,pkg-config)))
398 (home-page "http://www.linux-usb.org/")
399 (synopsis
400 "Tools for working with USB devices, such as lsusb")
401 (description
402 "Tools for working with USB devices, such as lsusb.")
4050e5d6 403 (license gpl2+)))
0750452a
LC
404
405(define-public e2fsprogs
406 (package
407 (name "e2fsprogs")
408 (version "1.42.7")
409 (source (origin
410 (method url-fetch)
411 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
412 version ".tar.gz"))
413 (sha256
414 (base32
415 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
416 (build-system gnu-build-system)
417 (inputs `(("util-linux" ,util-linux)
418 ("pkg-config" ,pkg-config)))
419 (arguments
420 '(#:phases (alist-cons-before
421 'configure 'patch-shells
422 (lambda _
423 (substitute* "configure"
424 (("/bin/sh (.*)parse-types.sh" _ dir)
425 (string-append (which "sh") " " dir
426 "parse-types.sh")))
427 (substitute* (find-files "." "^Makefile.in$")
428 (("#!/bin/sh")
429 (string-append "#!" (which "sh")))))
430 %standard-phases)
431
432 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
433 ;; they fail because we get an extra line that says "Can't check if
434 ;; filesystem is mounted due to missing mtab file".
435 #:tests? #f))
436 (home-page "http://e2fsprogs.sourceforge.net/")
35ec07c7 437 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
0750452a
LC
438 (description
439 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
440 (license (list gpl2 ; programs
441 lgpl2.0 ; libext2fs
442 x11)))) ; libuuid
d8482ad0
LC
443
444(define-public strace
445 (package
446 (name "strace")
447 (version "4.7")
448 (source (origin
449 (method url-fetch)
450 (uri (string-append "mirror://sourceforge/strace/strace-"
451 version ".tar.xz"))
452 (sha256
453 (base32
454 "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
455 (build-system gnu-build-system)
456 (inputs `(("perl" ,perl)))
457 (home-page "http://strace.sourceforge.net/")
458 (synopsis "System call tracer for Linux")
459 (description
460 "strace is a system call tracer, i.e. a debugging tool which prints out a
461trace of all the system calls made by a another process/program.")
462 (license bsd-3)))
ba04571a
LC
463
464(define-public alsa-lib
465 (package
466 (name "alsa-lib")
467 (version "1.0.27.1")
468 (source (origin
469 (method url-fetch)
470 (uri (string-append
471 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
472 version ".tar.bz2"))
473 (sha256
474 (base32
bcd94e19
MW
475 "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))
476 (patches (list (search-patch "alsa-lib-mips-atomic-fix.patch")))))
ba04571a
LC
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)
1dba6407 516 ("gettext" ,gnu-gettext)))
17b293a0
LC
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"))))))
1dba6407 679 (native-inputs `(("gettext" ,gnu-gettext)))
85e0dc6a
LC
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+)))