blob: 4fbf5a22d972987d6ee588c383813efc6e9abd24 [file] [log] [blame]
Christian Eglif70f4e02011-01-03 15:09:06 +00001This HACKING file describes the development environment. -*- org -*-
Christian Egli5510e4a2009-11-05 09:55:30 +00002
Christian Egli311d52b2013-01-11 16:19:23 +00003 Copyright (C) 2008, 2009, 2011 ViewPlus Technologies, Inc. and Abilitiessoft, Inc.
Christian Egli71647d62014-05-20 09:20:28 +02004 Copyright (C) 2012, 2013, 2014 Swiss Library for the Blind, Visually Impaired and Print Disabled
Christian Egli311d52b2013-01-11 16:19:23 +00005
Christian Egli5510e4a2009-11-05 09:55:30 +00006 Copying and distribution of this file, with or without modification,
7 are permitted in any medium without royalty provided the copyright
Christian Egli741b0072014-09-18 11:08:45 +02008 notice and this notice are preserved. This file is offered as-is,
9 without any warranty.
Christian Eglieddc4662009-03-09 13:27:20 +000010
11This file attempts to describe the maintainer-specific notes to follow
12when hacking liblouis.
13
Christian Egli5510e4a2009-11-05 09:55:30 +000014* Developing
15** Where to get it
Christian Egli71647d62014-05-20 09:20:28 +020016The development sources are available through git at github.com:
Christian Egli5510e4a2009-11-05 09:55:30 +000017
Christian Egli71647d62014-05-20 09:20:28 +020018 https://github.com/liblouis/liblouis
Christian Egli5510e4a2009-11-05 09:55:30 +000019
20** Build requirements
21This distribution uses Automake, Autoconf, and Libtool. If you are
Christian Egli71647d62014-05-20 09:20:28 +020022getting the sources from git (or change configure.ac), you'll need to
Christian Egli5510e4a2009-11-05 09:55:30 +000023have these tools installed to (re)build. Optionally (if you want to
24generate man pages) you'll also need help2man. All of these programs
25are available from ftp://ftp.gnu.org/gnu.
26
27** Gnulib
Christian Egli71647d62014-05-20 09:20:28 +020028This distribution also uses Gnulib (http://www.gnu.org/software/gnulib). If
29you want to update from the current gnulib, install gnulib, and then run
30gnulib-tool --import in the top-level directory.
Christian Egli5510e4a2009-11-05 09:55:30 +000031
32For the record, the first time invocation was
33 gnulib-tool --import --lib=libgnu --source-base=gnulib \
34 --m4-base=gnulib/m4 --aux-dir=build-aux --libtool \
35 --macro-prefix=gl getopt-gnu progname version-etc
36More modules might have been added since. The currently-used gnulib
37modules and other gnulib information are recorded in
38gnulib/m4/gnulib-cache.m4. Given a source checkout of gnulib, you can
39update the files with gnulib-tool --import.
40
41** How to build
Christian Egli71647d62014-05-20 09:20:28 +020042After getting the sources from git, with
Christian Egli81b04812009-11-05 11:07:17 +000043
Christian Egli71647d62014-05-20 09:20:28 +020044 git clone https://github.com/liblouis/liblouis.git
Christian Egli81b04812009-11-05 11:07:17 +000045
46and installing the tools above, change to the liblouis directory and
47and bootstrap the project with the following command
48
49 ./autogen.sh
50
51to do a fresh build. Then run configure as usual:
52
53 ./configure
54
55You have the choice to compile liblouis for either 16- or 32-bit
56Unicode. By default it is compiled for the former. To get 32-bit
57Unicode run configure with --enable-ucs4 .
58
59After running configure run "make" and then "make install". You must
60have root privileges for the installation step.
Christian Egli5510e4a2009-11-05 09:55:30 +000061
Christian Eglif70f4e02011-01-03 15:09:06 +000062** How to debug
Christian Egli45b3d322013-01-17 09:51:56 +000063First you have to build liblouis with debugging info enabled.
64
65 $ ./configure CFLAGS='-g -O0 -Wall -Wextra'
66 $ make
67
Christian Eglif70f4e02011-01-03 15:09:06 +000068Starting the programs under the tools directory within gdb is a little
69tricky as they are linked with libtool. See the info page of libtool
70for more information. To start lou_checktable for table wiskunde.ctb
71for example you'd have to issue the following commands:
72
73 $ libtool --mode=execute gdb ./tools/lou_checktable
74 (gdb) run tables/wiskunde.ctb
75
Christian Eglic77a5892012-05-11 12:11:26 +000076** How to find memory leaks
77Valgrind is a tool that can be used to find memory errors. It is
78recommended that you compile liblouis without any optimizations and
79with all warnings enabled before running it through Valgrind:
80
81 $ ./configure CFLAGS='-g -O0 -Wall'
82 $ make
83
84Then use Valgrind to analyze liblouis. For example you can run
85lou_translate trough Valgrind:
86
87 $ libtool --mode=execute valgrind -v --tool=memcheck \
88 --leak-check=full --leak-resolution=high --log-file=valgrind.log \
89 ./tools/lou_translate en-us-g2.ctb
90
91Type a few words at the prompt, check translation and terminate
92lou_translate. Now open the file valgrind.log and see if there are any
93memory leaks reported.
94
95You can also just run lou_checktable for example:
96
97 $ libtool --mode=execute valgrind -v --tool=memcheck \
98 --leak-check=full --leak-resolution=high --log-file=valgrind.log \
99 ./tools/lou_checktable tables/nl-BE-g1.ctb
100
101Again open valgrind.log to see if any memory leaks were reported.
102
Christian Egliae435322012-05-14 10:00:36 +0000103For the full experience run lou_allround under Valgrind:
104
105 $ libtool --mode=execute valgrind -v --tool=memcheck \
106 --leak-check=full --show-reachable=yes \
107 --leak-resolution=high --track-origins=yes \
108 --log-file=valgrind.log ./tools/lou_allround
109
Christian Egli6eb63342013-06-03 10:03:54 +0000110** How to analyze performance
111Gprof helps you analyze the performance of programs. You have to
112compile liblouis as follows:
113
114 $ ./configure --disable-shared
115 $ make clean all CFLAGS='-g -O0 -pg' LDFLAGS='-all-static'
116
117Then translate some stuff with a large table:
118
119 $ ./tools/lou_translate tests/tables/large.ctb
120
121Finally look at the call profile:
122
123 $ libtool --mode=execute gprof ./tools/lou_translate gmon.out
124
Christian Egli35f4aeb2010-08-19 11:58:07 +0000125** How to build for win32
Christian Egli311d52b2013-01-11 16:19:23 +0000126See the README.windows file and the windows subdirectory.
Christian Egli75cd5692012-05-16 08:00:37 +0000127
128*** How to cross-compile for win32
Christian Egli311d52b2013-01-11 16:19:23 +0000129Use the mingw win32 cross compiler as shown below. Use the prefix
130option to install the binaries to a temporary place where you can
131create a zip file.
Christian Egli75cd5692012-05-16 08:00:37 +0000132
Christian Eglidaaf7e32013-06-21 14:27:14 +0000133 ./configure --build i686-pc-linux-gnu --host i586-mingw32msvc --prefix=/tmp/liblouis-mingw32msvc
Christian Egli75cd5692012-05-16 08:00:37 +0000134 make
Christian Eglidaaf7e32013-06-21 14:27:14 +0000135 make install
136 zip -r liblouis-mingw32msvc.zip /tmp/liblouis-mingw32msvc
Christian Egli75cd5692012-05-16 08:00:37 +0000137
138
Christian Eglieddc4662009-03-09 13:27:20 +0000139* Release Procedure
140These steps describe what a maintainer does to make a release; they
141are not needed for ordinary patch submission.
142
143** Set the version number
144Update the version number in NEWS (with version, date, and release
145type), ChangeLog and configure.ac.
146
Christian Eglid1f57182011-05-18 07:16:46 +0000147Don't forget to update the libtool versioning info in configure.ac,
148i.e. LIBLOUIS_REVISION and possibly LIBLOUIS_CURRENT and LIBLOUIS_AGE.
149
Christian Eglieddc4662009-03-09 13:27:20 +0000150** Commit and tag
151Commit the changes and tag this version
152
Christian Egli5f9c03f2014-09-01 14:01:41 +0200153 git tag -s v2.6.0 -m "Release 2.6.0"
154 git push origin v2.6.0
Christian Eglieddc4662009-03-09 13:27:20 +0000155
156If you know the exact version number that needs to be tagged use
157
Christian Egli5f9c03f2014-09-01 14:01:41 +0200158 git tag -s v2.6.0 -m "Release 2.6.0" <commit>
159 git push origin v2.6.0
Christian Eglieddc4662009-03-09 13:27:20 +0000160
161** Make the release
162Check out a clean copy in a different directory, like /tmp. Run
163autogen.sh and configure with no special prefixes. Run make distcheck.
164This will make sure that all needed files are present, and do a
165general sanity check. Run make dist. This will produce a tarball.
166
Christian Egli9a3b3ce2009-05-27 13:46:37 +0000167 ./autogen.sh && ./configure && make && make distcheck && make dist
Christian Eglieddc4662009-03-09 13:27:20 +0000168
169** Upload
Christian Egli71647d62014-05-20 09:20:28 +0200170Add the tarball to the liblouis web site, i.e. add it under
Christian Egli5f9c03f2014-09-01 14:01:41 +0200171$WEBSITE/downloads and add a link to it in $WEBSITE/downloads/index.md.
Christian Egli71647d62014-05-20 09:20:28 +0200172See below for instructions on how to update the web site.
Christian Eglieddc4662009-03-09 13:27:20 +0000173
Christian Egli2ed702e2009-03-12 13:06:39 +0000174** Online documentation
Christian Egli71647d62014-05-20 09:20:28 +0200175The online documentation is part of the liblouis web site. To add it to the
176site simply copy doc/liblouis.html to $WEBSITE/documentation/liblouis.html.
177Make sure you add the proper YAML front matter. Again see below for
178instructions on how to update the web site.
Christian Egli2ed702e2009-03-12 13:06:39 +0000179
Christian Egli71647d62014-05-20 09:20:28 +0200180** Web site maintenance
181The liblouis web site at liblouis.org is maintained with the help of
182github pages (https://pages.github.com/). To edit the site just check
183out the repo at https://github.com/liblouis/liblouis.github.io. You'll
184need to know a few things about Jekyll (http://jekyllrb.com/) and
185textile (http://redcloth.org/textile/) the markup that is used to edit
186the content. In order to update the site simply edit, commit and push.
Christian Egli2ed702e2009-03-12 13:06:39 +0000187
Christian Egli71647d62014-05-20 09:20:28 +0200188For the new release update the project web site. Add a post containing
189the current NEWS to the _posts directory.
Christian Egli2ed702e2009-03-12 13:06:39 +0000190
Christian Egli25419732011-05-09 07:38:14 +0000191** Announce
192Send an announcement to the liblouis list
193liblouis-liblouisxml@freelists.org. See ANNOUNCEMENT for an example.
194