all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 033b55c988e3ed230a5b3dcb744b57b4ed7f4ee2 13833 bytes (raw)
name: gnu/packages/java-compression.scm 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
 
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017, 2018 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages java-compression)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix utils)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system ant)
  #:use-module (gnu packages)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages java)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages python-compression))

(define-public java-snappy
  (package
    (name "java-snappy")
    (version "1.1.7.5")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/xerial/snappy-java")
             (commit version)))
       (sha256
        (base32 "0894zyasrmbi268d1ky9db16wrnc6x8b9ilq0b5paaxi2pwgjlrp"))
       (file-name (git-file-name name version))))
    (build-system ant-build-system)
    (arguments
     `(#:jar-name "snappy.jar"
       #:source-dir "src/main/java"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'make-git-checkout-writable
           (lambda _
             (for-each make-file-writable (find-files "."))
             #t))
         (add-before 'build 'remove-binaries
           (lambda _
             (delete-file "lib/org/xerial/snappy/OSInfo.class")
             (delete-file-recursively "src/main/resources/org/xerial/snappy/native")
             #t))
         (add-before 'build 'build-jni
           (lambda _
             ;; Rebuild one of the binaries we removed earlier
             (invoke "javac" "src/main/java/org/xerial/snappy/OSInfo.java"
                      "-d" "lib")
             ;; Link to the dynamic bitshuffle and snappy, not the static ones
             (substitute* "Makefile.common"
               (("-shared")
                "-shared -lbitshuffle -lsnappy"))
             (substitute* "Makefile"
               ;; Don't try to use git, don't download bitshuffle source
               ;; and don't build it.
               (("\\$\\(SNAPPY_GIT_UNPACKED\\) ")
                "")
               ((": \\$\\(SNAPPY_GIT_UNPACKED\\)")
                ":")
               (("\\$\\(BITSHUFFLE_UNPACKED\\) ")
                "")
               ((": \\$\\(SNAPPY_SOURCE_CONFIGURED\\)") ":")
               ;; What we actually want to build
               (("SNAPPY_OBJ:=.*")
                "SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/, \
                 SnappyNative.o BitShuffleNative.o)\n")
               ;; Since we removed the directory structure in "native" during
               ;; the previous phase, we need to recreate it.
               (("NAME\\): \\$\\(SNAPPY_OBJ\\)")
                "NAME): $(SNAPPY_OBJ)\n\t@mkdir -p $(@D)"))
             ;; Finally we can run the Makefile to build the dynamic library.
             ;; Use the -nocmake target to avoid a dependency on cmake,
             ;; which in turn requires the "git_unpacked" directory.
             (invoke "make" "native-nocmake")))
         ;; Once we have built the shared library, we need to place it in the
         ;; "build" directory so it can be added to the jar file.
         (add-after 'build-jni 'copy-jni
           (lambda _
             (copy-recursively "src/main/resources/org/xerial/snappy/native"
                               "build/classes/org/xerial/snappy/native")
             #t))
         (add-before 'build 'set-test-memory-size
           (lambda _
             (substitute* "build.xml"
               (("<junit printsummary=") "<junit maxmemory=\"2G\" printsummary="))
             #t))
         (add-before 'check 'fix-failing
           (lambda _
             (with-directory-excursion "src/test/java/org/xerial/snappy"
               ;; This package assumes maven build, which puts results in "target".
               ;; We put them in "build" instead, so fix that.
               (substitute* "SnappyLoaderTest.java"
                 (("target/classes") "build/classes"))
               ;; This requires Hadoop, which is not in Guix yet.
               (delete-file "SnappyHadoopCompatibleOutputStreamTest.java"))
             #t)))))
    (inputs
     `(("osgi-framework" ,java-osgi-framework)))
    (propagated-inputs
     `(("bitshuffle" ,bitshuffle-for-snappy)
       ("snappy" ,snappy)))
    (native-inputs
     `(("junit" ,java-junit)
       ("hamcrest" ,java-hamcrest-core)
       ("xerial-core" ,java-xerial-core)
       ("classworlds" ,java-plexus-classworlds)
       ("commons-lang" ,java-commons-lang)
       ("commons-io" ,java-commons-io)
       ("perl" ,perl)))
    (home-page "https://github.com/xerial/snappy-java")
    (synopsis "Compression/decompression algorithm in Java")
    (description "Snappy-java is a Java port of snappy, a fast C++
compressor/decompressor.")
    (license license:asl2.0)))

