HACKING 6.16 KB
Newer Older
1 2
Requirements
------------
3 4
If you want to hack on the GIMP project, it will make your life easier
to have the following packages (or newer versions) installed:
5

Sven Neumann's avatar
Sven Neumann committed
6
    * GNU autoconf 2.54
7
        - ftp://ftp.gnu.org/gnu/autoconf/
8
    * GNU automake 1.9 (automake 1.10 should also work)
9
        - ftp://ftp.gnu.org/gnu/automake/
10
    * GNU libtool 1.5
11
        - ftp://ftp.gnu.org/gnu/libtool/
Manish Singh's avatar
Manish Singh committed
12

13 14
Fine GNU mirrors are listed at http://www.gnu.org/prep/ftp.html
Beta software can be found at alpha.gnu.org.
15

16
    * pkg-config 0.16.0 (or preferably a newer version)
17
        - http://www.freedesktop.org/software/pkgconfig/
18

19 20 21
    * gtkdocize
        - http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/

22 23 24
    * xsltproc
        - ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/

25
These are only the additional requirements if you want to compile from
26 27
the git repository. The file INSTALL lists the various libraries we
depend on.
28

29 30 31

Compilation
-----------
32 33 34
If you are accessing gimp via git, then you will need to take several
steps to get it to compile.  You can do all these steps at once by
running:
35

36
    gimp/trunk$ ./autogen.sh
37

38
Basically this does the following for you:
39

40
    gimp/trunk$ aclocal-1.9; libtoolize; automake-1.9 -a;
41
    gimp/trunk$ autoconf; intltoolize --automake
42

43
The above commands create the "configure" script.  Now you can run the
44
configure script in gimp/trunk to create all the Makefiles.
45

46
Before running autogen.sh or configure, make sure you have libtool in
47
your path. Also make sure glib-2.0.m4 glib-gettext.m4, gtk-2.0.m4,
Sven Neumann's avatar
Sven Neumann committed
48 49
pkg.m4 and intltool.m4 are either installed in the same
$prefix/share/aclocal relative to your automake/aclocal installation
50
or call autogen.sh as follows:
51

52
    $ ACLOCAL_FLAGS="-I $prefix/share/aclocal" ./autogen.sh
53 54

Note that autogen.sh runs configure for you.  If you wish to pass
55 56
options like --prefix=/usr to configure you can give those options to
autogen.sh and they will be passed on to configure.
57

58 59 60 61 62
If AUTOGEN_CONFIGURE_ARGS is set, these options will also be passed to
the configure script. If for example you want to enable the build of
the GIMP API reference manuals, you can set AUTOGEN_CONFIGURE_ARGS to
"--enable-gtk-doc". Please note that you will then need a recent
version of gtk-doc as well as a working setup for handling DocBook/XML.
63

64 65 66 67 68
If you do not have a recent version of gtk-doc, you can pass the
option "--disable-gtk-doc" to autogen.sh.  This will completely
disable the support for gtk-doc so you will not be able to generate
the API documentation.

69

70
Git
71
---
72 73
GIMP is available from GNOME Git. You can use the following commands
to get GIMP from the the git server:
74

75
    $ git clone git://git.gnome.org/gimp
76

77
You can read more on using GNOME's git service at these URLs:
78

79 80
    http://live.gnome.org/Git
    http://www.kernel.org/pub/software/scm/git/docs/
81

82

83
You will also need relatively new stable releases of glib, pango, atk,
84
gtk+, cairo, gtkhtml2, etc. for building GIMP, which you can get as a
85 86 87
part of recent Linux distribution releases.


88 89
Patches
-------
90

91 92 93 94
The best way to submit patches is to publish your git repository and
ask developers to git-fetch from you.

For bug fixes where the patch is small you can file a bug report at
95 96
http://bugzilla.gnome.org/ and attach your patch to it as a plain text
file, not compressed. If your patch is reasonably small you can submit
97 98 99 100
it to the gimp-developer@lists.xcf.berkeley.edu mailing list. You can
create the patch file with git-format-patch

If the patch needs to be discussed, you should also consider using the
101 102
mailing list instead of Bugzilla because bug reports tend to be hard
to read if they contain too many comments. For the code, please try to
103
follow the guidelines given in Hackordnung, below.
104

105

106 107
Auto-generated Files
--------------------
Sven Neumann's avatar
Sven Neumann committed
108
Please notice that some files in the source are generated from other
109
sources. All those files have a short notice about being generated
110 111
somewhere at the top. Among them are the files ending in pdb.[ch] in
the libgimp directory and the files ending in cmds.c in the app/pdb
Sven Neumann's avatar
Sven Neumann committed
112
subdirectory. Those are generated from the respective .pdb files in
113
tools/pdbgen/pdb.
114 115 116 117


Hackordnung
-----------
Sven Neumann's avatar
Sven Neumann committed
118 119 120
We encourage you to follow the GIMP coding style throughout the GIMP
project.  For the core components (application and libs) this coding
style is enforced.  The GIMP coding style is defined as follows:
121

Sven Neumann's avatar
Sven Neumann committed
122
    * There's a single space between the function name and the opening
123
      paren.
Sven Neumann's avatar
Sven Neumann committed
124

125 126 127 128 129 130
    * Function names are lowercase, words separated by underscores.

    * Macros and enums are all uppercase, words seperated by
      underscores.

    * Types are all words capitalized, no separators between words.
131

132
    * All functions in header files need to be prototyped.
133

134 135
    * Indentation rules are GNU coding style, in particular:
        - 2 characters indentation level
136 137 138 139 140 141 142 143
        - Do not use tabs (of course your editor can accept the TAB key
          as a command, typically to indent the current line properly
          or to add spaces at the cursor until the next multiple of 8
          columns, but it should not put TAB characters in the file).
        - When editing files that still have TABs in them, make sure your
          editor interprets the TABs correctly, that is, has tab stops
          at 8 column intervals.
        - Opening braces are on a new line and indented one level.
144 145 146
        - Function header have the return type on one line, the name
          starting in the first column of the following line. All
          parameters are prototyped and there's a new line for each.
147

Sven Neumann's avatar
Sven Neumann committed
148 149 150 151
Try to make use of GLib's object system as much as possible. Do not
create wrappers around functions of parent classes. If you end up
duplicating code, try to create a common parent class and implement
the common methods there.
152

153
Don't include headers in headers except where unavoidable (e.g. for
Michael Natterer's avatar
Michael Natterer committed
154
deriving objects). Opaque typedefs go to app/base/base-types.h,
155 156
app/core/core-types.h etc. See devel-docs/includes.txt for a
detailed description of the include policy.
157

158 159
Don't use the GTK wrappers around the GLib object and signal system.

Sven Neumann's avatar
Sven Neumann committed
160 161 162 163
One goal of GIMP development is to make the GIMP code more readable
and understandable. Please help us to achieve this goal by cleaning up
the present code and make sure that all new code follows the coding
guidelines.