Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / java.scm
index 26fc3ec..aa8cd2c 100644 (file)
@@ -250,6 +250,11 @@ build process and its dependencies, whereas Make uses Makefile format.")
        ;; gremlin) doesn't support it yet, so skip this phase.
        #:validate-runpath? #f
 
+       #:modules ((guix build utils)
+                  (guix build gnu-build-system)
+                  (ice-9 popen)
+                  (ice-9 rdelim))
+
        #:configure-flags
        (let* ((gcjdir (assoc-ref %build-inputs "gcj"))
               (ecj    (string-append gcjdir "/share/java/ecj.jar"))
@@ -378,9 +383,16 @@ build process and its dependencies, whereas Make uses Makefile format.")
            (lambda* (#:key inputs #:allow-other-keys)
              (let* ((gcjdir  (assoc-ref %build-inputs "gcj"))
                     (gcjlib  (string-append gcjdir "/lib"))
-                    (antpath (string-append (getcwd) "/../apache-ant-1.9.4")))
+                    (antpath (string-append (getcwd) "/../apache-ant-1.9.4"))
+                    ;; Get target-specific include directory so that
+                    ;; libgcj-config.h is found when compiling hotspot.
+                    (gcjinclude (let* ((port (open-input-pipe "gcj -print-file-name=include"))
+                                       (str  (read-line port)))
+                                  (close-pipe port)
+                                  str)))
                (setenv "CPATH"
-                       (string-append (assoc-ref %build-inputs "libxrender")
+                       (string-append gcjinclude ":"
+                                      (assoc-ref %build-inputs "libxrender")
                                       "/include/X11/extensions" ":"
                                       (assoc-ref %build-inputs "libxtst")
                                       "/include/X11/extensions" ":"
@@ -598,6 +610,9 @@ build process and its dependencies, whereas Make uses Makefile format.")
                 (modules '((guix build utils)))
                 (snippet
                  '(substitute* "Makefile.in"
+                    ;; link against libgcj to avoid linker error
+                    (("-o native-ecj")
+                     "-lgcj -o native-ecj")
                     ;; do not leak information about the build host
                     (("DISTRIBUTION_ID=\"\\$\\(DIST_ID\\)\"")
                      "DISTRIBUTION_ID=\"\\\"guix\\\"\"")))))
@@ -615,15 +630,7 @@ build process and its dependencies, whereas Make uses Makefile format.")
          #:locale "C"
          ,@(substitute-keyword-arguments (package-arguments icedtea6)
              ((#:configure-flags flags)
-              `(let ((jdk (assoc-ref %build-inputs "icedtea6"))
-                     (ant (assoc-ref %build-inputs "ant")))
-                 `("--disable-bootstrap"
-                   "--without-rhino"
-                   "--enable-nss"
-                   "--enable-system-lcms"
-                   "--disable-downloading"
-                   ,(string-append "--with-ant-home=" ant)
-                   ,(string-append "--with-jdk-home=" jdk))))
+              `(delete "--with-openjdk-src-dir=./openjdk" ,flags))
              ((#:phases phases)
               `(modify-phases ,phases
                  (replace
@@ -665,30 +672,37 @@ build process and its dependencies, whereas Make uses Makefile format.")
                  (replace
                   'set-additional-paths
                   (lambda* (#:key inputs #:allow-other-keys)
-                    (substitute* "openjdk/jdk/make/common/shared/Sanity.gmk"
-                      (("ALSA_INCLUDE=/usr/include/alsa/version.h")
-                       (string-append "ALSA_INCLUDE="
-                                      (assoc-ref inputs "alsa-lib")
-                                      "/include/alsa/version.h")))
-                    (setenv "CC" "gcc")
-                    (setenv "CPATH"
-                            (string-append (assoc-ref inputs "libxrender")
-                                           "/include/X11/extensions" ":"
-                                           (assoc-ref inputs "libxtst")
-                                           "/include/X11/extensions" ":"
-                                           (assoc-ref inputs "libxinerama")
-                                           "/include/X11/extensions" ":"
-                                           (or (getenv "CPATH") "")))
-                    (setenv "ALT_OBJCOPY" (which "objcopy"))
-                    (setenv "ALT_CUPS_HEADERS_PATH"
-                            (string-append (assoc-ref inputs "cups")
-                                           "/include"))
-                    (setenv "ALT_FREETYPE_HEADERS_PATH"
-                            (string-append (assoc-ref inputs "freetype")
-                                           "/include"))
-                    (setenv "ALT_FREETYPE_LIB_PATH"
-                            (string-append (assoc-ref inputs "freetype")
-                                           "/lib"))))
+                    (let (;; Get target-specific include directory so that
+                          ;; libgcj-config.h is found when compiling hotspot.
+                          (gcjinclude (let* ((port (open-input-pipe "gcj -print-file-name=include"))
+                                             (str  (read-line port)))
+                                        (close-pipe port)
+                                        str)))
+                      (substitute* "openjdk/jdk/make/common/shared/Sanity.gmk"
+                        (("ALSA_INCLUDE=/usr/include/alsa/version.h")
+                         (string-append "ALSA_INCLUDE="
+                                        (assoc-ref inputs "alsa-lib")
+                                        "/include/alsa/version.h")))
+                      (setenv "CC" "gcc")
+                      (setenv "CPATH"
+                              (string-append gcjinclude ":"
+                                             (assoc-ref inputs "libxrender")
+                                             "/include/X11/extensions" ":"
+                                             (assoc-ref inputs "libxtst")
+                                             "/include/X11/extensions" ":"
+                                             (assoc-ref inputs "libxinerama")
+                                             "/include/X11/extensions" ":"
+                                             (or (getenv "CPATH") "")))
+                      (setenv "ALT_OBJCOPY" (which "objcopy"))
+                      (setenv "ALT_CUPS_HEADERS_PATH"
+                              (string-append (assoc-ref inputs "cups")
+                                             "/include"))
+                      (setenv "ALT_FREETYPE_HEADERS_PATH"
+                              (string-append (assoc-ref inputs "freetype")
+                                             "/include"))
+                      (setenv "ALT_FREETYPE_LIB_PATH"
+                              (string-append (assoc-ref inputs "freetype")
+                                             "/lib")))))
                  (add-after
                   'unpack 'fix-x11-extension-include-path
                   (lambda* (#:key inputs #:allow-other-keys)
@@ -721,7 +735,6 @@ build process and its dependencies, whereas Make uses Makefile format.")
                  (delete 'patch-patches))))))
       (native-inputs
        `(("ant" ,ant)
-         ("icedtea6" ,icedtea6 "jdk")
          ("openjdk-drop"
           ,(drop "openjdk"
                  "03gxqn17cxwl1nspnwigacaqd28p02d45f396j5f4kkbzfnbl0ak"))
@@ -744,4 +757,4 @@ build process and its dependencies, whereas Make uses Makefile format.")
           ,(drop "hotspot"
                  "1yqxfd2jwbm5y41wscyfx8h0fr3h8ny2g2mda5iwd8sikxsaj96p"))
          ,@(fold alist-delete (package-native-inputs icedtea6)
-                 '("openjdk6-src" "ant-bootstrap" "gcj")))))))
+                 '("openjdk6-src" "ant-bootstrap")))))))