unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add guile-opengl
@ 2014-06-25  2:03 David Thompson
  2014-06-25 19:29 ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: David Thompson @ 2014-06-25  2:03 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

Finally got around to finishing up this package.  I ran the example
programs shipped with guile-opengl and confirmed that they work as
expected. :)

How does it look?


[-- Attachment #2: 0001-gnu-Add-guile-opengl.patch --]
[-- Type: text/x-diff, Size: 3198 bytes --]

From 3368e741ce35751f050663ee58d8ea4da1afd0e0 Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Tue, 24 Jun 2014 21:59:47 -0400
Subject: [PATCH] gnu: Add guile-opengl.

* gnu/packages/gl.scm (guile-opengl): New variable.
---
 gnu/packages/gl.scm | 43 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 2741595..d314b03 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2013 Guy Grant <gzg@riseup.net>
+;;; Copyright © 2014 David Thompson <davet@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -30,7 +31,8 @@
   #:use-module (gnu packages python)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages xml)
-  #:use-module (gnu packages fontutils))
+  #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages guile))
 
 (define-public glu
   (package
@@ -170,3 +172,42 @@ a system for rendering interactive 3D graphics. A variety of device drivers
 allows Mesa to be used in many different environments ranging from software
 emulation to complete hardware acceleration for modern GPUs.")
     (license l:x11)))
+
+(define-public guile-opengl
+  (package
+    (name "guile-opengl")
+    (version "0.1.0")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-"
+                                 version ".tar.gz"))
+             (sha256
+              (base32
+               "13qfx4xh8baryxqrv986l848ygd0piqwm6s2s90pxk9c0m9vklim"))))
+    (build-system gnu-build-system)
+    (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs `(("guile" ,guile-2.0)
+              ("mesa" ,mesa)
+              ("freeglut" ,freeglut)))
+    (arguments
+     '(#:phases (alist-cons-before
+                 'build 'patch-dynamic-link
+                 (lambda* (#:key inputs outputs #:allow-other-keys)
+                   (define (dynamic-link-substitute file lib input)
+                     (substitute* file
+                       (((string-append "dynamic-link \"" lib "\""))
+                        (string-append "dynamic-link \""
+                                       (assoc-ref inputs input)
+                                       "/lib/" lib "\""))))
+                   ;; Replace dynamic-link calls for libGL, libGLU, and
+                   ;; libglut with absolute paths to the store.
+                   (dynamic-link-substitute "glx/runtime.scm" "libGL" "mesa")
+                   (dynamic-link-substitute "glu/runtime.scm" "libGLU" "mesa")
+                   (dynamic-link-substitute "glut/runtime.scm" "libglut" "freeglut"))
+                 %standard-phases)))
+    (home-page "http://gnu.org/s/guile-opengl")
+    (synopsis "OpenGL bindings for Guile")
+    (description
+     "GNU Guile-OpenGL is a library providing access to the OpenGL graphics
+API from GNU Guile.")
+    (license l:lgpl3+)))
-- 
2.0.0


[-- Attachment #3: Type: text/plain, Size: 136 bytes --]


-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate

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

* Re: [PATCH] gnu: Add guile-opengl
  2014-06-25  2:03 [PATCH] gnu: Add guile-opengl David Thompson
@ 2014-06-25 19:29 ` Ludovic Courtès
  2014-06-26  0:04   ` David Thompson
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2014-06-25 19:29 UTC (permalink / raw)
  To: David Thompson; +Cc: guix-devel

David Thompson <dthompson2@worcester.edu> skribis:

> Finally got around to finishing up this package.  I ran the example
> programs shipped with guile-opengl and confirmed that they work as
> expected. :)
>
> How does it look?

Looks good to me!  One comment:

> +                   (define (dynamic-link-substitute file lib input)
> +                     (substitute* file
> +                       (((string-append "dynamic-link \"" lib "\""))
> +                        (string-append "dynamic-link \""
> +                                       (assoc-ref inputs input)
> +                                       "/lib/" lib "\""))))

Patterns in ‘substitute*’ are supposed to be literals.

Wouldn’t it work to do something like:

  (substitute* file
    (("dynamic-link \"lib[a-zA-Z]+\" _ libname)
     (string-append ...)))

?

Thanks,
Ludo’.

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

* Re: [PATCH] gnu: Add guile-opengl
  2014-06-25 19:29 ` Ludovic Courtès
@ 2014-06-26  0:04   ` David Thompson
  2014-06-26 12:41     ` Ludovic Courtès
  2014-06-27  4:08     ` Mark H Weaver
  0 siblings, 2 replies; 5+ messages in thread
From: David Thompson @ 2014-06-26  0:04 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 710 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

>> +                   (define (dynamic-link-substitute file lib input)
>> +                     (substitute* file
>> +                       (((string-append "dynamic-link \"" lib "\""))
>> +                        (string-append "dynamic-link \""
>> +                                       (assoc-ref inputs input)
>> +                                       "/lib/" lib "\""))))
>
> Patterns in ‘substitute*’ are supposed to be literals.
>
> Wouldn’t it work to do something like:
>
>   (substitute* file
>     (("dynamic-link \"lib[a-zA-Z]+\" _ libname)
>      (string-append ...)))
>
> ?
>

Yes, that's better.  Updated patch attached.


[-- Attachment #2: 0001-gnu-Add-guile-opengl.patch --]
[-- Type: text/x-diff, Size: 3236 bytes --]

From 4e63b47f868f5eab5573e8e70c40f23545f3645a Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Tue, 24 Jun 2014 21:59:47 -0400
Subject: [PATCH] gnu: Add guile-opengl.

* gnu/packages/gl.scm (guile-opengl): New variable.
---
 gnu/packages/gl.scm | 44 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 2741595..36ba0bd 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2013 Guy Grant <gzg@riseup.net>
+;;; Copyright © 2014 David Thompson <davet@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -30,7 +31,8 @@
   #:use-module (gnu packages python)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages xml)
-  #:use-module (gnu packages fontutils))
+  #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages guile))
 
 (define-public glu
   (package
@@ -170,3 +172,43 @@ a system for rendering interactive 3D graphics. A variety of device drivers
 allows Mesa to be used in many different environments ranging from software
 emulation to complete hardware acceleration for modern GPUs.")
     (license l:x11)))
+
+(define-public guile-opengl
+  (package
+    (name "guile-opengl")
+    (version "0.1.0")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-"
+                                 version ".tar.gz"))
+             (sha256
+              (base32
+               "13qfx4xh8baryxqrv986l848ygd0piqwm6s2s90pxk9c0m9vklim"))))
+    (build-system gnu-build-system)
+    (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs `(("guile" ,guile-2.0)
+              ("mesa" ,mesa)
+              ("freeglut" ,freeglut)))
+    (arguments
+     '(#:phases (alist-cons-before
+                 'build 'patch-dynamic-link
+                 (lambda* (#:key inputs outputs #:allow-other-keys)
+                   (define (dynamic-link-substitute file lib input)
+                     (substitute* file
+                       (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
+                        (string-append "dynamic-link \""
+                                       (assoc-ref inputs input)
+                                       "/lib/lib" lib "\""))))
+                   ;; Replace dynamic-link calls for libGL, libGLU, and
+                   ;; libglut with absolute paths to the store.
+                   (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa")
+                   (dynamic-link-substitute "glu/runtime.scm" "GLU" "mesa")
+                   (dynamic-link-substitute "glut/runtime.scm" "glut"
+                                            "freeglut"))
+                 %standard-phases)))
+    (home-page "http://gnu.org/s/guile-opengl")
+    (synopsis "OpenGL bindings for Guile")
+    (description
+     "GNU Guile-OpenGL is a library providing access to the OpenGL graphics
+API from GNU Guile.")
+    (license l:lgpl3+)))
-- 
2.0.0


