unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add s2tc.
@ 2015-03-11 21:46 Taylan Ulrich Bayırlı/Kammer
  2015-03-12 21:05 ` Taylan Ulrich Bayırlı/Kammer
  0 siblings, 1 reply; 6+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-03-11 21:46 UTC (permalink / raw)
  To: guix-devel

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

This adds s2tc as an input to mesa, and uses a mesa-without-s2tc package
as an input to s2tc to solve a cyclic dependency.

The resulting s2tc package does *not* link to any libraries in the
mesa-without-s2tc package (it's not a requisite as per "guix gc -R"), so
this should be safe, as in the user won't end up with two different
libGL images in memory.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3037 bytes --]

From 9b23215a9ab474c2f03c6ae2c888672beb4b4f58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Wed, 11 Mar 2015 21:49:24 +0100
Subject: [PATCH] gnu: Add s2tc.

* gnu/packages/gl.scm (s2tc): New variable.
(mesa): Add input s2tc.
(mesa-without-s2tc): 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 7d549d3..ba5f8a4 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -21,11 +21,13 @@
 
 (define-module (gnu packages gl)
   #:use-module (ice-9 match)
+  #:use-module (guix build utils)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages pkg-config)
@@ -123,6 +125,38 @@ rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
 Polygon meshes, and Extruded polygon meshes")
     (license l:x11)))
 
+(define-public s2tc
+  (package
+    (name "s2tc")
+    (version "1.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/divVerent/s2tc/archive/v" version ".tar.gz"))
+       (sha256
+        (base32 "0ibfdib277fhbqvxzan0bmglwnsl1y1rw2g8skvz82l1sfmmn752"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)))
+    (inputs
+     `(("mesa" ,mesa-without-s2tc)))
+    (arguments
+     '(#:phases
+       (alist-cons-after
+        'unpack 'autogen
+        (lambda _
+          (zero? (system* "sh" "autogen.sh")))
+        %standard-phases)))
+    (home-page "https://github.com/divVerent/s2tc")
+    (synopsis "S3 Text Compression implementation")
+    (description
+     "S2TC is a patent-free S3TC compatible implementation and provides
+texture compression to Mesa.")
+    (license l:expat)))
+
 (define-public mesa
   (package
     (name "mesa")
@@ -153,7 +187,8 @@ Polygon meshes, and Extruded polygon meshes")
         ("libxml2" ,libxml2)
         ;; TODO: Add 'libva'
         ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
-        ("makedepend" ,makedepend)))
+        ("makedepend" ,makedepend)
+        ("s2tc" ,s2tc)))
     (native-inputs
       `(("pkg-config" ,pkg-config)
         ("gettext" ,gnu-gettext)
@@ -196,6 +231,12 @@ 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 mesa-without-s2tc
+  (package
+    (inherit mesa)
+    (name "mesa-without-s2tc")
+    (inputs (alist-delete "s2tc" (package-inputs mesa)))))
+
 (define-public glew
   (package
     (name "glew")
-- 
2.2.1


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

* Re: [PATCH] gnu: Add s2tc.
  2015-03-11 21:46 [PATCH] gnu: Add s2tc Taylan Ulrich Bayırlı/Kammer
@ 2015-03-12 21:05 ` Taylan Ulrich Bayırlı/Kammer
  2015-03-13 15:21   ` Taylan Ulrich Bayırlı/Kammer
  0 siblings, 1 reply; 6+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-03-12 21:05 UTC (permalink / raw)
  To: guix-devel

Please postpone reviewing this!  (Sorry if I wasted anyone's time.)

I was planning to do all the dlopen() patching later on in one commit,
but realized that it means I will be adding a phase lambda that
references the 's2tc' input, after which the 'mesa-without-s2tc' package
breaks because it simply inherits from the full 'mesa' package.  (I
would have to hackishly take out that lambda from the phases again to
make it work...)

I'm pondering on a solution using a much more minimal 'mesa-for-s2tc'
package.  I might even get away with only installing the libGL headers
in the output of that package, without doing any compilation at all,
since I think s2tc needs only the headers...

Taylan

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

* Re: [PATCH] gnu: Add s2tc.
  2015-03-12 21:05 ` Taylan Ulrich Bayırlı/Kammer
@ 2015-03-13 15:21   ` Taylan Ulrich Bayırlı/Kammer
  2015-03-14 13:39     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-03-13 15:21 UTC (permalink / raw)
  To: guix-devel

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

Here's the updated patch, which adds a mesa-headers package, and fixes
the dlopening of s2tc.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 4575 bytes --]

From 01539ae1ff353ac7feccdfdd05992ad295dcdd00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Wed, 11 Mar 2015 21:49:24 +0100
Subject: [PATCH 1/3] gnu: Add s2tc.

* gnu/packages/gl.scm (s2tc): New variable.
(mesa): Add input s2tc, patch references to "libtxc_dxtn.so".
(mesa-headers): New variable.
---
 gnu/packages/gl.scm | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 65 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 7d549d3..e237cb1 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -21,11 +21,13 @@
 
 (define-module (gnu packages gl)
   #:use-module (ice-9 match)
+  #:use-module (guix build utils)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages pkg-config)
@@ -123,6 +125,37 @@ rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
 Polygon meshes, and Extruded polygon meshes")
     (license l:x11)))
 
+(define-public s2tc
+  (package
+    (name "s2tc")
+    (version "1.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/divVerent/s2tc/archive/v" version ".tar.gz"))
+       (sha256
+        (base32 "0ibfdib277fhbqvxzan0bmglwnsl1y1rw2g8skvz82l1sfmmn752"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)))
+    (inputs
+     `(("mesa-headers" ,mesa-headers)))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after unpack autogen
+          (lambda _
+            (zero? (system* "sh" "autogen.sh")))))))
+    (home-page "https://github.com/divVerent/s2tc")
+    (synopsis "S3 Text Compression implementation")
+    (description
+     "S2TC is a patent-free S3TC compatible implementation and provides
+texture compression to Mesa.")
+    (license l:expat)))
+
 (define-public mesa
   (package
     (name "mesa")
@@ -153,7 +186,8 @@ Polygon meshes, and Extruded polygon meshes")
         ("libxml2" ,libxml2)
         ;; TODO: Add 'libva'
         ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
-        ("makedepend" ,makedepend)))
+        ("makedepend" ,makedepend)
+        ("s2tc" ,s2tc)))
     (native-inputs
       `(("pkg-config" ,pkg-config)
         ("gettext" ,gnu-gettext)
@@ -187,7 +221,17 @@ Polygon meshes, and Extruded polygon meshes")
                   (lambda _
                     (substitute* "src/glsl/tests/lower_jumps/create_test_cases.py"
                       (("/usr/bin/env bash") (which "bash"))))
-                  %standard-phases))))
+                  (alist-cons-before
+                   'build 'fix-dxtn-libname
+                   (lambda* (#:key inputs #:allow-other-keys)
+                     (let ((s2tc (assoc-ref inputs "s2tc")))
+                       (substitute*
+                           '("src/gallium/auxiliary/util/u_format_s3tc.c"
+                             "src/mesa/main/texcompress_s3tc.c")
+                         (("\"libtxc_dxtn\\.so\"")
+                          (string-append
+                           "\"" s2tc "/lib/libtxc_dxtn.so\"")))))
+                   %standard-phases)))))
     (home-page "http://mesa3d.org/")
     (synopsis "OpenGL implementation")
     (description "Mesa is a free implementation of the OpenGL specification -
@@ -196,6 +240,25 @@ 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 mesa-headers
+  (package
+    (inherit mesa)
+    (name "mesa-headers")
+    (propagated-inputs '())
+    (inputs '())
+    (native-inputs '())
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (delete configure)
+         (delete build)
+         (delete check)
+         (replace install
+                  (lambda* (#:key outputs #:allow-other-keys)
+                    (copy-recursively "include" (string-append
+                                                 (assoc-ref outputs "out")
+                                                 "/include")))))))))
+
 (define-public glew
   (package
     (name "glew")
-- 
2.2.1


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

* Re: [PATCH] gnu: Add s2tc.
  2015-03-13 15:21   ` Taylan Ulrich Bayırlı/Kammer
@ 2015-03-14 13:39     ` Ludovic Courtès
  2015-03-17 10:58       ` Taylan Ulrich Bayırlı/Kammer
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2015-03-14 13:39 UTC (permalink / raw)
  To: Taylan Ulrich "Bayırlı/Kammer"; +Cc: guix-devel

taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") skribis:

> From 01539ae1ff353ac7feccdfdd05992ad295dcdd00 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
>  <taylanbayirli@gmail.com>
> Date: Wed, 11 Mar 2015 21:49:24 +0100
> Subject: [PATCH 1/3] gnu: Add s2tc.
>
> * gnu/packages/gl.scm (s2tc): New variable.
> (mesa): Add input s2tc, patch references to "libtxc_dxtn.so".
> (mesa-headers): New variable.


LGTM, but please make the addition of s2tc to mesa a second patch.

> +    (description
> +     "S2TC is a patent-free S3TC compatible implementation and provides
> +texture compression to Mesa.")

Could you expound a bit, giving a bit more context?

Thanks!

Ludo’.

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

* Re: [PATCH] gnu: Add s2tc.
  2015-03-14 13:39     ` Ludovic Courtès
@ 2015-03-17 10:58       ` Taylan Ulrich Bayırlı/Kammer
  2015-03-18  8:44         ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-03-17 10:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

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

>> +    (description
>> +     "S2TC is a patent-free S3TC compatible implementation and provides
>> +texture compression to Mesa.")
>
> Could you expound a bit, giving a bit more context?
>
> Thanks!
>
> Ludo’.

Updated patches below; is this description OK?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch1 --]
[-- Type: text/x-diff, Size: 2911 bytes --]

From 7b35851a3da24d376c59b192555d885c9baf79dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Wed, 11 Mar 2015 21:49:24 +0100
Subject: [PATCH 1/5] gnu: Add s2tc.

* gnu/packages/gl.scm (s2tc): New variable.
(mesa-headers): New variable.
---
 gnu/packages/gl.scm | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 7d549d3..26c514e 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -26,6 +26,7 @@
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages pkg-config)
@@ -123,6 +124,37 @@ rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
 Polygon meshes, and Extruded polygon meshes")
     (license l:x11)))
 
