gnu: Add envstore.
[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 ;;;
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)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages perl))
25
26 (define %ftp-base
27 "ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/")
28
29 (define-public lsof
30 (package
31 (name "lsof")
32 (version "4.88")
33 (source (origin
34 (method url-fetch)
35 (uri (list (string-append %ftp-base "lsof_"
36 version ".tar.bz2")
37 (string-append %ftp-base "OLD/lsof_"
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")))
49 (sha256
50 (base32
51 "16y9wm26rg81mihnzcbdg8h8vhxmq8kn62ssxb8cqydp4q79nvzy"))))
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
59 (lambda* (#:key source #:allow-other-keys)
60 (let ((unpack (assoc-ref %standard-phases 'unpack)))
61 (unpack #:source source)
62 (unpack #:source (car (find-files "." "\\.tar$")))))
63 (alist-replace
64 'configure
65 (lambda _
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)))))
82 (synopsis "Display information about open files")
83 (description
84 "Lsof stands for LiSt Open Files, and it does just that.
85 It lists information about files that are open by the processes running
86 on 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/")))