Archived
1
0
Fork 0

gnu: racket: Patch dynamically loaded libraries with absolute paths.

* gnu/packages/scheme.scm (racket)[arguments]: Patch 'ffi-lib' calls to
absolute paths in 'pre-configure' phase.  Remove 'wrap-programs' phase.
This commit is contained in:
宋文武 2016-07-19 20:57:51 +08:00
parent 8d63dddac1
commit e8c6811bf1
No known key found for this signature in database
GPG key ID: 26525665AE727D37

View file

@ -408,46 +408,73 @@ implementation techniques and as an expository tool.")
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
'(#:phases '(#:phases
(let* ((gui-libs (alist-cons-before
(lambda (inputs) 'configure 'pre-configure
(define (lib input) (lambda* (#:key inputs #:allow-other-keys)
(string-append (assoc-ref inputs input) "/lib")) ;; Patch dynamically loaded libraries with their absolute paths.
(let* ((library-path (search-path-as-string->list
(list (lib "glib") (getenv "LIBRARY_PATH")))
(lib "cairo") (find-so (lambda (soname)
(lib "pango") (search-path
(lib "libjpeg") library-path
(lib "gtk") (format #f "~a.so" soname))))
(lib "gdk-pixbuf") (patch-ffi-libs (lambda (file libs)
(lib "fontconfig") (for-each
(lib "sqlite"))))) ;to build the doc (lambda (lib)
(alist-cons-before (substitute* file
'configure 'pre-configure (((format #f "\"~a\"" lib))
(lambda* (#:key inputs #:allow-other-keys) (format #f "\"~a\"" (find-so lib)))))
(chdir "src") libs))))
(substitute* "collects/db/private/sqlite3/ffi.rkt"
;; The GUI libs are dynamically opened through the FFI, so they (("ffi-lib sqlite-so")
;; must be in the loader's search path. (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
(setenv "LD_LIBRARY_PATH" (string-join (gui-libs inputs) ":"))) (substitute* "collects/openssl/libssl.rkt"
(alist-cons-after (("ffi-lib libssl-so")
'unpack 'patch-/bin/sh (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
(lambda _ (substitute* "collects/openssl/libcrypto.rkt"
(substitute* "collects/racket/system.rkt" (("ffi-lib libcrypto-so")
(("/bin/sh") (which "sh")))) (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
(alist-cons-after (substitute* "share/pkgs/math-lib/math/private/bigfloat/gmp.rkt"
'install 'wrap-programs (("ffi-lib libgmp-so")
(lambda* (#:key inputs outputs #:allow-other-keys) (format #f "ffi-lib \"~a\"" (find-so "libgmp"))))
(let ((out (assoc-ref outputs "out"))) (substitute* "share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
(define (wrap prog) (("ffi-lib libmpfr-so")
(wrap-program prog (format #f "ffi-lib \"~a\"" (find-so "libmpfr"))))
`("LD_LIBRARY_PATH" ":" prefix (for-each
,(gui-libs inputs)))) (lambda (x) (apply patch-ffi-libs x))
'(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
(with-directory-excursion (string-append out "/bin") ("libfontconfig" "libcairo"))
(for-each wrap ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
(list "gracket" "drracket" "slideshow" "mred")) ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
#t))) ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
%standard-phases)))) ("libjpeg"))
("share/pkgs/draw-lib/racket/draw/unsafe/pango.rkt"
("libpango-1.0" "libpangocairo-1.0"))
("share/pkgs/draw-lib/racket/draw/unsafe/png.rkt"
("libpng"))
("share/pkgs/db-lib/db/private/odbc/ffi.rkt"
("libodbc"))
("share/pkgs/gui-lib/mred/private/wx/gtk/x11.rkt"
("libX11"))
("share/pkgs/gui-lib/mred/private/wx/gtk/gsettings.rkt"
("libgio-2.0"))
("share/pkgs/gui-lib/mred/private/wx/gtk/gtk3.rkt"
("libgdk-3" "libgtk-3"))
("share/pkgs/gui-lib/mred/private/wx/gtk/unique.rkt"
("libunique-1.0"))
("share/pkgs/gui-lib/mred/private/wx/gtk/utils.rkt"
("libgdk-x11-2.0" "libgdk_pixbuf-2.0" "libgtk-x11-2.0"))
("share/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt"
("libGL"))
("share/pkgs/sgl/gl.rkt"
("libGL" "libGLU")))))
(chdir "src"))
(alist-cons-after
'unpack 'patch-/bin/sh
(lambda _
(substitute* "collects/racket/system.rkt"
(("/bin/sh") (which "sh"))))
%standard-phases))
#:tests? #f ; XXX: how to run them? #:tests? #f ; XXX: how to run them?
)) ))
(inputs `(("libffi" ,libffi) (inputs `(("libffi" ,libffi)