From 1b55b4ef74177d22fd695910bf75ae3d89ad0b90 Mon Sep 17 00:00:00 2001
From: Andy Tai <atai@atai.org>
Date: Sat, 28 Aug 2021 20:12:52 -0700
Subject: [PATCH] gnu: Add bgfx
To: guix-patches@gnu.org
* gnu/packages/graphics.scm (bgfx): New variable
---
gnu/packages/graphics.scm | 74 +++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
@@ -2000,3 +2000,77 @@ Some feature highlights:
such as VR and AR on mobile, PC/desktop, and any other device. Monado aims to be
a complete and conforming implementation of the OpenXR API made by Khronos.")
(license license:boost1.0)))
+
+(define-public bgfx
+ (let ((commit "b029632186b897a7d65486f9809d65b3eb900abf")
+ (revision "0"))
+ (package
+ (name "bgfx")
+ (version
+ (git-version "0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/bkaradzic/bgfx.cmake")
+ (commit commit)))
+ (file-name (git-file-name "bgfx.cmake" version))
+ (sha256
+ (base32
+ "1j19a0ya1mi8vls6696b4zyb573hk8qil9lrzqd2anlrfn2xn395"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'unpack-submodule-sources
+ (lambda* (#:key inputs #:allow-other-keys)
+ (delete-file-recursively "bx")
+ (delete-file-recursively "bimg")
+ (delete-file-recursively "bgfx")
+
+ (copy-recursively (assoc-ref inputs "bx")
+ "./bx")
+ (copy-recursively (assoc-ref inputs "bimg")
+ "./bimg")
+ (copy-recursively (assoc-ref inputs "bgfx")
+ "./bgfx")
+ ;; delete binaries from source git
+ (delete-file-recursively "bx/tools/bin")
+ #t)))
+
+ #:tests? #f)) ;; no tests
+ (inputs
+ `(("glslang" ,glslang)
+ ("libxcb" ,libxcb)
+ ("opengl" ,mesa)
+ ("vulkan-loader" ,vulkan-loader)))
+ (native-inputs
+ (let ((additional-repo (lambda (url commit name hash)
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url url)
+ (commit commit)))
+ (file-name (git-file-name name commit))
+ (sha256 (base32 hash))))))
+ `(("bx"
+ ,(additional-repo "https://github.com/bkaradzic/bx"
+ "9978d894cb54efc0fcb874461f3127cbe8e55b33"
+ "bx" "0r98x2fdklldvkswda1hld6igzd0kzm21d0fhfdwi6401a718dyx"))
+ ("bimg"
+ ,(additional-repo "https://github.com/bkaradzic/bimg"
+ "0b6febf2b0ba07f5fd5de6a30acaf7c3afdb9921"
+ "bimg" "1a0d43ryv6hzssq18ri0rqb1zvqs62x7qp98mdc5qhgbn46bqg9z"))
+ ("bgfx"
+ ,(additional-repo "https://github.com/bkaradzic/bgfx"
+ "f26885aaed87ce6c39e8862212d62f82ff4a93ac"
+ "bgfx" "037h4m4kxxl9ii5f7bs8gwihcih0ydzkv5bh0jx1s22g3bbkvkr0"))
+ ("pkg-config" ,pkg-config)
+ ("vulkan-headers" ,vulkan-headers))))
+ (home-page "https://github.com/bkaradzic/bgfx")
+ (synopsis "Cross-platform, graphics API agnostic, rendering library")
+ (description "bgfx is a cross-platform, graphics API agnostic,
+'Bring Your Own Engine/Framework' style rendering library supporting Direct3D,
+OpenGL, Metal, Vulkan and WebGL.")
+ (license (list license:bsd-2 license:cc0)))))
--
2.33.0