projects/guix·blob java-team · refs

159 lines · 6.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014, 2018 Eric Bavier <[email protected]>
3;;; Copyright © 2016-2020, 2022 Efraim Flashner <[email protected]>
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages datamash)
21 #:use-module (guix packages)
22 #:use-module (guix licenses)
23 #:use-module (guix download)
24 #:use-module (guix git-download)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix gexp)
27 #:use-module (guix utils)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages gawk)
31 #:use-module (gnu packages perl)
32 #:use-module (gnu packages python)
33 #:use-module (gnu packages python-xyz))
34
35(define-public datamash
36 (package
37 (name "datamash")
38 (version "1.9")
39 (source
40 (origin
41 (method url-fetch)
42 (uri (string-append "mirror://gnu/datamash/datamash-"
43 version ".tar.gz"))
44 (sha256
45 (base32
46 "1ll7rfm2b8zdm1vlm3a32cr2kjbc1af8yx8z2rwxc3b50gdfp0pk"))))
47 (native-inputs
48 (list which ;for tests
49 perl)) ;for help2man
50 (build-system gnu-build-system)
51 (arguments
52 (if (%current-target-system)
53 ;; fix for crosscompiling; on GNU system strcasecmp always works
54 (list #:configure-flags
55 #~(list "ac_cv_func_strcasecmp=yes"
56 "gl_cv_func_strcasecmp_works=yes"))
57 '()))
58 (home-page "https://www.gnu.org/software/datamash/")
59 (synopsis "Scriptable statistics and data calculation")
60 (description
61 "Perform basic numeric, textual and statistical operations on plain text
62files. Designed to work within standard pipelines without additional code.")
63 (license gpl3+)))
64
65(define-public vnlog
66 (package
67 (name "vnlog")
68 (version "1.32")
69 (home-page "https://github.com/dkogan/vnlog")
70 (source (origin
71 (method git-fetch)
72 (uri (git-reference
73 (url home-page)
74 (commit (string-append "v" version))))
75 (file-name (git-file-name name version))
76 (sha256
77 (base32
78 "1g4insm6gkw3c82fq8q9swkdha3cncbz1nib15yg9b2s4yl123hm"))))
79 (build-system gnu-build-system)
80 (native-inputs
81 (list python-numpy)) ;for tests
82 (inputs
83 (list mawk
84 perl
85 perl-ipc-run
86 perl-list-moreutils
87 perl-string-shellquote
88 perl-text-diff
89 perl-text-table
90 python-wrapper))
91 (arguments
92 (list #:make-flags
93 #~(list (string-append "CC=" #$(cc-for-target))
94 (string-append "DESTDIR=" #$output)
95 "USRLIB=lib"
96 "MANDIR=share/man"
97 (string-append "PY3_MODULE_PATH=lib/python"
98 #$(version-major+minor
99 (package-version
100 (this-package-input "python-wrapper")))
101 "/site-packages")
102 ;; Do not install the Python 2 modules.
103 "DIST_PY2_MODULES=")
104 #:phases
105 #~(modify-phases %standard-phases
106 (add-after 'unpack 'adjust-Makefile
107 (lambda _
108 (substitute* "GNUmakefile"
109 ;; Install Perl modules to the usual location.
110 (("/usr/share/perl5")
111 (string-append "/lib/perl5/site_perl/"
112 #$(package-version
113 (this-package-input "perl"))))
114 ;; Do not add a '/usr' suffix to DESTDIR.
115 (("\\$\\(DESTDIR\\)/usr")
116 "$(DESTDIR)")
117 ;; Do not strip RUNPATH from the installed C library.
118 ((".*find.*chrpath.*")
119 ""))))
120 (add-after 'unpack 'use-absolute-mawk
121 (lambda* (#:key inputs #:allow-other-keys)
122 (let ((mawk (search-input-file inputs "bin/mawk")))
123 (substitute* '("vnl-filter" "lib/Vnlog/Util.pm")
124 (("'mawk'")
125 (string-append "'" mawk "'"))))))
126 (delete 'configure)
127 (add-before 'check 'disable-python2-test
128 (lambda _
129 (delete-file "test/test_python2_parser.sh")
130 (substitute* "GNUmakefile"
131 ((".*test/test_python2_parser\\.sh\\.RUN.*")
132 ""))))
133 (add-after 'install 'wrap
134 (lambda* (#:key inputs outputs #:allow-other-keys)
135 (let* ((out (assoc-ref outputs "out"))
136 (PERL5LIB (string-append
137 out "/lib/perl5/site_perl/"
138 #$(package-version
139 (this-package-input "perl"))
140 ":" (getenv "PERL5LIB"))))
141 (for-each (lambda (script)
142 (wrap-program script
143 `("PERL5LIB" ":" prefix (,PERL5LIB))))
144 (find-files (string-append out "/bin"))))))
145 (add-after 'wrap 'check-wrapped-executables
146 (lambda* (#:key outputs #:allow-other-keys)
147 (let ((out (assoc-ref outputs "out")))
148 ;; Assert that the installed Perl scripts can find
149 ;; their dependencies even when PERL5LIB is unset.
150 (unsetenv "PERL5LIB")
151 (for-each (lambda (script)
152 (invoke/quiet script "--help"))
153 (find-files (string-append out "/bin")
154 "^vnl-[[:lower:]]+$"))))))))
155 (synopsis "Process labelled tabular ASCII data on the command line")
156 (description
157 "Vnlog (pronounced @dfn{vanillog}) is a toolkit for manipulating
158tabular ASCII data with labelled fields using regular command-line tools.")
159 (license lgpl2.1+)))