version.c 4.9 KB
Newer Older
1 2 3
/* GIMP - The GNU Image Manipulation Program
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7 8 9 10 11 12 13 14
 * (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
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 17 18 19 20
 */

#include "config.h"

#include <glib.h>
21
#include <cairo.h>
22 23 24
#include <fontconfig/fontconfig.h>
#include <pango/pango.h>
#include <pango/pangoft2.h>
25
#include <gdk-pixbuf/gdk-pixbuf.h>
26
#include <gegl.h>
27

28 29 30 31
#ifndef GIMP_CONSOLE_COMPILATION
#include <gtk/gtk.h>
#endif

32 33
#include "libgimpbase/gimpbase.h"

34
#include "about.h"
35
#include "version.h"
36
#include "git-version.h"
37 38 39

#include "gimp-intl.h"

40

41
static void
42 43 44 45 46 47 48
gimp_show_library_version (const gchar *package,
                           gint         build_time_major,
                           gint         build_time_minor,
                           gint         build_time_micro,
                           gint         run_time_major,
                           gint         run_time_minor,
                           gint         run_time_micro)
49
{
50 51 52 53 54 55 56 57 58 59 60 61 62
  gchar *build_time_version;
  gchar *run_time_version;

  build_time_version = g_strdup_printf ("%d.%d.%d",
                                        build_time_major,
                                        build_time_minor,
                                        build_time_micro);
  run_time_version = g_strdup_printf ("%d.%d.%d",
                                      run_time_major,
                                      run_time_minor,
                                      run_time_micro);

  /* show versions of libraries used by GIMP */
63
  g_print (_("using %s version %s (compiled against version %s)"),
64
           package, run_time_version, build_time_version);
65 66 67 68
  g_print ("\n");

  g_free (run_time_version);
  g_free (build_time_version);
69 70 71 72 73
}

static void
gimp_show_library_versions (void)
{
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
  gint gegl_major_version;
  gint gegl_minor_version;
  gint gegl_micro_version;

  gegl_get_version (&gegl_major_version,
                    &gegl_minor_version,
                    &gegl_micro_version);

  gimp_show_library_version ("GEGL",
                             GEGL_MAJOR_VERSION,
                             GEGL_MINOR_VERSION,
                             GEGL_MICRO_VERSION,
                             gegl_major_version,
                             gegl_minor_version,
                             gegl_micro_version);
89

90 91 92 93 94 95 96 97
  gimp_show_library_version ("GLib",
                             GLIB_MAJOR_VERSION,
                             GLIB_MINOR_VERSION,
                             GLIB_MICRO_VERSION,
                             glib_major_version,
                             glib_minor_version,
                             glib_micro_version);

98 99 100 101 102 103 104 105
  gimp_show_library_version ("GdkPixbuf",
                             GDK_PIXBUF_MAJOR,
                             GDK_PIXBUF_MINOR,
                             GDK_PIXBUF_MICRO,
                             gdk_pixbuf_major_version,
                             gdk_pixbuf_minor_version,
                             gdk_pixbuf_micro_version);

106
#ifndef GIMP_CONSOLE_COMPILATION
107 108 109 110 111 112 113
  gimp_show_library_version ("GTK+",
                             GTK_MAJOR_VERSION,
                             GTK_MINOR_VERSION,
                             GTK_MICRO_VERSION,
                             gtk_major_version,
                             gtk_minor_version,
                             gtk_micro_version);
114
#endif
115 116 117 118 119 120 121 122 123 124 125 126 127 128

  gimp_show_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_library_version ("Fontconfig",
                             FC_MAJOR, FC_MINOR, FC_REVISION,
                             FcGetVersion () / 100 / 100,
                             FcGetVersion () / 100 % 100,
                             FcGetVersion () % 100);
129 130 131 132

  g_print (_("using %s version %s (compiled against version %s)"),
           "Cairo", cairo_version_string (), CAIRO_VERSION_STRING);
  g_print ("\n");
133 134 135 136 137 138 139 140 141 142
}

void
gimp_version_show (gboolean be_verbose)
{
  g_print (_("%s version %s"), GIMP_NAME, GIMP_VERSION);
  g_print ("\n");

  if (be_verbose)
    {
143
      g_print ("git-describe: %s", GIMP_GIT_VERSION);
144 145
      g_print ("\n");

146 147 148 149
      g_print ("\n");
      gimp_show_library_versions ();
    }
}