commit 4035f329c2f5c8f05f0ada33afdac41981eee6dc
Author: Petr Hodina <phodina@protonmail.com>
Date: Sat Oct 15 08:42:17 2022 +0200
gnu: alacritty: Patch to run on OpenGL 3.1 on aarch64 target.
* gnu/packages/terminals.scm (alacritty)[source]: Apply patch on aarch64
target.
* gnu/packages/patches/alacritty-use-OpenGL-3.1-with-extensions-instead-of-OpenGL-3.3.patch:
New file
* gnu/local.mk: Add patch.
@@ -865,6 +865,7 @@ dist_patch_DATA = \
%D%/packages/patches/akonadi-paths.patch \
%D%/packages/patches/akonadi-not-relocatable.patch \
%D%/packages/patches/akonadi-timestamps.patch \
+ %D%/packages/patches/alacritty-use-OpenGL-3.1-with-extensions-instead-of-OpenGL-3.3.patch \
%D%/packages/patches/allegro-mesa-18.2.5-and-later.patch \
%D%/packages/patches/anki-mpv-args.patch \
%D%/packages/patches/antiword-CVE-2014-8123.patch \
new file mode 100644
@@ -0,0 +1,86 @@
+From cc6f303100075e286d09ca77d31749f7adcdffc6 Mon Sep 17 00:00:00 2001
+From: Autumn <autumnontape@tutanota.com>
+Date: Wed, 14 Jul 2021 04:37:03 -0700
+Subject: [PATCH] use OpenGL 3.1 with extensions instead of OpenGL 3.3
+
+---
+ alacritty/build.rs | 2 +-
+ alacritty/res/rect.f.glsl | 2 +-
+ alacritty/res/rect.v.glsl | 3 ++-
+ alacritty/res/text.f.glsl | 3 ++-
+ alacritty/res/text.v.glsl | 3 ++-
+ alacritty/src/renderer/mod.rs | 2 +-
+ 6 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/alacritty/build.rs b/alacritty/build.rs
+index 48841ca..28c20e2 100644
+--- a/alacritty/build.rs
++++ b/alacritty/build.rs
+@@ -11,7 +11,7 @@ fn main() {
+ let dest = env::var("OUT_DIR").unwrap();
+ let mut file = File::create(&Path::new(&dest).join("gl_bindings.rs")).unwrap();
+
+- Registry::new(Api::Gl, (3, 3), Profile::Core, Fallbacks::All, ["GL_ARB_blend_func_extended"])
++ Registry::new(Api::Gl, (3, 1), Profile::Core, Fallbacks::All, ["GL_ARB_blend_func_extended", "GL_ARB_instanced_arrays", "GL_ARB_explicit_attrib_location"])
+ .write_bindings(GlobalGenerator, &mut file)
+ .unwrap();
+
+diff --git a/alacritty/res/rect.f.glsl b/alacritty/res/rect.f.glsl
+index 945eaf2..9f84237 100644
+--- a/alacritty/res/rect.f.glsl
++++ b/alacritty/res/rect.f.glsl
+@@ -1,4 +1,4 @@
+-#version 330 core
++#version 140
+
+ flat in vec4 color;
+
+diff --git a/alacritty/res/rect.v.glsl b/alacritty/res/rect.v.glsl
+index bf9a97d..258bb36 100644
+--- a/alacritty/res/rect.v.glsl
++++ b/alacritty/res/rect.v.glsl
+@@ -1,4 +1,5 @@
+-#version 330 core
++#version 140
++#extension GL_ARB_explicit_attrib_location : require
+ layout (location = 0) in vec2 aPos;
+ layout (location = 1) in vec4 aColor;
+
+diff --git a/alacritty/res/text.f.glsl b/alacritty/res/text.f.glsl
+index d5e2688..d4d559c 100644
+--- a/alacritty/res/text.f.glsl
++++ b/alacritty/res/text.f.glsl
+@@ -1,4 +1,5 @@
+-#version 330 core
++#version 140
++#extension GL_ARB_explicit_attrib_location : require
+ in vec2 TexCoords;
+ flat in vec4 fg;
+ flat in vec4 bg;
+diff --git a/alacritty/res/text.v.glsl b/alacritty/res/text.v.glsl
+index 31e6f93..09c477a 100644
+--- a/alacritty/res/text.v.glsl
++++ b/alacritty/res/text.v.glsl
+@@ -1,4 +1,5 @@
+-#version 330 core
++#version 140
++#extension GL_ARB_explicit_attrib_location : require
+ // Cell properties.
+ layout(location = 0) in vec2 gridCoords;
+
+diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs
+index bac8225..3e170be 100644
+--- a/alacritty/src/renderer/mod.rs
++++ b/alacritty/src/renderer/mod.rs
+@@ -600,7 +600,7 @@ impl QuadRenderer {
+ size as *const _,
+ );
+ gl::EnableVertexAttribArray(index);
+- gl::VertexAttribDivisor(index, 1);
++ gl::VertexAttribDivisorARB(index, 1);
+
+ #[allow(unused_assignments)]
+ {
+--
+2.32.0
+
@@ -1341,6 +1341,14 @@ (define-public alacritty
(url "https://github.com/jwilm/alacritty")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
+ ;; This patch enables to run Alacritty on aarch64 targets such as
+ ;; PineBook Pro which run Panfrost driver and support OpenGL 3.1
+ (patches
+ `,(if (string-prefix? "aarch64" (or (%current-system)
+ (%current-target-system)))
+ (search-patches
+ "alacritty-use-OpenGL-3.1-with-extensions-instead-of-OpenGL-3.3.patch")
+ '()))
(sha256
(base32 "068y0b1a0m33r7a3j2xf6k602sc8062gm4d5568ynfx6w5n481lj"))))
(build-system cargo-build-system)