gnu: Add ecj-javac-on-jamvm-wrapper.
* gnu/packages/java.scm (ecj-javac-on-jamvm-wrapper): New variable.
This commit is contained in:
parent
04d7cae2c4
commit
7292d69419
|
@ -536,6 +536,92 @@ gnu.classpath.tools.~a.~a $@"
|
||||||
the GNU Classpath library. They are executed by the JamVM virtual
|
the GNU Classpath library. They are executed by the JamVM virtual
|
||||||
machine.")))
|
machine.")))
|
||||||
|
|
||||||
|
(define ecj-javac-on-jamvm-wrapper
|
||||||
|
(package (inherit ecj-javac-wrapper)
|
||||||
|
(name "ecj-javac-on-jamvm-wrapper")
|
||||||
|
(arguments
|
||||||
|
`(#:modules ((guix build utils))
|
||||||
|
#:builder
|
||||||
|
;; TODO: This builder is exactly the same as in ecj-javac-wrapper,
|
||||||
|
;; except that the backend is 'jamvm here. Can we reuse the same
|
||||||
|
;; builder somehow?
|
||||||
|
(let ((backend 'jamvm))
|
||||||
|
(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)
|
||||||
|
(write
|
||||||
|
`(begin (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)
|
||||||
|
("jamvm" ,jamvm-bootstrap)
|
||||||
|
("classpath" ,classpath-on-sablevm)))
|
||||||
|
(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. The tool runs on JamVM instead of SableVM.")))
|
||||||
|
|
||||||
(define-public java-swt
|
(define-public java-swt
|
||||||
(package
|
(package
|
||||||
(name "java-swt")
|
(name "java-swt")
|
||||||
|
|
Loading…
Reference in New Issue