summary refs log tree commit diff
diff options
context:
space:
mode:
authorPierre Neidhardt <mail@ambrevar.xyz>2019-09-24 09:44:49 +0200
committerPierre Neidhardt <mail@ambrevar.xyz>2019-09-24 09:44:49 +0200
commit5c1547383f1d8fca1e46a1a3a17e90b61ece915c (patch)
tree1ed7892931db2f038f09823c26be810188bf0c76
parent2395d863de36937016d29a008d18f65e32a9594e (diff)
downloadguix-5c1547383f1d8fca1e46a1a3a17e90b61ece915c.tar.gz
gnu: Add mojoshader.
* gnu/packages/gl.scm (mojoshader): New variable.
-rw-r--r--gnu/packages/gl.scm55
1 files changed, 55 insertions, 0 deletions
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index a2658a6789..c05ce4e06a 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -52,6 +53,7 @@
   #:use-module (gnu packages xorg)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix hg-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system meson)
@@ -801,3 +803,56 @@ applications to 3D accelerator hardware in a dedicated server and displays the
 rendered output interactively to a thin client located elsewhere on the
 network.")
     (license license:wxwindows3.1+)))
+
+(define-public mojoshader
+  (let ((changeset "5887634ea695"))
+    (package
+      (name "mojoshader")
+      (version changeset)
+      (source
+       (origin
+         (method hg-fetch)
+         (uri (hg-reference
+               (url "https://hg.icculus.org/icculus/mojoshader/")
+               (changeset changeset)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0ibl4z1696jiifv9j5drir7jm0b5px0vwkwckbi7cfd46p7p6wcy"))))
+      (arguments
+       ;; Tests only for COMPILER_SUPPORT=ON.
+       `(#:tests? #f
+         #:configure-flags '("-DBUILD_SHARED=ON")
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (lib (string-append out "/lib"))
+                      (header (string-append out "/include")))
+                 (install-file "libmojoshader.so" lib)
+                 (for-each (lambda (f)
+                             (install-file f header))
+                           (find-files "../source" "mojoshader.*\\.h$"))
+                 (let ((profiles-header (string-append header "/profiles")))
+                   (mkdir-p profiles-header)
+                   (rename-file (string-append header "/mojoshader_profile.h")
+                                (string-append profiles-header "/mojoshader_profile.h"))))
+               #t)))))
+      (build-system cmake-build-system)
+      (home-page "https://www.icculus.org/mojoshader/")
+      (synopsis "Work with Direct3D shaders on alternate 3D APIs")
+      (description "MojoShader is a library to work with Direct3D shaders on
+alternate 3D APIs and non-Windows platforms.  The primary motivation is moving
+shaders to OpenGL languages on the fly.  The developer deals with \"profiles\"
+that represent various target languages, such as GLSL or ARB_*_program.
+
+This allows a developer to manage one set of shaders, presumably written in
+Direct3D HLSL, and use them across multiple rendering backends.  This also
+means that the developer only has to worry about one (offline) compiler to
+manage program complexity, while MojoShader itself deals with the reduced
+complexity of the bytecode at runtime.
+
+MojoShader provides both a simple API to convert bytecode to various profiles,
+and (optionally) basic glue to rendering APIs to abstract the management of
+the shaders at runtime.")
+      (license license:zlib))))