]> git.meshlink.io Git - catta/blob - docs/HACKING
* Update HACKING
[catta] / docs / HACKING
1 Please comply with the following rules when hacking on Avahi:
2
3  * When you add a new textual file to the repository please enable SVN
4    keyword expansion for it:
5        
6        svn ps svn:keywords Id foo.c
7
8  * Before commiting check with "svn st" that all built files are ignored
9    by svn. To change the list of ignored files  use 
10    
11        svn pe svn:ignore .
12
13    This is similar to the ".cvsignore" file in CVS times.
14
15  * Don't forget to add the autoconf config.h inclusion to all C source files:
16    
17    #ifdef HAVE_CONFIG_H
18    #include <config.h>
19    #endif
20
21    This needs to be placed in in .c files only. NOT IN HEADER FILES!
22
23  * Don't hardcode any paths in source files. Either use the -D option of gcc
24    for C sources or use "sed" to replace them based on a .in file.
25
26  * Never forget that Avahi should be buildable without DBUS, GTK or python!
27
28  * Before commiting, test your code! In case of C consider running it
29    a few times through valgrind, to make sure that you got everything
30    right.  You have to call libtool explicitly when running valgrind
31    on binaries that depend on shared objects. e.g:
32
33        libtool --mode=execute valgrind ./avahi-daemon
34
35    Please note that valgrind can't find you all bugs. Please check
36    your code thrice with your brain before committing. Valgrind is
37    only a final check.
38
39  * When you code in C, please compile with the following gcc options from time
40    to time:
41   
42    -Wextra
43    -Wfloat-equal 
44    -Wmissing-declarations
45    -Wmissing-prototypes
46    -Wstrict-prototypes
47    -Wredundant-decls
48    -Wold-style-definition
49    -Wmissing-noreturn
50    -Wdeclaration-after-statement
51    -Wshadow
52    -Wendif-labels
53    -Wlarger-than-4000
54    -Wpointer-arith
55    -Wbad-function-cast
56    -Wcast-qual
57    -Wcast-align
58    -Wwrite-strings
59    -Winline
60
61    This will show you a bunch of issues which might be problems in your source
62    code.  Not all options are available on all GCC versions. Just pass these
63    options in $CFLAGS when running bootstrap.sh:
64
65    CFLAGS="-Wextra ..." ./bootstrap.sh
66
67  * Whenever you add a new Makefile.am, C (.c or .h) source file, shell or
68    python script please add this legal blurb to its header:
69
70    For Makefile.am, python and shell code:
71
72 <snip>
73 # $Id$
74
75 # This file is part of avahi.
76 #
77 # avahi is free software; you can redistribute it and/or modify it
78 # under the terms of the GNU Lesser General Public License as
79 # published by the Free Software Foundation; either version 2 of the
80 # License, or (at your option) any later version.
81 #
82 # avahi is distributed in the hope that it will be useful, but WITHOUT
83 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
84 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
85 # License for more details.
86 #
87 # You should have received a copy of the GNU Lesser General Public
88 # License along with avahi; if not, write to the Free Software
89 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
90 # USA.
91 </snip>
92
93    For C source code:
94
95 <snip>
96 /* $Id$ */
97
98 /***
99   This file is part of avahi.
100
101   avahi is free software; you can redistribute it and/or modify it
102   under the terms of the GNU Lesser General Public License as
103   published by the Free Software Foundation; either version 2.1 of the
104   License, or (at your option) any later version.
105
106   avahi is distributed in the hope that it will be useful, but WITHOUT
107   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
108   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
109   Public License for more details.
110
111   You should have received a copy of the GNU Lesser General Public
112   License along with avahi; if not, write to the Free Software
113   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
114   USA.
115 ***/
116 </snip>
117
118
119 $Id$