gnu:: java-swt: Use ant-build-system.

* gnu/packages/java.scm (java-swt): Use ant-build-system.
[native-inputs]: Remove JDK.
This commit is contained in:
Ricardo Wurmus 2016-05-05 14:37:52 +02:00
parent 81b98756a3
commit 8226c2717c
1 changed files with 33 additions and 41 deletions

View File

@ -66,48 +66,41 @@
(sha256 (sha256
(base32 (base32
"03mhzraikcs4fsz7d3h5af9pw1bbcfd6dglsvbk2ciwimy9zj30q")))) "03mhzraikcs4fsz7d3h5af9pw1bbcfd6dglsvbk2ciwimy9zj30q"))))
(build-system gnu-build-system) (build-system ant-build-system)
(arguments (arguments
`(#:make-flags '("-f" "make_linux.mak") `(#:jar-name "swt.jar"
#:tests? #f ; no "check" target #:tests? #f ; no "check" target
#:phases #:phases
(alist-replace (modify-phases %standard-phases
'unpack (replace 'unpack
(lambda _ (lambda* (#:key source #:allow-other-keys)
(and (mkdir "swt") (and (mkdir "swt")
(zero? (system* "unzip" (assoc-ref %build-inputs "source") "-d" "swt")) (zero? (system* "unzip" source "-d" "swt"))
(chdir "swt") (chdir "swt")
(mkdir "src") (mkdir "src")
(zero? (system* "unzip" "src.zip" "-d" "src")) (zero? (system* "unzip" "src.zip" "-d" "src")))))
(chdir "src"))) ;; The classpath contains invalid icecat jars. Since we don't need
(alist-replace ;; anything other than the JDK on the classpath, we can simply unset
'build ;; it.
(add-after 'configure 'unset-classpath
(lambda _ (unsetenv "CLASSPATH") #t))
(add-before 'build 'build-native
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let ((lib (string-append (assoc-ref outputs "out") "/lib"))) (let ((lib (string-append (assoc-ref outputs "out") "/lib")))
(setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
;; Build shared libraries. Users of SWT have to set the system ;; Build shared libraries. Users of SWT have to set the system
;; property swt.library.path to the "lib" directory of this ;; property swt.library.path to the "lib" directory of this
;; package output. ;; package output.
(mkdir-p lib) (mkdir-p lib)
(setenv "OUTPUT_DIR" lib) (setenv "OUTPUT_DIR" lib)
(zero? (system* "bash" "build.sh")) (with-directory-excursion "src"
(zero? (system* "bash" "build.sh"))))))
;; build jar (add-after 'install 'install-native
(mkdir "build")
(for-each (lambda (file)
(format #t "Compiling ~s\n" file)
(system* "javac" "-d" "build" file))
(find-files "." "\\.java"))
(zero? (system* "jar" "cvf" "swt.jar" "-C" "build" "."))))
(alist-cons-after
'install 'install-java-files
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let ((java (string-append (assoc-ref outputs "out") (let ((lib (string-append (assoc-ref outputs "out") "/lib")))
"/share/java"))) (for-each (lambda (file)
(install-file "swt.jar" java) (install-file file lib))
#t)) (find-files "." "\\.so$"))
(alist-delete 'configure %standard-phases)))))) #t))))))
(inputs (inputs
`(("xulrunner" ,icecat) `(("xulrunner" ,icecat)
("gtk" ,gtk+-2) ("gtk" ,gtk+-2)
@ -117,8 +110,7 @@
("glu" ,glu))) ("glu" ,glu)))
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config) `(("pkg-config" ,pkg-config)
("unzip" ,unzip) ("unzip" ,unzip)))
("jdk" ,icedtea "jdk")))
(home-page "https://www.eclipse.org/swt/") (home-page "https://www.eclipse.org/swt/")
(synopsis "Widget toolkit for Java") (synopsis "Widget toolkit for Java")
(description (description