Subject: [PATCH] gnu: Add opencsg.

From: Steve Sprang <[email-masked]>
Date: Fri, 23 Aug 2019 17:25:25 -0700

From 796d4013b78bb596690f254bdc08f89143805ace Mon Sep 17 00:00:00 2001
From: Steve Sprang <[email-masked]>
Date: Fri, 23 Aug 2019 15:38:42 -0700
Subject: [PATCH] gnu: Add opencsg.

* gnu/packages/graphics.scm (opencsg): New variable.
---
 gnu/packages/graphics.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index ee56dae54e..9071884a3c 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2018 Kei Kebreau <[email-masked]>
 ;;; Copyright © 2019 Mark H Weaver <[email-masked]>
 ;;; Copyright © 2019 Carlo Zancanaro <[email-masked]>
+;;; Copyright © 2019 Steve Sprang <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1018,3 +1019,41 @@ requirements.")
 performance subdivision surface (subdiv) evaluation on massively parallel CPU
 and GPU architectures.")
     (license license:asl2.0)))
+
+(define-public opencsg
+  (package
+    (name "opencsg")
+    (version "1.4.2")
+    (source (origin
+	      (method url-fetch)
+	      (uri (string-append "https://github.com/floriankirsch/OpenCSG/"
+				  "archive/opencsg-"
+				  (string-map
+				   (lambda (c)
+				     (if (char=? c #\.) #\- c)) version)
+				  "-release.tar.gz"))
+	      (sha256
+	       (base32
+		"0b18gb7w9rpwkrjrkxx9apy17v5infgh2hnbzg9y3f54rxcjwx1c"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+	 (replace 'configure
+	   (lambda* (#:key outputs #:allow-other-keys)
+	     (substitute* "src/Makefile"
+	       (("/usr/local") (assoc-ref outputs "out")))
+	     #t))
+	 (add-before 'build 'skip-example
+	   (lambda _ (chdir "src") #t)))))
+    (inputs
+     `(("glew" ,glew)
+       ("freeglut" ,freeglut)))
+    (synopsis "Library for rendering Constructive Solid Geometry (CSG)")
+    (description
+     "OpenCSG is a library for rendering Constructive Solid Geometry (CSG) using
+OpenGL.  CSG is an approach for modeling complex 3D-shapes using simpler ones.
+For example, two shapes can be combined by uniting them, by intersecting them,
+or by subtracting one shape from the other.")
+    (home-page "http://www.opencsg.org/")
+    (license license:gpl2)))
-- 
2.23.0