all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: 26966@debbugs.gnu.org
Cc: Ricardo Wurmus <rekado@elephly.net>
Subject: bug#26966: [PATCH 06/22] gnu: Add ecj-javac-wrapper.
Date: Wed, 17 May 2017 19:18:49 +0200	[thread overview]
Message-ID: <20170517171905.7840-6-rekado@elephly.net> (raw)
In-Reply-To: <20170517171905.7840-1-rekado@elephly.net>

* gnu/packages/java.scm (ecj-javac-wrapper): New variable.
---
 gnu/packages/java.scm | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index b3883bf7a..912825a92 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -28,6 +28,7 @@
   #:use-module (guix utils)
   #:use-module (guix build-system ant)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages attr)
   #:use-module (gnu packages autotools)
@@ -45,6 +46,7 @@
   #:use-module (gnu packages ghostscript) ;lcms
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages guile)
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux) ;alsa
@@ -323,6 +325,91 @@ for bootstrapping purposes.  The @dfn{Eclipse compiler for Java} (ecj) is a
 requirement for all GNU Classpath releases after version 0.93.")
     (license license:epl1.0)))
 
+(define ecj-javac-wrapper
+  (package (inherit ecj-bootstrap)
+    (name "ecj-javac-wrapper")
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (let ((backend 'sablevm))
+         (use-modules (guix build utils))
+         (let* ((bin    (string-append (assoc-ref %outputs "out") "/bin"))
+                (target (string-append bin "/javac"))
+                (guile  (string-append (assoc-ref %build-inputs "guile")
+                                       "/bin/guile"))
+                (ecj    (string-append (assoc-ref %build-inputs "ecj-bootstrap")
+                                       "/share/java/ecj-bootstrap.jar"))
+                (java   (case backend
+                          ((sablevm)
+                           (string-append (assoc-ref %build-inputs "sablevm")
+                                          "/lib/sablevm/bin/java"))
+                          ((jamvm)
+                           (string-append (assoc-ref %build-inputs "jamvm")
+                                          "/bin/jamvm"))))
+                (bootcp (case backend
+                          ((sablevm)
+                           (let ((jvmlib (string-append
+                                          (assoc-ref %build-inputs "sablevm-classpath")
+                                          "/lib/sablevm")))
+                             (string-append jvmlib "/jre/lib/rt.jar")))
+                          ((jamvm)
+                           (let ((jvmlib (string-append (assoc-ref %build-inputs "classpath")
+                                                        "/share/classpath")))
+                             (string-append jvmlib "/lib/glibj.zip:"
+                                            jvmlib "/lib/tools.zip"))))))
+           (mkdir-p bin)
+           (with-output-to-file target
+             (lambda _
+               (format #t "#!~a --no-auto-compile\n!#\n" guile)
+               (map write
+                    `((use-modules (ice-9 match)
+                                   (ice-9 receive)
+                                   (ice-9 hash-table)
+                                   (srfi srfi-1)
+                                   (srfi srfi-26))
+                      (define defaults
+                        '(("-bootclasspath" ,bootcp)
+                          ("-source" "1.5")
+                          ("-target" "1.5")
+                          ("-cp"     ".")))
+                      (define (main args)
+                        (let ((classpath (getenv "CLASSPATH")))
+                          (setenv "CLASSPATH"
+                                  (string-append ,ecj
+                                                 (if classpath
+                                                     (string-append ":" classpath)
+                                                     ""))))
+                        (receive (vm-args other-args)
+                            ;; Separate VM arguments from arguments to ECJ.
+                            (partition (cut string-prefix? "-J" <>)
+                                       (fold (lambda (default acc)
+                                               (if (member (first default) acc)
+                                                   acc (append default acc)))
+                                             args defaults))
+                          (apply system* ,java
+                                 (append
+                                  ;; Remove "-J" prefix
+                                  (map (cut string-drop <> 2) vm-args)
+                                  '("org.eclipse.jdt.internal.compiler.batch.Main")
+                                  (cons "-nowarn" other-args)))))
+                      ;; Entry point
+                      (let ((args (cdr (command-line))))
+                        (if (null? args)
+                            (format (current-error-port) "javac: no arguments given!\n")
+                            (main args)))))))
+           (chmod target #o755)
+           #t))))
+    (native-inputs
+     `(("guile" ,guile-2.2)
+       ("ecj-bootstrap" ,ecj-bootstrap)
+       ("sablevm" ,sablevm)
+       ("sablevm-classpath" ,sablevm-classpath)))
+    (description "This package provides a wrapper around the @dfn{Eclipse
+compiler for Java} (ecj) with a command line interface that is compatible with
+the standard javac executable.")))
+
 (define-public java-swt
   (package
     (name "java-swt")
-- 
2.12.2

  parent reply	other threads:[~2017-05-17 17:20 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17 17:06 bug#26966: New Java bootstrap Ricardo Wurmus
2017-05-17 17:18 ` bug#26966: [PATCH 01/22] gnu: Add jikes Ricardo Wurmus
2017-05-17 17:18   ` bug#26966: [PATCH 02/22] gnu: Add sablevm-classpath Ricardo Wurmus
2017-05-18 10:35     ` Roel Janssen
2017-05-17 17:18   ` bug#26966: [PATCH 03/22] gnu: Add sablevm Ricardo Wurmus
2017-05-18 10:34     ` Roel Janssen
2017-05-17 17:18   ` bug#26966: [PATCH 04/22] gnu: Add ant-bootstrap Ricardo Wurmus
2017-05-18 10:38     ` Roel Janssen
2017-05-17 17:18   ` bug#26966: [PATCH 05/22] gnu: Add ecj-bootstrap Ricardo Wurmus
2017-05-22  7:36     ` Roel Janssen
2017-05-17 17:18   ` Ricardo Wurmus [this message]
2017-05-22  7:38     ` bug#26966: [PATCH 06/22] gnu: Add ecj-javac-wrapper Roel Janssen
2017-05-22  8:55       ` Ludovic Courtès
2017-05-22 16:28         ` Ricardo Wurmus
2017-05-17 17:18   ` bug#26966: [PATCH 07/22] gnu: Add classpath Ricardo Wurmus
2017-05-22  7:58     ` Roel Janssen
2017-05-22 17:00       ` Ricardo Wurmus
2017-05-17 17:18   ` bug#26966: [PATCH 08/22] gnu: Add jamvm-bootstrap Ricardo Wurmus
2017-05-22  7:59     ` Roel Janssen
2017-05-17 17:18   ` bug#26966: [PATCH 09/22] gnu: Add classpath-jamvm-wrappers Ricardo Wurmus
2017-05-22  8:05     ` Roel Janssen
2017-05-17 17:18   ` bug#26966: [PATCH 10/22] gnu: Add ecj-javac-on-jamvm-wrapper Ricardo Wurmus
2017-05-22  9:38     ` Roel Janssen
2017-05-22 17:01       ` Ricardo Wurmus
2017-05-17 17:18   ` bug#26966: [PATCH 11/22] gnu: Add classpath-devel Ricardo Wurmus
2017-05-22  9:38     ` Roel Janssen
2017-05-17 17:18   ` bug#26966: [PATCH 12/22] gnu: Add jamvm Ricardo Wurmus
2017-05-22  9:39     ` Roel Janssen
2017-05-17 17:18   ` bug#26966: [PATCH 13/22] gnu: Add ecj-javac-on-jamvm-wrapper-final Ricardo Wurmus
2017-05-22  9:39     ` Roel Janssen
2017-05-17 17:18   ` bug#26966: [PATCH 14/22] gnu: Add icedtea-6 Ricardo Wurmus
2017-05-22  9:43     ` Roel Janssen
2017-05-22 14:33       ` Ricardo Wurmus
2017-05-17 17:18   ` bug#26966: [PATCH 15/22] gnu: icedtea-7: Use icedtea-6 for bootstrapping Ricardo Wurmus
2017-05-18 10:09     ` Ricardo Wurmus
2017-05-17 17:18   ` bug#26966: [PATCH 16/22] gnu: java-swt: Move below the bootstrap packages Ricardo Wurmus
2017-05-22 10:00     ` Roel Janssen
2017-05-17 17:19   ` bug#26966: [PATCH 17/22] gnu: clojure: Move below " Ricardo Wurmus
2017-05-22 10:01     ` Roel Janssen
2017-05-17 17:19   ` bug#26966: [PATCH 18/22] gnu: ant-bootstrap: Do not delete scripts Ricardo Wurmus
2017-05-18 10:54     ` Roel Janssen
2017-05-18 19:57       ` Ricardo Wurmus
2017-05-17 17:19   ` bug#26966: [PATCH 19/22] gnu: ant: Inherit from ant-bootstrap Ricardo Wurmus
2017-05-22 10:02     ` Roel Janssen
2017-05-17 17:19   ` bug#26966: [PATCH 20/22] gnu: ant: Delete bundled jars Ricardo Wurmus
2017-05-18 10:31     ` Roel Janssen
2017-05-17 17:19   ` bug#26966: [PATCH 21/22] gnu: ant: Update to 1.10.1 Ricardo Wurmus
2017-05-18  9:31     ` Roel Janssen
2017-05-18 20:00       ` Ricardo Wurmus
2017-05-18 21:23         ` Ricardo Wurmus
2017-05-17 17:19   ` bug#26966: [PATCH 22/22] gnu: Remove GCJ Ricardo Wurmus
2017-05-18  9:29     ` Roel Janssen
2017-05-18 10:03       ` Ricardo Wurmus
2017-05-18 10:28         ` Roel Janssen
2017-05-18 11:49         ` Ludovic Courtès
2017-05-18  9:25   ` bug#26966: [PATCH 01/22] gnu: Add jikes Roel Janssen
2017-05-18 11:54   ` Ludovic Courtès
2017-05-18  9:24 ` bug#26966: New Java bootstrap Roel Janssen
2017-05-18 11:47 ` Ludovic Courtès
2017-05-22 10:22 ` Roel Janssen
2017-05-22 17:03   ` 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=20170517171905.7840-6-rekado@elephly.net \
    --to=rekado@elephly.net \
    --cc=26966@debbugs.gnu.org \
    /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.