gimp r24968 - in trunk: . app



Author: tml
Date: Tue Feb 26 14:02:44 2008
New Revision: 24968
URL: http://svn.gnome.org/viewvc/gimp?rev=24968&view=rev

Log:
2008-02-26  Tor Lillqvist  <tml novell com>

	* app/version.[ch]: New files. Rename gimp_show_version() to
	gimp_version_show() and move here. When given both --version and
	--verbose, print build-time and run-time versions of the most
	important dependencies.

	* app/Makefile.am: Add them.

	* app/main.c: Call gimp_version_show().

	* app/Makefile.am: Use -mwindows only for the GUI gimp, not for
	gimp-console.



Added:
   trunk/app/version.c
   trunk/app/version.h
Modified:
   trunk/ChangeLog
   trunk/app/Makefile.am
   trunk/app/main.c

Modified: trunk/app/Makefile.am
==============================================================================
--- trunk/app/Makefile.am	(original)
+++ trunk/app/Makefile.am	Tue Feb 26 14:02:44 2008
@@ -51,6 +51,8 @@
 	sanity.h	\
 	units.c		\
 	units.h		\
+	version.c	\
+	version.h	\
 	gimp-log.c	\
 	gimp-log.h	\
 	gimp-intl.h
@@ -88,13 +90,15 @@
 	$(GEGL_CFLAGS)		\
 	-I$(includedir)
 
-AM_LDFLAGS = $(mwindows) $(munix) \
+AM_LDFLAGS = $(munix) \
 	$(CARBON_LDFLAGS)			\
 	-u $(SYMPREFIX)xcf_init			\
 	-u $(SYMPREFIX)internal_procs_init	\
 	-u $(SYMPREFIX)gimp_coords_mix		\
 	-u $(SYMPREFIX)gimp_plug_in_manager_restore
 
+gimp_2_5_LDFLAGS = $(mwindows) 
+
 gimp_2_5_LDADD = \
 	gui/libappgui.a			\
 	actions/libappactions.a		\

Modified: trunk/app/main.c
==============================================================================
--- trunk/app/main.c	(original)
+++ trunk/app/main.c	Tue Feb 26 14:02:44 2008
@@ -68,6 +68,7 @@
 #include "errors.h"
 #include "sanity.h"
 #include "units.h"
+#include "version.h"
 
 #ifdef G_OS_WIN32
 #include <windows.h>
@@ -309,6 +310,20 @@
   g_set_prgname (basename);
   g_free (basename);
 
+  /* Check argv[] for "--verbose" first */
+  for (i = 1; i < argc; i++)
+    {
+      const gchar *arg = argv[i];
+
+      if (arg[0] != '-')
+        continue;
+
+      if ((strcmp (arg, "--verbose") == 0) || (strcmp (arg, "-v") == 0))
+        {
+          be_verbose = TRUE;
+        }
+    }
+
   /* Check argv[] for "--no-interface" before trying to initialize gtk+. */
   for (i = 1; i < argc; i++)
     {
@@ -323,7 +338,6 @@
         }
       else if ((strcmp (arg, "--version") == 0) || (strcmp (arg, "-v") == 0))
         {
-          gimp_open_console_window ();
           gimp_show_version_and_exit ();
         }
 #if defined (G_OS_WIN32) && !defined (GIMP_CONSOLE_COMPILATION)
@@ -553,17 +567,10 @@
 }
 
 static void
-gimp_show_version (void)
-{
-  gimp_open_console_window ();
-  g_print (_("%s version %s"), GIMP_NAME, GIMP_VERSION);
-  g_print ("\n");
-}
-
-static void
 gimp_show_version_and_exit (void)
 {
-  gimp_show_version ();
+  gimp_open_console_window ();
+  gimp_version_show (be_verbose);
 
   app_exit (EXIT_SUCCESS);
 }
@@ -571,7 +578,8 @@
 static void
 gimp_show_license_and_exit (void)
 {
-  gimp_show_version ();
+  gimp_open_console_window ();
+  gimp_version_show (be_verbose);
 
   g_print ("\n");
   g_print (GIMP_LICENSE);

Added: trunk/app/version.c
==============================================================================
--- (empty file)
+++ trunk/app/version.c	Tue Feb 26 14:02:44 2008
@@ -0,0 +1,97 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <glib.h>
+
+#ifndef GIMP_CONSOLE_COMPILATION
+#include <gtk/gtk.h>
+#endif
+#include <fontconfig/fontconfig.h>
+#include <pango/pango.h>
+#include <pango/pangoft2.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "version.h"
+
+#include "about.h"
+#include "gimp-intl.h"
+
+static void
+gimp_show_one_library_version (const gchar *package,
+                               int          build_time_major,
+                               int          build_time_minor,
+                               int          build_time_micro,
+                               int          run_time_major,
+                               int          run_time_minor,
+                               int          run_time_micro)
+{
+  g_print ("%s: %s %d.%d.%d, %s %d.%d.%d\n",
+           package,
+           _("compiled against version"),
+           build_time_major, build_time_minor, build_time_micro,
+           _("running against version"),
+           run_time_major, run_time_minor, run_time_micro);
+}
+
+static void
+gimp_show_library_versions (void)
+{
+#ifndef GIMP_CONSOLE_COMPILATION
+  gimp_show_one_library_version
+    ("GTK+",
+     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION,
+     gtk_major_version, gtk_minor_version, gtk_micro_version);
+#endif
+  gimp_show_one_library_version
+    ("Pango",
+     PANGO_VERSION_MAJOR, PANGO_VERSION_MINOR, PANGO_VERSION_MICRO,
+     pango_version () / 100 / 100, pango_version () / 100 % 100, pango_version () % 100);
+  gimp_show_one_library_version
+    ("GLib",
+     GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION,
+     glib_major_version, glib_minor_version, glib_micro_version);
+  gimp_show_one_library_version
+    ("Fontconfig",
+     FC_MAJOR, FC_MINOR, FC_REVISION,
+     FcGetVersion () / 100 / 100, FcGetVersion () / 100 % 100, FcGetVersion () % 100);
+}
+
+void
+gimp_version_show (gboolean be_verbose)
+{
+  g_print (_("%s version %s"), GIMP_NAME, GIMP_VERSION);
+  g_print ("\n");
+
+  if (be_verbose)
+    {
+      g_print ("\n");
+      gimp_show_library_versions ();
+    }
+}
+

Added: trunk/app/version.h
==============================================================================
--- (empty file)
+++ trunk/app/version.h	Tue Feb 26 14:02:44 2008
@@ -0,0 +1,31 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __VERSION_H__
+#define __VERSION_H__
+
+
+#ifndef GIMP_APP_GLUE_COMPILATION
+#error You must not #include "version.h" from an app/ subdir
+#endif
+
+
+void   gimp_version_show (gboolean be_verbose);
+
+
+#endif /* __VERSION_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]