unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/2] gnu: racket: Patch dynamically loaded libraries with absolute paths.
@ 2016-07-19 13:53 宋文武
  2016-07-19 13:53 ` [PATCH 2/2] gnu: racket: Add more inputs 宋文武
  2016-07-21 16:57 ` [PATCH 1/2] gnu: racket: Patch dynamically loaded libraries with absolute paths Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: 宋文武 @ 2016-07-19 13:53 UTC (permalink / raw)
  To: guix-devel; +Cc: 宋文武

* gnu/packages/scheme.scm (racket)[arguments]: Patch 'ffi-lib' calls to
absolute paths in 'pre-configure' phase.  Remove 'wrap-programs' phase.
---
 gnu/packages/scheme.scm | 105 ++++++++++++++++++++++++++++++------------------
 1 file changed, 65 insertions(+), 40 deletions(-)

diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index e7cf950..715feca 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -408,46 +408,71 @@ implementation techniques and as an expository tool.")
     (build-system gnu-build-system)
     (arguments
      '(#:phases
-       (let* ((gui-libs
-               (lambda (inputs)
-                 (define (lib input)
-                   (string-append (assoc-ref inputs input) "/lib"))
-
-                 (list (lib "glib")
-                       (lib "cairo")
-                       (lib "pango")
-                       (lib "libjpeg")
-                       (lib "gtk")
-                       (lib "gdk-pixbuf")
-                       (lib "fontconfig")
-                       (lib "sqlite")))))         ;to build the doc
-         (alist-cons-before
-          'configure 'pre-configure
-          (lambda* (#:key inputs #:allow-other-keys)
-            (chdir "src")
-
-            ;; The GUI libs are dynamically opened through the FFI, so they
-            ;; must be in the loader's search path.
-            (setenv "LD_LIBRARY_PATH" (string-join (gui-libs inputs) ":")))
-          (alist-cons-after
-           'unpack 'patch-/bin/sh
-           (lambda _
-             (substitute* "collects/racket/system.rkt"
-               (("/bin/sh") (which "sh"))))
-           (alist-cons-after
-            'install 'wrap-programs
-            (lambda* (#:key inputs outputs #:allow-other-keys)
-              (let ((out (assoc-ref outputs "out")))
-                (define (wrap prog)
-                  (wrap-program prog
-                                `("LD_LIBRARY_PATH" ":" prefix
-                                  ,(gui-libs inputs))))
-
-                (with-directory-excursion (string-append out "/bin")
-                  (for-each wrap
-                            (list "gracket" "drracket" "slideshow" "mred"))
-                  #t)))
-            %standard-phases))))
+       (alist-cons-before
+        'configure 'pre-configure
+        (lambda* (#:key inputs #:allow-other-keys)
+          ;; Patch dynamically loaded libraries with their absolute paths.
+          (let* ((library-path   (search-path-as-string->list
+                                  (getenv "LIBRARY_PATH")))
+                 (find-so        (lambda (soname)
+                                   (search-path
+                                    library-path
+                                    (format #f "~a.so" soname))))
+                 (patch-ffi-libs (lambda (file libs)
+                                   (for-each
+                                    (lambda (lib)
+                                      (substitute* file
+                                        (((format #f "\"~a\"" lib))
+                                         (format #f "\"~a\"" (find-so lib)))))
+                                    libs))))
+            (substitute* "collects/db/private/sqlite3/ffi.rkt"
+              (("ffi-lib sqlite-so")
+               (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
+            (substitute* "collects/openssl/libssl.rkt"
+              (("ffi-lib libssl-so")
+               (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
+            (substitute* "collects/openssl/libcrypto.rkt"
+              (("ffi-lib libcrypto-so")
+               (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
+            (for-each
+             (lambda (x) (apply patch-ffi-libs x))
+             '(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
+                ("libfontconfig" "libcairo"))
+               ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
+                ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
+               ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
+                ("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/math-lib/math/private/bigfloat/gmp.rkt"
+                ("libgmp"))
+               ("share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
+                ("libmpfr"))
+               ("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?
        ))
     (inputs `(("libffi" ,libffi)
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] gnu: racket: Add more inputs.
  2016-07-19 13:53 [PATCH 1/2] gnu: racket: Patch dynamically loaded libraries with absolute paths 宋文武
@ 2016-07-19 13:53 ` 宋文武
  2016-07-21 16:59   ` Ludovic Courtès
  2016-07-21 16:57 ` [PATCH 1/2] gnu: racket: Patch dynamically loaded libraries with absolute paths Ludovic Courtès
  1 sibling, 1 reply; 5+ messages in thread
From: 宋文武 @ 2016-07-19 13:53 UTC (permalink / raw)
  To: guix-devel; +Cc: 宋文武

* gnu/packages/schem.scm (racket)[inputs]: Add glu, gmp, libpng, libx11,
mesa, mpfr, openssl and unixodbc.  Replace libjpeg-8 with libjpeg and
gtk+-2 with gtk+.
---
 gnu/packages/scheme.scm | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 715feca..461cce7 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -23,7 +23,7 @@
 
 (define-module (gnu packages scheme)
   #:use-module (gnu packages)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:hide (openssl))
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -48,6 +48,8 @@
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages image)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages tls)
+  #:use-module (gnu packages gl)
   #:use-module (ice-9 match))
 
 (define (mit-scheme-source-directory system version)
@@ -475,15 +477,25 @@ implementation techniques and as an expository tool.")
          %standard-phases))
        #:tests? #f                                ; XXX: how to run them?
        ))
-    (inputs `(("libffi" ,libffi)
-              ("glib" ,glib)                      ; for DrRacket
-              ("cairo" ,cairo)
-              ("pango" ,pango)
-              ("libjpeg" ,libjpeg-8)
-              ("fontconfig" ,fontconfig)
-              ("gdk-pixbuf" ,gdk-pixbuf)
-              ("gtk" ,gtk+-2)
-              ("sqlite" ,sqlite)))                ;needed to build the doc
+    (inputs
+     `(("libffi" ,libffi)
+       ;; Hardcode dynamically loaded libraries for better functionality.
+       ;; sqlite and libraries for `racket/draw' are needed to build the doc.
+       ("cairo" ,cairo)
+       ("fontconfig" ,fontconfig)
+       ("glib" ,glib)
+       ("glu" ,glu)
+       ("gmp" ,gmp)
+       ("gtk+" ,gtk+)  ; propagates gtk-pixbuf+svg
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libx11" ,libx11)
+       ("mesa" ,mesa)
+       ("mpfr" ,mpfr)
+       ("openssl" ,openssl)
+       ("pango" ,pango)
+       ("sqlite" ,sqlite)
+       ("unixodbc" ,unixodbc)))
     (home-page "http://racket-lang.org")
     (synopsis "Implementation of Scheme and related languages")
     (description
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] gnu: racket: Patch dynamically loaded libraries with absolute paths.
  2016-07-19 13:53 [PATCH 1/2] gnu: racket: Patch dynamically loaded libraries with absolute paths 宋文武
  2016-07-19 13:53 ` [PATCH 2/2] gnu: racket: Add more inputs 宋文武
@ 2016-07-21 16:57 ` Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2016-07-21 16:57 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> * gnu/packages/scheme.scm (racket)[arguments]: Patch 'ffi-lib' calls to
> absolute paths in 'pre-configure' phase.  Remove 'wrap-programs' phase.

Awesome, go ahead!  (I tried to do this long ago and eventually gave
up…)

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] gnu: racket: Add more inputs.
  2016-07-19 13:53 ` [PATCH 2/2] gnu: racket: Add more inputs 宋文武
@ 2016-07-21 16:59   ` Ludovic Courtès
  2016-07-22 11:26     ` 宋文武
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2016-07-21 16:59 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> * gnu/packages/schem.scm (racket)[inputs]: Add glu, gmp, libpng, libx11,
                     ^^
Typo.                     

> mesa, mpfr, openssl and unixodbc.  Replace libjpeg-8 with libjpeg and
> gtk+-2 with gtk+.

LGTM!

Thanks,
Ludo'.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] gnu: racket: Add more inputs.
  2016-07-21 16:59   ` Ludovic Courtès
@ 2016-07-22 11:26     ` 宋文武
  0 siblings, 0 replies; 5+ messages in thread
From: 宋文武 @ 2016-07-22 11:26 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

ludo@gnu.org (Ludovic Courtès) writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> * gnu/packages/schem.scm (racket)[inputs]: Add glu, gmp, libpng, libx11,
>                      ^^
> Typo.                     
>
>> mesa, mpfr, openssl and unixodbc.  Replace libjpeg-8 with libjpeg and
>> gtk+-2 with gtk+.
>
> LGTM!
Thanks for the review, pushed!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-22 11:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-19 13:53 [PATCH 1/2] gnu: racket: Patch dynamically loaded libraries with absolute paths 宋文武
2016-07-19 13:53 ` [PATCH 2/2] gnu: racket: Add more inputs 宋文武
2016-07-21 16:59   ` Ludovic Courtès
2016-07-22 11:26     ` 宋文武
2016-07-21 16:57 ` [PATCH 1/2] gnu: racket: Patch dynamically loaded libraries with absolute paths Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).