mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-07-04 17:09:30 +00:00
Added simple bundle support
This can be used to produce a zip file which can be distributed and run without installing. Use ./configure --enable-bundle and after 'make bundle' to produce the bundle.
This commit is contained in:
parent
7cbcd31f8a
commit
79d686825a
|
@ -12,3 +12,12 @@ EXTRA_DIST = \
|
|||
intltool-extract.in \
|
||||
intltool-merge.in \
|
||||
intltool-update.in
|
||||
|
||||
bundle:
|
||||
rm -rf "$(bundledir)"; mkdir "$(bundledir)"; \
|
||||
rm -rf gitg-$(PACKAGE_VERSION).zip; \
|
||||
top_bundledir=`cd "$(bundledir)" && pwd`; \
|
||||
for i in $(SUBDIRS); do (cd $$i && $(MAKE) top_bundledir="$$top_bundledir" $(AM_MAKEFLAGS) bundle); done; \
|
||||
zip -r gitg-$(PACKAGE_VERSION).zip $(bundledir) >/dev/null;
|
||||
|
||||
.PHONY: bundle
|
||||
|
|
14
configure.ac
14
configure.ac
|
@ -58,9 +58,17 @@ AC_SUBST(PACKAGE_LIBS)
|
|||
|
||||
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
|
||||
|
||||
dnl ================================================================
|
||||
dnl GConf related settings
|
||||
dnl ================================================================
|
||||
AC_ARG_ENABLE([bundle],
|
||||
AS_HELP_STRING([--enable-bundle],[Enable building bundle (default: disabled)]),
|
||||
[enable_bundle=$enableval],
|
||||
[enable_bundle=no])
|
||||
|
||||
if test "$enable_bundle" = "yes"; then
|
||||
AC_DEFINE([ENABLE_BUNDLE],[1],[Defined if building bundle])
|
||||
fi
|
||||
|
||||
bundledir=gitg-bundle-gitg_version
|
||||
AC_SUBST(bundledir)
|
||||
|
||||
AM_GCONF_SOURCE_2
|
||||
|
||||
|
|
|
@ -29,6 +29,13 @@ else
|
|||
install-data-local:
|
||||
endif
|
||||
|
||||
bundle: $(gitglangs_DATA) $(gitgstyles_DATA)
|
||||
for i in $(SUBDIRS); do (cd $$i && $(MAKE) top_bundledir="$(top_bundledir)" $(AM_MAKEFLAGS) bundle); done; \
|
||||
for i in $(gitglangs_DATA); do $(INSTALL) -D $$i $(top_bundledir)/resources/language-specs/$$i; done; \
|
||||
for i in $(gitgstyles_DATA); do $(INSTALL) -D $$i $(top_bundledir)/resources/styles/$$i; done;
|
||||
|
||||
.PHONY: bundle
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(desktop_in_files) \
|
||||
$(schemas_in_files) \
|
||||
|
|
|
@ -12,5 +12,11 @@ pixmapsdir = $(datadir)/pixmaps
|
|||
pixmaps_DATA = \
|
||||
gitg48x48.png
|
||||
|
||||
bundle: $(icons_DATA)
|
||||
for i in $(SUBDIRS); do (cd $$i && $(MAKE) top_bundledir="$(top_bundledir)" $(AM_MAKEFLAGS) bundle); done; \
|
||||
for i in $(icons_DATA); do $(INSTALL) -D $$i $(top_bundledir)/resources/icons/$$i; done;
|
||||
|
||||
.PHONY: bundle
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(icons_DATA)
|
||||
|
|
|
@ -8,9 +8,7 @@ INCLUDES = \
|
|||
$(DISABLE_DEPRECATED_CFLAGS) \
|
||||
-DDATADIR=\""$(datadir)"\" \
|
||||
-DGITG_DATADIR=\""$(datadir)/gitg"\" \
|
||||
-DGITG_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
|
||||
-DGITG_UI_DIR=\""$(datadir)/gitg/ui/"\" \
|
||||
-DGITG_ICONDIR=\""$(datadir)/gitg/icons"\"
|
||||
-DGITG_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
|
||||
|
||||
BUILT_SOURCES = \
|
||||
gitg-enum-types.c \
|
||||
|
@ -25,6 +23,7 @@ NOINST_H_FILES = \
|
|||
gitg-data-binding.h \
|
||||
gitg-debug.h \
|
||||
gitg-diff-view.h \
|
||||
gitg-dirs.h \
|
||||
gitg-label-renderer.h \
|
||||
gitg-lane.h \
|
||||
gitg-lanes.h \
|
||||
|
@ -54,6 +53,7 @@ gitg_SOURCES = \
|
|||
gitg-data-binding.c \
|
||||
gitg-debug.c \
|
||||
gitg-diff-view.c \
|
||||
gitg-dirs.c \
|
||||
gitg-label-renderer.c \
|
||||
gitg-lane.c \
|
||||
gitg-lanes.c \
|
||||
|
@ -100,3 +100,12 @@ CLEANFILES = $(BUILT_SOURCES)
|
|||
|
||||
dist-hook:
|
||||
cd $(distdir); rm -f $(BUILT_SOURCES)
|
||||
|
||||
bundle: $(bin_PROGRAMS) $(ui_DATA)
|
||||
for i in $(SUBDIRS); do (cd $$i && $(MAKE) top_bundledir="$(top_bundledir)" $(AM_MAKEFLAGS) bundle); done; \
|
||||
for i in $(bin_PROGRAMS); do $(INSTALL) -D $$i $(top_bundledir)/bin/$$i; done; \
|
||||
for i in $(ui_DATA); do $(INSTALL) -D $$i $(top_bundledir)/resources/ui/$$i; done;
|
||||
|
||||
.PHONY: bundle
|
||||
|
||||
# vi:ts=8
|
||||
|
|
86
gitg/gitg-dirs.c
Normal file
86
gitg/gitg-dirs.c
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* gitg-dirs.c
|
||||
* This file is part of gitg - git repository viewer
|
||||
*
|
||||
* Copyright (C) 2009 - Jesse van den Kieboom
|
||||
*
|
||||
* 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., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "gitg-dirs.h"
|
||||
#include "config.h"
|
||||
|
||||
static gchar executable_directory[PATH_MAX];
|
||||
|
||||
gchar const *
|
||||
gitg_dirs_get_data_dir()
|
||||
{
|
||||
static gchar *datadir = NULL;
|
||||
|
||||
if (!datadir)
|
||||
{
|
||||
#ifdef ENABLE_BUNDLE
|
||||
gchar *up = g_path_get_dirname(executable_directory);
|
||||
datadir = g_build_filename(up, "resources", NULL);
|
||||
g_free(up);
|
||||
#else
|
||||
datadir = g_strdup(GITG_DATADIR);
|
||||
#endif
|
||||
}
|
||||
|
||||
return datadir;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gitg_dirs_get_data_filename(gchar const *first, ...)
|
||||
{
|
||||
gchar const *datadir = gitg_dirs_get_data_dir();
|
||||
gchar *ret;
|
||||
|
||||
ret = g_build_filename(datadir, first, NULL);
|
||||
gchar const *item;
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, first);
|
||||
|
||||
while ((item = va_arg(ap, gchar const *)))
|
||||
{
|
||||
gchar *tmp = ret;
|
||||
ret = g_build_filename(ret, item, NULL);
|
||||
g_free(tmp);
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
gitg_dirs_initialize(int argc, char **argv)
|
||||
{
|
||||
gchar *path = g_path_get_dirname(argv[0]);
|
||||
|
||||
if (!g_path_is_absolute(path))
|
||||
{
|
||||
gchar *tmp = path;
|
||||
gchar *cwd = g_get_current_dir();
|
||||
|
||||
path = g_build_filename(cwd, tmp, NULL);
|
||||
g_free(tmp);
|
||||
}
|
||||
|
||||
g_snprintf(executable_directory, PATH_MAX, "%s", path);
|
||||
g_free(path);
|
||||
}
|
31
gitg/gitg-dirs.h
Normal file
31
gitg/gitg-dirs.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* gitg-dirs.h
|
||||
* This file is part of gitg - git repository viewer
|
||||
*
|
||||
* Copyright (C) 2009 - Jesse van den Kieboom
|
||||
*
|
||||
* 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., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __GITG_DIRS_H__
|
||||
#define __GITG_DIRS_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
gchar const *gitg_dirs_get_data_dir();
|
||||
gchar *gitg_dirs_get_data_filename(gchar const *first, ...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
#endif /* __GITG_DIRS_H__ */
|
|
@ -26,6 +26,7 @@
|
|||
#include <gconf/gconf-client.h>
|
||||
|
||||
#include "gitg-utils.h"
|
||||
#include "gitg-dirs.h"
|
||||
|
||||
inline static guint8
|
||||
atoh(gchar c)
|
||||
|
@ -478,7 +479,7 @@ gitg_utils_new_builder(gchar const *filename)
|
|||
GtkBuilder *b = gtk_builder_new();
|
||||
GError *error = NULL;
|
||||
|
||||
gchar *path = g_build_filename(GITG_UI_DIR G_DIR_SEPARATOR_S, filename, NULL);
|
||||
gchar *path = gitg_dirs_get_data_filename("ui", filename, NULL);
|
||||
|
||||
if (!gtk_builder_add_from_file(b, path, &error))
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "sexy-icon-entry.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "gitg-dirs.h"
|
||||
#include "gitg-ref.h"
|
||||
#include "gitg-utils.h"
|
||||
#include "gitg-runner.h"
|
||||
|
@ -937,10 +938,16 @@ on_help_about(GtkAction *action, GitgWindow *window)
|
|||
gtk_about_dialog_set_url_hook(url_activate_hook, NULL, NULL);
|
||||
gtk_about_dialog_set_email_hook(email_activate_hook, NULL, NULL);
|
||||
|
||||
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(GITG_ICONDIR "/gitg.svg", NULL);
|
||||
gchar *path = gitg_dirs_get_data_filename("icons", "gitg.svg", NULL);
|
||||
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(path, NULL);
|
||||
g_free(path);
|
||||
|
||||
if (!pixbuf)
|
||||
pixbuf = gdk_pixbuf_new_from_file(GITG_ICONDIR "/gitg128x128.png", NULL);
|
||||
{
|
||||
path = gitg_dirs_get_data_filename("icons", "gitg128x128.png", NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_file(path, NULL);
|
||||
g_free(path);
|
||||
}
|
||||
|
||||
gtk_show_about_dialog(GTK_WINDOW(window),
|
||||
"authors", authors,
|
||||
|
|
31
gitg/gitg.c
31
gitg/gitg.c
|
@ -33,6 +33,8 @@
|
|||
#include "sexy-icon-entry.h"
|
||||
#include "config.h"
|
||||
#include "gitg-settings.h"
|
||||
#include "gitg-dirs.h"
|
||||
#include "gitg-utils.h"
|
||||
|
||||
static gboolean commit_mode = FALSE;
|
||||
|
||||
|
@ -102,8 +104,12 @@ set_language_search_path()
|
|||
++i;
|
||||
}
|
||||
|
||||
dirs[0] = GITG_DATADIR "/language-specs";
|
||||
gchar *path = gitg_dirs_get_data_filename("language-specs", NULL);
|
||||
dirs[0] = path;
|
||||
gtk_source_language_manager_set_search_path(manager, (gchar **)dirs);
|
||||
g_free(path);
|
||||
|
||||
g_free(dirs);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -111,19 +117,21 @@ set_style_scheme_search_path()
|
|||
{
|
||||
GtkSourceStyleSchemeManager *manager = gtk_source_style_scheme_manager_get_default();
|
||||
|
||||
gtk_source_style_scheme_manager_prepend_search_path(manager, GITG_DATADIR "/styles");
|
||||
gchar *path = gitg_dirs_get_data_filename("styles", NULL);
|
||||
gtk_source_style_scheme_manager_prepend_search_path(manager, path);
|
||||
g_free(path);
|
||||
}
|
||||
|
||||
static void
|
||||
set_icons()
|
||||
{
|
||||
static gchar const *icon_infos[] = {
|
||||
GITG_DATADIR "/icons/gitg16x16.png",
|
||||
GITG_DATADIR "/icons/gitg24x24.png",
|
||||
GITG_DATADIR "/icons/gitg32x32.png",
|
||||
GITG_DATADIR "/icons/gitg48x48.png",
|
||||
GITG_DATADIR "/icons/gitg64x64.png",
|
||||
GITG_DATADIR "/icons/gitg128x128.png",
|
||||
"gitg16x16.png",
|
||||
"gitg24x24.png",
|
||||
"gitg32x32.png",
|
||||
"gitg48x48.png",
|
||||
"gitg64x64.png",
|
||||
"gitg128x128.png",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -132,8 +140,10 @@ set_icons()
|
|||
|
||||
for (i = 0; icon_infos[i]; ++i)
|
||||
{
|
||||
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(icon_infos[i], NULL);
|
||||
|
||||
gchar *filename = gitg_dirs_get_data_filename("icons", icon_infos[i], NULL);
|
||||
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
|
||||
g_free(filename);
|
||||
|
||||
if (pixbuf)
|
||||
icons = g_list_prepend(icons, pixbuf);
|
||||
}
|
||||
|
@ -160,6 +170,7 @@ main(int argc, char **argv)
|
|||
/* Translators: this is the application name as in g_set_application_name */
|
||||
g_set_application_name(_("gitg"));
|
||||
|
||||
gitg_dirs_initialize(argc, argv);
|
||||
gtk_init(&argc, &argv);
|
||||
parse_options(&argc, &argv);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user