Control: tags 1116331 + pending

Dear maintainer,

I've prepared an NMU for horizon-eda (versioned as 2.6.0-2.3) and
uploaded it to DELAYED/2. Please feel free to tell me if I
should cancel it.

Regards.

diffstat for horizon-eda-2.6.0 horizon-eda-2.6.0

 changelog                                     |    7 
 control                                       |    2 
 patches/bug-1116331-drop-libosmesa6-dev.patch |  210 ++++++++++++++++++++++++++
 patches/series                                |    1 
 4 files changed, 219 insertions(+), 1 deletion(-)

diff -Nru horizon-eda-2.6.0/debian/changelog horizon-eda-2.6.0/debian/changelog
--- horizon-eda-2.6.0/debian/changelog	2024-12-18 03:24:09.000000000 +0100
+++ horizon-eda-2.6.0/debian/changelog	2025-10-17 16:13:24.000000000 +0200
@@ -1,3 +1,10 @@
+horizon-eda (2.6.0-2.3) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Cherrypick upstream commit to remove libosmesa6-dev. (Closes: #1116331)
+
+ -- Tobias Frost <[email protected]>  Fri, 17 Oct 2025 16:13:24 +0200
+
 horizon-eda (2.6.0-2.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru horizon-eda-2.6.0/debian/control horizon-eda-2.6.0/debian/control
--- horizon-eda-2.6.0/debian/control	2024-12-18 03:24:09.000000000 +0100
+++ horizon-eda-2.6.0/debian/control	2025-10-17 15:59:52.000000000 +0200
@@ -8,7 +8,7 @@
  libepoxy-dev, libgtkmm-3.0-dev, uuid-dev, libzmq5, libzmq3-dev,
  libglm-dev, libgit2-dev, libcurl4-gnutls-dev, libocct-data-exchange-dev,
  libdxflib-dev (>> 3.17.0), libarchive-dev,
- libzip-dev, libglib2.0-dev, libpodofo-dev, python3-cairo-dev, libosmesa6-dev,
+ libzip-dev, libglib2.0-dev, libpodofo-dev, python3-cairo-dev,
  dh-python, cppzmq-dev
 Standards-Version: 4.4.0
 Homepage: https://horizon-eda.org/
diff -Nru horizon-eda-2.6.0/debian/patches/bug-1116331-drop-libosmesa6-dev.patch horizon-eda-2.6.0/debian/patches/bug-1116331-drop-libosmesa6-dev.patch
--- horizon-eda-2.6.0/debian/patches/bug-1116331-drop-libosmesa6-dev.patch	1970-01-01 01:00:00.000000000 +0100
+++ horizon-eda-2.6.0/debian/patches/bug-1116331-drop-libosmesa6-dev.patch	2025-10-17 15:59:57.000000000 +0200
@@ -0,0 +1,210 @@
+From 663a8adaa1cb7eae7a824de07df8909bc33677c3 Mon Sep 17 00:00:00 2001
+From: "Lukas K." <[email protected]>
+Date: Mon, 9 Jun 2025 12:50:26 +0200
+Subject: [PATCH] replace osmesa with EGL_PLATFORM_SURFACELESS_MESA
+
+fixes #809
+---
+ meson.build                             |  9 ++-
+ src/export_3d_image/export_3d_image.cpp | 82 ++++++++++++++++++-------
+ src/export_3d_image/export_3d_image.hpp |  5 +-
+ src/util/gl_inc.h                       |  6 --
+ 5 files changed, 68 insertions(+), 38 deletions(-)
+
+--- a/meson.build
++++ b/meson.build
+@@ -49,7 +49,6 @@
+ 
+ libpython = dependency('python3', required: false, disabler:true)
+ py3cairo = dependency('py3cairo', required: false, disabler:true)
+-osmesa = dependency('osmesa', required: false, disabler:true)
+ glm = dependency('glm')
+ 
+ cpp_args_router = ['-D_USE_MATH_DEFINES']
+@@ -106,7 +105,8 @@
+ 
+ 
+ build_dependencies_libhorizon = [libm, pthread, gtkmm, sqlite3, dxflib, png] + stdlibs
+-build_dependencies_horizonmodule = [libm, gtkmm, sqlite3, dxflib, png, py3cairo, podofo, libpython, osmesa, opencascade, libarchive]
++build_dependencies_horizonmodule = [libm, gtkmm, sqlite3, dxflib, png, py3cairo, podofo, libpython, epoxy, opencascade, libarchive]
++
+ if not is_windows
+ 	uuid = dependency('uuid')
+ 	build_dependencies_libhorizon += uuid
+@@ -117,7 +117,7 @@
+ 
+ build_dependencies_libhorizonui = build_dependencies_libhorizon + [epoxy, zeromq, cppzmq, curl, glm]
+ build_dependencies_gen_pkg =    build_dependencies_libhorizon
+-build_dependencies_pr_review = build_dependencies_libhorizon + [podofo, osmesa, opencascade, libgit2]
++build_dependencies_pr_review = build_dependencies_libhorizon + [podofo, epoxy, opencascade, libgit2]
+ 
+ build_dependencies_pool_prj_mgr = build_dependencies_libhorizonui + [libgit2]
+ build_dependencies_imp = build_dependencies_libhorizonui +[rsvg, podofo, libarchive, opencascade, spnav]
+@@ -1001,7 +1001,7 @@
+     dependencies: build_dependencies_horizonmodule,
+     link_with: [clipper_pic, delaunator_pic, polypartition_pic, poly2tri_pic],
+     include_directories: include_directories,
+-    cpp_args: cpp_args + ['-DOFFSCREEN=1'],
++    cpp_args: cpp_args,
+     build_by_default: false,
+     name_prefix: ''
+ )
+@@ -1011,7 +1011,7 @@
+     dependencies: build_dependencies_pr_review,
+     link_with: [clipper_nopic, delaunator_nopic, polypartition_nopic, poly2tri_nopic, libhorizon],
+     include_directories: include_directories,
+-    cpp_args: cpp_args + ['-DOFFSCREEN=1'],
++    cpp_args: cpp_args,
+     build_by_default: false,
+ )
+ 
+--- a/src/export_3d_image/export_3d_image.cpp
++++ b/src/export_3d_image/export_3d_image.cpp
+@@ -1,7 +1,7 @@
+ #include "export_3d_image.hpp"
+ #include "canvas3d/canvas3d_base.hpp"
+-#include "GL/osmesa.h"
+ #include <cairomm/cairomm.h>
++#include <epoxy/egl.h>
+ 
+ namespace horizon {
+ 
+@@ -11,28 +11,59 @@
+     width = awidth;
+     height = aheight;
+ 
+-    {
+-        std::vector<int> attribs;
+-        attribs.push_back(OSMESA_DEPTH_BITS);
+-        attribs.push_back(16);
+-
+-        attribs.push_back(OSMESA_PROFILE);
+-        attribs.push_back(OSMESA_CORE_PROFILE);
+-
+-        attribs.push_back(OSMESA_CONTEXT_MAJOR_VERSION);
+-        attribs.push_back(3);
+-
+-        attribs.push_back(0);
+-        attribs.push_back(0);
+-        ctx = OSMesaCreateContextAttribs(attribs.data(), NULL);
+-    }
+-    if (!ctx) {
+-        throw std::runtime_error("couldn't create context");
+-    }
+-    buffer.resize(width * height * 4);
+-    if (!OSMesaMakeCurrent(static_cast<OSMesaContext>(ctx), buffer.data(), GL_UNSIGNED_BYTE, width, height)) {
+-        throw std::runtime_error("couldn't make current");
+-    }
++    // based on
++    // https://code.videolan.org/videolan/libplacebo/-/blob/00a1009a78434bbc43a1efc54f5915dd466706a4/src/tests/opengl_surfaceless.c#L98
++    const char *extstr = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
++    if (!extstr || !strstr(extstr, "EGL_MESA_platform_surfaceless"))
++        throw std::runtime_error("no EGL_MESA_platform_surfaceless");
++
++    dpy = eglGetPlatformDisplayEXT(EGL_PLATFORM_SURFACELESS_MESA, (void *)EGL_DEFAULT_DISPLAY, NULL);
++    if (!dpy)
++        throw std::runtime_error("no dpy");
++
++    EGLint major, minor;
++    if (!eglInitialize(dpy, &major, &minor))
++        throw std::runtime_error("error in eglInitialize");
++
++    // clang-format off
++    const int cfg_attribs[] = {
++            EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
++            EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
++            EGL_ALPHA_SIZE, 8,
++            EGL_NONE
++    };
++    // clang-format on
++
++    EGLConfig config = 0;
++    EGLint num_configs = 0;
++    bool ok = eglChooseConfig(dpy, cfg_attribs, &config, 1, &num_configs);
++    if (!ok || !num_configs)
++        throw std::runtime_error("error in eglChooseConfig");
++
++    if (!eglBindAPI(EGL_OPENGL_API))
++        throw std::runtime_error("error in eglBindAPI");
++
++    // clang-format off
++    const int egl_attribs[] = {
++        EGL_CONTEXT_MAJOR_VERSION, 4,
++        EGL_CONTEXT_MINOR_VERSION, 6,
++        EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
++        EGL_NONE
++    };
++    // clang-format on
++
++    egl = eglCreateContext(dpy, config, EGL_NO_CONTEXT, egl_attribs);
++    if (!egl)
++        throw std::runtime_error("no context");
++
++
++    const EGLint pbuffer_attribs[] = {EGL_WIDTH, width, EGL_HEIGHT, height, EGL_NONE};
++
++    surf = eglCreatePbufferSurface(dpy, config, pbuffer_attribs);
++
++    if (!eglMakeCurrent(dpy, surf, surf, egl))
++        throw std::runtime_error("error in eglMakeCurrent");
++
+     a_realize();
+ 
+     brd = &abrd;
+@@ -43,7 +74,7 @@
+ 
+ void Image3DExporter::check_ctx()
+ {
+-    if (ctx != OSMesaGetCurrentContext()) {
++    if (egl != eglGetCurrentContext()) {
+         throw std::runtime_error("lost context");
+     }
+ }
+@@ -68,7 +99,10 @@
+     render(render_background ? RenderBackground::YES : RenderBackground::NO);
+     glFinish();
+ 
+-    auto buf = buffer.data();
++    glReadBuffer(GL_COLOR_ATTACHMENT0);
++    std::vector<uint8_t> buf(width * height * 4);
++    glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buf.data());
++
+     unsigned int iwidth = width;
+     unsigned int iheight = height;
+     auto surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, iwidth, iheight);
+@@ -90,6 +124,8 @@
+ 
+ Image3DExporter::~Image3DExporter()
+ {
+-    OSMesaDestroyContext(static_cast<OSMesaContext>(ctx));
++    eglDestroySurface(dpy, surf);
++    eglDestroyContext(dpy, egl);
++    eglTerminate(dpy);
+ }
+ } // namespace horizon
+--- a/src/export_3d_image/export_3d_image.hpp
++++ b/src/export_3d_image/export_3d_image.hpp
+@@ -25,8 +25,9 @@
+ 
+ private:
+     class IPool &pool;
+-    void *ctx = nullptr; // to get around including osmesa here
+-    std::vector<unsigned char> buffer;
++    void *egl = nullptr;  // to get around including epoxy here
++    void *dpy = nullptr;  // to get around including epoxy here
++    void *surf = nullptr; // to get around including epoxy here
+     void check_ctx();
+     bool render_background = false;
+ };
+--- a/src/util/gl_inc.h
++++ b/src/util/gl_inc.h
+@@ -1,9 +1,3 @@
+ #pragma once
+ 
+-#ifndef OFFSCREEN
+ #include <epoxy/gl.h>
+-#else
+-#define GL_GLEXT_PROTOTYPES 1
+-#include <GL/gl.h>
+-#include <GL/glcorearb.h>
+-#endif
diff -Nru horizon-eda-2.6.0/debian/patches/series horizon-eda-2.6.0/debian/patches/series
--- horizon-eda-2.6.0/debian/patches/series	2024-12-17 04:38:44.000000000 +0100
+++ horizon-eda-2.6.0/debian/patches/series	2025-10-17 15:54:38.000000000 +0200
@@ -2,3 +2,4 @@
 02-local-collage.patch
 canvas_gl-error-check.patch
 libgit-api-updates.patch
+bug-1116331-drop-libosmesa6-dev.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to