gnu: wine: Update to 3.0.3.
[jackhill/guix/guix.git] / gnu / packages / lsof.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages lsof)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix build-system gnu)
26 #:use-module (gnu packages perl))
27
28 (define-public lsof
29 (package
30 (name "lsof")
31 (version "4.91")
32 (source
33 (origin
34 (method url-fetch)
35 (uri
36 (apply append
37 (map
38 (lambda (mirror-uri)
39 (let ((tarball (string-append name "_" version ".tar.bz2")))
40 (list
41 (string-append mirror-uri "/" tarball)
42 ;; Upon every new release, the previous one is moved here:
43 (string-append mirror-uri "/OLD/" tarball))))
44 (list
45 "ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/"
46
47 ;; Add mirrors because the canonical FTP server at purdue.edu
48 ;; bails out when it cannot do a reverse DNS lookup, as noted
49 ;; at <http://people.freebsd.org/~abe/>.
50 "ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/"
51 (string-append "http://www.mirrorservice.org/sites/"
52 "lsof.itap.purdue.edu/pub/tools/unix/lsof")
53 (string-append "ftp://ftp.mirrorservice.org/sites/"
54 "lsof.itap.purdue.edu/pub/tools/unix/lsof")))))
55 (sha256
56 (base32 "18sh4hbl9jw2szkf0gvgan8g13f3g4c6s2q9h3zq5gsza9m99nn9"))))
57 (build-system gnu-build-system)
58 (native-inputs `(("perl" ,perl)))
59 (arguments
60 `(#:phases
61 (modify-phases %standard-phases
62 (replace 'unpack
63 (lambda* (#:key source #:allow-other-keys)
64 (let ((unpack (assoc-ref %standard-phases 'unpack)))
65 (unpack #:source source)
66 (unpack #:source (car (find-files "." "\\.tar$"))))))
67 (replace 'configure
68 (lambda _
69 (setenv "LSOF_CC" "gcc")
70 (setenv "LSOF_MAKE" "make")
71 (invoke "./Configure" "linux")
72 #t))
73 (add-after 'configure 'patch-timestamps
74 (lambda _
75 (substitute* "Makefile"
76 (("`date`") "`date --date=@1`"))
77 #t))
78 (add-before 'check 'disable-failing-tests
79 (lambda _
80 (substitute* "tests/Makefile"
81 ;; Fails with ‘ERROR!!! client gethostbyaddr() failure’.
82 (("(STDTST=.*) LTsock" _ prefix) prefix)
83 ;; Fails without access to a remote NFS server.
84 (("(OPTTST=.*) LTnfs" _ prefix) prefix))
85 #t))
86 (replace 'check
87 (lambda _
88 (with-directory-excursion "tests"
89 ;; Tests refuse to run on ‘unvalidated’ platforms.
90 (make-file-writable "TestDB")
91 (invoke "./Add2TestDB")
92
93 ;; The ‘standard’ tests suggest running ‘optional’ ones as well.
94 (invoke "make" "standard" "optional")
95 #t)))
96 (replace 'install
97 (lambda* (#:key outputs #:allow-other-keys)
98 (let ((out (assoc-ref outputs "out")))
99 (install-file "lsof" (string-append out "/bin"))
100 (install-file "lsof.8" (string-append out "/share/man/man8")))
101 #t)))))
102 (synopsis "Display information about open files")
103 (description
104 "Lsof stands for LiSt Open Files, and it does just that.
105 It lists information about files that are open by the processes running
106 on the system.")
107 (license (license:fsf-free
108 "file://00FAQ"
109 "License inspired by zlib, see point 1.9 of 00FAQ in the distribution."))
110 (home-page "http://people.freebsd.org/~abe/")))