summary refs log tree commit diff
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2019-05-03 12:47:48 +0200
committerJulien Lepiller <julien@lepiller.eu>2019-11-13 22:48:50 +0100
commit16fdf2f55d13ebcb16bdbb888a1c3453c47e469d (patch)
tree11cc275ffe6349a3c9f36d7f0db2a236ccada1e2
parenta005c63a2167b76ce89b5a7017b216320a403ab4 (diff)
downloadguix-16fdf2f55d13ebcb16bdbb888a1c3453c47e469d.tar.gz
gnu: javacc: Install binaries.
* gnu/packages/java.scm (javacc)[arguments]: Add install-bin phase.
-rw-r--r--gnu/packages/java.scm22
1 files changed, 21 insertions, 1 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 20db3e9553..bc55c2fa39 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2394,7 +2394,27 @@ debugging, etc.")
        #:test-target "test"
        #:phases
        (modify-phases %standard-phases
-         (replace 'install (install-jars "target")))))
+         (replace 'install (install-jars "target"))
+         (add-after 'install 'install-bin
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (dir (string-append out "/share/java"))
+                    (bin (string-append out "/bin"))
+                    (javacc (string-append bin "/javacc")))
+               (mkdir-p bin)
+               (with-output-to-file javacc
+                 (lambda _
+                   (display
+                     (string-append "#!/bin/sh\n"
+                                    (assoc-ref inputs "jdk") "/bin/java"
+                                    " -cp " dir "/javacc.jar" " `basename $0`" " $*"))))
+               (chmod javacc #o755)
+               ;; symlink to different names to affect the first argument and
+               ;; change the behavior of the jar file.
+               (symlink javacc (string-append bin "/jjdoc"))
+               (symlink javacc (string-append bin "/jjtree"))
+               #t))))))
+
     (native-inputs
      `(("javacc" ,javacc-4)))))