Commit | Line | Data |
---|---|---|
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> |
938081b9 AE |
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) | |
b5b73a82 | 22 | #:use-module ((guix licenses) #:prefix license:) |
938081b9 AE |
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") | |
b9ffa82b | 31 | (version "4.91") |
cb443e55 TGR |
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/" | |
d45d8904 | 46 | |
cb443e55 TGR |
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 | |
b9ffa82b | 56 | (base32 "18sh4hbl9jw2szkf0gvgan8g13f3g4c6s2q9h3zq5gsza9m99nn9")))) |
938081b9 | 57 | (build-system gnu-build-system) |
57774ae1 | 58 | (native-inputs `(("perl" ,perl))) |
938081b9 | 59 | (arguments |
16cb3b8f | 60 | `(#:phases |
b6ea329a EF |
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") | |
b7fd3e96 TGR |
71 | (invoke "./Configure" "linux") |
72 | #t)) | |
c2799070 TGR |
73 | (add-after 'configure 'patch-timestamps |
74 | (lambda _ | |
75 | (substitute* "Makefile" | |
6f6f9ef0 MB |
76 | (("`date`") "`date --date=@1`")) |
77 | #t)) | |
16cb3b8f TGR |
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. | |
6f6f9ef0 MB |
84 | (("(OPTTST=.*) LTnfs" _ prefix) prefix)) |
85 | #t)) | |
16cb3b8f TGR |
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))) | |
b6ea329a EF |
96 | (replace 'install |
97 | (lambda* (#:key outputs #:allow-other-keys) | |
98 | (let ((out (assoc-ref outputs "out"))) | |
4ae3549f EF |
99 | (install-file "lsof" (string-append out "/bin")) |
100 | (install-file "lsof.8" (string-append out "/share/man/man8"))) | |
101 | #t))))) | |
35b9e423 | 102 | (synopsis "Display information about open files") |
938081b9 AE |
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/"))) |