From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHTGA-0007E3-I6 for guix-patches@gnu.org; Wed, 22 Nov 2017 06:32:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHTG6-0002u8-AV for guix-patches@gnu.org; Wed, 22 Nov 2017 06:32:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:43231) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eHTG6-0002to-0R for guix-patches@gnu.org; Wed, 22 Nov 2017 06:32:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eHTG5-0007tj-Ky for guix-patches@gnu.org; Wed, 22 Nov 2017 06:32:01 -0500 Subject: [bug#29394] [PATCH 01/12] gnu: Add java-snappy-1. References: <87zi7ev9rd.fsf@mdc-berlin.de> In-Reply-To: <87zi7ev9rd.fsf@mdc-berlin.de> Resent-Message-ID: From: Date: Wed, 22 Nov 2017 12:30:31 +0100 Message-ID: <20171122113042.1734-1-ricardo.wurmus@mdc-berlin.de> MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 29394@debbugs.gnu.org Cc: Ricardo Wurmus From: Ricardo Wurmus * gnu/packages/compression.scm (java-snappy-1): New variable. --- gnu/packages/compression.scm | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index 748c75a74..193d36797 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -1206,6 +1206,64 @@ install: libbitshuffle.so compresser/decompresser.") (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 + (system* "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. + (zero? (system* "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") -- 2.14.1