Package: guix-patches;
Reported by: "Artyom V. Poptsov" <poptsov.artyom <at> gmail.com>
Date: Sun, 16 Feb 2025 08:45:02 UTC
Severity: normal
Tags: patch
Message #11 received at 76326 <at> debbugs.gnu.org (full text, mbox):
From: "Artyom V. Poptsov" <poptsov.artyom <at> gmail.com> To: 76326 <at> debbugs.gnu.org Cc: "Artyom V. Poptsov" <poptsov.artyom <at> gmail.com> Subject: [PATCH 2/2] gnu: gpick: Update to 0.3-1.365f605. Date: Sun, 16 Feb 2025 11:45:16 +0300
* gnu/packages/image.scm (gpick): Update to 0.3-1.365f605. [source]: Apply the patch from <https://github.com/thezbyg/gpick/pull/225/>. [inputs]: Use gtk+ and lua. [arguments]<#:scons-flags>: Set "LUA_TYPE". <#:phases>: Add 'generate-version-file' phase. Use lua-5.3 in "fix-lua-reference" phase. * gnu/packages/patches/gpick-fix-segfault-on-start.patch: New file. * gnu/local.mk (dist_patch_DATA): Register the patch. Change-Id: I18e5e9dea1b43a3f4f641e2c52b95a17a17429b7 --- gnu/local.mk | 1 + gnu/packages/image.scm | 77 ++++++---- .../patches/gpick-fix-segfault-on-start.patch | 141 ++++++++++++++++++ 3 files changed, 188 insertions(+), 31 deletions(-) create mode 100644 gnu/packages/patches/gpick-fix-segfault-on-start.patch diff --git a/gnu/local.mk b/gnu/local.mk index 9690bbe647..7bfcb43a1e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1511,6 +1511,7 @@ dist_patch_DATA = \ %D%/packages/patches/go-skip-gc-test.patch \ %D%/packages/patches/gourmet-sqlalchemy-compat.patch \ %D%/packages/patches/gpaste-fix-paths.patch \ + %D%/packages/patches/gpick-fix-segfault-on-start.patch \ %D%/packages/patches/gpm-glibc-2.26.patch \ %D%/packages/patches/gpodder-disable-updater.patch \ %D%/packages/patches/grantlee-fix-i586-precision.patch \ diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index 282b6582e8..04824f23ad 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -2041,37 +2041,52 @@ (define-public picket (license license:gpl3+))) (define-public gpick - (package - (name "gpick") - (version "0.2.6") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/thezbyg/gpick") - (commit (string-append name "-" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 "0nl89gca5nmbyycv5rl5bm6k7facapdk4pab9pl949aa3cjw9bk7")))) - (build-system scons-build-system) - (native-inputs (list boost gettext-minimal pkg-config ragel)) - (inputs (list expat gtk+-2 lua-5.2)) - (arguments - (list - #:tests? #f - #:scons scons-python2 - #:scons-flags #~(list (string-append "DESTDIR=" #$output)) - #:phases - #~(modify-phases %standard-phases - (add-before 'build 'fix-lua-reference - (lambda _ - (substitute* "SConscript" - (("lua5.2") - "lua-5.2"))))))) - (home-page "http://www.gpick.org/") - (synopsis "Color picker") - (description "Gpick is an advanced color picker and palette editing tool.") - (license license:bsd-3))) + (let ((commit "365f605d187cb57dc86d3feb166c4636f262ae31") + (revision "1") + (version "0.3")) + (package + (name "gpick") + (version (git-version version revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/thezbyg/gpick") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1p60pa85mgcbzgd85pvyishw8jr49ciphq6z07yw6v9j97j80iax")) + ;; See this pull request: + ;; <https://github.com/thezbyg/gpick/pull/225/> + (patches (search-patches "gpick-fix-segfault-on-start.patch")))) + (build-system scons-build-system) + (native-inputs (list boost gettext-minimal pkg-config ragel)) + (inputs (list expat gtk+ lua)) + (arguments + (list + #:tests? #f + #:scons scons + #:scons-flags #~(list (string-append "DESTDIR=" #$output) + "LUA_TYPE=C") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'generate-version-file + (lambda _ + (with-output-to-file ".version" + (lambda () + (format #t "0.3~%") + (format #t "~a~%" #$revision) + (format #t "~a~%" #$commit) + (format #t "2023-06-09~%"))))) + (add-before 'build 'fix-lua-reference + (lambda _ + (substitute* "SConscript" + (("lua5.3") + "lua-5.3"))))))) + (home-page "http://www.gpick.org/") + (synopsis "Color picker") + (description "Gpick is an advanced color picker and palette editing tool.") + (license license:bsd-3)))) (define-public libiptcdata (package diff --git a/gnu/packages/patches/gpick-fix-segfault-on-start.patch b/gnu/packages/patches/gpick-fix-segfault-on-start.patch new file mode 100644 index 0000000000..1ecc6012db --- /dev/null +++ b/gnu/packages/patches/gpick-fix-segfault-on-start.patch @@ -0,0 +1,141 @@ +From a55129f534a62e179ae7facd58b75a61b500e387 Mon Sep 17 00:00:00 2001 +From: Trantarius <leborjt <at> yahoo.com> +Date: Sat, 18 Nov 2023 19:01:18 -0500 +Subject: [PATCH] fix segfault on start + +--- + source/GlobalState.cpp | 13 ++++-- + source/common/Span.h | 1 + + source/gtk/ColorComponent.cpp | 78 +++++++++++++++++------------------ + 3 files changed, 49 insertions(+), 43 deletions(-) + +diff --git a/source/GlobalState.cpp b/source/GlobalState.cpp +index 50b3c2a..146c53e 100644 +--- a/source/GlobalState.cpp ++++ b/source/GlobalState.cpp +@@ -50,9 +50,16 @@ struct ConverterOptions: public Converter::Options, public IEventHandler { + } + void update() { + auto options = m_settings.getMap("gpick.options"); +- upperCaseHex = options->getString("hex_case", "upper") == "upper"; +- cssPercentages = options->getBool("css_percentages", false); +- cssAlphaPercentage = options->getBool("css_alpha_percentage", false); ++ if(options){ ++ upperCaseHex = options->getString("hex_case", "upper") == "upper"; ++ cssPercentages = options->getBool("css_percentages", false); ++ cssAlphaPercentage = options->getBool("css_alpha_percentage", false); ++ } ++ else{ ++ upperCaseHex=true; ++ cssPercentages=false; ++ cssAlphaPercentage=false; ++ } + } + virtual ~ConverterOptions() { + } +diff --git a/source/common/Span.h b/source/common/Span.h +index f5b0552..67c7bde 100644 +--- a/source/common/Span.h ++++ b/source/common/Span.h +@@ -19,6 +19,7 @@ + #ifndef GPICK_COMMON_SPAN_H_ + #define GPICK_COMMON_SPAN_H_ + #include <type_traits> ++#include <cstdint> + #include <iterator> + namespace common { + template<typename T, typename SizeT = size_t> +diff --git a/source/gtk/ColorComponent.cpp b/source/gtk/ColorComponent.cpp +index 7d59fdc..aa626d5 100644 +--- a/source/gtk/ColorComponent.cpp ++++ b/source/gtk/ColorComponent.cpp +@@ -550,51 +550,49 @@ static gboolean onDraw(GtkWidget *widget, cairo_t *cr) { + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_set_line_width(cr, 1); + cairo_stroke(cr); +- if (ns->text[i] || ns->label[i]) { +- PangoLayout *layout; +- PangoFontDescription *font_description; +- font_description = pango_font_description_new(); +- layout = pango_cairo_create_layout(cr); +- pango_font_description_set_family(font_description, "sans"); +- pango_font_description_set_weight(font_description, PANGO_WEIGHT_NORMAL); +- pango_font_description_set_absolute_size(font_description, 12 * PANGO_SCALE); +- pango_layout_set_font_description(layout, font_description); +- pango_layout_set_wrap(layout, PANGO_WRAP_WORD); +- pango_layout_set_single_paragraph_mode(layout, true); ++ PangoLayout *layout; ++ PangoFontDescription *font_description; ++ font_description = pango_font_description_new(); ++ layout = pango_cairo_create_layout(cr); ++ pango_font_description_set_family(font_description, "sans"); ++ pango_font_description_set_weight(font_description, PANGO_WEIGHT_NORMAL); ++ pango_font_description_set_absolute_size(font_description, 12 * PANGO_SCALE); ++ pango_layout_set_font_description(layout, font_description); ++ pango_layout_set_wrap(layout, PANGO_WRAP_WORD); ++ pango_layout_set_single_paragraph_mode(layout, true); + #if GTK_MAJOR_VERSION >= 3 +- //TODO: GTK3 font color ++ //TODO: GTK3 font color + #else +- gdk_cairo_set_source_color(cr, &widget->style->text[0]); ++ gdk_cairo_set_source_color(cr, &widget->style->text[0]); + #endif +- int width, height; +- if (ns->text[i]) { +- pango_layout_set_text(layout, ns->text[i], -1); +- pango_layout_set_width(layout, 40 * PANGO_SCALE); +- pango_layout_set_height(layout, 16 * PANGO_SCALE); +- pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT); +- pango_cairo_update_layout(cr, layout); +- pango_layout_get_pixel_size(layout, &width, &height); +- cairo_move_to(cr, 200 + offset_x - 5, i * 16); +- pango_cairo_show_layout(cr, layout); +- } +- if (ns->label[i][0] && ns->label[i][1] && offset_x > 10) { +- if (offset_x > 50) { +- pango_layout_set_text(layout, ns->label[i][1], -1); +- } else { +- pango_layout_set_text(layout, ns->label[i][0], -1); +- } +- pango_layout_set_width(layout, (offset_x - 10) * PANGO_SCALE); +- pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END); +- pango_layout_set_height(layout, 16 * PANGO_SCALE); +- pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT); +- pango_cairo_update_layout(cr, layout); +- pango_layout_get_pixel_size(layout, &width, &height); +- cairo_move_to(cr, 5, i * 16); +- pango_cairo_show_layout(cr, layout); ++ int width, height; ++ if (ns->text[i]) { ++ pango_layout_set_text(layout, ns->text[i], -1); ++ pango_layout_set_width(layout, 40 * PANGO_SCALE); ++ pango_layout_set_height(layout, 16 * PANGO_SCALE); ++ pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT); ++ pango_cairo_update_layout(cr, layout); ++ pango_layout_get_pixel_size(layout, &width, &height); ++ cairo_move_to(cr, 200 + offset_x - 5, i * 16); ++ pango_cairo_show_layout(cr, layout); ++ } ++ if (ns->label[i][0] && ns->label[i][1] && offset_x > 10) { ++ if (offset_x > 50) { ++ pango_layout_set_text(layout, ns->label[i][1], -1); ++ } else { ++ pango_layout_set_text(layout, ns->label[i][0], -1); + } +- g_object_unref(layout); +- pango_font_description_free(font_description); ++ pango_layout_set_width(layout, (offset_x - 10) * PANGO_SCALE); ++ pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END); ++ pango_layout_set_height(layout, 16 * PANGO_SCALE); ++ pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT); ++ pango_cairo_update_layout(cr, layout); ++ pango_layout_get_pixel_size(layout, &width, &height); ++ cairo_move_to(cr, 5, i * 16); ++ pango_cairo_show_layout(cr, layout); + } ++ g_object_unref(layout); ++ pango_font_description_free(font_description); + } + return TRUE; + } -- 2.48.1
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.