+(define-public s2tc
+  (package
+    (name "s2tc")
+    (version "1.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/divVerent/s2tc/archive/v" version ".tar.gz"))
+       (sha256
+        (base32 "0ibfdib277fhbqvxzan0bmglwnsl1y1rw2g8skvz82l1sfmmn752"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)))
+    (inputs
+     `(("mesa-headers" ,mesa-headers)))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after unpack autogen
+          (lambda _
+            (zero? (system* "sh" "autogen.sh")))))))
+    (home-page "https://github.com/divVerent/s2tc")
+    (synopsis "S3 Texture Compression implementation")
+    (description
+     "S2TC is a patent-free implementation of S3 Texture Compression (S3TC,
+also known as DXTn or DXTC) for Mesa.")
+    (license l:expat)))
+
 (define-public mesa
   (package
     (name "mesa")
@@ -196,6 +228,25 @@ 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 mesa-headers
+  (package
+    (inherit mesa)
+    (name "mesa-headers")
+    (propagated-inputs '())
+    (inputs '())
+    (native-inputs '())
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (delete configure)
+         (delete build)
+         (delete check)
+         (replace install
+                  (lambda* (#:key outputs #:allow-other-keys)
+                    (copy-recursively "include" (string-append
+                                                 (assoc-ref outputs "out")
+                                                 "/include")))))))))
+
 (define-public glew
   (package
     (name "glew")
-- 
2.2.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch2 --]
[-- Type: text/x-diff, Size: 2154 bytes --]

From ba19b56ba979e5a85a26aa98c0eef8e12846edd2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Sat, 14 Mar 2015 15:05:15 +0100
Subject: [PATCH 2/5] gnu: mesa: Add input s2tc.

* gnu/packages/gl.scm (mesa): Add input s2tc, patch sources to make the
  reference to libtxc_dxtn.so absolute since it's passed to dlopen(3).
---
 gnu/packages/gl.scm | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 26c514e..d2096b6 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -185,7 +185,8 @@ also known as DXTn or DXTC) for Mesa.")
         ("libxml2" ,libxml2)
         ;; TODO: Add 'libva'
         ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
-        ("makedepend" ,makedepend)))
+        ("makedepend" ,makedepend)
+        ("s2tc" ,s2tc)))
     (native-inputs
       `(("pkg-config" ,pkg-config)
         ("gettext" ,gnu-gettext)
@@ -219,7 +220,18 @@ also known as DXTn or DXTC) for Mesa.")
                   (lambda _
                     (substitute* "src/glsl/tests/lower_jumps/create_test_cases.py"
                       (("/usr/bin/env bash") (which "bash"))))
-                  %standard-phases))))
+                  (alist-cons-before
+                   'build 'fix-dxtn-libname
+                   (lambda* (#:key inputs #:allow-other-keys)
+                     (let ((s2tc (assoc-ref inputs "s2tc")))
+                       ;; Remain agnostic to .so.X.Y.Z versions while doing
+                       ;; the substitutions so we're future-safe.
+                       (substitute*
+                           '("src/gallium/auxiliary/util/u_format_s3tc.c"
+                             "src/mesa/main/texcompress_s3tc.c")
+                         (("\"libtxc_dxtn\\.so")
+                          (string-append "\"" s2tc "/lib/libtxc_dxtn.so")))))
+                   %standard-phases)))))
     (home-page "http://mesa3d.org/")
     (synopsis "OpenGL implementation")
     (description "Mesa is a free implementation of the OpenGL specification -
-- 
2.2.1


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

* Re: [PATCH] gnu: Add s2tc.
  2015-03-17 10:58       ` Taylan Ulrich Bayırlı/Kammer
@ 2015-03-18  8:44         ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2015-03-18  8:44 UTC (permalink / raw)
  To: Taylan Ulrich "Bayırlı/Kammer"; +Cc: guix-devel

taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>>> +    (description
>>> +     "S2TC is a patent-free S3TC compatible implementation and provides
>>> +texture compression to Mesa.")
>>
>> Could you expound a bit, giving a bit more context?
>>
>> Thanks!
>>
>> Ludo’.
>
> Updated patches below; is this description OK?

Yes.  OK to push, thank you!

Ludo’.

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

end of thread, other threads:[~2015-03-18  8:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-11 21:46 [PATCH] gnu: Add s2tc Taylan Ulrich Bayırlı/Kammer
2015-03-12 21:05 ` Taylan Ulrich Bayırlı/Kammer
2015-03-13 15:21   ` Taylan Ulrich Bayırlı/Kammer
2015-03-14 13:39     ` Ludovic Courtès
2015-03-17 10:58       ` Taylan Ulrich Bayırlı/Kammer
2015-03-18  8:44         ` 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).