Re-added, since my test re: the repository-global cvsignore file was unsuccessful...
[bpt/guile.git] / HACKING
CommitLineData
b0749d03
MV
1Hacking It Yourself ==================================================
2
3As distributed, Guile needs only an ANSI C compiler and a Unix system
4to compile. However, Guile's makefiles, configuration scripts, and a
5few other files are automatically generated, not written by hand. If
6you want to make changes to the system (which we encourage!) you will
7find it helpful to have the tools we use to develop Guile. They
8are the following:
9
10Autoconf 2.13 --- a system for automatically generating `configure'
11 scripts from templates which list the non-portable features a
12 program would like to use. Available in
13 "ftp://ftp.gnu.org/pub/gnu/autoconf"
14
15Automake 1.4 --- a system for automatically generating Makefiles that
16 conform to the (rather Byzantine) GNU coding standards. The
17 nice thing is that it takes care of hairy targets like 'make
18 dist' and 'make distclean', and automatically generates
19 Makefile dependencies. Automake is available in
20 "ftp://ftp.gnu.org/pub/gnu/automake"
21
22 Before using automake, you may need to copy `threads.m4' and
23 `guile.m4' from the top directory of the Guile core disty to
24 `/usr/local/share/aclocal.
25
26libtool 1.3.4 --- a system for managing the zillion hairy options needed
27 on various systems to produce shared libraries. Available in
28 "ftp://ftp.gnu.org/pub/gnu/libtool"
29
30You are lost in a little maze of automatically generated files, all
31different.
32>
33
795b4217 34
0822a9c1
JB
35Contributing Your Changes ============================================
36
37- If you have put together a change that meets the coding standards
38described below, we encourage you to submit it to Guile. The best
c5ee0952
JB
39place to post it is guile@sourceware.cygnus.com. Please don't send it
40directly to me; I often don't have time to look things over. If you
41have tested your change, then you don't need to be shy.
0822a9c1
JB
42
43- Please submit patches using either context or unified diffs (diff -c
44or diff -u). Don't include a patch for ChangeLog; such patches don't
45apply cleanly, since we've probably changed the top of ChangeLog too.
46Instead, provide the unaltered text at the top of your patch.
47
48Please don't include patches for generated files like configure,
49aclocal.m4, or any Makefile.in. Such patches are often large, and
50we're just going to regenerate those files anyway.
51
52
d2bd3d8d
JB
53CVS conventions ======================================================
54
eb4194d6 55- We use CVS to manage the Guile sources. The repository lives on
349d9c1f 56egcs.cygnus.com, in /cvs/guile; you will need an
aa31443a
JB
57account on that machine to access the repository. Also, for security
58reasons, egcs presently only supports CVS connections via the SSH
59protocol, so you must first install the SSH client. Then, you should
60set your CVS_RSH environment variable to ssh, and use the following as
61your CVS root:
eb4194d6 62
349d9c1f 63 :ext:USER@egcs.cygnus.com:/cvs/guile
eb4194d6
JB
64
65Either set your CVSROOT environment variable to that, or give it as
66the value of the global -d option to CVS when you check out a working
67directory.
68
848f2a01 69For more information on SSH, see http://www.cs.hut.fi/ssh.
eb4194d6
JB
70
71The Guile sources live in several modules:
72
73 - guile-core --- the interpreter, QuickThreads, and ice-9
e19268af
JB
74 - guile-doc --- documentation in progress. When complete, this will
75 be incorporated into guile-core.
15fb0024 76 - guile-oops --- The Guile Object-Oriented Programming System (talk to mdj)
eb4194d6 77 - guile-tcltk --- the Guile/Tk interface
b1f4ddc1 78 - guile-tk --- the new Guile/Tk interface, based on STk's modified Tk
eb4194d6
JB
79 - guile-rgx-ctax --- the Guile/Rx interface, and the ctax implementation
80 - guile-scsh --- the port of SCSH to guile, talk to Gary Houston
b1f4ddc1 81 - guile-www --- A Guile module for making HTTP requests.
eb4194d6 82
afdfe3f4
JB
83There is a mailing list for CVS commit messages; see README for details.
84
d2bd3d8d
JB
85- We check Makefile.in and configure files into CVS, as well as the
86files they are built from (Makefile.am, configure.in); we do not check
87in Makefiles or header files generated by configuration scripts. The
350294b1 88general rule is that you should be able to check out a working
d2bd3d8d
JB
89directory of Guile from CVS, and then type "configure" and "make",
90without running any other tools.
350294b1 91
d4c83f63
JB
92- (Automake 1.4 only) Be sure to run automake at the top of the tree
93with no arguments. Do not use `automake Makefile' to regenerate
94specific Makefile.in files, and do not trust the Makefile rules to
95rebuild them when they are out of date. Automake 1.4 will add
96extraneous rules to the top-level Makefile if you specify specific
97Makefiles to rebuild on the command line. Running the command
98`autoreconf --force' should take care of everything correctly.
99
795b4217
JB
100- Make sure your changes compile and work, at least on your own
101machine, before checking them into the main branch of the Guile
102repository. If you really need to check in untested changes, make a
103branch.
104
d2bd3d8d
JB
105- Include each log entry in both the ChangeLog and in the CVS logs.
106If you're using Emacs, the pcl-cvs interface to CVS has features to
107make this easier; it checks the ChangeLog, and generates good default
108CVS log entries from that.
109
110
111Coding standards =====================================================
112
113- As for any part of Project GNU, changes to Guile should follow the
114GNU coding standards. The standards are available via anonymous FTP
115from prep.ai.mit.edu, as /pub/gnu/standards/standards.texi and
116make-stds.texi.
117
99be3450
JB
118- The Guile tree should compile without warnings under the following
119GCC switches, which are the default in the current configure script:
859bb431 120 -O2 -Wall -Wpointer-arith -Wmissing-prototypes
18fa97f8
JB
121The only warnings which can be tolerated are those about variables
122being clobbered by longjmp/vfork in eval.c. The variables in question
123are critical to the interpreter's performance; as far as I can tell,
124it is difficult/annoying to avoid these warnings without slowing the
125system down substantially. (If you can figure out a good fix, I'd be happy to see it.)
99be3450 126
d043e0bb
JB
127Note that the warnings generated vary from one version of GCC to the
128next, and from one architecture to the next (apparently). To provide
129a concrete common standard, Guile should compile without warnings from
18fa97f8 130GCC 2.7.2.3 in a Red Hat 5.2 i386 Linux machine. Furthermore, each
d043e0bb
JB
131developer should pursue any additional warnings noted by on their
132compiler. This means that people using more stringent compilers will
133have more work to do, and assures that everyone won't switch to the
41d368d9 134most lenient compiler they can find. :)
d043e0bb 135
afdfe3f4
JB
136Note also that EGCS (as of November 3 1998) doesn't handle the
137`noreturn' attribute properly, so it doesn't understand that functions
138like scm_error won't return. This may lead to some silly warnings
139about uninitialized variables. You should look into these warnings to
140make sure they are indeed spurious, but you needn't correct warnings
141caused by this EGCS bug.
142
0822a9c1
JB
143- If you add code which uses functions or other features that are not
144entirely portable, please make sure the rest of Guile will still
145function properly on systems where they are missing. This usually
146entails adding a test to configure.in, and then adding #ifdefs to your
147code to disable it if the system's features are missing.
afdfe3f4 148
795b4217
JB
149- When you make a user-visible change (i.e. one that should be
150documented, and appear in NEWS, put an asterisk in column zero of the
151start of the ChangeLog entry, like so:
152
153Sat Aug 3 01:27:14 1996 Gary Houston <ghouston@actrix.gen.nz>
154
155* * fports.c (scm_open_file): don't return #f, throw error.
156
fa3f45cc
JB
157When you've written a NEWS entry and updated the documentation, go
158ahead and remove the asterisk. I will use the asterisks to find and
159document changes that haven't been dealt with before a release.
160
d49a7907
JB
161- Please write log entries for functions written in C under the
162functions' C names, and write log entries for functions written in
163Scheme under the functions' Scheme names. Please don't do this:
164
165 * procs.c, procs.h (procedure-documentation): Moved from eval.c.
166
167Entries like this make it harder to search the ChangeLogs, because you
afdfe3f4
JB
168can never tell which name the entry will refer to. Instead, write this:
169
170 * procs.c, procs.h (scm_procedure_documentation): Moved from eval.c.
d49a7907 171
4085a3da
JB
172Changes like adding this line are special:
173
174 SCM_PROC (s_serial_map, "serial-map", 2, 0, 1, scm_map);
175
176Since the change here is about the name itself --- we're adding a new
177alias for scm_map that guarantees the order in which we process list
178elements, but we're not changing scm_map at all --- it's appropriate
179to use the Scheme name in the log entry.
180
30d14d55
JB
181- There's no need to keep a change log for documentation files. This
182is because documentation is not susceptible to bugs that are hard to
183fix. Documentation does not consist of parts that must interact in a
184precisely engineered fashion; to correct an error, you need not know
185the history of the erroneous passage. (This is copied from the GNU
186coding standards.)
187
795b4217
JB
188- Make sure you have papers from people before integrating their
189changes or contributions. This is very frustrating, but very
190important to do right. From maintain.texi, "Information for
191Maintainers of GNU Software":
192
193 When incorporating changes from other people, make sure to follow the
194 correct procedures. Doing this ensures that the FSF has the legal
195 right to distribute and defend GNU software.
196
197 For the sake of registering the copyright on later versions ofthe
198 software you need to keep track of each person who makes significant
199 changes. A change of ten lines or so, or a few such changes, in a
200 large program is not significant.
201
202 *Before* incorporating significant changes, make sure that the person
203 has signed copyright papers, and that the Free Software Foundation has
204 received them.
205
206If you receive contributions you want to use from someone, let me know
207and I'll take care of the administrivia. Put the contributions aside
208until we have the necessary papers.
209
fa3f45cc
JB
210- When you make substantial changes to a file, add the current year to
211the list of years in the copyright notice at the top of the file.
795b4217 212
d2bd3d8d
JB
213
214Helpful hints ========================================================
215
f84f77f5
JB
216- [From Mikael Djurfeldt] When working on the Guile internals, it is
217quite often practical to implement a scheme-level procedure which
218helps you examine the feature you're working on.
219
220Examples of such procedures are: pt-size, debug-hand and
221current-pstate.
222
223I've now put #ifdef GUILE_DEBUG around all such procedures, so that
224they are not compiled into the "normal" Guile library. Please do the
225same when you add new procedures/C functions for debugging purpose.
226
227You can define the GUILE_DEBUG flag by passing --enable-guile-debug to
228the configure script.
229
52591c80
JB
230- You'll see uses of the macro SCM_P scattered throughout the code;
231those are vestiges of a time when Guile was meant to compile on
232pre-ANSI compilers. Guile now requires ANSI C, so when you write new
233functions, feel free to use ANSI declarations, and please provide
1cf84ea5 234prototypes for everything. You don't need to use SCM_P in new code.
52591c80 235
795b4217
JB
236
237Jim Blandy