diff mbox series

[bug#54299,v3] Build on Aarch64

Message ID kxxOHG3TiJOjIQ-fZAtbejKVpD6b2mb-71ZEwl91L1byuZismwMNUYdYxrgX_1tpIichYDiEfOfbZRlVT1F7gagqnjhyM39Ea5gevvtgFfg=@protonmail.com
State New
Headers show
Series [bug#54299,v3] Build on Aarch64 | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

phodina Oct. 16, 2022, 5:44 a.m. UTC
Sorry, incorrect target ("arch64" instead of "aarch64") got into second patch :-)

----
Petr
------- Original Message -------
On Saturday, October 15th, 2022 at 9:17 AM, phodina <phodina@protonmail.com> wrote:

> Hi Maxime,
>
> could you please review the 2 patches for Alacritty?
>
> First one is to build it on Aarch64 (disables one failing test).
>
> The other enables HW support on devices like PineBook Pro - I remeber you use one Efraim. [1]
>
> The rest is just for newer version.
>
> I have to check the antioxidant system! It's been on my list for too long.
>
> 1 https://github.com/alacritty/alacritty/issues/128#issuecomment-880270507
>
> Thanks!
>
> ----
> Petr

Comments

phodina Dec. 25, 2022, 5:50 p.m. UTC | #1
Hi,

any progress on this issue?

----
Petr
------- Original Message -------
On Sunday, October 16th, 2022 at 7:44 AM, phodina <phodina@protonmail.com> wrote:

> Sorry, incorrect target ("arch64" instead of "aarch64") got into second patch :-)
>
> ----
> Petr
> ------- Original Message -------
> On Saturday, October 15th, 2022 at 9:17 AM, phodina <phodina@protonmail.com> wrote:
>
>> Hi Maxime,
>>
>> could you please review the 2 patches for Alacritty?
>>
>> First one is to build it on Aarch64 (disables one failing test).
>>
>> The other enables HW support on devices like PineBook Pro - I remeber you use one Efraim. [1]
>>
>> The rest is just for newer version.
>>
>> I have to check the antioxidant system! It's been on my list for too long.
>>
>> 1 https://github.com/alacritty/alacritty/issues/128#issuecomment-880270507
>>
>> Thanks!
>>
>> ----
>> Petr
Efraim Flashner Feb. 15, 2023, 10:43 a.m. UTC | #2
On Sun, Dec 25, 2022 at 05:50:19PM +0000, phodina wrote:
> Hi,
> 
> any progress on this issue?
> 
> ----
> Petr

I haven't been able to get the patch to apply when building for aarch64
so that's a problem. I tried adding it as an input and applying it as a
phase but then the 'configure script chokes on the patch not being a tar
archive.

I saw that alacritty 0.11.0 adds fallback support for gles 2.0. I was
able to build (using cargo, not packaged) and run that on my pinebook
pro. Can you send another version of the patchset to upgrade to 0.11.0?
With that everything should just be working nicely.
diff mbox series

Patch

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.

diff --git a/gnu/local.mk b/gnu/local.mk
index 78bdc113ac..15c62d5c7f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -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			\
diff --git a/gnu/packages/patches/alacritty-use-OpenGL-3.1-with-extensions-instead-of-OpenGL-3.3.patch b/gnu/packages/patches/alacritty-use-OpenGL-3.1-with-extensions-instead-of-OpenGL-3.3.patch
new file mode 100644
index 0000000000..92d72a83e7
--- /dev/null
+++ b/gnu/packages/patches/alacritty-use-OpenGL-3.1-with-extensions-instead-of-OpenGL-3.3.patch
@@ -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
+
diff --git a/gnu/packages/terminals.scm b/gnu/packages/terminals.scm
index 1084cd2d7d..e74a664e7c 100644
--- a/gnu/packages/terminals.scm
+++ b/gnu/packages/terminals.scm
@@ -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)