From 24155bf40db2dfd25c167f41452ea0227a712654 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 10 Jan 2019 14:55:50 +0100 Subject: gnu: Move Java compression packages to new module. * gnu/packages/compression.scm (bitshuffle-for-snappy): Export variable. (java-snappy, java-snappy-1, java-iq80-snappy, java-jbzip2, java-tukaani-xz): Move these variables from here... * gnu/packages/java-compression.scm: ...to this new file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/java.scm, gnu/packages/bioinformatics.scm: Adjust module references. --- gnu/packages/java-compression.scm | 308 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 gnu/packages/java-compression.scm (limited to 'gnu/packages/java-compression.scm') diff --git a/gnu/packages/java-compression.scm b/gnu/packages/java-compression.scm new file mode 100644 index 00000000000..8cebfc65a5d --- /dev/null +++ b/gnu/packages/java-compression.scm @@ -0,0 +1,308 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017, 2019 Ricardo Wurmus +;;; Copyright © 2017, 2018 Julien Lepiller +;;; Copyright © 2018 Marius Bakke +;;; Copyright © 2018 Mark H Weaver +;;; Copyright © 2018 Tobias Geerinckx-Rice +;;; +;;; 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 . + +(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 build-system ant) + #:use-module (gnu packages) + #:use-module (gnu packages compression) + #:use-module (gnu packages java) + #:use-module (gnu packages perl)) + +(define-public java-snappy + (package + (name "java-snappy") + (version "1.1.7.2") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/xerial/snappy-java/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "1p557vdv006ysgxbpp83krmq0066k46108vyiyka69w8i4i8rbbm")))) + (build-system ant-build-system) + (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 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 '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) + (version "1.0.3-rc3") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/xerial/snappy-java/archive/" + "snappy-java-" version ".tar.gz")) + (sha256 + (base32 + "08hsxlqidiqck0q57fshwyv3ynyxy18vmhrai9fyc8mz17m7gsa3")))) + (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 url-fetch) + (uri (string-append "https://github.com/dain/snappy/archive/snappy-" + version ".tar.gz")) + (sha256 + (base32 + "0rb3zhci7w9wzd65lfnk7p3ip0n6gb58a9qpx8n7r0231gahyamf")))) + (build-system ant-build-system) + (arguments + `(#:jar-name "iq80-snappy.jar" + #:source-dir "src/main/java" + #:test-dir "src/test" + #:jdk ,icedtea-8 + #: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))))) + (home-page "https://github.com/dain/snappy") + (native-inputs + `(("guava" ,java-guava) + ("java-snappy" ,java-snappy) + ("hamcrest" ,java-hamcrest-core) + ("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-tukaani-xz + (package + (name "java-tukaani-xz") + (version "1.6") + (source (origin + (method url-fetch) + (uri (string-append "https://tukaani.org/xz/xz-java-" version ".zip")) + (sha256 + (base32 + "1z3p1ri1gvl07inxn0agx44ck8n7wrzfmvkz8nbq3njn8r9wba8x")))) + (build-system ant-build-system) + (arguments + `(#:tests? #f; no tests + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ + ;; Our build system enters the first directory in the archive, but + ;; the package is not contained in a subdirectory + (chdir "..") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + ;; Do we want to install *Demo.jar? + (install-file "build/jar/xz.jar" + (string-append + (assoc-ref outputs "out") + "/share/java/xz.jar")) + #t))))) + (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))) -- cgit v1.3 From 4fec042b54d65a2f44cc3602f7d6f82292e3d1a9 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Tue, 15 Jan 2019 17:42:59 +0100 Subject: gnu: Move Python compression packages to new module. * gnu/packages/compression.scm (python-lzo, python2-lzo, python-lz4, python2-lz4, python-lzstring, python2-lzstring, bitshuffle, bitshuffle-for-snappy): Move variables from here... * gnu/packages/python-compression.scm: ...to this new module. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/bioinformatics.scm, gnu/packages/java-compression.scm, gnu/packages/xorg.scm: Adjust module references. --- gnu/local.mk | 1 + gnu/packages/bioinformatics.scm | 1 + gnu/packages/compression.scm | 173 ------------------------------ gnu/packages/java-compression.scm | 3 +- gnu/packages/python-compression.scm | 206 ++++++++++++++++++++++++++++++++++++ gnu/packages/xorg.scm | 1 + 6 files changed, 211 insertions(+), 174 deletions(-) create mode 100644 gnu/packages/python-compression.scm (limited to 'gnu/packages/java-compression.scm') diff --git a/gnu/local.mk b/gnu/local.mk index 7ee41de6444..fb8e0e1eb09 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -367,6 +367,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/pure.scm \ %D%/packages/pv.scm \ %D%/packages/python.scm \ + %D%/packages/python-compression.scm \ %D%/packages/python-crypto.scm \ %D%/packages/python-web.scm \ %D%/packages/python-xyz.scm \ diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index 1254d21c872..28dbdca13bd 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm @@ -98,6 +98,7 @@ #:use-module (gnu packages popt) #:use-module (gnu packages protobuf) #:use-module (gnu packages python) + #:use-module (gnu packages python-compression) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) #:use-module (gnu packages readline) diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index 956cac7a1fe..327951fded7 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -47,7 +47,6 @@ #:use-module (guix git-download) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) - #:use-module (guix build-system python) #:use-module (gnu packages) #:use-module (gnu packages assembly) #:use-module (gnu packages autotools) @@ -61,7 +60,6 @@ #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) - #:use-module (gnu packages python-xyz) #:use-module (gnu packages tls) #:use-module (gnu packages valgrind) #:use-module (ice-9 match) @@ -462,44 +460,6 @@ LZO is written in ANSI C. Both the source code and the compressed data format are designed to be portable across platforms.") (license license:gpl2+))) -(define-public python-lzo - (package - (name "python-lzo") - (version "1.12") - (source - (origin - (method url-fetch) - (uri (pypi-uri "python-lzo" version)) - (sha256 - (base32 - "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p")))) - (build-system python-build-system) - (arguments - `(#:test-target "check" - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'patch-setuppy - (lambda _ - (substitute* "setup.py" - (("include_dirs.append\\(.*\\)") - (string-append "include_dirs.append('" - (assoc-ref %build-inputs "lzo") - "/include/lzo" - "')"))) - #t))))) - (inputs - `(("lzo" ,lzo))) - (home-page "https://github.com/jd-boyd/python-lzo") - (synopsis "Python bindings for the LZO data compression library") - (description - "Python-LZO provides Python bindings for LZO, i.e. you can access -the LZO library from your Python scripts thereby compressing ordinary -Python strings.") - (license license:gpl2+))) - -(define-public python2-lzo - (package-with-python2 python-lzo)) - (define-public lzop (package (name "lzop") @@ -741,54 +701,6 @@ time for compression ratio.") ;; line interface programs (lz4, fullbench, fuzzer, datagen) are GPL2+. (license (list license:bsd-2 license:gpl2+)))) -(define-public python-lz4 - (package - (name "python-lz4") - (version "0.10.1") - (source - (origin - (method url-fetch) - (uri (pypi-uri "lz4" version)) - (sha256 - (base32 - "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0")))) - (build-system python-build-system) - (native-inputs - `(("python-nose" ,python-nose) - ("python-setuptools-scm" ,python-setuptools-scm))) - (home-page "https://github.com/python-lz4/python-lz4") - (synopsis "LZ4 bindings for Python") - (description - "This package provides python bindings for the lz4 compression library -by Yann Collet. The project contains bindings for the LZ4 block format and -the LZ4 frame format.") - (license license:bsd-3))) - -(define-public python2-lz4 - (package-with-python2 python-lz4)) - -(define-public python-lzstring - (package - (name "python-lzstring") - (version "1.0.4") - (source - (origin - (method url-fetch) - (uri (pypi-uri "lzstring" version)) - (sha256 - (base32 - "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs")))) - (build-system python-build-system) - (propagated-inputs - `(("python-future" ,python-future))) - (home-page "https://github.com/gkovacs/lz-string-python") - (synopsis "String compression") - (description "Lz-string is a string compressor library for Python.") - (license license:expat))) - -(define-public python2-lzstring - (package-with-python2 python-lzstring)) - (define-public squashfs-tools (package (name "squashfs-tools") @@ -1118,54 +1030,6 @@ well as bzip2.") (license (list license:gpl3+ license:public-domain)))) ; most files in lzma/ -(define-public bitshuffle - (package - (name "bitshuffle") - (version "0.3.5") - (source (origin - (method url-fetch) - (uri (pypi-uri "bitshuffle" version)) - (sha256 - (base32 - "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy")) - (modules '((guix build utils))) - (snippet - '(begin - ;; Remove generated Cython files. - (delete-file "bitshuffle/h5.c") - (delete-file "bitshuffle/ext.c") - #t)))) - (build-system python-build-system) - (arguments - `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769 - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'fix-neon-detection - ;; Neon is only for aarch64 ATM - ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73 - (lambda _ - (substitute* "src/bitshuffle_core.c" - (("#define USEARMNEON") - "#ifdef __aarch64__\n#define USEARMNEON\n#endif")) - #t)) - (add-after 'unpack 'dont-build-native - (lambda _ - (substitute* "setup.py" - (("'-march=native', ") "")) - #t))))) - (inputs - `(("numpy" ,python-numpy) - ("h5py" ,python-h5py) - ("hdf5" ,hdf5))) - (native-inputs - `(("cython" ,python-cython))) - (home-page "https://github.com/kiyo-masui/bitshuffle") - (synopsis "Filter for improving compression of typed binary data") - (description "Bitshuffle is an algorithm that rearranges typed, binary data -for improving compression, as well as a python/C package that implements this -algorithm within the Numpy framework.") - (license license:expat))) - (define-public snappy (package (name "snappy") @@ -1192,43 +1056,6 @@ for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger.") (license license:asl2.0))) -(define-public bitshuffle-for-snappy - (package - (inherit bitshuffle) - (name "bitshuffle-for-snappy") - (build-system gnu-build-system) - (arguments - `(#:tests? #f - #:phases - (modify-phases %standard-phases - (replace 'configure - (lambda* (#:key outputs #:allow-other-keys) - (with-output-to-file "Makefile" - (lambda _ - (format #t "\ -libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o -\tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^ - -%.o: %.c -\tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@ - -PREFIX:=~a -LIBDIR:=$(PREFIX)/lib -INCLUDEDIR:=$(PREFIX)/include - -install: libbitshuffle.so -\tinstall -dm755 $(LIBDIR) -\tinstall -dm755 $(INCLUDEDIR) -\tinstall -m755 libbitshuffle.so $(LIBDIR) -\tinstall -m644 src/bitshuffle.h $(INCLUDEDIR) -\tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR) -\tinstall -m644 src/iochain.h $(INCLUDEDIR) -\tinstall -m644 lz4/lz4.h $(INCLUDEDIR) -" (assoc-ref outputs "out")))) - #t))))) - (inputs '()) - (native-inputs '()))) - (define-public p7zip (package (name "p7zip") diff --git a/gnu/packages/java-compression.scm b/gnu/packages/java-compression.scm index 8cebfc65a5d..3102c70d887 100644 --- a/gnu/packages/java-compression.scm +++ b/gnu/packages/java-compression.scm @@ -29,7 +29,8 @@ #:use-module (gnu packages) #:use-module (gnu packages compression) #:use-module (gnu packages java) - #:use-module (gnu packages perl)) + #:use-module (gnu packages perl) + #:use-module (gnu packages python-compression)) (define-public java-snappy (package diff --git a/gnu/packages/python-compression.scm b/gnu/packages/python-compression.scm new file mode 100644 index 00000000000..3792f373281 --- /dev/null +++ b/gnu/packages/python-compression.scm @@ -0,0 +1,206 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice +;;; Copyright © 2017 Ricardo Wurmus +;;; Copyright © 2017 Nils Gillmann +;;; Copyright © 2017 Julien Lepiller +;;; Copyright © 2018, 2019 Efraim Flashner +;;; +;;; 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 . + +(define-module (gnu packages python-compression) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix utils) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix build-system gnu) + #:use-module (guix build-system python) + #:use-module (gnu packages) + #:use-module (gnu packages compression) + #:use-module (gnu packages check) + #:use-module (gnu packages maths) + #:use-module (gnu packages python) + #:use-module (gnu packages python-xyz)) + +(define-public python-lzo + (package + (name "python-lzo") + (version "1.12") + (source + (origin + (method url-fetch) + (uri (pypi-uri "python-lzo" version)) + (sha256 + (base32 + "0iakqgd51n1cd7r3lpdylm2rgbmd16y74cra9kcapwg84mlf9a4p")))) + (build-system python-build-system) + (arguments + `(#:test-target "check" + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-setuppy + (lambda _ + (substitute* "setup.py" + (("include_dirs.append\\(.*\\)") + (string-append "include_dirs.append('" + (assoc-ref %build-inputs "lzo") + "/include/lzo" + "')"))) + #t))))) + (inputs + `(("lzo" ,lzo))) + (home-page "https://github.com/jd-boyd/python-lzo") + (synopsis "Python bindings for the LZO data compression library") + (description + "Python-LZO provides Python bindings for LZO, i.e. you can access +the LZO library from your Python scripts thereby compressing ordinary +Python strings.") + (license license:gpl2+))) + +(define-public python2-lzo + (package-with-python2 python-lzo)) + +(define-public python-lz4 + (package + (name "python-lz4") + (version "0.10.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "lz4" version)) + (sha256 + (base32 + "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0")))) + (build-system python-build-system) + (native-inputs + `(("python-nose" ,python-nose) + ("python-setuptools-scm" ,python-setuptools-scm))) + (home-page "https://github.com/python-lz4/python-lz4") + (synopsis "LZ4 bindings for Python") + (description + "This package provides python bindings for the lz4 compression library +by Yann Collet. The project contains bindings for the LZ4 block format and +the LZ4 frame format.") + (license license:bsd-3))) + +(define-public python2-lz4 + (package-with-python2 python-lz4)) + +(define-public python-lzstring + (package + (name "python-lzstring") + (version "1.0.4") + (source + (origin + (method url-fetch) + (uri (pypi-uri "lzstring" version)) + (sha256 + (base32 + "18ly9pppy2yspxzw7k1b23wk77k7m44rz2g0271bqgqrk3jn3yhs")))) + (build-system python-build-system) + (propagated-inputs + `(("python-future" ,python-future))) + (home-page "https://github.com/gkovacs/lz-string-python") + (synopsis "String compression") + (description "Lz-string is a string compressor library for Python.") + (license license:expat))) + +(define-public python2-lzstring + (package-with-python2 python-lzstring)) + +(define-public bitshuffle + (package + (name "bitshuffle") + (version "0.3.5") + (source (origin + (method url-fetch) + (uri (pypi-uri "bitshuffle" version)) + (sha256 + (base32 + "1823x61kyax4dc2hjmc1xraskxi1193y8lvxd03vqv029jrj8cjy")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Remove generated Cython files. + (delete-file "bitshuffle/h5.c") + (delete-file "bitshuffle/ext.c") + #t)))) + (build-system python-build-system) + (arguments + `(#:tests? #f ; fail: https://github.com/h5py/h5py/issues/769 + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-neon-detection + ;; Neon is only for aarch64 ATM + ;; see: https://github.com/kiyo-masui/bitshuffle/pull/73 + (lambda _ + (substitute* "src/bitshuffle_core.c" + (("#define USEARMNEON") + "#ifdef __aarch64__\n#define USEARMNEON\n#endif")) + #t)) + (add-after 'unpack 'dont-build-native + (lambda _ + (substitute* "setup.py" + (("'-march=native', ") "")) + #t))))) + (inputs + `(("numpy" ,python-numpy) + ("h5py" ,python-h5py) + ("hdf5" ,hdf5))) + (native-inputs + `(("cython" ,python-cython))) + (home-page "https://github.com/kiyo-masui/bitshuffle") + (synopsis "Filter for improving compression of typed binary data") + (description "Bitshuffle is an algorithm that rearranges typed, binary data +for improving compression, as well as a python/C package that implements this +algorithm within the Numpy framework.") + (license license:expat))) + +(define-public bitshuffle-for-snappy + (package + (inherit bitshuffle) + (name "bitshuffle-for-snappy") + (build-system gnu-build-system) + (arguments + `(#:tests? #f + #:phases + (modify-phases %standard-phases + (replace 'configure + (lambda* (#:key outputs #:allow-other-keys) + (with-output-to-file "Makefile" + (lambda _ + (format #t "\ +libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o +\tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^ + +%.o: %.c +\tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@ + +PREFIX:=~a +LIBDIR:=$(PREFIX)/lib +INCLUDEDIR:=$(PREFIX)/include + +install: libbitshuffle.so +\tinstall -dm755 $(LIBDIR) +\tinstall -dm755 $(INCLUDEDIR) +\tinstall -m755 libbitshuffle.so $(LIBDIR) +\tinstall -m644 src/bitshuffle.h $(INCLUDEDIR) +\tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR) +\tinstall -m644 src/iochain.h $(INCLUDEDIR) +\tinstall -m644 lz4/lz4.h $(INCLUDEDIR) +" (assoc-ref outputs "out")))) + #t))))) + (inputs '()) + (native-inputs '()))) diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm index a6a2e603aa0..67b38246ecf 100644 --- a/gnu/packages/xorg.scm +++ b/gnu/packages/xorg.scm @@ -71,6 +71,7 @@ #:use-module (gnu packages perl-check) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) + #:use-module (gnu packages python-compression) #:use-module (gnu packages python-crypto) #:use-module (gnu packages python-xyz) #:use-module (gnu packages qt) -- cgit v1.3