gnu: calibre: Wrap QTWEBENGINEPROCESS_PATH.
[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>
d70478da 5;;; Copyright © 2018, 2019 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
3720a6f8 50 ;; at <https://people.freebsd.org/~abe/>.
cb443e55
TGR
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")
d70478da
LC
72
73 ;; By default, the makefile captures the output of 'uname -a'.
74 ;; Provide a fixed output instead to make builds reproducible.
75 (setenv "LSOF_SYSINFO"
76 (string-append "GNU/" (utsname:sysname (uname))
77 " (GNU Guix)"))
78
b7fd3e96
TGR
79 (invoke "./Configure" "linux")
80 #t))
c2799070
TGR
81 (add-after 'configure 'patch-timestamps
82 (lambda _
83 (substitute* "Makefile"
6f6f9ef0
MB
84 (("`date`") "`date --date=@1`"))
85 #t))
16cb3b8f
TGR
86 (add-before 'check 'disable-failing-tests
87 (lambda _
f1a9c6e5
LC
88 ;; In libc 2.28, the 'major' and 'minor' macros are provided by
89 ;; <sys/sysmacros.h> only so include it.
90 (substitute* "tests/LTlib.c"
91 (("#ifndef lint")
92 "#include <sys/sysmacros.h>\n\n#ifndef lint"))
93
16cb3b8f
TGR
94 (substitute* "tests/Makefile"
95 ;; Fails with ‘ERROR!!! client gethostbyaddr() failure’.
96 (("(STDTST=.*) LTsock" _ prefix) prefix)
97 ;; Fails without access to a remote NFS server.
6f6f9ef0
MB
98 (("(OPTTST=.*) LTnfs" _ prefix) prefix))
99 #t))
16cb3b8f
TGR
100 (replace 'check
101 (lambda _
102 (with-directory-excursion "tests"
103 ;; Tests refuse to run on ‘unvalidated’ platforms.
104 (make-file-writable "TestDB")
105 (invoke "./Add2TestDB")
106
107 ;; The ‘standard’ tests suggest running ‘optional’ ones as well.
108 (invoke "make" "standard" "optional")
109 #t)))
b6ea329a
EF
110 (replace 'install
111 (lambda* (#:key outputs #:allow-other-keys)
112 (let ((out (assoc-ref outputs "out")))
4ae3549f
EF
113 (install-file "lsof" (string-append out "/bin"))
114 (install-file "lsof.8" (string-append out "/share/man/man8")))
115 #t)))))
35b9e423 116 (synopsis "Display information about open files")
938081b9
AE
117 (description
118 "Lsof stands for LiSt Open Files, and it does just that.
119It lists information about files that are open by the processes running
120on the system.")
121 (license (license:fsf-free
122 "file://00FAQ"
123 "License inspired by zlib, see point 1.9 of 00FAQ in the distribution."))
3720a6f8 124 (home-page "https://people.freebsd.org/~abe/")))