(define-public java-snappy-1
  (package
    (inherit java-snappy)
    (name "java-snappy")
    (version "1.0.3-rc3")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url (string-append "https://github.com/xerial/snappy-java"))
             (commit (string-append "snappy-java-" version))))
       (sha256
        (base32 "0gbg3xmhniyh5p6w5zqj16fr15fa8j4raswd8pj00l4ixf5qa6m4"))
       (file-name (git-file-name name version))))
    (arguments
     `(#:jar-name "snappy.jar"
       #:source-dir "src/main/java"
       #:phases
       (modify-phases %standard-phases
         (add-before 'build 'remove-binaries
           (lambda _
             (delete-file "lib/org/xerial/snappy/OSInfo.class")
             (delete-file-recursively "src/main/resources/org/xerial/snappy/native")
             #t))
         (add-before 'build 'build-jni
           (lambda _
             ;; Rebuild one of the binaries we removed earlier
             (invoke "javac" "src/main/java/org/xerial/snappy/OSInfo.java"
                      "-d" "lib")
             ;; Link to the dynamic snappy, not the static ones
             (substitute* "Makefile.common"
               (("-shared") "-shared -lsnappy"))
             (substitute* "Makefile"
               ;; Don't download the sources here.
               (("\\$\\(SNAPPY_UNPACKED\\) ") "")
               ((": \\$\\(SNAPPY_UNPACKED\\) ") ":")
               ;; What we actually want to build
               (("SNAPPY_OBJ:=.*")
                "SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/, SnappyNative.o)\n")
               ;; Since we removed the directory structure in "native" during
               ;; the previous phase, we need to recreate it.
               (("NAME\\): \\$\\(SNAPPY_OBJ\\)")
                "NAME): $(SNAPPY_OBJ)\n\t@mkdir -p $(@D)"))
             ;; Finally we can run the Makefile to build the dynamic library.
             (invoke "make" "native")))
         ;; Once we have built the shared library, we need to place it in the
         ;; "build" directory so it can be added to the jar file.
         (add-after 'build-jni 'copy-jni
           (lambda _
             (copy-recursively "src/main/resources/org/xerial/snappy/native"
                               "build/classes/org/xerial/snappy/native")
             #t))
         (add-before 'check 'fix-tests
           (lambda _
             (mkdir-p "src/test/resources/org/xerial/snappy/")
             (copy-recursively "src/test/java/org/xerial/snappy/testdata"
                               "src/test/resources/org/xerial/snappy/testdata")
             (install-file "src/test/java/org/xerial/snappy/alice29.txt"
                           "src/test/resources/org/xerial/snappy/")
             #t)))))))

(define-public java-iq80-snappy
  (package
    (name "java-iq80-snappy")
    (version "0.4")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/dain/snappy")
             (commit (string-append "snappy-" version))))
       (sha256
        (base32 "1mswh207065rdzbxk6rxaqlxhbg1ngxa0vjc20knsn31kqbq1bcz"))
       (file-name (git-file-name name version))))
    (build-system ant-build-system)
    (arguments
     `(#:jar-name "iq80-snappy.jar"
       #:source-dir "src/main/java"
       #:test-dir "src/test"
       #:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (define (test class)
               (invoke "java" "-cp" (string-append (getenv "CLASSPATH")
                                                   ":build/classes"
                                                   ":build/test-classes")
                       "-Dtest.resources.dir=src/test/resources"
                       "org.testng.TestNG" "-testclass"
                       class))
             (invoke "ant" "compile-tests")
             (test "org.iq80.snappy.SnappyFramedStreamTest")
             (test "org.iq80.snappy.SnappyStreamTest")
             #t))
         (add-before 'build 'remove-hadoop-dependency
           (lambda _
             ;; We don't have hadoop
             (delete-file "src/main/java/org/iq80/snappy/HadoopSnappyCodec.java")
             (delete-file "src/test/java/org/iq80/snappy/TestHadoopSnappyCodec.java")
             #t))
         (replace 'install (install-from-pom "pom.xml")))))
    (home-page "https://github.com/dain/snappy")
    (native-inputs
     `(("java-guava" ,java-guava)
       ("java-snappy" ,java-snappy)
       ("java-testng" ,java-testng)))
    (synopsis "Java port of the Snappy (de)compressor")
    (description
     "Iq80-snappy is a port of the Snappy compressor and decompressor rewritten
in pure Java.  This compression code produces a byte-for-byte exact copy of the
output created by the original C++ code, and is extremely fast.")
    (license license:asl2.0)))

(define-public java-jbzip2
  (package
    (name "java-jbzip2")
    (version "0.9.1")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://storage.googleapis.com/"
                                  "google-code-archive-source/v2/"
                                  "code.google.com/jbzip2/"
                                  "source-archive.zip"))
              (file-name (string-append name "-" version ".zip"))
              (sha256
               (base32
                "0ncmhlqmrfmj96nqf6p77b9ws35lcfsvpfxzwxi2asissc83z1l3"))))
    (build-system ant-build-system)
    (native-inputs
     `(("unzip" ,unzip)
       ("java-junit" ,java-junit)))
    (arguments
     `(#:tests? #f                      ; no tests
       #:jar-name "jbzip2.jar"
       #:source-dir "tags/release-0.9.1/src"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-encoding-problems
           (lambda _
             ;; Some of the files we're patching are
             ;; ISO-8859-1-encoded, so choose it as the default
             ;; encoding so the byte encoding is preserved.
             (with-fluids ((%default-port-encoding #f))
               (substitute* "tags/release-0.9.1/src/org/itadaki/bzip2/HuffmanAllocator.java"
                 (("Milidi.") "Milidiu")))
             #t)))))
    (home-page "https://code.google.com/archive/p/jbzip2/")
    (synopsis "Java bzip2 compression/decompression library")
    (description "Jbzip2 is a Java bzip2 compression/decompression library.
It can be used as a replacement for the Apache @code{CBZip2InputStream} /
@code{CBZip2OutputStream} classes.")
    (license license:expat)))

(define-public java-xz
  (package
    (name "java-xz")
    (version "1.9")
    (source (origin
              (method url-fetch/zipbomb)
              (uri (string-append "https://tukaani.org/xz/xz-java-" version ".zip"))
              (sha256
               (base32
                "007d9f83277qn70swz9inqhyf0qxq6ygajpq5rqg0xgsyh1sdndi"))))
    (build-system ant-build-system)
    (arguments
     `(#:tests? #f; no tests
       #:jdk ,openjdk9
       #:phases
       (modify-phases %standard-phases
         (add-before 'install 'generate-pom
           (lambda _
             (copy-file "maven/pom_template.xml" "pom.xml")
             (substitute* "pom.xml"
               (("@VERSION@") ,version)
               (("@TITLE@") "XZ data compression")
               (("@HOMEPAGE@") "http://tukaani.org/xz/java.html"))
             #t))
        (add-before 'install 'rename-jar
          (lambda _
            (rename-file "build/jar/xz.jar"
                         (string-append "build/jar/xz-" ,version ".jar"))
            #t))
        (replace 'install
          (install-from-pom "pom.xml")))))
    (native-inputs
     `(("unzip" ,unzip)))
    (home-page "https://tukaani.org")
    (synopsis "XZ in Java")
    (description "Tukaani-xz is an implementation of xz compression/decompression
algorithms in Java.")
    (license license:public-domain)))

debug log:

solving 033b55c988 ...
found 033b55c988 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.