Commit 11fc353c authored by Jesse van den Kieboom's avatar Jesse van den Kieboom

Initial import

parents
This diff is collapsed.
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
6. Often, you can also type `make uninstall' to remove the installed
files again.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
## Process this file with automake to produce Makefile.in
SUBDIRS = gitg data po
DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update
EXTRA_DIST = \
autogen.sh \
intltool-extract.in \
intltool-merge.in \
intltool-update.in
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="gitg"
(test -f $srcdir/configure.ac \
&& test -f $srcdir/README \
&& test -d $srcdir/$PKG_NAME) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}
which gnome-autogen.sh || {
echo "You need to install gnome-common from the GNOME CVS"
exit 1
}
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4" REQUIRED_AUTOMAKE_VERSION=1.8 USE_GNOME2_MACROS=1 USE_COMMON_DOC_BUILD=yes . gnome-autogen.sh
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
m4_define(gitg_major_version, 0)
m4_define(gitg_minor_version, 0)
m4_define(gitg_micro_version, 1)
m4_define(gitg_version, gitg_major_version.gitg_minor_version.gitg_micro_version)
AC_INIT(gitg, gitg_version, http://www.icecrew.nl)
AC_CONFIG_SRCDIR(gitg/gitg.c)
AC_CONFIG_MACRO_DIR([m4])
AC_DEFINE(GITG_MAJOR_VERSION, gitg_major_version, [GitG major version])
AC_SUBST(GITG_MAJOR_VERSION, gitg_major_version)
AC_DEFINE(GITG_MINOR_VERSION, gitg_minor_version, [GitG minor version])
AC_SUBST(GITG_MINOR_VERSION, gitg_minor_version)
AC_DEFINE(GITG_MICRO_VERSION, gitg_micro_version, [GitG micro version])
AC_SUBST(GITG_MICRO_VERSION, gitg_micro_version)
AM_INIT_AUTOMAKE([1.8 dist-bzip2 no-dist-gzip])
AM_MAINTAINER_MODE
AC_CONFIG_HEADERS(config.h)
IT_PROG_INTLTOOL([0.35.0])
AC_PROG_LIBTOOL
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PATH_PROG(GZIP, gzip)
dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4")
GETTEXT_PACKAGE=gitg
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
AM_GLIB_GNU_GETTEXT
PKG_CHECK_MODULES(PACKAGE, [
gtk+-2.0 >= 2.8.0
gthread-2.0
gtksourceview-2.0
])
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_CONFIG_FILES([
Makefile
gitg/Makefile
data/Makefile
data/gitg.desktop.in
po/Makefile.in
])
AC_OUTPUT
echo "
Configuration:
Source code location: ${srcdir}
Compiler: ${CC}
"
desktopdir = $(datadir)/applications
desktop_in_files = gitg.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
man_MANS = gitg.1
EXTRA_DIST = \
$(desktop_in_files) \
$(man_MANS)
CLEANFILES = \
$(desktop_DATA)
.TH GITG 1 "22 Jun 2008"
.SH NAME
\gitg\fP \- Git repository viewer
.SH SYNOPSIS
.B gitg
.RI [path]
.SH DESCRIPTION
.B gitg
is a git repository viewer for GNOME
.SH AUTHORS
Jesse van den Kieboom (jesse@icecrew.nl)
[Desktop Entry]
Encoding=UTF-8
_Name=GitG
_Comment=Browser git repositories
Exec=gitg %U
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
#Icon=
Categories=GNOME;GTK;Utility;
#X-GNOME-DocPath=gitg/gitg.xml
bin_PROGRAMS = gitg
INCLUDES = \
-I$(top_srcdir) \
-I$(srcdir) \
$(PACKAGE_CFLAGS) \
$(WARN_CFLAGS) \
$(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"\"
gitg_SOURCES = \
gitg.c \
gitg-revision.c \
gitg-rv-model.c \
gitg-loader.c \
gitg-runner.c \
gitg-utils.c
gitg_LDADD = $(PACKAGE_LIBS)
gitg_LDFLAGS =
uidir = $(datadir)/gitg/ui/
ui_DATA = gitg-ui.xml
update-ui:
gtk-builder-convert gitg.glade gitg-ui.xml
EXTRA_DIST = \
$(ui_DATA)
#include "gitg-loader.h"
#define GITG_LOADER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GITG_TYPE_LOADER, GitgLoaderPrivate))
static void impl_update(GitgRunner *runner, gchar **buffer);
/* Signals */
enum
{
REVISIONS_ADDED,
LAST_SIGNAL
};
static guint loader_signals[LAST_SIGNAL] = { 0 };
struct _GitgLoaderPrivate
{
GitgRevision **buffer;
GitgRvModel *store;
};
G_DEFINE_TYPE(GitgLoader, gitg_loader, GITG_TYPE_RUNNER)
static void
gitg_loader_finalize(GObject *object)
{
GitgLoader *loader = GITG_LOADER(object);
guint size = gitg_runner_get_buffer_size(GITG_RUNNER(loader));
g_slice_free1(sizeof(GitgRevision *) * (size + 1), loader->priv->buffer);
G_OBJECT_CLASS(gitg_loader_parent_class)->finalize(object);
}
static GObject *
gitg_loader_constructor(GType type, guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GObject *object;
{
object = G_OBJECT_CLASS(gitg_loader_parent_class)->constructor(type, n_construct_properties, construct_properties);
}
GitgLoader *loader = GITG_LOADER(object);
guint bs = gitg_runner_get_buffer_size(GITG_RUNNER(loader));
loader->priv->buffer = g_slice_alloc(sizeof(GitgRevision *) * (bs + 1));
loader->priv->buffer[0] = NULL;
return object;
}
static void
gitg_loader_class_init(GitgLoaderClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
GitgRunnerClass *runner_class = GITG_RUNNER_CLASS(klass);
object_class->finalize = gitg_loader_finalize;
object_class->constructor = gitg_loader_constructor;
runner_class->update = impl_update;
loader_signals[REVISIONS_ADDED] =
g_signal_new ("revisions-added",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GitgLoaderClass, revisions_added),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE,
1,
G_TYPE_POINTER);
g_type_class_add_private(object_class, sizeof(GitgLoaderPrivate));
}
static void
gitg_loader_init(GitgLoader *self)
{
self->priv = GITG_LOADER_GET_PRIVATE(self);
}
static void
impl_update(GitgRunner *runner, gchar **buffer)
{
GitgLoader *loader = GITG_LOADER(runner);
gchar *line;
GitgRevision **ptr = loader->priv->buffer;
while ((line = *buffer++))
{
// New line is read
gchar **components = g_strsplit(line, "\01", 0);
if (g_strv_length(components) < 5)
{
g_strfreev(components);
continue;
}
// components -> [hash, author, subject, parents ([1 2 3]), timestamp]
gint64 timestamp = g_ascii_strtoll(components[4], NULL, 0);
*ptr++ = gitg_revision_new(components[0], components[1], components[2], components[3], timestamp);
g_strfreev(components);
}
*ptr = NULL;
g_signal_emit(loader, loader_signals[REVISIONS_ADDED], 0, loader->priv->buffer);
/* Make sure to unref all the revision objects */
GitgRevision *rv;
ptr = loader->priv->buffer;
while ((rv = *ptr++))
g_object_unref(rv);
loader->priv->buffer[0] = NULL;
}
GitgLoader*
gitg_loader_new()
{
return GITG_LOADER(g_object_new(GITG_TYPE_LOADER, "buffer_size", 3000, NULL));
}
gboolean
gitg_loader_load(GitgLoader *loader, gchar const *path, GError **error)
{
g_return_val_if_fail(GITG_IS_LOADER(loader), FALSE);
g_return_val_if_fail(loader->priv != NULL, FALSE);
g_return_val_if_fail(path != NULL, FALSE);
gchar *argv[] = {
"git",
"--git-dir",
path,
"log",
"--topo-order",
"--pretty=format:%H\01%an\01%s\01%P\01%at",
"HEAD",
NULL
};
return gitg_runner_run(GITG_RUNNER(loader), argv, error);
}
#include "gitg-rv-model.h"
#ifndef __GITG_LOADER_H__
#define __GITG_LOADER_H__
#include <glib-object.h>
#include "gitg-revision.h"
#include "gitg-runner.h"
G_BEGIN_DECLS
#define GITG_TYPE_LOADER (gitg_loader_get_type ())
#define GITG_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_LOADER, GitgLoader))
#define GITG_LOADER_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GITG_TYPE_LOADER, GitgLoader const))
#define GITG_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GITG_TYPE_LOADER, GitgLoaderClass))
#define GITG_IS_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GITG_TYPE_LOADER))
#define GITG_IS_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GITG_TYPE_LOADER))
#define GITG_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GITG_TYPE_LOADER, GitgLoaderClass))
typedef struct _GitgLoader GitgLoader;
typedef struct _GitgLoaderClass GitgLoaderClass;
typedef struct _GitgLoaderPrivate GitgLoaderPrivate;
struct _GitgLoader {
GitgRunner parent;
GitgLoaderPrivate *priv;
};
struct _GitgLoaderClass {
GitgRunnerClass parent_class;
void (* revisions_added) (GitgLoader *loader, GitgRevision **revisions);
};
GType gitg_loader_get_type (void) G_GNUC_CONST;
GitgLoader *gitg_loader_new();
void gitg_loader_set_store(GitgLoader *loader, GitgRvModel *store);
GitgRvModel *gitg_loader_get_store(GitgLoader *loader);
gboolean gitg_loader_load(GitgLoader *loader, gchar const *path, GError **error);
G_END_DECLS
#endif /* __GITG_LOADER_H__ */
#include "gitg-revision.h"
#include "gitg-utils.h"
#define GITG_REVISION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GITG_TYPE_REVISION, GitgRevisionPrivate))
typedef gchar Hash[20];
struct _GitgRevisionPrivate
{
Hash hash;
gchar *author;
gchar *subject;
Hash *parents;
guint num_parents;
gint64 timestamp;
};
G_DEFINE_TYPE(GitgRevision, gitg_revision, G_TYPE_OBJECT)
static void
gitg_revision_finalize(GObject *object)
{
GitgRevision *rv = GITG_REVISION(object);
g_free(rv->priv->author);
g_free(rv->priv->subject);
g_free(rv->priv->parents);
G_OBJECT_CLASS(gitg_revision_parent_class)->finalize(object);
}
static void
gitg_revision_class_init(GitgRevisionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
object_class->finalize = gitg_revision_finalize;
g_type_class_add_private(object_class, sizeof(GitgRevisionPrivate));
}
static void
gitg_revision_init(GitgRevision *self)
{
self->priv = GITG_REVISION_GET_PRIVATE(self);
}
GitgRevision *gitg_revision_new(gchar const *sha,
gchar const *author,
gchar const *subject,
gchar const *parents,
gint64 timestamp)
{
GitgRevision *rv = g_object_new(GITG_TYPE_REVISION, NULL);
gitg_utils_sha1_to_hash(sha, rv->priv->hash);
rv->priv->author = g_strdup(author);
rv->priv->subject = g_strdup(subject);
rv->priv->timestamp = timestamp;
gchar **shas = g_strsplit(parents, " ", 0);
gint num = g_strv_length(shas);
rv->priv->parents = g_new(Hash, num + 1);
int i;
for (i = 0; i < num; ++i)
gitg_utils_sha1_to_hash(shas[i], rv->priv->parents[i]);
g_strfreev(shas);
rv->priv->num_parents = num;
return rv;
}
gchar const *
gitg_revision_get_author(GitgRevision *revision)
{
g_return_val_if_fail(GITG_IS_REVISION(revision), NULL);
return revision->priv->author;
}
gchar const *
gitg_revision_get_subject(GitgRevision *revision)
{
g_return_val_if_fail(GITG_IS_REVISION(revision), NULL);
return revision->priv->subject;
}
guint64
gitg_revision_get_timestamp(GitgRevision *revision)
{
g_return_val_if_fail(GITG_IS_REVISION(revision), 0);
return revision->priv->timestamp;
}
gchar const *
gitg_revision_get_hash(GitgRevision *revision)
{
g_return_val_if_fail(GITG_IS_REVISION(revision), NULL);
return revision->priv->hash;
}
gchar *
gitg_revision_get_sha1(GitgRevision *revision)
{
g_return_val_if_fail(GITG_IS_REVISION(revision), NULL);
char res[40];
gitg_utils_hash_to_sha1(revision->priv->hash, res);
return g_strndup(res, 40);