gnome-extra/extension-manager: Add patch to remove libbacktrace dep

Signed-off-by: Yuan Liao <liaoyuan@gmail.com>
This commit is contained in:
Yuan Liao
2023-06-03 10:40:10 -07:00
parent ae6c713a4b
commit eab57b2eca
4 changed files with 281 additions and 1 deletions

View File

@@ -0,0 +1,88 @@
# Copyright 2022-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit gnome2-utils meson xdg
if [[ ${PV} == *9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/mjakeman/extension-manager.git"
else
SRC_URI="https://github.com/mjakeman/extension-manager/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64"
fi
DESCRIPTION="A native tool for browsing, installing, and managing GNOME Shell Extensions"
HOMEPAGE="https://mjakeman.github.io/extension-manager/"
LICENSE="GPL-3+"
SLOT="0"
BDEPEND="
dev-libs/glib:2
dev-util/blueprint-compiler
sys-devel/gettext
virtual/pkgconfig
"
RDEPEND="
dev-libs/glib:2
dev-libs/json-glib
gui-libs/gtk:4[introspection]
>=gui-libs/libadwaita-1.2.0:1[introspection]
gui-libs/text-engine
net-libs/libsoup:3.0
"
DEPEND="
${RDEPEND}
"
PATCHES=(
"${FILESDIR}/${PN}-0.4.1-exm-backtrace.c-include-stdint.h.patch"
"${FILESDIR}/${PN}-0.4.1-make-libbacktrace-optional.patch"
)
src_configure() {
local emesonargs=(
-Dpackage="ebuild"
-Ddistributor="Gentoo GURU <guru-bugs@gentoo.org>"
# sys-libs/libbacktrace has been last-rited in ::gentoo
# and is thus unavailable
-Dbacktrace=false
)
if has live ${PROPERTIES}; then
# Produce a development build for live ebuild
emesonargs+=( -Ddevelopment=true )
fi
meson_src_configure
}
# Tests are skipped because as of version 0.3.0, the tests only validate
# resource files and do not verify any functionality of the program. Those
# validations are either already handled by QA checks or not relevant on
# Gentoo. For more information about the rationale, please refer to:
# https://github.com/gentoo/guru/commit/f896bee213fbb62c70e818c1bf503fee2a41919a#comments
#
# If tests are to be executed in the future because the upstream adds
# functionality tests or for other reasons, and should there be no convenient
# way to skip the validations, the following variable values need to be set:
#
# IUSE="test"
# RESTRICT="!test? ( test )"
# BDEPEND="test? ( dev-libs/appstream-glib dev-util/desktop-file-utils )"
src_test() {
:
}
pkg_postinst() {
xdg_pkg_postinst
gnome2_schemas_update
}
pkg_postrm() {
xdg_pkg_postrm
gnome2_schemas_update
}

View File

@@ -33,17 +33,25 @@ RDEPEND="
>=gui-libs/libadwaita-1.2.0:1[introspection]
gui-libs/text-engine
net-libs/libsoup:3.0
sys-libs/libbacktrace
"
DEPEND="
${RDEPEND}
"
PATCHES=(
"${FILESDIR}/${PN}-0.4.1-exm-backtrace.c-include-stdint.h.patch"
"${FILESDIR}/${PN}-0.4.1-make-libbacktrace-optional.patch"
)
src_configure() {
local emesonargs=(
-Dpackage="ebuild"
-Ddistributor="Gentoo GURU <guru-bugs@gentoo.org>"
# sys-libs/libbacktrace has been last-rited in ::gentoo
# and is thus unavailable
-Dbacktrace=false
)
if has live ${PROPERTIES}; then
# Produce a development build for live ebuild

View File

@@ -0,0 +1,31 @@
From 49186450ff33e4a75d966cee51bcb6446fae3639 Mon Sep 17 00:00:00 2001
From: Yuan Liao <liaoyuan@gmail.com>
Date: Sat, 3 Jun 2023 09:59:11 -0700
Subject: [PATCH 1/2] exm-backtrace.c: Explicitly include stdint.h for
uintptr_t usage
The file uses type uintptr_t from stdint.h, which is indirectly included
by backtrace.h. Even so, the file should unconditionally include
stdint.h just in case backtrace.h no longer includes stdint.h in the
future.
Signed-off-by: Yuan Liao <liaoyuan@gmail.com>
---
src/exm-backtrace.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/exm-backtrace.c b/src/exm-backtrace.c
index 56b253a..4951394 100644
--- a/src/exm-backtrace.c
+++ b/src/exm-backtrace.c
@@ -21,6 +21,7 @@
#include "exm-backtrace.h"
#include <glib.h>
+#include <stdint.h>
#include <backtrace-supported.h>
#include <backtrace.h>
--
2.39.3

View File

@@ -0,0 +1,153 @@
From 6365d56e120c7522bc5a2ba515a3cd6efac1b184 Mon Sep 17 00:00:00 2001
From: Yuan Liao <liaoyuan@gmail.com>
Date: Sat, 3 Jun 2023 09:55:38 -0700
Subject: [PATCH 2/2] Make libbacktrace an optional dependency
Signed-off-by: Yuan Liao <liaoyuan@gmail.com>
---
meson.build | 1 +
meson_options.txt | 5 +++++
src/exm-application.c | 2 ++
src/exm-backtrace.c | 17 +++++++++++++++++
src/meson.build | 9 ++++++---
5 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/meson.build b/meson.build
index 536cd97..d7b0eb5 100644
--- a/meson.build
+++ b/meson.build
@@ -25,6 +25,7 @@ config_h.set_quoted('PKG_NAME', get_option('package'))
config_h.set_quoted('PKG_DISTRIBUTOR', get_option('distributor'))
config_h.set10('IS_OFFICIAL', get_option('official'))
config_h.set10('IS_DEVEL', get_option('development'))
+config_h.set10('WITH_BACKTRACE', get_option('backtrace'))
configure_file(
output: 'exm-config.h',
configuration: config_h,
diff --git a/meson_options.txt b/meson_options.txt
index b604dda..3f54b77 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,6 +8,11 @@ option('official',
value: false,
description: 'Whether this is an official upstream package')
+option('backtrace',
+ type: 'boolean',
+ value: true,
+ description: 'Whether the package is built with backtrace support')
+
# Will be shown in error messages
option('package',
type: 'string',
diff --git a/src/exm-application.c b/src/exm-application.c
index 5b56295..d062627 100644
--- a/src/exm-application.c
+++ b/src/exm-application.c
@@ -201,11 +201,13 @@ exm_application_show_about (GSimpleAction *action,
GTK_LICENSE_MPL_2_0,
NULL);
+#if WITH_BACKTRACE
adw_about_window_add_legal_section (ADW_ABOUT_WINDOW (about_window),
"libbacktrace",
"Copyright (C) 2012-2016 Free Software Foundation, Inc.",
GTK_LICENSE_BSD_3,
NULL);
+#endif
adw_about_window_add_legal_section (ADW_ABOUT_WINDOW (about_window),
"blueprint",
diff --git a/src/exm-backtrace.c b/src/exm-backtrace.c
index 4951394..3cf09b7 100644
--- a/src/exm-backtrace.c
+++ b/src/exm-backtrace.c
@@ -18,15 +18,21 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
+#include "exm-config.h"
+
#include "exm-backtrace.h"
#include <glib.h>
#include <stdint.h>
+#if WITH_BACKTRACE
#include <backtrace-supported.h>
#include <backtrace.h>
+#endif
+#if WITH_BACKTRACE
static struct backtrace_state *state = NULL;
+#endif
static void
exm_backtrace_error_cb (void *data,
@@ -54,6 +60,8 @@ exm_backtrace_full_cb (GString *string_builder,
void
exm_backtrace_init (char *filename)
{
+#if WITH_BACKTRACE
+
#ifdef BACKTRACE_SUPPORTED
state = backtrace_create_state (filename, 0,
exm_backtrace_error_cb,
@@ -61,11 +69,16 @@ exm_backtrace_init (char *filename)
#else
g_warning ("Backtraces are not supported.\n");
#endif
+
+#else
+ g_warning ("Backtraces were not enabled at build time.\n");
+#endif
}
char *
exm_backtrace_print ()
{
+#if WITH_BACKTRACE
GString *string_builder;
if (!state)
@@ -82,4 +95,8 @@ exm_backtrace_print ()
string_builder);
return g_string_free (string_builder, FALSE);
+#else
+ g_critical ("Backtraces were not enabled at build time.\n");
+ return NULL;
+#endif
}
diff --git a/src/meson.build b/src/meson.build
index 8599a8f..2adde2d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -29,7 +29,7 @@ exm_sources = [
]
cc = meson.get_compiler('c')
-libbacktrace_dep = cc.find_library('backtrace', required: true)
+libbacktrace_dep = cc.find_library('backtrace', required: get_option('backtrace'))
exm_deps = [
dependency('gtk4'),
@@ -37,10 +37,13 @@ exm_deps = [
dependency('gio-unix-2.0'),
dependency('json-glib-1.0'),
dependency('libsoup-3.0'),
- dependency('text-engine-0.1'),
- libbacktrace_dep
+ dependency('text-engine-0.1')
]
+if libbacktrace_dep.found()
+ exm_deps += libbacktrace_dep
+endif
+
gnome = import('gnome')
subdir('local')
--
2.39.3