[-- Attachment #3: Type: text/plain, Size: 136 bytes --]


-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate

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

* Re: [PATCH] gnu: Add guile-opengl
  2014-06-26  0:04   ` David Thompson
@ 2014-06-26 12:41     ` Ludovic Courtès
  2014-06-27  4:08     ` Mark H Weaver
  1 sibling, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2014-06-26 12:41 UTC (permalink / raw)
  To: David Thompson; +Cc: guix-devel

David Thompson <dthompson2@worcester.edu> skribis:

> From 4e63b47f868f5eab5573e8e70c40f23545f3645a Mon Sep 17 00:00:00 2001
> From: David Thompson <dthompson2@worcester.edu>
> Date: Tue, 24 Jun 2014 21:59:47 -0400
> Subject: [PATCH] gnu: Add guile-opengl.
>
> * gnu/packages/gl.scm (guile-opengl): New variable.

Looks good to me, please push.

Ludo’.

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

* Re: [PATCH] gnu: Add guile-opengl
  2014-06-26  0:04   ` David Thompson
  2014-06-26 12:41     ` Ludovic Courtès
@ 2014-06-27  4:08     ` Mark H Weaver
  1 sibling, 0 replies; 5+ messages in thread
From: Mark H Weaver @ 2014-06-27  4:08 UTC (permalink / raw)
  To: David Thompson; +Cc: guix-devel

David Thompson <dthompson2@worcester.edu> writes:
> +                 (lambda* (#:key inputs outputs #:allow-other-keys)
> +                   (define (dynamic-link-substitute file lib input)
> +                     (substitute* file
> +                       (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
> +                        (string-append "dynamic-link \""
> +                                       (assoc-ref inputs input)
> +                                       "/lib/lib" lib "\""))))

I think the 'substitute*' form binds 'lib' to whatever matched the
pattern ([a-zA-z]+), thus shadowing the 'lib' argument to
'dynamic-link-substitute', so I think you could simply remove that
argument, or no?

> +                   ;; Replace dynamic-link calls for libGL, libGLU, and
> +                   ;; libglut with absolute paths to the store.
> +                   (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa")
> +                   (dynamic-link-substitute "glu/runtime.scm" "GLU" "mesa")
> +                   (dynamic-link-substitute "glut/runtime.scm" "glut"
> +                                            "freeglut"))
> +                 %standard-phases)))

   Thanks!
     Mark

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

end of thread, other threads:[~2014-06-27  4:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25  2:03 [PATCH] gnu: Add guile-opengl David Thompson
2014-06-25 19:29 ` Ludovic Courtès
2014-06-26  0:04   ` David Thompson
2014-06-26 12:41     ` Ludovic Courtès
2014-06-27  4:08     ` Mark H Weaver

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).