Merge branch 'master' into core-updates
[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>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages lsof)
b5b73a82 20 #:use-module ((guix licenses) #:prefix license:)
938081b9
AE
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages perl))
25
9a0569aa
LC
26(define %ftp-base
27 "ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/")
28
938081b9
AE
29(define-public lsof
30 (package
31 (name "lsof")
9a0569aa 32 (version "4.88")
938081b9
AE
33 (source (origin
34 (method url-fetch)
9a0569aa
LC
35 (uri (list (string-append %ftp-base "lsof_"
36 version ".tar.bz2")
37 (string-append %ftp-base "OLD/lsof_"
d45d8904
LC
38 version ".tar.bz2")
39
40 ;; Add mirrors because the FTP server at purdue.edu
41 ;; bails out when it cannot do a reverse DNS lookup, as
42 ;; noted at <http://people.freebsd.org/~abe/>.
43 (string-append
44 "ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/lsof_"
45 version ".tar.bz2")
46 (string-append
47 "ftp://sunsite.ualberta.ca/pub/Mirror/lsof/lsof_"
48 version ".tar.bz2")))
9a0569aa
LC
49 (sha256
50 (base32
51 "16y9wm26rg81mihnzcbdg8h8vhxmq8kn62ssxb8cqydp4q79nvzy"))))
938081b9
AE
52 (build-system gnu-build-system)
53 (inputs `(("perl" ,perl)))
54 (arguments
55 `(#:tests? #f ; no test target
56 #:phases
57 (alist-replace
58 'unpack
d4bf49b1 59 (lambda* (#:key source #:allow-other-keys)
938081b9 60 (let ((unpack (assoc-ref %standard-phases 'unpack)))
d4bf49b1
EB
61 (unpack #:source source)
62 (unpack #:source (car (find-files "." "\\.tar$")))))
938081b9
AE
63 (alist-replace
64 'configure
d4bf49b1 65 (lambda _
938081b9
AE
66 (setenv "LSOF_CC" "gcc")
67 (setenv "LSOF_MAKE" "make")
68 (system* "./Configure" "linux"))
69 (alist-replace
70 'install
71 (lambda* (#:key outputs #:allow-other-keys)
72 (let ((out (assoc-ref outputs "out")))
73 (mkdir out)
74 (mkdir (string-append out "/bin"))
75 (copy-file "lsof" (string-append out "/bin/lsof"))
76 (mkdir (string-append out "/share"))
77 (mkdir (string-append out "/share/man"))
78 (mkdir (string-append out "/share/man/man8"))
79 (copy-file "lsof.8" (string-append out "/share/man/man8/lsof.8"))
80 ))
81 %standard-phases)))))
35b9e423 82 (synopsis "Display information about open files")
938081b9
AE
83 (description
84 "Lsof stands for LiSt Open Files, and it does just that.
85It lists information about files that are open by the processes running
86on the system.")
87 (license (license:fsf-free
88 "file://00FAQ"
89 "License inspired by zlib, see point 1.9 of 00FAQ in the distribution."))
90 (home-page "http://people.freebsd.org/~abe/")))