all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: <ricardo.wurmus@mdc-berlin.de>
To: 29394@debbugs.gnu.org
Cc: Ricardo Wurmus <rekado@elephly.net>
Subject: [bug#29394] [PATCH 01/12] gnu: Add java-snappy-1.
Date: Wed, 22 Nov 2017 12:30:31 +0100	[thread overview]
Message-ID: <20171122113042.1734-1-ricardo.wurmus@mdc-berlin.de> (raw)
In-Reply-To: <87zi7ev9rd.fsf@mdc-berlin.de>

From: Ricardo Wurmus <rekado@elephly.net>

* 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

  reply	other threads:[~2017-11-22 11:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 11:21 [bug#29394] [PATCH 00/12] Add Java dependencies for FastQC Ricardo Wurmus
2017-11-22 11:30 ` ricardo.wurmus [this message]
2017-11-22 11:30   ` [bug#29394] [PATCH 02/12] gnu: Add javacc ricardo.wurmus
2017-11-22 11:30   ` [bug#29394] [PATCH 03/12] gnu: Add javacc-4 ricardo.wurmus
2017-11-22 11:30   ` [bug#29394] [PATCH 04/12] gnu: Add java-commons-jexl-2 ricardo.wurmus
2017-11-22 11:30   ` [bug#29394] [PATCH 05/12] gnu: java-htsjdk: Update to 2.3.0 ricardo.wurmus
2017-11-22 11:30   ` [bug#29394] [PATCH 06/12] gnu: Add java-picard ricardo.wurmus
2017-11-22 11:30   ` [bug#29394] [PATCH 07/12] gnu: Add java-cofoja ricardo.wurmus
2017-11-22 11:30   ` [bug#29394] [PATCH 08/12] gnu: Add java-commons-bcel ricardo.wurmus
2017-11-22 11:30   ` [bug#29394] [PATCH 09/12] gnu: Add ant-apache-bcel ricardo.wurmus
2017-11-22 11:30   ` [bug#29394] [PATCH 10/12] gnu: Add ant-junit ricardo.wurmus
2017-11-22 11:30   ` [bug#29394] [PATCH 11/12] gnu: Add java-picard-1.113 ricardo.wurmus
2017-11-22 11:30   ` [bug#29394] [PATCH 12/12] gnu: Add java-jbzip2 ricardo.wurmus
2017-11-27 20:56     ` bug#29394: " Ricardo Wurmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171122113042.1734-1-ricardo.wurmus@mdc-berlin.de \
    --to=ricardo.wurmus@mdc-berlin.de \
    --cc=29394@debbugs.gnu.org \
    --cc=rekado@elephly.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.