gnu: gcj: Add $libdir to RUNPATH.

* gnu/packages/gcc.scm (gcj)[arguments]: Add build phase to add library output
  directory to RUNPATH.
This commit is contained in:
Ricardo Wurmus 2015-05-08 12:36:58 +02:00
parent aa2e989e1e
commit ad12c43e97

@ -415,38 +415,47 @@ Go. It also includes runtime support libraries for these languages.")
"--enable-languages=java" "--enable-languages=java"
,@(remove (cut string-match "--enable-languages.*" <>) ,@(remove (cut string-match "--enable-languages.*" <>)
,flags)))) ,flags))))
((#:phases phases) ((#:phases phases)
`(alist-cons-after `(modify-phases ,phases
'install 'install-javac-and-javap-wrappers (add-after
(lambda _ 'unpack 'add-lib-output-to-rpath
(let* ((javac (assoc-ref %build-inputs "javac.in")) (lambda _
(ecj (assoc-ref %build-inputs "ecj-bootstrap")) (substitute* "libjava/Makefile.in"
(gcj (assoc-ref %outputs "out")) (("libgcj_bc_dummy_LINK = .* -shared" line)
(gcjbin (string-append gcj "/bin/")) (string-append line " -Wl,-rpath=$(libdir)"))
(jvm (string-append gcj "/lib/jvm/")) (("libgcj(_bc)?_la_LDFLAGS =" ldflags _)
(target (string-append jvm "/bin/javac"))) (string-append ldflags " -Wl,-rpath=$(libdir)")))))
(add-after
'install 'install-javac-and-javap-wrappers
(lambda _
(let* ((javac (assoc-ref %build-inputs "javac.in"))
(ecj (assoc-ref %build-inputs "ecj-bootstrap"))
(gcj (assoc-ref %outputs "out"))
(gcjbin (string-append gcj "/bin/"))
(jvm (string-append gcj "/lib/jvm/"))
(target (string-append jvm "/bin/javac")))
(symlink (string-append gcjbin "jcf-dump") (symlink (string-append gcjbin "jcf-dump")
(string-append jvm "/bin/javap")) (string-append jvm "/bin/javap"))
(copy-file ecj (string-append gcj "/share/java/ecj.jar")) (copy-file ecj (string-append gcj "/share/java/ecj.jar"))
;; Create javac wrapper from the template javac.in by ;; Create javac wrapper from the template javac.in by
;; replacing the @VARIABLES@ with paths. ;; replacing the @VARIABLES@ with paths.
(copy-file javac target) (copy-file javac target)
(patch-shebang target) (patch-shebang target)
(substitute* target (substitute* target
(("@JAVA@") (("@JAVA@")
(string-append jvm "/bin/java")) (string-append jvm "/bin/java"))
(("@ECJ_JAR@") (("@ECJ_JAR@")
(string-append gcj "/share/java/ecj.jar")) (string-append gcj "/share/java/ecj.jar"))
(("@RT_JAR@") (("@RT_JAR@")
(string-append jvm "/jre/lib/rt.jar")) (string-append jvm "/jre/lib/rt.jar"))
(("@TOOLS_JAR@") (("@TOOLS_JAR@")
(string-append jvm "/lib/tools.jar"))) (string-append jvm "/lib/tools.jar")))
(chmod target #o755) (chmod target #o755)
#t)) #t)))
(alist-cons-after (add-after
'install 'remove-broken-or-conflicting-files 'install 'remove-broken-or-conflicting-files
(lambda _ (lambda _
(let ((out (assoc-ref %outputs "out"))) (let ((out (assoc-ref %outputs "out")))
@ -456,8 +465,7 @@ Go. It also includes runtime support libraries for these languages.")
"libjawt.so") "libjawt.so")
(find-files (string-append out "/bin") (find-files (string-append out "/bin")
".*(c\\+\\+|cpp|g\\+\\+|gcc.*)")))) ".*(c\\+\\+|cpp|g\\+\\+|gcc.*)"))))
#t) #t))))))))
,phases)))))))
(define ecj-bootstrap-4.8 (define ecj-bootstrap-4.8
(origin (origin