1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

tools, app-tools: move gimp-debug-tool from tools/ to app-tools/

Move gimp-debug-tools.c from tools/ to a new app-tools/ subdir,
which should contain external tools needed by app/, and which is
built *after* app/ (unlinke tools/).  This allows gimp-debug-tool
to depend on libapp and libappwidgets, instead of on actual source
files from app/.  Building sources from app/ in another subdir
screws with the distclean rules, and breaks distcheck.
This commit is contained in:
Ell
2018-03-10 16:48:20 -05:00
parent 646a56fe8a
commit 5893d2dc73
7 changed files with 80 additions and 33 deletions

6
app-tools/.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
/Makefile
/Makefile.in
/.deps
/.libs
/gimp-debug-tool-2.0
/gimp-debug-tool-2.0.exe

71
app-tools/Makefile.am Normal file
View File

@@ -0,0 +1,71 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = subdir-objects
libapp = $(top_builddir)/app/libapp.a
libappwidgets = $(top_builddir)/app/widgets/libappwidgets.a
if PLATFORM_OSX
xobjective_c = "-xobjective-c"
endif
if OS_WIN32
bin_PROGRAMS = gimp-debug-tool-@GIMP_TOOL_VERSION@
else
if PLATFORM_OSX
bin_PROGRAMS = gimp-debug-tool-@GIMP_TOOL_VERSION@
else
libexec_PROGRAMS = gimp-debug-tool-@GIMP_TOOL_VERSION@
endif
endif
gimp_debug_tool_@GIMP_TOOL_VERSION@_SOURCES = \
gimp-debug-tool.c
gimp_debug_tool_@GIMP_TOOL_VERSION@_CPPFLAGS = \
-DCC_VERSION=\""$(CC_VERSION)"\" \
-I$(top_srcdir)/app \
-I$(top_builddir)/app \
$(AM_CPPFLAGS) \
$(GIO_CFLAGS) \
$(GEGL_CFLAGS) \
$(GTK_CFLAGS) \
$(FONTCONFIG_CFLAGS)
gimp_debug_tool_@GIMP_TOOL_VERSION@_LDADD = \
$(libappwidgets) \
$(libapp) \
$(GIO_LIBS) \
$(GEGL_LIBS) \
$(GTK_LIBS) \
$(FONTCONFIG_LIBS)
AM_CPPFLAGS = \
-DGIMP_APP_VERSION=\"@GIMP_APP_VERSION@\" \
-DLOCALEDIR=\""$(gimplocaledir)"\" \
-DPREFIX=\""$(prefix)"\" \
-DEXEC_PREFIX=\""$(exec_prefix)"\" \
-DBINDIR=\""$(bindir)"\" \
-DSBINDIR=\""$(sbindir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DDATAROOTDIR=\""$(datarootdir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DSHAREDSTATEDIR=\""$(sharedstatedir)"\" \
-DLOCALSTATEDIR=\""$(localstatedir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DINFODIR=\""$(infodir)"\" \
-DMANDIR=\""$(mandir)"\" \
-DGIMPPLUGINDIR=\""$(gimpplugindir)"\" \
-DGIMPDATADIR=\""$(gimpdatadir)"\" \
-DCC=\""$(CC)"\" \
-DGIMPDIR=\""$(gimpdir)"\" \
-DGIMP_PLUGIN_VERSION=\""$(GIMP_PLUGIN_VERSION)"\" \
-I$(top_srcdir) \
$(GTK_CFLAGS) \
-I$(includedir) \
$(xobjective_c)

View File

@@ -0,0 +1,92 @@
/* gimpdebug
* Copyright (C) 2018 Jehan <jehan@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* GimpDebug simply displays a dialog with debug data (backtraces,
* version, etc.), proposing to create a bug report. The reason why it
* is a separate executable is simply that when the program crashed,
* even though some actions are possible before exit() by catching fatal
* errors and signals, it may not be possible to allocate memory
* anymore. Therefore creating a new dialog is an impossible action.
* So we call instead a separate program, then exit.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <gio/gio.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "app/widgets/gimpcriticaldialog.h"
int
main (int argc,
char **argv)
{
const gchar *program;
const gchar *pid;
const gchar *reason;
const gchar *message;
const gchar *bt_file = NULL;
gchar *trace = NULL;
gchar *error;
GtkWidget *dialog;
if (argc != 6)
{
g_print ("Usage: gimpdebug-2.0 [PROGRAM] [PID] [REASON] [MESSAGE] [BT_FILE]\n");
exit (EXIT_FAILURE);
}
program = argv[1];
pid = argv[2];
reason = argv[3];
message = argv[4];
error = g_strdup_printf ("%s: %s", reason, message);
bt_file = argv[5];
g_file_get_contents (bt_file, &trace, NULL, NULL);
if (trace == NULL || strlen (trace) == 0)
exit (EXIT_FAILURE);
gtk_init (&argc, &argv);
dialog = gimp_critical_dialog_new (_("GIMP Crash Debug"));
gimp_critical_dialog_add (dialog, error, trace, TRUE, program,
g_ascii_strtoull (pid, NULL, 10));
g_free (error);
g_free (trace);
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (dialog);
gtk_main ();
exit (EXIT_SUCCESS);
}