[PATCH] gnu: Add bgfx

OpenSubmitted by Andy Tai.
Details
4 participants
  • Andy Tai
  • Leo Prikler
  • Andy Tai
  • Tobias Geerinckx-Rice
Owner
unassigned
Severity
normal
Blocked by
A
A
Andy Tai wrote on 14 Aug 2021 10:35
(address . guix-patches@gnu.org)
CAJsg1E-vKn6LebAFgYsTNF3YbtV=TvQcJaqU32orKFFoyA5N3g@mail.gmail.com
* gnu/packages/graphics.scm (bgfx): New variable
---
gnu/packages/graphics.scm | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)

Toggle diff (49 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 38feb27c87..53ac12f731 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -2000,3 +2000,41 @@ 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 "65513d08541ab1ead814f2c97d0502c8d13eae68")
+        (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)
+           ;; Fetch git submodules
+           (recursive? #t)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "1k18230zw3v2l0vgz5xi0l23fa0686yx0jd6hkvvvwp3zlakqp7n"))))
+      (build-system cmake-build-system)
+      (arguments
+       `(#:tests? #f)) ;; no tests
+      (inputs
+       `(("glslang" ,glslang)
+         ("libxcb" ,libxcb)
+         ("opengl" ,mesa)
+         ("vulkan-loader" ,vulkan-loader)))
+      (native-inputs
+       `(("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:expat license:cc0)))))
-- 
2.32.0
A
A
Andy Tai wrote on 14 Aug 2021 10:51
Re: bug#50054: Acknowledgement ([PATCH] gnu: Add bgfx)
(address . 50054@debbugs.gnu.org)
CAJsg1E-wuXM+GKTHX9csGDHFtGFSD=qLGwLTnhE3gHUL9RhX=w@mail.gmail.com
On Sat, Aug 14, 2021 at 1:37 AM GNU bug Tracking System
<help-debbugs@gnu.org> wrote:
Toggle quote (25 lines)
>
> Thank you for filing a new bug report with debbugs.gnu.org.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
> guix-patches@gnu.org
>
> If you wish to submit further information on this problem, please
> send it to 50054@debbugs.gnu.org.
>
> Please do not send mail to help-debbugs@gnu.org unless you wish
> to report a problem with the Bug-tracking system.
>
> --
> 50054: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=50054
> GNU Bug Tracking System
> Contact help-debbugs@gnu.org with problems



--
Andy Tai, atai@atai.org
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能
From 998232936a491ace0383fbcff968029a81c12c1e Mon Sep 17 00:00:00 2001
From: Andy Tai <atai@atai.org>
Date: Sat, 14 Aug 2021 01:31:34 -0700
Subject: [PATCH] gnu: Add bgfx
To: guix-patches@gnu.org

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

Toggle diff (48 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 38feb27c87..a07c3067fb 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -2000,3 +2000,41 @@ 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 "65513d08541ab1ead814f2c97d0502c8d13eae68")
+        (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)
+           ;; Fetch git submodules
+           (recursive? #t)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "1k18230zw3v2l0vgz5xi0l23fa0686yx0jd6hkvvvwp3zlakqp7n"))))
+      (build-system cmake-build-system)
+      (arguments
+       `(#:tests? #f)) ;; no tests
+      (inputs
+       `(("glslang" ,glslang)
+         ("libxcb" ,libxcb)
+         ("opengl" ,mesa)
+         ("vulkan-loader" ,vulkan-loader)))
+      (native-inputs
+       `(("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.32.0
L
L
Leo Prikler wrote on 14 Aug 2021 11:43
Re: [PATCH] gnu: Add bgfx
b1ce9ca702f3ef31b17a17d5c7c75fc3bfa1f47a.camel@student.tugraz.at
Hi,

Am Samstag, den 14.08.2021, 01:35 -0700 schrieb Andy Tai:
Toggle quote (33 lines)
> * gnu/packages/graphics.scm (bgfx): New variable
> ---
> gnu/packages/graphics.scm | 38
> ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
>
> diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
> index 38feb27c87..53ac12f731 100644
> --- a/gnu/packages/graphics.scm
> +++ b/gnu/packages/graphics.scm
> @@ -2000,3 +2000,41 @@ 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 "65513d08541ab1ead814f2c97d0502c8d13eae68")
> + (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)
> + ;; Fetch git submodules
> + (recursive? #t)))
The use of submodules is discouraged because it's often hard to reason
about them. This is such a case. bgfx and the other submodules each
vendor a bunch of dependencies on top of the binaries that e.g. bx
ships as part of their tools repo.
Toggle quote (19 lines)
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "1k18230zw3v2l0vgz5xi0l23fa0686yx0jd6hkvvvwp3zlakqp7n")))
> )
> + (build-system cmake-build-system)
> + (arguments
> + `(#:tests? #f)) ;; no tests
> + (inputs
> + `(("glslang" ,glslang)
> + ("libxcb" ,libxcb)
> + ("opengl" ,mesa)
> + ("vulkan-loader" ,vulkan-loader)))
> + (native-inputs
> + `(("pkg-config" ,pkg-config)
> + ("vulkan-headers" ,vulkan-headers)))
> + (home-page "https://github.com/bkaradzic/bgfx")
> + (synopsis "Cross-platform, graphics API agnostic. rendering
> library")
A dot too much :)
Toggle quote (5 lines)
> + (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:expat license:cc0)))))
A
A
Andy Tai wrote on 14 Aug 2021 20:07
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 50054@debbugs.gnu.org)
CAJsg1E-fyZ=vWtt2UXGXbtS07+z3ZxZgmu+09ozzaAhR9jM+2w@mail.gmail.com
Question: then how in the package definition can I check out
submpodule repos and make them in the same relative positions for the
build to work?

On Sat, Aug 14, 2021 at 2:43 AM Leo Prikler
<leo.prikler@student.tugraz.at> wrote:
Toggle quote (8 lines)
>
> Hi,
>
> Am Samstag, den 14.08.2021, 01:35 -0700 schrieb Andy Tai:
> > * gnu/packages/graphics.scm (bgfx): New variable
> > ---
> > gnu/packages/graphics.scm | 38
> > ++++++++++++++++++++++++++++++++++++++
...
Toggle quote (20 lines)
> > + (method git-fetch)
> > + (uri
> > + (git-reference
> > + (url "https://github.com/bkaradzic/bgfx.cmake")
> > + (commit commit)
> > + ;; Fetch git submodules
> > + (recursive? #t)))
> The use of submodules is discouraged because it's often hard to reason
> about them. This is such a case. bgfx and the other submodules each
> vendor a bunch of dependencies on top of the binaries that e.g. bx
> ships as part of their tools repo.
> > + (file-name (git-file-name name version))
> > + (sha256
> > + (base32
> > + "1k18230zw3v2l0vgz5xi0l23fa0686yx0jd6hkvvvwp3zlakqp7n")))
> > )
> > +
>


--
Andy Tai, atai@atai.org
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能
A
A
Andy Tai wrote on 14 Aug 2021 20:24
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 50054@debbugs.gnu.org)
CAJsg1E-vVB8NE=Zd9F_85n_oBwRpTbbn1cXa+kcmmT998Mo21g@mail.gmail.com
Or your intent is that each repo should be a separate package in guix,
like bgfx with its three git repos shall be three packages in guix?

On Sat, Aug 14, 2021 at 11:07 AM Andy Tai <lichengtai@gmail.com> wrote:
Toggle quote (44 lines)
>
> Question: then how in the package definition can I check out
> submpodule repos and make them in the same relative positions for the
> build to work?
>
> On Sat, Aug 14, 2021 at 2:43 AM Leo Prikler
> <leo.prikler@student.tugraz.at> wrote:
> >
> > Hi,
> >
> > Am Samstag, den 14.08.2021, 01:35 -0700 schrieb Andy Tai:
> > > * gnu/packages/graphics.scm (bgfx): New variable
> > > ---
> > > gnu/packages/graphics.scm | 38
> > > ++++++++++++++++++++++++++++++++++++++
> ...
> > > + (method git-fetch)
> > > + (uri
> > > + (git-reference
> > > + (url "https://github.com/bkaradzic/bgfx.cmake")
> > > + (commit commit)
> > > + ;; Fetch git submodules
> > > + (recursive? #t)))
> > The use of submodules is discouraged because it's often hard to reason
> > about them. This is such a case. bgfx and the other submodules each
> > vendor a bunch of dependencies on top of the binaries that e.g. bx
> > ships as part of their tools repo.
> > > + (file-name (git-file-name name version))
> > > + (sha256
> > > + (base32
> > > + "1k18230zw3v2l0vgz5xi0l23fa0686yx0jd6hkvvvwp3zlakqp7n")))
> > > )
> > > +
> >
>
>
> --
> Andy Tai, atai@atai.org
> Year 2021 民國110年
> 自動的精神力是信仰與覺悟
> 自動的行為力是勞動與技能



--
Andy Tai, atai@atai.org
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能
L
L
Leo Prikler wrote on 14 Aug 2021 20:48
(name . Andy Tai)(address . lichengtai@gmail.com)(address . 50054@debbugs.gnu.org)
ea722086ee5abb67e3dd04ff8c4a4383a47a6ee6.camel@student.tugraz.at
If possible, we should have one package per repo with everything nasty
in that repo removed. I realize that's a lot more to ask for than
simply "a package that builds", but we do have some standards.

Optionally, if it's really not possible, you can still go for various
merged origins, but I should stress that in that case you also ought to
filter out the nasty stuff. It's usually easier to do that if you have
one package for whatever you could reason to be a package upstream.

Am Samstag, den 14.08.2021, 11:24 -0700 schrieb Andy Tai:
Toggle quote (50 lines)
> Or your intent is that each repo should be a separate package in
> guix,
> like bgfx with its three git repos shall be three packages in guix?
>
> On Sat, Aug 14, 2021 at 11:07 AM Andy Tai <lichengtai@gmail.com>
> wrote:
> > Question: then how in the package definition can I check out
> > submpodule repos and make them in the same relative positions for
> > the
> > build to work?
> >
> > On Sat, Aug 14, 2021 at 2:43 AM Leo Prikler
> > <leo.prikler@student.tugraz.at> wrote:
> > > Hi,
> > >
> > > Am Samstag, den 14.08.2021, 01:35 -0700 schrieb Andy Tai:
> > > > * gnu/packages/graphics.scm (bgfx): New variable
> > > > ---
> > > > gnu/packages/graphics.scm | 38
> > > > ++++++++++++++++++++++++++++++++++++++
> > ...
> > > > + (method git-fetch)
> > > > + (uri
> > > > + (git-reference
> > > > + (url "https://github.com/bkaradzic/bgfx.cmake")
> > > > + (commit commit)
> > > > + ;; Fetch git submodules
> > > > + (recursive? #t)))
> > > The use of submodules is discouraged because it's often hard to
> > > reason
> > > about them. This is such a case. bgfx and the other submodules
> > > each
> > > vendor a bunch of dependencies on top of the binaries that e.g.
> > > bx
> > > ships as part of their tools repo.
> > > > + (file-name (git-file-name name version))
> > > > + (sha256
> > > > + (base32
> > > > + "1k18230zw3v2l0vgz5xi0l23fa0686yx0jd6hkvvvwp3zlakqp
> > > > 7n")))
> > > > )
> > > > +
> >
> > --
> > Andy Tai, atai@atai.org
> > Year 2021 民國110年
> > 自動的精神力是信仰與覺悟
> > 自動的行為力是勞動與技能
>
>
A
A
Andy Tai wrote on 16 Aug 2021 14:42
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 50054@debbugs.gnu.org)
CAJsg1E-GvNKOFbTUMMg_Kjxy=CKrR+OP2LnO14JMYVZE6eTpdg@mail.gmail.com
Leo, by "nasty stuff" you meant non-free stuff (I doubt if there is
any in a graphics library but will check), or you meant the embedded
packages that shall be reference to other packages in guix (if
packaged already)? I think the embedded copies of other stuff may
have local customization that may make it impossible to simply build
with the existing packages in guix.

On Sat, Aug 14, 2021 at 11:48 AM Leo Prikler
<leo.prikler@student.tugraz.at> wrote:
Toggle quote (9 lines)
>
> If possible, we should have one package per repo with everything nasty
> in that repo removed. I realize that's a lot more to ask for than
> simply "a package that builds", but we do have some standards.
>
> Optionally, if it's really not possible, you can still go for various
> merged origins, but I should stress that in that case you also ought to
> filter out the nasty stuff. It's usually easier to do that if you have
> one package for whatever you could reason to be a package upstream.
L
L
Leo Prikler wrote on 16 Aug 2021 14:52
(name . Andy Tai)(address . lichengtai@gmail.com)(address . 50054@debbugs.gnu.org)
b69efaa44a899aa9eef0316d8dd3f5166313e14d.camel@student.tugraz.at
Hi,

Am Montag, den 16.08.2021, 05:42 -0700 schrieb Andy Tai:
Toggle quote (6 lines)
> Leo, by "nasty stuff" you meant non-free stuff (I doubt if there is
> any in a graphics library but will check), or you meant the embedded
> packages that shall be reference to other packages in guix (if
> packaged already)? I think the embedded copies of other stuff may
> have local customization that may make it impossible to simply build
> with the existing packages in guix.
Nasty stuff are not only already existing packages, but also outdated
versions thereof. If there are heavily customized versions or packages
not yet included in Guix, then those can be left in (but with a
remark!), though in the long term it would be better to make those
packages work with upstream versions rather than require specific
tweaking.

The other thing I already mentioned are binaries, which upstream seems
also aware about, see e.g.

Regards
A
A
Andy Tai wrote on 27 Aug 2021 19:49
dependency
(address . 50054@debbugs.gnu.org)
CAJsg1E-BigkWVUY0euC4s8Aur3_8q6c3yLqP-Cq+n2VCtp5Tww@mail.gmail.com
The following bug should be a prerequisite of this bug

adding build tool genie to guix as a package
T
T
Tobias Geerinckx-Rice wrote on 27 Aug 2021 20:27
(no subject)
(name . Control)(address . control@debbugs.gnu.org)
c33db2de2e21fa7c634788cda2841980@tobias.gr
block 50054 by 50229
T
T
Tobias Geerinckx-Rice wrote on 27 Aug 2021 20:31
Re: [bug#50054] dependency
(name . Andy Tai)(address . atai@atai.org)(address . 50054@debbugs.gnu.org)
3cd5adb94761b3fecc467fbd5abf4409@tobias.gr
On 2021-08-27 19:49, Andy Tai wrote:
Toggle quote (5 lines)
> The following bug should be a prerequisite of this bug
>
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=50229
> adding build tool genie to guix as a package

Done:


block 50054 by 50229

Kind regards,

T (it's aliiive) G-R

Sent from a Web browser. Excuse or enjoy my brevity.
A
A
Andy Tai wrote on 29 Aug 2021 05:16
Re: [PATCH] gnu: Add bgfx
(address . 50054@debbugs.gnu.org)
CAJsg1E_5VfUjd-PLoLP9G2U5FfJZ-wt+v4qvfsXkWGY5NWf3Zg@mail.gmail.com
updated patch attached:

directly checking out source rather than replying on git submodule

first attempt at removing "nasty" stuff, removing bx/tools/bin

On Mon, Aug 16, 2021 at 5:52 AM Leo Prikler
<leo.prikler@student.tugraz.at> wrote:
Toggle quote (20 lines)
>
> Hi,
>
> Am Montag, den 16.08.2021, 05:42 -0700 schrieb Andy Tai:
> > Leo, by "nasty stuff" you meant non-free stuff (I doubt if there is
> > any in a graphics library but will check), or you meant the embedded
> > packages that shall be reference to other packages in guix (if
> > packaged already)? I think the embedded copies of other stuff may
> > have local customization that may make it impossible to simply build
> > with the existing packages in guix.
> Nasty stuff are not only already existing packages, but also outdated
> versions thereof. If there are heavily customized versions or packages
> not yet included in Guix, then those can be left in (but with a
> remark!), though in the long term it would be better to make those
> packages work with upstream versions rather than require specific
> tweaking.
>
> The other thing I already mentioned are binaries, which upstream seems
> also aware about, see e.g.
> https://github.com/bkaradzic/bgfx/commit/caed3f91026bf0e703f1eaf6f622e27b820df86c
From 12fa8bfe0766d493c0a2aeb01490e2513d6b709b 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(+)

Toggle diff (84 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 38feb27c87..ba3d401311 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -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
A
A
Andy Tai wrote on 29 Aug 2021 05:25
(address . 50054@debbugs.gnu.org)
CAJsg1E_56n1URitX-YShd4WnAbKcwr=PaA0__dd-HRFuyweKgw@mail.gmail.com
updated patch attached:

directly checking out additional source repos rather than relying on
git submodule

first attempt at removing "nasty" stuff, removing bx/tools/bin

Toggle quote (22 lines)
> On Mon, Aug 16, 2021 at 5:52 AM Leo Prikler
> <leo.prikler@student.tugraz.at> wrote:
> >
> > Hi,
> >
> > Am Montag, den 16.08.2021, 05:42 -0700 schrieb Andy Tai:
> > > Leo, by "nasty stuff" you meant non-free stuff (I doubt if there is
> > > any in a graphics library but will check), or you meant the embedded
> > > packages that shall be reference to other packages in guix (if
> > > packaged already)? I think the embedded copies of other stuff may
> > > have local customization that may make it impossible to simply build
> > > with the existing packages in guix.
> > Nasty stuff are not only already existing packages, but also outdated
> > versions thereof. If there are heavily customized versions or packages
> > not yet included in Guix, then those can be left in (but with a
> > remark!), though in the long term it would be better to make those
> > packages work with upstream versions rather than require specific
> > tweaking.
> >
> > The other thing I already mentioned are binaries, which upstream seems
> > also aware about, see e.g.
> > https://github.com/bkaradzic/bgfx/commit/caed3f91026bf0e703f1eaf6f622e27b820df86c
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(+)

Toggle diff (84 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 38feb27c87..3c34e31a07 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -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
A
A
Andy Tai wrote on 29 Aug 2021 06:29
(address . 50054@debbugs.gnu.org)
CAJsg1E9zF591MxhCFekOtheVB0CU2zwNPxD9MKAb=YvV1DFE0A@mail.gmail.com
further update

building the examples and the tools from source

On Sat, Aug 28, 2021 at 8:25 PM Andy Tai <lichengtai@gmail.com> wrote:
Toggle quote (33 lines)
>
> updated patch attached:
>
> directly checking out additional source repos rather than relying on
> git submodule
>
> first attempt at removing "nasty" stuff, removing bx/tools/bin
>
> > On Mon, Aug 16, 2021 at 5:52 AM Leo Prikler
> > <leo.prikler@student.tugraz.at> wrote:
> > >
> > > Hi,
> > >
> > > Am Montag, den 16.08.2021, 05:42 -0700 schrieb Andy Tai:
> > > > Leo, by "nasty stuff" you meant non-free stuff (I doubt if there is
> > > > any in a graphics library but will check), or you meant the embedded
> > > > packages that shall be reference to other packages in guix (if
> > > > packaged already)? I think the embedded copies of other stuff may
> > > > have local customization that may make it impossible to simply build
> > > > with the existing packages in guix.
> > > Nasty stuff are not only already existing packages, but also outdated
> > > versions thereof. If there are heavily customized versions or packages
> > > not yet included in Guix, then those can be left in (but with a
> > > remark!), though in the long term it would be better to make those
> > > packages work with upstream versions rather than require specific
> > > tweaking.
> > >
> > > The other thing I already mentioned are binaries, which upstream seems
> > > also aware about, see e.g.
> > > https://github.com/bkaradzic/bgfx/commit/caed3f91026bf0e703f1eaf6f622e27b820df86c



--
Andy Tai, atai@atai.org
Year 2021 民國110年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能
From f772db933bba365e435e96f9441b5017305c8a04 Mon Sep 17 00:00:00 2001
From: Andy Tai <atai@atai.org>
Date: Sat, 28 Aug 2021 21:27:36 -0700
Subject: [PATCH] gnu: Add bgfx
To: guix-patches@gnu.org

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

Toggle diff (92 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 38feb27c87..3027eac61e 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -2000,3 +2000,85 @@ 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
+       `(#:configure-flags
+         '("-DBGFX_BUILD_TOOLS=TRUE"
+           "-DBGFX_BUILD_EXAMPLES=TRUE")
+
+         #: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 upstream git repos
+               (delete-file-recursively "bx/tools/bin")
+               ;; delete extra 3rd party code not needed for bgfx to function on Guix
+               ;; note dear-imgui local copy in bgfx heavily modified from original upstream
+               ;; so we for now can not use the upstream dear-imgui for bgfx
+               (delete-file-recursively "bgfx/3rdparty/dxsdk")
+               #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
L
L
Leo Prikler wrote on 29 Aug 2021 13:41
(name . Andy Tai)(address . lichengtai@gmail.com)(address . 50054@debbugs.gnu.org)
06bebf1e2ab2d17f465e0c48c58a82e38a88fe94.camel@student.tugraz.at
Hi,

Am Samstag, den 28.08.2021, 21:29 -0700 schrieb Andy Tai:
Toggle quote (15 lines)
> further update
>
> building the examples and the tools from source
>
> On Sat, Aug 28, 2021 at 8:25 PM Andy Tai <lichengtai@gmail.com>
> wrote:
> > updated patch attached:
> >
> > directly checking out additional source repos rather than relying
> > on
> > git submodule
> >
> > first attempt at removing "nasty" stuff, removing bx/tools/bin
> > [...]

First things first, this still does a build of everything at once
rather than one package per repo. Have you looked into the one package
per repo thing and decided that it's not possible or do you simply
continue with the package as-is because it builds?

Even if you want to do a merged build, binaries, vendored dependencies,
etc. ought to be removed in the origins, not at build time. I suggest
you use a computed origin to merge the three and remove all those
things.

Regards
A
A
Andy Tai wrote on 29 Aug 2021 20:21
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 50054@debbugs.gnu.org)
CAJsg1E-+chrT5szkQ_76LemLj4mncbmCcyX4MKfzYpxFkksVsA@mail.gmail.com
Toggle quote (6 lines)
> First things first, this still does a build of everything at once
> rather than one package per repo. Have you looked into the one package
> per repo thing and decided that it's not possible or do you simply
> continue with the package as-is because it builds?
>

Hi, the author of the upstream is very opinionated; this is how how
arranges the things for this package and his documentation on how to
build mentions checking out all three repos and build them together.
I can look into his build system setup to try to build each repo
separately but that means I need to maintain custom build inside the
package and normally I don't think distribution package maintainers
want to go into inside the package to setup alternative build
processes separate from upstream--what goes inside the package is best
left to the author. If you maintain essentially separate build
scripts in the original package in terms of cmake or genie, that is
outside the scope of guix and hard to maintain as you need to keep up
with new releases.

Toggle quote (6 lines)
> Even if you want to do a merged build, binaries, vendored dependencies,
> etc. ought to be removed in the origins, not at build time. I suggest
> you use a computed origin to merge the three and remove all those
> things.
>

Is there a "computed origin" example in existing package receipts in guix?
L
L
Leo Prikler wrote on 29 Aug 2021 22:04
(name . Andy Tai)(address . lichengtai@gmail.com)(address . 50054@debbugs.gnu.org)
f4301a437ac5661b584bac25abf8666e1cd4448b.camel@student.tugraz.at
Hi

Am Sonntag, den 29.08.2021, 11:21 -0700 schrieb Andy Tai:
Toggle quote (10 lines)
> > First things first, this still does a build of everything at once
> > rather than one package per repo. Have you looked into the one
> > package
> > per repo thing and decided that it's not possible or do you simply
> > continue with the package as-is because it builds?
> >
>
> Hi, the author of the upstream is very opinionated; this is how how
> arranges the things for this package and his documentation on how to
> build mentions checking out all three repos and build them together.
I wouldn't read too much into that. Just because they put those
directories next to each other doesn't mean Guix is forced to do the
same. Many people have their shells in /bin/bash. Some use
/usr/bin/bash. Neither exists in Guix and we still manage to somehow
ship bash.

Plus, according to upstream, the CMake structure is literally an
alternative build system and there are several versions of it,
suggesting that it shouldn't be particularly hard to adapt bgfx to
something else.

Toggle quote (9 lines)
> I can look into his build system setup to try to build each repo
> separately but that means I need to maintain custom build inside the
> package and normally I don't think distribution package maintainers
> want to go into inside the package to setup alternative build
> processes separate from upstream--what goes inside the package is
> best left to the author. If you maintain essentially separate build
> scripts in the original package in terms of cmake or genie, that is
> outside the scope of guix and hard to maintain as you need to keep up
> with new releases.
People have rolled their own Makefiles for decades and Guix has a way
of coping with that. You simply need to delete bootstrap and configure
from gnu-build-system or replace them with whatever command upstream
uses.

Toggle quote (10 lines)
> > Even if you want to do a merged build, binaries, vendored
> > dependencies,
> > etc. ought to be removed in the origins, not at build time. I
> > suggest
> > you use a computed origin to merge the three and remove all those
> > things.
> >
>
> Is there a "computed origin" example in existing package receipts in
> guix?
There are few examples, as computed origins are typically only used
with huge pieces of software that need large patches to throw away
proprietary blobs. See the linux kernel or chromium.

Regards
A
A
Andy Tai wrote on 30 Aug 2021 01:59
(name . Leo Prikler)(address . leo.prikler@student.tugraz.at)(address . 50054@debbugs.gnu.org)
CAJsg1E_+4nAqVq6jQh2L9snoNStyFpFAacESygqzn+wLtxssyg@mail.gmail.com
Related, this patch


adds genie to guix which may be required to build these repos
individually, but no response on that patch (independent of this one)
so far
?