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