gl.scm 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
  3. ;;; Copyright © 2013 Joshua Grant <tadni@riseup.net>
  4. ;;; Copyright © 2014, 2016 David Thompson <davet@gnu.org>
  5. ;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
  6. ;;; Copyright © 2016 Nikita <nikita@n0.is>
  7. ;;; Copyright © 2016, 2017, 2018, 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
  8. ;;; Copyright © 2016 David Thompson <davet@gnu.org>
  9. ;;; Copyright © 2017, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
  10. ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
  11. ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
  12. ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  13. ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
  14. ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
  15. ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
  16. ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  17. ;;; Copyright © 2020 Kei Kebreau <kkebreau@posteo.net>
  18. ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
  19. ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
  20. ;;;
  21. ;;; This file is part of GNU Guix.
  22. ;;;
  23. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  24. ;;; under the terms of the GNU General Public License as published by
  25. ;;; the Free Software Foundation; either version 3 of the License, or (at
  26. ;;; your option) any later version.
  27. ;;;
  28. ;;; GNU Guix is distributed in the hope that it will be useful, but
  29. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  30. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  31. ;;; GNU General Public License for more details.
  32. ;;;
  33. ;;; You should have received a copy of the GNU General Public License
  34. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  35. (define-module (gnu packages gl)
  36. #:use-module (gnu packages)
  37. #:use-module (gnu packages autotools)
  38. #:use-module (gnu packages bison)
  39. #:use-module (gnu packages compression)
  40. #:use-module (gnu packages documentation)
  41. #:use-module (gnu packages elf)
  42. #:use-module (gnu packages flex)
  43. #:use-module (gnu packages fontutils)
  44. #:use-module (gnu packages freedesktop)
  45. #:use-module (gnu packages gettext)
  46. #:use-module (gnu packages guile)
  47. #:use-module (gnu packages image)
  48. #:use-module (gnu packages linux)
  49. #:use-module (gnu packages llvm)
  50. #:use-module (gnu packages mono)
  51. #:use-module (gnu packages pkg-config)
  52. #:use-module (gnu packages python)
  53. #:use-module (gnu packages python-xyz)
  54. #:use-module (gnu packages tls)
  55. #:use-module (gnu packages video)
  56. #:use-module (gnu packages vulkan)
  57. #:use-module (gnu packages xdisorg)
  58. #:use-module (gnu packages xml)
  59. #:use-module (gnu packages xorg)
  60. #:use-module (guix download)
  61. #:use-module (guix git-download)
  62. #:use-module (guix hg-download)
  63. #:use-module (guix build-system gnu)
  64. #:use-module (guix build-system cmake)
  65. #:use-module (guix build-system meson)
  66. #:use-module (guix build-system waf)
  67. #:use-module ((guix licenses) #:prefix license:)
  68. #:use-module (guix packages)
  69. #:use-module (guix utils)
  70. #:use-module (ice-9 match)
  71. #:use-module ((srfi srfi-1) #:hide (zip)))
  72. (define-public glu
  73. (package
  74. (name "glu")
  75. (version "9.0.1")
  76. (source (origin
  77. (method url-fetch)
  78. (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/glu/glu-"
  79. version ".tar.gz"))
  80. (sha256
  81. (base32
  82. "1xqhk9bn10nbvffw3r4p4rjslwz1l7gaycc0x2pqkr2irp7q9x7n"))))
  83. (build-system gnu-build-system)
  84. (propagated-inputs
  85. `(("mesa" ,mesa))) ; according to glu.pc
  86. (home-page "http://www.opengl.org/archives/resources/faq/technical/glu.htm")
  87. (synopsis "Mesa OpenGL Utility library")
  88. (description
  89. "GLU, or OpenGL Utility Library provides some higher-level functionality
  90. not provided by just OpenGL itself. Some of GLU's Features
  91. include: Scaling of 2D images and creation of mipmap pyramids,
  92. Transformation of object coordinates into device coordinates and
  93. vice versa, Support for NURBS surfaces, Support for tessellation
  94. of concave or bow tie polygonal primitives, Specialty transformation
  95. matrices for creating perspective and orthographic projections,
  96. positioning a camera, and selection/picking, Rendering of disk,
  97. cylinder, and sphere primitives, Interpreting OpenGL error values
  98. as ASCII text.")
  99. (license (license:x11-style "http://directory.fsf.org/wiki/License:SGIFreeBv2"))))
  100. (define-public freeglut
  101. (package
  102. (name "freeglut")
  103. (version "3.2.1")
  104. (source (origin
  105. (method url-fetch)
  106. (uri (string-append
  107. "mirror://sourceforge/freeglut/freeglut/"
  108. version "/freeglut-" version ".tar.gz"))
  109. (patches (search-patches "freeglut-gcc-compat.patch"))
  110. (sha256
  111. (base32
  112. "0s6sk49q8ijgbsrrryb7dzqx2fa744jhx1wck5cz5jia2010w06l"))))
  113. (build-system cmake-build-system)
  114. (arguments
  115. '(#:tests? #f ;no test target
  116. #:configure-flags '("-DFREEGLUT_BUILD_STATIC_LIBS=OFF")))
  117. (inputs `(("libx11" ,libx11)
  118. ("libxi" ,libxi)
  119. ("libxrandr" ,libxrandr)
  120. ("libxxf86vm" ,libxxf86vm)))
  121. (propagated-inputs
  122. ;; Headers from Mesa and GLU are needed.
  123. `(("glu" ,glu)
  124. ("mesa" ,mesa)))
  125. (home-page "http://freeglut.sourceforge.net/")
  126. (synopsis "Alternative to the OpenGL Utility Toolkit (GLUT)")
  127. (description
  128. "Freeglut is a completely Free/OpenSourced alternative to
  129. the OpenGL Utility Toolkit (GLUT) library. GLUT was originally
  130. written by Mark Kilgard to support the sample programs in the
  131. second edition OpenGL @code{RedBook}. Since then, GLUT has been used
  132. in a wide variety of practical applications because it is simple,
  133. widely available and highly portable.
  134. GLUT (and hence freeglut) allows the user to create and manage windows
  135. containing OpenGL contexts on a wide range of platforms and also read
  136. the mouse, keyboard and joystick functions. Freeglut is released under
  137. the X-Consortium license.")
  138. (license license:x11)))
  139. ;; Needed for "kiki".
  140. (define-public freeglut-2.8
  141. (package (inherit freeglut)
  142. (name "freeglut")
  143. (version "2.8.1")
  144. (source (origin
  145. (method url-fetch)
  146. (uri (string-append
  147. "mirror://sourceforge/freeglut/freeglut/"
  148. version "/freeglut-" version ".tar.gz"))
  149. (sha256
  150. (base32
  151. "16lrxxxd9ps9l69y3zsw6iy0drwjsp6m26d1937xj71alqk6dr6x"))))
  152. (build-system gnu-build-system)
  153. (arguments
  154. '(#:configure-flags '("--disable-static")))))
  155. (define-public ftgl
  156. (package
  157. (name "ftgl")
  158. (version "2.4.0")
  159. (home-page "https://github.com/frankheckenbach/ftgl")
  160. (source (origin
  161. (method git-fetch)
  162. (uri (git-reference (url home-page)
  163. (commit (string-append "v" version))))
  164. (file-name (git-file-name name version))
  165. (sha256
  166. (base32
  167. "0zjs1h9w30gajq9lndzvjsa26rsmr1081lb1fbpbj10yhcdcsc79"))))
  168. (build-system gnu-build-system)
  169. (arguments
  170. `(#:configure-flags '("--disable-static")))
  171. ;; The pkg-config file lists "freetype2" as Requires.private.
  172. (propagated-inputs `(("freetype" ,freetype)))
  173. (inputs `(("libx11" ,libx11)
  174. ("mesa" ,mesa)
  175. ("glu" ,glu)))
  176. (native-inputs
  177. `(("pkg-config" ,pkg-config)
  178. ("autoconf" ,autoconf)
  179. ("automake" ,automake)
  180. ("libtool" ,libtool)))
  181. (synopsis "Font rendering library for OpenGL applications")
  182. (description
  183. "FTGL is a font rendering library for OpenGL applications. Supported
  184. rendering modes are: Bitmaps, Anti-aliased pixmaps, Texture maps, Outlines,
  185. Polygon meshes, and Extruded polygon meshes.")
  186. (license license:x11)))
  187. (define-public s2tc
  188. (package
  189. (name "s2tc")
  190. (version "1.0")
  191. (source
  192. (origin
  193. (method git-fetch)
  194. (uri (git-reference
  195. (url "https://github.com/divVerent/s2tc")
  196. (commit (string-append "v" version))))
  197. (file-name (git-file-name name version))
  198. (sha256
  199. (base32 "1fg323fk7wlv2xh6lw66wswgcv6qi8aaadk7c28h2f2lj1s7njnf"))))
  200. (build-system gnu-build-system)
  201. (native-inputs
  202. `(("autoconf" ,autoconf)
  203. ("automake" ,automake)
  204. ("libtool" ,libtool)))
  205. (inputs
  206. `(("mesa-headers" ,mesa-headers)))
  207. (home-page "https://github.com/divVerent/s2tc")
  208. (synopsis "S3 Texture Compression implementation")
  209. (description
  210. "S2TC is a patent-free implementation of S3 Texture Compression (S3TC,
  211. also known as DXTn or DXTC) for Mesa.")
  212. (license license:expat)))
  213. ;;; Mesa needs LibVA headers to build its Gallium-based VA API implementation;
  214. ;;; LibVA itself depends on Mesa. We use the following to solve the circular
  215. ;;; dependency.
  216. (define libva-without-mesa
  217. ;; Delay to work around circular import problem.
  218. (delay
  219. (package
  220. (inherit libva)
  221. (name "libva-without-mesa")
  222. (inputs `(,@(fold alist-delete (package-inputs libva)
  223. '("mesa" "wayland"))))
  224. (arguments
  225. (strip-keyword-arguments
  226. '(#:make-flags)
  227. (substitute-keyword-arguments (package-arguments libva)
  228. ((#:configure-flags flags)
  229. '(list "--disable-glx" "--disable-egl"))))))))
  230. (define-public mesa
  231. (package
  232. (name "mesa")
  233. (version "21.1.6")
  234. (source
  235. (origin
  236. (method url-fetch)
  237. (uri (list (string-append "https://mesa.freedesktop.org/archive/"
  238. "mesa-" version ".tar.xz")
  239. (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
  240. "mesa-" version ".tar.xz")
  241. (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
  242. version "/mesa-" version ".tar.xz")))
  243. (sha256
  244. (base32
  245. "0dwyk7cxlwna24ap23i8i92a2qcc6xhp16i03zzakpqiz4i03jxi"))
  246. (patches
  247. (search-patches "mesa-skip-tests.patch"))))
  248. (build-system meson-build-system)
  249. (propagated-inputs
  250. `(;; The following are in the Requires.private field of gl.pc.
  251. ("libdrm" ,libdrm)
  252. ("libvdpau" ,libvdpau)
  253. ("libx11" ,libx11)
  254. ("libxdamage" ,libxdamage)
  255. ("libxfixes" ,libxfixes)
  256. ("libxshmfence" ,libxshmfence)
  257. ("libxxf86vm" ,libxxf86vm)
  258. ("xorgproto" ,xorgproto)))
  259. (inputs
  260. `(("expat" ,expat)
  261. ("libelf" ,elfutils) ;required for r600 when using llvm
  262. ("libva" ,(force libva-without-mesa))
  263. ("libxml2" ,libxml2)
  264. ;; TODO: Add 'libxml2-python' for OpenGL ES 1.1 and 2.0 support
  265. ("libxrandr" ,libxrandr)
  266. ("libxvmc" ,libxvmc)
  267. ,@(match (%current-system)
  268. ((or "x86_64-linux" "i686-linux" "powerpc64le-linux" "aarch64-linux" "powerpc-linux")
  269. ;; Note: update the 'clang' input of mesa-opencl when bumping this.
  270. `(("llvm" ,llvm-11)))
  271. (_
  272. `()))
  273. ("wayland" ,wayland)
  274. ("wayland-protocols" ,wayland-protocols)))
  275. (native-inputs
  276. `(("bison" ,bison)
  277. ("flex" ,flex)
  278. ("gettext" ,gettext-minimal)
  279. ,@(match (%current-system)
  280. ((or "x86_64-linux" "i686-linux" "powerpc64le-linux" "aarch64-linux" "powerpc-linux")
  281. `(("glslang" ,glslang)))
  282. (_
  283. `()))
  284. ("pkg-config" ,pkg-config)
  285. ("python" ,python-wrapper)
  286. ("python-mako" ,python-mako)
  287. ("which" ,(@ (gnu packages base) which))))
  288. (outputs '("out" "bin"))
  289. (arguments
  290. `(#:configure-flags
  291. '(,@(match (%current-system)
  292. ((or "armhf-linux" "aarch64-linux")
  293. ;; TODO: Fix svga driver for non-Intel architectures.
  294. '("-Dgallium-drivers=etnaviv,freedreno,kmsro,lima,nouveau,panfrost,r300,r600,swrast,tegra,v3d,vc4,virgl"))
  295. ((or "powerpc64le-linux" "powerpc-linux")
  296. '("-Dgallium-drivers=nouveau,r300,r600,radeonsi,swrast,virgl"))
  297. (_
  298. '("-Dgallium-drivers=iris,nouveau,r300,r600,radeonsi,svga,swrast,virgl")))
  299. ;; Enable various optional features. TODO: opencl requires libclc,
  300. ;; omx requires libomxil-bellagio
  301. "-Dplatforms=x11,wayland"
  302. "-Dglx=dri" ;Thread Local Storage, improves performance
  303. ;; "-Dopencl=true"
  304. ;; "-Domx=true"
  305. "-Dosmesa=true"
  306. "-Dgallium-xa=enabled"
  307. ;; features required by wayland
  308. "-Dgles2=enabled"
  309. "-Dgbm=enabled"
  310. "-Dshared-glapi=enabled"
  311. ;; Explicitly enable Vulkan on some architectures.
  312. ,@(match (%current-system)
  313. ((or "i686-linux" "x86_64-linux")
  314. '("-Dvulkan-drivers=intel,amd"))
  315. ((or "powerpc64le-linux" "powerpc-linux")
  316. '("-Dvulkan-drivers=amd,swrast"))
  317. ("aarch64-linux"
  318. '("-Dvulkan-drivers=freedreno,amd,broadcom,swrast"))
  319. (_
  320. '("-Dvulkan-drivers=auto")))
  321. ;; Enable the Vulkan overlay layer on architectures using llvm.
  322. ,@(match (%current-system)
  323. ((or "x86_64-linux" "i686-linux" "powerpc64le-linux" "aarch64-linux" "powerpc-linux")
  324. '("-Dvulkan-overlay-layer=true"))
  325. (_
  326. '()))
  327. ;; Also enable the tests.
  328. "-Dbuild-tests=true"
  329. ;; on non-intel systems, drop i915 and i965
  330. ;; from the default dri drivers
  331. ,@(match (%current-system)
  332. ((or "x86_64-linux" "i686-linux")
  333. '("-Ddri-drivers=i915,i965,nouveau,r200,r100"
  334. "-Dllvm=enabled")) ; default is x86/x86_64 only
  335. ((or "powerpc64le-linux" "aarch64-linux" "powerpc-linux")
  336. '("-Ddri-drivers=nouveau,r200,r100"
  337. "-Dllvm=enabled"))
  338. (_
  339. '("-Ddri-drivers=nouveau,r200,r100"))))
  340. ;; XXX: 'debugoptimized' causes LTO link failures on some drivers. The
  341. ;; documentation recommends using 'release' for performance anyway.
  342. #:build-type "release"
  343. #:modules ((ice-9 match)
  344. (srfi srfi-1)
  345. (guix build utils)
  346. (guix build meson-build-system))
  347. #:phases
  348. (modify-phases %standard-phases
  349. (add-after 'unpack 'disable-failing-test
  350. (lambda _
  351. ,@(match (%current-system)
  352. ("powerpc64le-linux"
  353. ;; Disable some of the llvmpipe tests.
  354. `((substitute* "src/gallium/drivers/llvmpipe/lp_test_arit.c"
  355. (("0\\.5, ") ""))))
  356. ("powerpc-linux"
  357. ;; There are some tests which fail specifically on powerpc.
  358. `((substitute* '(;; LLVM ERROR: Relocation type not implemented yet!
  359. "src/gallium/drivers/llvmpipe/meson.build"
  360. ;; This is probably a big-endian test failure.
  361. "src/gallium/targets/osmesa/meson.build")
  362. (("if with_tests") "if not with_tests"))
  363. (substitute* "src/util/tests/format/meson.build"
  364. ;; This is definately an endian-ness test failure.
  365. (("'u_format_test', ") ""))
  366. ;; It is only this portion of the test which fails.
  367. (substitute* "src/mesa/main/tests/meson.build"
  368. ((".*mesa_formats.*") ""))
  369. ;; This test times out and receives SIGTERM.
  370. (substitute* "src/amd/common/meson.build"
  371. (("and not with_platform_windows") "and with_platform_windows"))))
  372. ("i686-linux"
  373. ;; Disable new test from Mesa 19 that fails on i686. Upstream
  374. ;; report: <https://bugs.freedesktop.org/show_bug.cgi?id=110612>.
  375. `((substitute* "src/util/tests/format/meson.build"
  376. (("'u_format_test',") ""))))
  377. ("aarch64-linux"
  378. ;; The ir3_disasm test segfaults.
  379. ;; The simplest way to skip it is to run a different test instead.
  380. `((substitute* "src/freedreno/ir3/meson.build"
  381. (("disasm\\.c'") "delay.c',\n link_args: ld_args_build_id"))))
  382. (_
  383. '((display "No tests to disable on this architecture.\n"))))))
  384. (add-after 'unpack 'fix-tests
  385. (lambda _
  386. ;; See <https://gitlab.freedesktop.org/mesa/mesa/-/issues/3181>.
  387. (substitute* "src/compiler/glsl/glcpp/tests/084-unbalanced-parentheses.c.expected"
  388. (("unexpected \\$end") "unexpected end of file"))
  389. #t))
  390. (add-before 'configure 'fix-dlopen-libnames
  391. (lambda* (#:key inputs outputs #:allow-other-keys)
  392. (let ((out (assoc-ref outputs "out")))
  393. ;; Remain agnostic to .so.X.Y.Z versions while doing
  394. ;; the substitutions so we're future-safe.
  395. (substitute* "src/glx/meson.build"
  396. (("-DGL_LIB_NAME=\"lib@0@\\.so\\.@1@\"")
  397. (string-append "-DGL_LIB_NAME=\"" out
  398. "/lib/lib@0@.so.@1@\"")))
  399. (substitute* "src/gbm/backends/dri/gbm_dri.c"
  400. (("\"libglapi\\.so")
  401. (string-append "\"" out "/lib/libglapi.so")))
  402. (substitute* "src/gbm/main/backend.c"
  403. ;; No need to patch the gbm_gallium_drm.so reference;
  404. ;; it's never installed since Mesa removed its
  405. ;; egl_gallium support.
  406. (("\"gbm_dri\\.so")
  407. (string-append "\"" out "/lib/dri/gbm_dri.so")))
  408. #t)))
  409. (add-after 'install 'split-outputs
  410. (lambda* (#:key outputs #:allow-other-keys)
  411. (let ((out (assoc-ref outputs "out"))
  412. (bin (assoc-ref outputs "bin")))
  413. ;; Not all architectures have the Vulkan overlay control script.
  414. (mkdir-p (string-append out "/bin"))
  415. (call-with-output-file (string-append out "/bin/.empty")
  416. (const #t))
  417. (copy-recursively (string-append out "/bin")
  418. (string-append bin "/bin"))
  419. (delete-file-recursively (string-append out "/bin")))))
  420. (add-after 'install 'symlinks-instead-of-hard-links
  421. (lambda* (#:key outputs #:allow-other-keys)
  422. ;; All the drivers and gallium targets create hard links upon
  423. ;; installation (search for "hardlink each megadriver instance"
  424. ;; in the makefiles). This is no good for us since we'd produce
  425. ;; nars that contain several copies of these files. Thus, turn
  426. ;; them into symlinks, which saves ~124 MiB.
  427. (let* ((out (assoc-ref outputs "out"))
  428. (lib (string-append out "/lib"))
  429. (files (find-files lib
  430. (lambda (file stat)
  431. (and (string-contains file ".so")
  432. (eq? 'regular
  433. (stat:type stat))))))
  434. (inodes (map (compose stat:ino stat) files)))
  435. (for-each (lambda (inode)
  436. (match (filter-map (match-lambda
  437. ((file ino)
  438. (and (= ino inode) file)))
  439. (zip files inodes))
  440. ((_)
  441. #f)
  442. ((reference others ..1)
  443. (format #t "creating ~a symlinks to '~a'~%"
  444. (length others) reference)
  445. (for-each delete-file others)
  446. (for-each (lambda (file)
  447. (if (string=? (dirname file)
  448. (dirname reference))
  449. (symlink (basename reference)
  450. file)
  451. (symlink reference file)))
  452. others))))
  453. (delete-duplicates inodes))
  454. #t))))))
  455. (home-page "https://mesa3d.org/")
  456. (synopsis "OpenGL and Vulkan implementations")
  457. (description "Mesa is a free implementation of the OpenGL and Vulkan
  458. specifications - systems for rendering interactive 3D graphics. A variety of
  459. device drivers allows Mesa to be used in many different environments ranging
  460. from software emulation to complete hardware acceleration for modern GPUs.")
  461. (license license:x11)))
  462. (define-public mesa-opencl
  463. (package/inherit mesa
  464. (name "mesa-opencl")
  465. (source (origin
  466. (inherit (package-source mesa))
  467. (patches (cons (search-patch "mesa-opencl-all-targets.patch")
  468. (origin-patches (package-source mesa))))))
  469. (arguments
  470. (substitute-keyword-arguments (package-arguments mesa)
  471. ((#:configure-flags flags)
  472. `(cons "-Dgallium-opencl=standalone" ,flags))))
  473. (inputs
  474. `(("libclc" ,libclc)
  475. ,@(package-inputs mesa)))
  476. (native-inputs
  477. `(("clang" ,clang-11)
  478. ,@(package-native-inputs mesa)))))
  479. (define-public mesa-opencl-icd
  480. (package/inherit mesa-opencl
  481. (name "mesa-opencl-icd")
  482. (arguments
  483. (substitute-keyword-arguments (package-arguments mesa)
  484. ((#:configure-flags flags)
  485. `(cons "-Dgallium-opencl=icd"
  486. ,(delete "-Dgallium-opencl=standalone" flags)))
  487. ((#:phases phases)
  488. `(modify-phases ,phases
  489. (add-after 'install 'mesa-icd-absolute-path
  490. (lambda _
  491. ;; Use absolute path for OpenCL platform library.
  492. ;; Otherwise we would have to set LD_LIBRARY_PATH=LIBRARY_PATH
  493. ;; for ICD in our applications to find OpenCL platform.
  494. (use-modules (guix build utils)
  495. (ice-9 textual-ports))
  496. (let* ((out (assoc-ref %outputs "out"))
  497. (mesa-icd (string-append out "/etc/OpenCL/vendors/mesa.icd"))
  498. (old-path (call-with-input-file mesa-icd get-string-all))
  499. (new-path (string-append out "/lib/" (string-trim-both old-path))))
  500. (if (file-exists? new-path)
  501. (call-with-output-file mesa-icd
  502. (lambda (port) (format port "~a\n" new-path)))))))))))))
  503. (define-public mesa-headers
  504. (package/inherit mesa
  505. (name "mesa-headers")
  506. (propagated-inputs '())
  507. (inputs '())
  508. (native-inputs '())
  509. (outputs '("out"))
  510. (arguments
  511. '(#:phases
  512. (modify-phases %standard-phases
  513. (delete 'configure)
  514. (delete 'build)
  515. (delete 'check)
  516. (replace 'install
  517. (lambda* (#:key outputs #:allow-other-keys)
  518. (copy-recursively "include" (string-append
  519. (assoc-ref outputs "out")
  520. "/include"))
  521. #t)))))))
  522. ;;; The mesa-demos distribution contains non-free files, many files with no
  523. ;;; clear license information, and many demos that aren't useful for most
  524. ;;; people, so we just use this for the mesa-utils package below, and possibly
  525. ;;; other packages in the future. This is modeled after Debian's solution.
  526. (define (mesa-demos-source version)
  527. (origin
  528. (method url-fetch)
  529. (uri (string-append "ftp://ftp.freedesktop.org/pub/mesa/demos"
  530. "/mesa-demos-" version ".tar.bz2"))
  531. (sha256 (base32 "0zgzbz55a14hz83gbmm0n9gpjnf5zadzi2kjjvkn6khql2a9rs81"))))
  532. (define-public mesa-utils
  533. (package
  534. (name "mesa-utils")
  535. (version "8.4.0")
  536. (source (mesa-demos-source version))
  537. (build-system gnu-build-system)
  538. (inputs
  539. `(("mesa" ,mesa)
  540. ("glut" ,freeglut)
  541. ("glew" ,glew)))
  542. (native-inputs
  543. `(("pkg-config" ,pkg-config)))
  544. (arguments
  545. '(#:phases
  546. (modify-phases %standard-phases
  547. (replace
  548. 'install
  549. (lambda* (#:key outputs #:allow-other-keys)
  550. (let ((out (assoc-ref outputs "out")))
  551. (mkdir-p (string-append out "/bin"))
  552. (for-each
  553. (lambda (file)
  554. (copy-file file (string-append out "/bin/" (basename file))))
  555. '("src/xdemos/glxdemo" "src/xdemos/glxgears"
  556. "src/xdemos/glxinfo" "src/xdemos/glxheads"))
  557. #t))))))
  558. (home-page "https://mesa3d.org/")
  559. (synopsis "Utility tools for Mesa")
  560. (description
  561. "The mesa-utils package contains several utility tools for Mesa: glxdemo,
  562. glxgears, glxheads, and glxinfo.")
  563. ;; glxdemo is public domain; others expat.
  564. (license (list license:expat license:public-domain))))
  565. (define-public glew
  566. (package
  567. (name "glew")
  568. (version "2.1.0")
  569. (source (origin
  570. (method url-fetch)
  571. (uri (string-append "mirror://sourceforge/glew/glew/" version
  572. "/glew-" version ".tgz"))
  573. (sha256
  574. (base32
  575. "159wk5dc0ykjbxvag5i1m2mhp23zkk6ra04l26y3jc3nwvkr3ph4"))
  576. (modules '((guix build utils)))
  577. (snippet
  578. '(begin
  579. (substitute* "config/Makefile.linux"
  580. (("= cc") "= gcc")
  581. (("/lib64") "/lib"))
  582. #t))))
  583. (build-system gnu-build-system)
  584. (arguments
  585. '(#:phases (modify-phases %standard-phases (delete 'configure))
  586. #:make-flags (list (string-append "GLEW_PREFIX="
  587. (assoc-ref %outputs "out"))
  588. (string-append "GLEW_DEST="
  589. (assoc-ref %outputs "out")))
  590. #:tests? #f)) ;no 'check' target
  591. (inputs
  592. `(("libxi" ,libxi)
  593. ("libxmu" ,libxmu)
  594. ("libx11" ,libx11)
  595. ("mesa" ,mesa)))
  596. ;; <GL/glew.h> includes <GL/glu.h>.
  597. (propagated-inputs `(("glu" ,glu)))
  598. (home-page "http://glew.sourceforge.net/")
  599. (synopsis "OpenGL extension loading library for C and C++")
  600. (description
  601. "The OpenGL Extension Wrangler Library (GLEW) is a C/C++ extension
  602. loading library. GLEW provides efficient run-time mechanisms for determining
  603. which OpenGL extensions are supported on the target platform. OpenGL core and
  604. extension functionality is exposed in a single header file.")
  605. (license license:bsd-3)))
  606. (define-public guile-opengl
  607. (package
  608. (name "guile-opengl")
  609. (version "0.1.0")
  610. (source (origin
  611. (method url-fetch)
  612. (uri (string-append "mirror://gnu/guile-opengl/guile-opengl-"
  613. version ".tar.gz"))
  614. (sha256
  615. (base32
  616. "13qfx4xh8baryxqrv986l848ygd0piqwm6s2s90pxk9c0m9vklim"))))
  617. (build-system gnu-build-system)
  618. (native-inputs `(("pkg-config" ,pkg-config)))
  619. (inputs `(("guile" ,guile-2.2)
  620. ("mesa" ,mesa)
  621. ("glu" ,glu)
  622. ("freeglut" ,freeglut)))
  623. (arguments
  624. '(#:phases (modify-phases %standard-phases
  625. (add-after 'configure 'patch-makefile
  626. (lambda _
  627. ;; Install compiled Guile files in the expected place.
  628. (substitute* '("Makefile")
  629. (("^godir = .*$")
  630. "godir = $(moddir)\n"))))
  631. (add-before 'build 'patch-dynamic-link
  632. (lambda* (#:key inputs outputs #:allow-other-keys)
  633. (substitute* "gl/runtime.scm"
  634. (("\\(dynamic-link\\)")
  635. (string-append "(dynamic-link \""
  636. (assoc-ref inputs "mesa")
  637. "/lib/libGL.so" "\")")))
  638. (define (dynamic-link-substitute file lib input)
  639. (substitute* file
  640. (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
  641. (string-append "dynamic-link \""
  642. (assoc-ref inputs input)
  643. "/lib/lib" lib "\""))))
  644. ;; Replace dynamic-link calls for libGL, libGLU, and
  645. ;; libglut with absolute paths to the store.
  646. (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa")
  647. (dynamic-link-substitute "glu/runtime.scm" "GLU" "glu")
  648. (dynamic-link-substitute "glut/runtime.scm" "glut"
  649. "freeglut"))))))
  650. (home-page "https://gnu.org/s/guile-opengl")
  651. (synopsis "Guile binding for the OpenGL graphics API")
  652. (description
  653. "Guile-OpenGL is a library for Guile that provides bindings to the
  654. OpenGL graphics API.")
  655. (license license:lgpl3+)))
  656. (define-public guile3.0-opengl
  657. (package
  658. (inherit guile-opengl)
  659. (name "guile3.0-opengl")
  660. (arguments
  661. (substitute-keyword-arguments (package-arguments guile-opengl)
  662. ((#:phases phases)
  663. `(modify-phases ,phases
  664. (add-after 'unpack 'build-with-guile-3.0
  665. (lambda _
  666. (substitute* "configure"
  667. (("_guile_versions_to_search=\"")
  668. "_guile_versions_to_search=\"3.0 "))
  669. #t))))))
  670. (inputs
  671. `(("guile" ,guile-3.0)
  672. ("mesa" ,mesa)
  673. ("glu" ,glu)
  674. ("freeglut" ,freeglut)))))
  675. (define-public libepoxy
  676. (package
  677. (name "libepoxy")
  678. (version "1.5.5")
  679. (source (origin
  680. (method url-fetch)
  681. (uri (string-append
  682. "https://github.com/anholt/libepoxy/releases/download/"
  683. version "/libepoxy-" version ".tar.xz"))
  684. (sha256
  685. (base32
  686. "0mh5bdgqfd8m4wj6jlvn4ac94sgfa8r6ish75ciwrhdw47dn65i6"))))
  687. (arguments
  688. `(#:phases
  689. (modify-phases %standard-phases
  690. (delete 'bootstrap)
  691. (add-before
  692. 'configure 'patch-paths
  693. (lambda* (#:key inputs #:allow-other-keys)
  694. (let ((python (assoc-ref inputs "python"))
  695. (mesa (assoc-ref inputs "mesa")))
  696. (substitute* "src/gen_dispatch.py"
  697. (("/usr/bin/env python") python))
  698. (substitute* (find-files "." "\\.[ch]$")
  699. (("libGL.so.1") (string-append mesa "/lib/libGL.so.1"))
  700. (("libEGL.so.1") (string-append mesa "/lib/libEGL.so.1")))
  701. #t))))))
  702. (build-system meson-build-system)
  703. (native-inputs
  704. `(("pkg-config" ,pkg-config)
  705. ("python" ,python)))
  706. (propagated-inputs
  707. ;; epoxy.pc: 'Requires.private: gl egl'
  708. `(("mesa" ,mesa)))
  709. (home-page "https://github.com/anholt/libepoxy/")
  710. (synopsis "A library for handling OpenGL function pointer management")
  711. (description
  712. "A library for handling OpenGL function pointer management.")
  713. (license license:x11)))
  714. (define-public libglvnd
  715. (package
  716. (name "libglvnd")
  717. (version "1.3.4")
  718. (home-page "https://gitlab.freedesktop.org/glvnd/libglvnd")
  719. (source (origin
  720. (method git-fetch)
  721. (uri (git-reference
  722. (url home-page)
  723. (commit (string-append "v" version))))
  724. (file-name (git-file-name name version))
  725. (sha256
  726. (base32
  727. "0phvgg2h3pcz3x39gaymwb37bnw1s26clq9wsj0zx398zmp3dwpk"))))
  728. (build-system meson-build-system)
  729. (arguments
  730. '(#:configure-flags '("-Dx11=enabled")
  731. #:phases (modify-phases %standard-phases
  732. (add-after 'unpack 'disable-glx-tests
  733. (lambda _
  734. ;; This package is meant to be used alongside Mesa.
  735. ;; To avoid a circular dependency, disable tests that
  736. ;; require a running Xorg server.
  737. (substitute* "tests/meson.build"
  738. (("if with_glx")
  739. "if false")))))))
  740. (native-inputs
  741. `(("pkg-config" ,pkg-config)))
  742. (inputs
  743. `(("libx11" ,libx11)
  744. ("libxext" ,libxext)
  745. ("xorgproto" ,xorgproto)))
  746. (synopsis "Vendor-neutral OpenGL dispatch library")
  747. (description
  748. "libglvnd is a vendor-neutral dispatch layer for arbitrating OpenGL
  749. API calls between multiple vendors. It allows multiple drivers from
  750. different vendors to coexist on the same file system, and determines which
  751. vendor to dispatch each API call to at runtime.
  752. Both GLX and EGL are supported, in any combination with OpenGL and OpenGL ES.")
  753. ;; libglvnd is available under a custom X11-style license, and incorporates
  754. ;; code with various other licenses. See README.md for details.
  755. (license (list (license:x11-style "file://README.md")
  756. license:x11
  757. license:expat))))
  758. (define-public soil
  759. (package
  760. (name "soil")
  761. (version "1.0.7")
  762. (source (origin
  763. (method url-fetch)
  764. ;; No versioned archive available.
  765. (uri "http://www.lonesock.net/files/soil.zip")
  766. (sha256
  767. (base32
  768. "00gpwp9dldzhsdhksjvmbhsd2ialraqbv6v6dpikdmpncj6mnc52"))))
  769. (build-system gnu-build-system)
  770. (arguments
  771. '(#:tests? #f ; no tests
  772. #:phases (modify-phases %standard-phases
  773. (delete 'configure)
  774. (add-before 'build 'init-build
  775. (lambda* (#:key outputs #:allow-other-keys)
  776. (let ((out (assoc-ref outputs "out")))
  777. (setenv "CFLAGS" "-fPIC") ; needed for shared library
  778. ;; Use alternate Makefile
  779. (copy-file "projects/makefile/alternate Makefile.txt"
  780. "src/Makefile")
  781. (chdir "src")
  782. (substitute* '("Makefile")
  783. (("INCLUDEDIR = /usr/include/SOIL")
  784. (string-append "INCLUDEDIR = " out "/include/SOIL"))
  785. (("LIBDIR = /usr/lib")
  786. (string-append "LIBDIR = " out "/lib"))
  787. ;; Remove these flags from 'install' commands.
  788. (("-o root -g root") ""))))))))
  789. (native-inputs
  790. `(("unzip" ,unzip)))
  791. (inputs
  792. `(("mesa" ,mesa)))
  793. (home-page "https://www.lonesock.net/soil.html")
  794. (synopsis "OpenGL texture loading library")
  795. (description
  796. "SOIL is a tiny C library used primarily for uploading textures into
  797. OpenGL.")
  798. (license license:public-domain)))
  799. (define-public glfw
  800. (package
  801. (name "glfw")
  802. (version "3.3.4")
  803. (source (origin
  804. (method url-fetch)
  805. (uri (string-append "https://github.com/glfw/glfw"
  806. "/releases/download/" version
  807. "/glfw-" version ".zip"))
  808. (sha256
  809. (base32
  810. "1kcrpl4d6b6h23ib5j9q670d9w3knd07whgbanbmwwhbcqnc9lmv"))))
  811. (build-system cmake-build-system)
  812. (arguments
  813. '(#:tests? #f ; no test target
  814. #:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
  815. (native-inputs
  816. `(("doxygen" ,doxygen)
  817. ("unzip" ,unzip)))
  818. (propagated-inputs
  819. `(("mesa" ,mesa) ;included in public headers
  820. ;; These are in 'Requires.private' of 'glfw3.pc'.
  821. ("libx11" ,libx11)
  822. ("libxrandr" ,libxrandr)
  823. ("libxi" ,libxi)
  824. ("libxinerama" ,libxinerama)
  825. ("libxcursor" ,libxcursor)
  826. ("libxxf86vm" ,libxxf86vm)))
  827. (home-page "https://www.glfw.org")
  828. (synopsis "OpenGL application development library")
  829. (description
  830. "GLFW is a library for OpenGL, OpenGL ES and Vulkan development for
  831. desktop computers. It provides a simple API for creating windows, contexts
  832. and surfaces, receiving input and events.")
  833. (license license:zlib)))
  834. (define-public nanovg-for-extempore
  835. (let ((version "0.7.1")
  836. (revision "0")
  837. (commit "3c60175fcc2e5fe305b04355cdce35d499c80310"))
  838. (package
  839. (name "nanovg-for-extempore")
  840. (version (git-version version revision commit))
  841. (source (origin
  842. (method git-fetch)
  843. (uri (git-reference
  844. (url "https://github.com/extemporelang/nanovg")
  845. (commit commit)))
  846. (file-name (git-file-name name version))
  847. (sha256
  848. (base32
  849. "0ddn3d3mxqn8hj9967v3pss7lz1wn08pcdnqzc118g7yjkq7hxzy"))))
  850. (build-system cmake-build-system)
  851. (arguments `(#:tests? #f)) ; no tests included
  852. (inputs
  853. `(("mesa" ,mesa)))
  854. ;; Extempore refuses to build on architectures other than x86_64
  855. (supported-systems '("x86_64-linux"))
  856. (home-page "https://github.com/extemporelang/nanovg")
  857. (synopsis "2D vector drawing library on top of OpenGL")
  858. (description "NanoVG is small antialiased vector graphics rendering
  859. library for OpenGL. It has lean API modeled after HTML5 canvas API. It is
  860. aimed to be a practical and fun toolset for building scalable user interfaces
  861. and visualizations.")
  862. (license license:zlib))))
  863. (define-public gl2ps
  864. (package
  865. (name "gl2ps")
  866. (version "1.4.2")
  867. (source
  868. (origin
  869. (method url-fetch)
  870. (uri (string-append
  871. "http://geuz.org/gl2ps/src/gl2ps-"
  872. version ".tgz"))
  873. (sha256
  874. (base32 "1sgzv547h7hrskb9qd0x5yp45kmhvibjwj2mfswv95lg070h074d"))))
  875. (build-system cmake-build-system)
  876. (inputs
  877. `(("libpng" ,libpng)
  878. ("mesa" ,mesa)
  879. ("zlib" ,zlib)))
  880. (arguments
  881. `(#:tests? #f)) ; no tests
  882. (home-page "http://www.geuz.org/gl2ps/")
  883. (synopsis "OpenGL to PostScript printing library")
  884. (description "GL2PS is a C library providing high quality vector
  885. output for any OpenGL application. GL2PS uses sorting algorithms
  886. capable of handling intersecting and stretched polygons, as well as
  887. non-manifold objects. GL2PS provides many features including advanced
  888. smooth shading and text rendering, culling of invisible primitives and
  889. mixed vector/bitmap output.")
  890. ;; GL2PS is dual-licenced and can be used under the terms of either.
  891. (license (list license:lgpl2.0+
  892. (license:fsf-free "http://www.geuz.org/gl2ps/COPYING.GL2PS"
  893. "GPL-incompatible copyleft license")))))
  894. (define-public virtualgl
  895. (package
  896. (name "virtualgl")
  897. (version "2.6.2")
  898. (source
  899. (origin
  900. (method git-fetch)
  901. (uri (git-reference
  902. (url "https://github.com/VirtualGL/virtualgl")
  903. (commit version)))
  904. (file-name (git-file-name name version))
  905. (sha256
  906. (base32 "0yyc553xsb5n0rx7jp9p4wdbd7md07b3qrkf3ssyjavqqg908qg9"))))
  907. (arguments
  908. `(#:tests? #f ; no tests are available
  909. #:configure-flags (list
  910. (string-append "-DCMAKE_INSTALL_LIBDIR="
  911. (assoc-ref %outputs "out") "/lib")
  912. "-DVGL_USESSL=1"))) ; use OpenSSL
  913. (build-system cmake-build-system)
  914. (inputs `(("glu" ,glu)
  915. ("libjpeg-turbo" ,libjpeg-turbo)
  916. ("libxtst" ,libxtst)
  917. ("mesa" ,mesa)
  918. ("openssl" ,openssl)))
  919. (native-inputs `(("pkg-config" ,pkg-config)))
  920. (home-page "https://www.virtualgl.org")
  921. (synopsis "Redirects 3D commands from an OpenGL application onto a 3D
  922. graphics card")
  923. (description "VirtualGL redirects the 3D rendering commands from OpenGL
  924. applications to 3D accelerator hardware in a dedicated server and displays the
  925. rendered output interactively to a thin client located elsewhere on the
  926. network.")
  927. (license license:wxwindows3.1+)))
  928. (define-public mojoshader
  929. (let ((changeset "5887634ea695"))
  930. (package
  931. (name "mojoshader")
  932. (version (string-append "20190825" "-" changeset))
  933. (source
  934. (origin
  935. (method hg-fetch)
  936. (uri (hg-reference
  937. (url "https://hg.icculus.org/icculus/mojoshader/")
  938. (changeset changeset)))
  939. (file-name (git-file-name name version))
  940. (sha256
  941. (base32 "0ibl4z1696jiifv9j5drir7jm0b5px0vwkwckbi7cfd46p7p6wcy"))))
  942. (arguments
  943. ;; Tests only for COMPILER_SUPPORT=ON.
  944. `(#:tests? #f
  945. #:configure-flags '("-DBUILD_SHARED=ON"
  946. "-DFLIP_VIEWPORT=ON"
  947. "-DDEPTH_CLIPPING=ON")
  948. #:phases
  949. (modify-phases %standard-phases
  950. (replace 'install
  951. (lambda* (#:key outputs #:allow-other-keys)
  952. (let* ((out (assoc-ref outputs "out"))
  953. (lib (string-append out "/lib"))
  954. (header (string-append out "/include")))
  955. (install-file "libmojoshader.so" lib)
  956. (for-each (lambda (f)
  957. (install-file f header))
  958. (find-files "../source" "mojoshader.*\\.h$"))
  959. (let ((profiles-header (string-append header "/profiles")))
  960. (mkdir-p profiles-header)
  961. (rename-file (string-append header "/mojoshader_profile.h")
  962. (string-append profiles-header "/mojoshader_profile.h"))))
  963. #t)))))
  964. (build-system cmake-build-system)
  965. (home-page "https://www.icculus.org/mojoshader/")
  966. (synopsis "Work with Direct3D shaders on alternate 3D APIs")
  967. (description "MojoShader is a library to work with Direct3D shaders on
  968. alternate 3D APIs and non-Windows platforms. The primary motivation is moving
  969. shaders to OpenGL languages on the fly. The developer deals with \"profiles\"
  970. that represent various target languages, such as GLSL or ARB_*_program.
  971. This allows a developer to manage one set of shaders, presumably written in
  972. Direct3D HLSL, and use them across multiple rendering backends. This also
  973. means that the developer only has to worry about one (offline) compiler to
  974. manage program complexity, while MojoShader itself deals with the reduced
  975. complexity of the bytecode at runtime.
  976. MojoShader provides both a simple API to convert bytecode to various profiles,
  977. and (optionally) basic glue to rendering APIs to abstract the management of
  978. the shaders at runtime.")
  979. (license license:zlib))))
  980. (define-public mojoshader-with-viewport-flip
  981. ;; Changeset c586d4590241 replaced glProgramViewportFlip with
  982. ;; glProgramViewportInfo.
  983. ;; https://hg.icculus.org/icculus/mojoshader/rev/c586d4590241
  984. (let ((changeset "2e37299b13d8"))
  985. (package
  986. (inherit mojoshader)
  987. (name "mojoshader-with-viewport-flip")
  988. (version (string-append "20190725" "-" changeset))
  989. (source
  990. (origin
  991. (method hg-fetch)
  992. (uri (hg-reference
  993. (url "https://hg.icculus.org/icculus/mojoshader/")
  994. (changeset changeset)))
  995. (file-name (git-file-name name version))
  996. (sha256
  997. (base32 "0ffws7cqbskxwc3hjsnnzq4r2bbf008kdr3b11pa3kr7dsi50y6i"))))
  998. (synopsis "Work with Direct3D shaders on alternate 3D APIs (with viewport flip)")
  999. (description "This is the last version of the mojoshader library with
  1000. the glProgramViewportFlip before it was replaced with glProgramViewportInfo.")
  1001. (license license:zlib))))
  1002. (define-public mojoshader-cs
  1003. (let ((commit "10d0dba21ff1cfe332eb7de328a2adce01286bd7"))
  1004. (package
  1005. (name "mojoshader-cs")
  1006. (version (git-version "20191205" "1" commit))
  1007. (source (origin
  1008. (method git-fetch)
  1009. (uri (git-reference
  1010. (url "https://github.com/FNA-XNA/MojoShader")
  1011. (commit commit)))
  1012. (file-name (git-file-name name version))
  1013. (sha256
  1014. (base32
  1015. "11mdhf3fmb9rsn2iv753gmb596j4dh5j2iipgw078vg0lj23rml7"))))
  1016. (build-system gnu-build-system)
  1017. (arguments
  1018. '(#:tests? #f ; No tests.
  1019. #:phases
  1020. (modify-phases %standard-phases
  1021. (delete 'configure)
  1022. (replace 'build
  1023. (lambda _
  1024. (invoke "make" "-C" "csharp")))
  1025. (replace 'install
  1026. (lambda* (#:key outputs #:allow-other-keys)
  1027. (let ((out (assoc-ref outputs "out")))
  1028. (install-file "csharp/bin/MojoShader-CS.dll" (string-append out "/lib"))
  1029. #t))))))
  1030. (native-inputs
  1031. `(("mono" ,mono)))
  1032. (home-page "https://github.com/FNA-XNA/MojoShader")
  1033. (synopsis "C# wrapper for MojoShader")
  1034. (description
  1035. "Mojoshader-CS provides C# bindings for the Mojoshader library.
  1036. The C# wrapper was written to be used for FNA's platform support. However, this
  1037. is written in a way that can be used for any general C# application.")
  1038. (license license:zlib))))
  1039. (define-public glmark2
  1040. (package
  1041. (name "glmark2")
  1042. (version "2020.04")
  1043. (source (origin
  1044. (method git-fetch)
  1045. (uri (git-reference
  1046. (url "https://github.com/glmark2/glmark2")
  1047. (commit version)))
  1048. (file-name (git-file-name name version))
  1049. (sha256
  1050. (base32
  1051. "0ywpzp0imi3f8iyp7d1739576zx2nsr3db5hp2as4yhflfyq1as2"))
  1052. (modules '((guix build utils)))
  1053. ;; Fix Python 3 incompatibility.
  1054. (snippet
  1055. '(begin
  1056. (substitute* "wscript"
  1057. (("(sorted\\()FLAVORS\\.keys\\(\\)(.*)" _ beginning end)
  1058. (string-append beginning "list(FLAVORS)" end)))
  1059. #t))))
  1060. (build-system waf-build-system)
  1061. (arguments
  1062. '(#:tests? #f ; no check target
  1063. #:configure-flags
  1064. (list (string-append "--with-flavors="
  1065. (string-join '("x11-gl" "x11-glesv2"
  1066. "drm-gl" "drm-glesv2"
  1067. "wayland-gl" "wayland-glesv2")
  1068. ",")))
  1069. #:phases
  1070. (modify-phases %standard-phases
  1071. (add-after 'unpack 'patch-paths
  1072. (lambda* (#:key inputs #:allow-other-keys)
  1073. (let ((mesa (assoc-ref inputs "mesa")))
  1074. (substitute* (find-files "src" "gl-state-.*\\.cpp$")
  1075. (("libGL.so") (string-append mesa "/lib/libGL.so"))
  1076. (("libEGL.so") (string-append mesa "/lib/libEGL.so"))
  1077. (("libGLESv2.so") (string-append mesa "/lib/libGLESv2.so")))
  1078. #t))))))
  1079. (native-inputs
  1080. `(("pkg-config" ,pkg-config)))
  1081. (inputs
  1082. `(("eudev" ,eudev)
  1083. ("libdrm" ,libdrm)
  1084. ("libjpeg-turbo" ,libjpeg-turbo)
  1085. ("libpng" ,libpng)
  1086. ("libx11" ,libx11)
  1087. ("libxcb" ,libxcb)
  1088. ("mesa" ,mesa)
  1089. ("wayland" ,wayland)
  1090. ("wayland-protocols" ,wayland-protocols)))
  1091. (home-page "https://github.com/glmark2/glmark2")
  1092. (synopsis "OpenGL 2.0 and OpenGL ES 2.0 benchmark")
  1093. (description
  1094. "glmark2 is an OpenGL 2.0 and OpenGL ES 2.0 benchmark based on the
  1095. original glmark benchmark by Ben Smith.")
  1096. (license license:gpl3+)))