| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 |
|
| 24 | (define-module (gnu packages java-compression)
|
| 25 | #:use-module ((guix licenses) #:prefix license:)
|
| 26 | #:use-module (guix utils)
|
| 27 | #:use-module (guix packages)
|
| 28 | #:use-module (guix download)
|
| 29 | #:use-module (guix git-download)
|
| 30 | #:use-module (guix build-system ant)
|
| 31 | #:use-module (gnu packages)
|
| 32 | #:use-module (gnu packages compression)
|
| 33 | #:use-module (gnu packages java)
|
| 34 | #:use-module (gnu packages perl)
|
| 35 | #:use-module (gnu packages python-compression))
|
| 36 |
|
| 37 | (define-public java-snappy
|
| 38 | (package
|
| 39 | (name "java-snappy")
|
| 40 | (version "1.1.7.5")
|
| 41 | (source
|
| 42 | (origin
|
| 43 | (method git-fetch)
|
| 44 | (uri (git-reference
|
| 45 | (url "https://github.com/xerial/snappy-java")
|
| 46 | (commit version)))
|
| 47 | (sha256
|
| 48 | (base32 "0894zyasrmbi268d1ky9db16wrnc6x8b9ilq0b5paaxi2pwgjlrp"))
|
| 49 | (file-name (git-file-name name version))))
|
| 50 | (build-system ant-build-system)
|
| 51 | (arguments
|
| 52 | `(#:jar-name "snappy.jar"
|
| 53 | #:source-dir "src/main/java"
|
| 54 | #:phases
|
| 55 | (modify-phases %standard-phases
|
| 56 | (add-after 'unpack 'make-git-checkout-writable
|
| 57 | (lambda _
|
| 58 | (for-each make-file-writable (find-files "."))))
|
| 59 | (add-before 'build 'remove-binaries
|
| 60 | (lambda _
|
| 61 | (delete-file "lib/org/xerial/snappy/OSInfo.class")
|
| 62 | (delete-file-recursively
|
| 63 | "src/main/resources/org/xerial/snappy/native")))
|
| 64 | (add-before 'build 'build-jni
|
| 65 | (lambda _
|
| 66 | |
| 67 | (invoke "javac" "src/main/java/org/xerial/snappy/OSInfo.java"
|
| 68 | "-d" "lib")
|
| 69 | |
| 70 | (substitute* "Makefile.common"
|
| 71 | (("-shared")
|
| 72 | "-shared -lbitshuffle -lsnappy"))
|
| 73 | (substitute* "Makefile"
|
| 74 | |
| 75 | |
| 76 | (("\\$\\(SNAPPY_GIT_UNPACKED\\) ")
|
| 77 | "")
|
| 78 | ((": \\$\\(SNAPPY_GIT_UNPACKED\\)")
|
| 79 | ":")
|
| 80 | (("\\$\\(BITSHUFFLE_UNPACKED\\) ")
|
| 81 | "")
|
| 82 | ((": \\$\\(SNAPPY_SOURCE_CONFIGURED\\)") ":")
|
| 83 | |
| 84 | (("SNAPPY_OBJ:=.*")
|
| 85 | "SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/, \
|
| 86 | SnappyNative.o BitShuffleNative.o)\n")
|
| 87 | |
| 88 | |
| 89 | (("NAME\\): \\$\\(SNAPPY_OBJ\\)")
|
| 90 | "NAME): $(SNAPPY_OBJ)\n\t@mkdir -p $(@D)"))
|
| 91 | |
| 92 | |
| 93 | |
| 94 | (invoke "make" "native-nocmake")))
|
| 95 | |
| 96 | |
| 97 | (add-after 'build-jni 'copy-jni
|
| 98 | (lambda _
|
| 99 | (copy-recursively "src/main/resources/org/xerial/snappy/native"
|
| 100 | "build/classes/org/xerial/snappy/native")))
|
| 101 | (add-before 'build 'set-test-memory-size
|
| 102 | (lambda _
|
| 103 | (substitute* "build.xml"
|
| 104 | (("<junit printsummary=")
|
| 105 | "<junit maxmemory=\"2G\" printsummary="))))
|
| 106 | (add-before 'check 'fix-failing
|
| 107 | (lambda _
|
| 108 | (with-directory-excursion "src/test/java/org/xerial/snappy"
|
| 109 | |
| 110 | |
| 111 | (substitute* "SnappyLoaderTest.java"
|
| 112 | (("target/classes") "build/classes"))
|
| 113 | |
| 114 | (delete-file "SnappyHadoopCompatibleOutputStreamTest.java")))))))
|
| 115 | (inputs
|
| 116 | (list java-osgi-framework))
|
| 117 | (propagated-inputs
|
| 118 | (list bitshuffle-for-snappy snappy))
|
| 119 | (native-inputs
|
| 120 | (list java-junit
|
| 121 | java-hamcrest-core
|
| 122 | java-xerial-core
|
| 123 | java-plexus-classworlds
|
| 124 | java-commons-lang
|
| 125 | java-commons-io
|
| 126 | perl))
|
| 127 | (home-page "https://github.com/xerial/snappy-java")
|
| 128 | (synopsis "Compression/decompression algorithm in Java")
|
| 129 | (description "Snappy-java is a Java port of snappy, a fast C++
|
| 130 | compressor/decompressor.")
|
| 131 | (license license:asl2.0)))
|
| 132 |
|
| 133 | (define-public java-snappy-1
|
| 134 | (package
|
| 135 | (inherit java-snappy)
|
| 136 | (name "java-snappy")
|
| 137 | (version "1.0.3-rc3")
|
| 138 | (source
|
| 139 | (origin
|
| 140 | (method git-fetch)
|
| 141 | (uri (git-reference
|
| 142 | (url (string-append "https://github.com/xerial/snappy-java"))
|
| 143 | (commit (string-append "snappy-java-" version))))
|
| 144 | (sha256
|
| 145 | (base32 "0gbg3xmhniyh5p6w5zqj16fr15fa8j4raswd8pj00l4ixf5qa6m4"))
|
| 146 | (file-name (git-file-name name version))))
|
| 147 | (arguments
|
| 148 | `(#:jar-name "snappy.jar"
|
| 149 | #:source-dir "src/main/java"
|
| 150 | #:phases
|
| 151 | (modify-phases %standard-phases
|
| 152 | (add-before 'build 'remove-binaries
|
| 153 | (lambda _
|
| 154 | (delete-file "lib/org/xerial/snappy/OSInfo.class")
|
| 155 | (delete-file-recursively
|
| 156 | "src/main/resources/org/xerial/snappy/native")))
|
| 157 | (add-before 'build 'build-jni
|
| 158 | (lambda _
|
| 159 | |
| 160 | (invoke "javac" "src/main/java/org/xerial/snappy/OSInfo.java"
|
| 161 | "-d" "lib")
|
| 162 | |
| 163 | (substitute* "Makefile.common"
|
| 164 | (("-shared") "-shared -lsnappy"))
|
| 165 | (substitute* "Makefile"
|
| 166 | |
| 167 | (("\\$\\(SNAPPY_UNPACKED\\) ") "")
|
| 168 | ((": \\$\\(SNAPPY_UNPACKED\\) ") ":")
|
| 169 | |
| 170 | (("SNAPPY_OBJ:=.*")
|
| 171 | "SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/, SnappyNative.o)\n")
|
| 172 | |
| 173 | |
| 174 | (("NAME\\): \\$\\(SNAPPY_OBJ\\)")
|
| 175 | "NAME): $(SNAPPY_OBJ)\n\t@mkdir -p $(@D)"))
|
| 176 | |
| 177 | (invoke "make" "native")))
|
| 178 | |
| 179 | |
| 180 | (add-after 'build-jni 'copy-jni
|
| 181 | (lambda _
|
| 182 | (copy-recursively "src/main/resources/org/xerial/snappy/native"
|
| 183 | "build/classes/org/xerial/snappy/native")))
|
| 184 | (add-before 'check 'fix-tests
|
| 185 | (lambda _
|
| 186 | (mkdir-p "src/test/resources/org/xerial/snappy/")
|
| 187 | (copy-recursively "src/test/java/org/xerial/snappy/testdata"
|
| 188 | "src/test/resources/org/xerial/snappy/testdata")
|
| 189 | (install-file "src/test/java/org/xerial/snappy/alice29.txt"
|
| 190 | "src/test/resources/org/xerial/snappy/"))))))))
|
| 191 |
|
| 192 | (define-public java-iq80-snappy
|
| 193 | (package
|
| 194 | (name "java-iq80-snappy")
|
| 195 | (version "0.4")
|
| 196 | (source
|
| 197 | (origin
|
| 198 | (method git-fetch)
|
| 199 | (uri (git-reference
|
| 200 | (url "https://github.com/dain/snappy")
|
| 201 | (commit (string-append "snappy-" version))))
|
| 202 | (sha256
|
| 203 | (base32 "1mswh207065rdzbxk6rxaqlxhbg1ngxa0vjc20knsn31kqbq1bcz"))
|
| 204 | (file-name (git-file-name name version))))
|
| 205 | (build-system ant-build-system)
|
| 206 | (arguments
|
| 207 | `(#:jar-name "iq80-snappy.jar"
|
| 208 | #:source-dir "src/main/java"
|
| 209 | #:test-dir "src/test"
|
| 210 | #:phases
|
| 211 | (modify-phases %standard-phases
|
| 212 | (replace 'check
|
| 213 | (lambda _
|
| 214 | (define (test class)
|
| 215 | (invoke "java" "-cp" (string-append (getenv "CLASSPATH")
|
| 216 | ":build/classes"
|
| 217 | ":build/test-classes")
|
| 218 | "-Dtest.resources.dir=src/test/resources"
|
| 219 | "org.testng.TestNG" "-testclass"
|
| 220 | class))
|
| 221 | (invoke "ant" "compile-tests")
|
| 222 | (test "org.iq80.snappy.SnappyFramedStreamTest")
|
| 223 | (test "org.iq80.snappy.SnappyStreamTest")
|
| 224 | #t))
|
| 225 | (add-before 'build 'remove-hadoop-dependency
|
| 226 | (lambda _
|
| 227 | |
| 228 | (delete-file "src/main/java/org/iq80/snappy/HadoopSnappyCodec.java")
|
| 229 | (delete-file "src/test/java/org/iq80/snappy/TestHadoopSnappyCodec.java")
|
| 230 | #t))
|
| 231 | (replace 'install (install-from-pom "pom.xml")))))
|
| 232 | (home-page "https://github.com/dain/snappy")
|
| 233 | (native-inputs
|
| 234 | (list java-guava java-snappy java-testng))
|
| 235 | (synopsis "Java port of the Snappy (de)compressor")
|
| 236 | (description
|
| 237 | "Iq80-snappy is a port of the Snappy compressor and decompressor rewritten
|
| 238 | in pure Java. This compression code produces a byte-for-byte exact copy of the
|
| 239 | output created by the original C++ code, and is extremely fast.")
|
| 240 | (license license:asl2.0)))
|
| 241 |
|
| 242 | (define-public java-jbzip2
|
| 243 | (package
|
| 244 | (name "java-jbzip2")
|
| 245 | (version "0.9.1")
|
| 246 | (source (origin
|
| 247 | (method url-fetch)
|
| 248 | (uri (string-append "https://storage.googleapis.com/"
|
| 249 | "google-code-archive-source/v2/"
|
| 250 | "code.google.com/jbzip2/"
|
| 251 | "source-archive.zip"))
|
| 252 | (file-name (string-append name "-" version ".zip"))
|
| 253 | (sha256
|
| 254 | (base32
|
| 255 | "0ncmhlqmrfmj96nqf6p77b9ws35lcfsvpfxzwxi2asissc83z1l3"))))
|
| 256 | (build-system ant-build-system)
|
| 257 | (native-inputs
|
| 258 | (list unzip java-junit))
|
| 259 | (arguments
|
| 260 | `(#:tests? #f |
| 261 | #:jar-name "jbzip2.jar"
|
| 262 | #:source-dir "tags/release-0.9.1/src"
|
| 263 | #:phases
|
| 264 | (modify-phases %standard-phases
|
| 265 | (add-after 'unpack 'fix-encoding-problems
|
| 266 | (lambda _
|
| 267 | |
| 268 | |
| 269 | |
| 270 | (with-fluids ((%default-port-encoding #f))
|
| 271 | (substitute* "tags/release-0.9.1/src/org/itadaki/bzip2/HuffmanAllocator.java"
|
| 272 | (("Milidi.") "Milidiu")))
|
| 273 | #t)))))
|
| 274 | (home-page "https://code.google.com/archive/p/jbzip2/")
|
| 275 | (synopsis "Java bzip2 compression/decompression library")
|
| 276 | (description "Jbzip2 is a Java bzip2 compression/decompression library.
|
| 277 | It can be used as a replacement for the Apache @code{CBZip2InputStream} /
|
| 278 | @code{CBZip2OutputStream} classes.")
|
| 279 | (license license:expat)))
|
| 280 |
|
| 281 | (define-public java-xz
|
| 282 | (package
|
| 283 | (name "java-xz")
|
| 284 | (version "1.9")
|
| 285 | (source (origin
|
| 286 | (method url-fetch/zipbomb)
|
| 287 | (uri (string-append "https://tukaani.org/xz/xz-java-" version ".zip"))
|
| 288 | (sha256
|
| 289 | (base32
|
| 290 | "007d9f83277qn70swz9inqhyf0qxq6ygajpq5rqg0xgsyh1sdndi"))))
|
| 291 | (build-system ant-build-system)
|
| 292 | (arguments
|
| 293 | `(#:tests? #f; no tests
|
| 294 | #:jdk ,openjdk9
|
| 295 | #:phases
|
| 296 | (modify-phases %standard-phases
|
| 297 | (add-before 'install 'generate-pom
|
| 298 | (lambda _
|
| 299 | (copy-file "maven/pom_template.xml" "pom.xml")
|
| 300 | (substitute* "pom.xml"
|
| 301 | (("@VERSION@") ,version)
|
| 302 | (("@TITLE@") "XZ data compression")
|
| 303 | (("@HOMEPAGE@") "http://tukaani.org/xz/java.html"))
|
| 304 | #t))
|
| 305 | (add-before 'install 'rename-jar
|
| 306 | (lambda _
|
| 307 | (rename-file "build/jar/xz.jar"
|
| 308 | (string-append "build/jar/xz-" ,version ".jar"))
|
| 309 | #t))
|
| 310 | (replace 'install
|
| 311 | (install-from-pom "pom.xml")))))
|
| 312 | (native-inputs
|
| 313 | (list unzip))
|
| 314 | (home-page "https://tukaani.org")
|
| 315 | (synopsis "XZ in Java")
|
| 316 | (description "Tukaani-xz is an implementation of xz compression/decompression
|
| 317 | algorithms in Java.")
|
| 318 | (license license:public-domain)))
|
| 319 |
|
| 320 | (define-public java-zstd
|
| 321 | (package
|
| 322 | (name "java-zstd")
|
| 323 | (version "1.5.7-7")
|
| 324 | (source (origin
|
| 325 | (method git-fetch)
|
| 326 | (uri (git-reference
|
| 327 | (url "https://github.com/luben/zstd-jni")
|
| 328 | (commit (string-append "v" version))))
|
| 329 | (file-name (git-file-name name version))
|
| 330 | (sha256
|
| 331 | (base32
|
| 332 | "0wl8bk57flc5jlmkgqzr4jkp75nsisxlfrigfvyal825bm32czjc"))))
|
| 333 | (build-system ant-build-system)
|
| 334 | (arguments
|
| 335 | `(#:jar-name "java-zstd.jar"
|
| 336 | #:source-dir "src/main/java"
|
| 337 | #:tests? #f; Require scala
|
| 338 | #:phases
|
| 339 | (modify-phases %standard-phases
|
| 340 | (add-before 'build 'generate-version
|
| 341 | (lambda _
|
| 342 | (with-output-to-file
|
| 343 | "src/main/java/com/github/luben/zstd/util/ZstdVersion.java"
|
| 344 | (lambda _
|
| 345 | (format #t "package com.github.luben.zstd.util;
|
| 346 |
|
| 347 | public class ZstdVersion {
|
| 348 | public static final String VERSION = \"~a\";
|
| 349 | }" ,version))))))))
|
| 350 | (inputs
|
| 351 | `(("zstd" ,zstd)))
|
| 352 | (home-page "https://github.com/luben/zstd-jni")
|
| 353 | (synopsis "JNI bindings for Zstd native library")
|
| 354 | (description "Zstd, short for Zstandard, is a lossless compression
|
| 355 | algorithm, which provides both good compression ratio and speed for standard
|
| 356 | compression needs. This package provides JNI bindings for Zstd native
|
| 357 | library that provides fast and high compression lossless algorithm for
|
| 358 | Android, Java and all JVM languages.")
|
| 359 | (license license:bsd-2)))
|