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.
(lambda* (#:key inputs outputs #:allow-other-keys) (add-after 'configure 'unset-classpath
(let ((lib (string-append (assoc-ref outputs "out") "/lib"))) (lambda _ (unsetenv "CLASSPATH") #t))
(setenv "JAVA_HOME" (assoc-ref inputs "jdk")) (add-before 'build 'build-native
(lambda* (#:key inputs outputs #:allow-other-keys)
;; Build shared libraries. Users of SWT have to set the system (let ((lib (string-append (assoc-ref outputs "out") "/lib")))
;; property swt.library.path to the "lib" directory of this ;; Build shared libraries. Users of SWT have to set the system
;; package output. ;; property swt.library.path to the "lib" directory of this
(mkdir-p lib) ;; package output.
(setenv "OUTPUT_DIR" lib) (mkdir-p lib)
(zero? (system* "bash" "build.sh")) (setenv "OUTPUT_DIR" lib)
(with-directory-excursion "src"
;; build jar (zero? (system* "bash" "build.sh"))))))
(mkdir "build") (add-after 'install 'install-native
(for-each (lambda (file) (lambda* (#:key outputs #:allow-other-keys)
(format #t "Compiling ~s\n" file) (let ((lib (string-append (assoc-ref outputs "out") "/lib")))
(system* "javac" "-d" "build" file)) (for-each (lambda (file)
(find-files "." "\\.java")) (install-file file lib))
(zero? (system* "jar" "cvf" "swt.jar" "-C" "build" ".")))) (find-files "." "\\.so$"))
(alist-cons-after #t))))))
'install 'install-java-files
(lambda* (#:key outputs #:allow-other-keys)
(let ((java (string-append (assoc-ref outputs "out")
"/share/java")))
(install-file "swt.jar" java)
#t))
(alist-delete 'configure %standard-phases))))))
(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