Christian Egli | f70f4e0 | 2011-01-03 15:09:06 +0000 | [diff] [blame] | 1 | This HACKING file describes the development environment. -*- org -*- |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 2 | |
Christian Egli | 311d52b | 2013-01-11 16:19:23 +0000 | [diff] [blame] | 3 | Copyright (C) 2008, 2009, 2011 ViewPlus Technologies, Inc. and Abilitiessoft, Inc. |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 4 | Copyright (C) 2012, 2013, 2014,2015 Swiss Library for the Blind, Visually Impaired and Print Disabled |
Christian Egli | 311d52b | 2013-01-11 16:19:23 +0000 | [diff] [blame] | 5 | |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 6 | Copying and distribution of this file, with or without modification, |
| 7 | are permitted in any medium without royalty provided the copyright |
Christian Egli | 741b007 | 2014-09-18 11:08:45 +0200 | [diff] [blame] | 8 | notice and this notice are preserved. This file is offered as-is, |
| 9 | without any warranty. |
Christian Egli | eddc466 | 2009-03-09 13:27:20 +0000 | [diff] [blame] | 10 | |
| 11 | This file attempts to describe the maintainer-specific notes to follow |
| 12 | when hacking liblouis. |
| 13 | |
Christian Egli | f949627 | 2017-04-18 17:00:39 +0200 | [diff] [blame] | 14 | * Table of Contents :TOC: |
Christian Egli | e580c8e | 2018-03-05 14:42:33 +0100 | [diff] [blame] | 15 | - [[#developing][Developing]] |
| 16 | - [[#where-to-get-it][Where to get it]] |
| 17 | - [[#build-requirements][Build requirements]] |
| 18 | - [[#gnulib][Gnulib]] |
| 19 | - [[#how-to-build][How to build]] |
| 20 | - [[#install-with-homebrew][Install with Homebrew]] |
| 21 | - [[#docker][Docker]] |
| 22 | - [[#how-to-run-tests][How to run tests]] |
| 23 | - [[#how-to-debug][How to debug]] |
| 24 | - [[#how-to-find-memory-leaks][How to find memory leaks]] |
Christian Egli | ef45f5a | 2019-08-15 14:49:10 +0200 | [diff] [blame] | 25 | - [[#static-analysis][Static analysis]] |
Christian Egli | e580c8e | 2018-03-05 14:42:33 +0100 | [diff] [blame] | 26 | - [[#how-to-analyze-performance][How to analyze performance]] |
| 27 | - [[#how-to-build-for-windows][How to build for Windows]] |
| 28 | - [[#release-procedure][Release Procedure]] |
| 29 | - [[#update-the-news-entry][Update the NEWS entry]] |
| 30 | - [[#set-the-version-number][Set the version number]] |
| 31 | - [[#commit-and-tag][Commit and tag]] |
| 32 | - [[#make-the-release][Make the release]] |
| 33 | - [[#upload][Upload]] |
| 34 | - [[#online-documentation][Online documentation]] |
| 35 | - [[#web-site-maintenance][Web site maintenance]] |
| 36 | - [[#announce][Announce]] |
Christian Egli | f949627 | 2017-04-18 17:00:39 +0200 | [diff] [blame] | 37 | |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 38 | * Developing |
| 39 | ** Where to get it |
Christian Egli | 71647d6 | 2014-05-20 09:20:28 +0200 | [diff] [blame] | 40 | The development sources are available through git at github.com: |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 41 | |
Christian Egli | 71647d6 | 2014-05-20 09:20:28 +0200 | [diff] [blame] | 42 | https://github.com/liblouis/liblouis |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 43 | |
| 44 | ** Build requirements |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 45 | To build Automake, Autoconf, and Libtool are used. If you are getting |
| 46 | the sources from git (or change configure.ac), you'll need to have |
| 47 | these tools installed to (re)build. Optionally (if you want to |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 48 | generate man pages) you'll also need ~help2man~. All of these programs |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 49 | are available from ftp://ftp.gnu.org/gnu. |
| 50 | |
Christian Egli | a02c136 | 2017-03-06 10:38:45 +0100 | [diff] [blame] | 51 | If you want to run the YAML based test suite you will have to install |
| 52 | ~libyaml~. |
| 53 | |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 54 | On Mac OS, the programs can be optained with Homebrew (http://brew.sh): |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 55 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 56 | #+BEGIN_SRC shell |
| 57 | $ brew install automake libtool pkg-config texinfo |
| 58 | #+END_SRC |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 59 | |
| 60 | Note that if you are using Homebrew to install liblouis (see below), |
| 61 | the build dependencies are installed automatically. |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 62 | |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 63 | ** Gnulib |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 64 | Gnulib (http://www.gnu.org/software/gnulib) is used to provide |
| 65 | portable basic functionality to programs and libraries. We use two |
| 66 | instances of gnulib, one to provide portable functions such as |
| 67 | ~malloc~, ~strndup~, etc to the library and another one to provide |
| 68 | portable functionality such as ~getopt~, ~progname~ or |
| 69 | ~version-etc~ to the tools. |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 70 | |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 71 | The first time invocation to import gnulib for the library was |
| 72 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 73 | #+BEGIN_SRC shell |
| 74 | $ gnulib-tool --add-import --lib=libgnu --source-base=gnulib \ |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 75 | --m4-base=gnulib/m4 --aux-dir=build-aux --libtool \ |
| 76 | --macro-prefix=gl --no-vc-files \ |
| 77 | malloc-gnu realloc-gnu strndup |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 78 | #+END_SRC |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 79 | |
| 80 | and for the tools |
| 81 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 82 | #+BEGIN_SRC shell |
| 83 | $ gnulib-tool --add-import --lib=libgnutools --source-base=tools/gnulib \ |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 84 | --m4-base=tools/gnulib/m4 --aux-dir=build-aux --libtool \ |
| 85 | --macro-prefix=gl_tools --no-vc-files \ |
| 86 | getopt-gnu malloc-gnu progname version-etc |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 87 | #+END_SRC |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 88 | |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 89 | More modules might have been added since. The currently-used gnulib |
| 90 | modules and other gnulib information are recorded in |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 91 | ~gnulib/m4/gnulib-cache.m4~ and ~tools/gnulib/m4/gnulib-cache.m4~. |
| 92 | |
| 93 | If you want to update from the current gnulib, install gnulib, and |
| 94 | then run the following commands in the top-level directory. |
| 95 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 96 | #+BEGIN_SRC shell |
| 97 | $ gnulib-tool --add-import --lib=libgnu --source-base=gnulib \ |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 98 | --m4-base=gnulib/m4 --aux-dir=build-aux --libtool \ |
| 99 | --macro-prefix=gl --no-vc-files |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 100 | $ gnulib-tool --add-import --lib=libgnutools --source-base=tools/gnulib \ |
Christian Egli | 818e58b | 2015-06-05 14:27:06 +0200 | [diff] [blame] | 101 | --m4-base=tools/gnulib/m4 --aux-dir=build-aux --libtool \ |
| 102 | --macro-prefix=gl_tools --no-vc-files |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 103 | #+END_SRC |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 104 | |
| 105 | ** How to build |
Christian Egli | 71647d6 | 2014-05-20 09:20:28 +0200 | [diff] [blame] | 106 | After getting the sources from git, with |
Christian Egli | 81b0481 | 2009-11-05 11:07:17 +0000 | [diff] [blame] | 107 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 108 | #+BEGIN_SRC shell |
| 109 | $ git clone https://github.com/liblouis/liblouis.git |
| 110 | #+END_SRC |
Christian Egli | 81b0481 | 2009-11-05 11:07:17 +0000 | [diff] [blame] | 111 | |
| 112 | and installing the tools above, change to the liblouis directory and |
| 113 | and bootstrap the project with the following command |
| 114 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 115 | #+BEGIN_SRC shell |
| 116 | $ ./autogen.sh |
| 117 | #+END_SRC |
Christian Egli | 81b0481 | 2009-11-05 11:07:17 +0000 | [diff] [blame] | 118 | |
| 119 | to do a fresh build. Then run configure as usual: |
| 120 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 121 | #+BEGIN_SRC shell |
| 122 | $ ./configure |
| 123 | #+END_SRC |
Christian Egli | 81b0481 | 2009-11-05 11:07:17 +0000 | [diff] [blame] | 124 | |
| 125 | You have the choice to compile liblouis for either 16- or 32-bit |
| 126 | Unicode. By default it is compiled for the former. To get 32-bit |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 127 | Unicode run configure with ~--enable-ucs4~. |
Christian Egli | 81b0481 | 2009-11-05 11:07:17 +0000 | [diff] [blame] | 128 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 129 | After running configure run ~make~ and then ~make install~. You must |
Christian Egli | 81b0481 | 2009-11-05 11:07:17 +0000 | [diff] [blame] | 130 | have root privileges for the installation step. |
Christian Egli | 5510e4a | 2009-11-05 09:55:30 +0000 | [diff] [blame] | 131 | |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 132 | ** Install with Homebrew |
| 133 | Homebrew (http://brew.sh) is a package manager for Mac OS X that |
| 134 | installs software from source. There is nothing special about the |
| 135 | installation process in the sense that under the hood it happens |
| 136 | exactly as described above, with the only difference that Homebrew |
| 137 | automates it completely. |
| 138 | |
| 139 | First, use the ~brew tap~ command to add the repository that includes |
| 140 | the liblouis formula: |
| 141 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 142 | #+BEGIN_SRC shell |
| 143 | $ brew tap liblouis/liblouis |
| 144 | #+END_SRC |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 145 | |
| 146 | Now you are ready to install liblouis: |
| 147 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 148 | #+BEGIN_SRC shell |
| 149 | $ brew install liblouis |
| 150 | #+END_SRC |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 151 | |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 152 | ** Docker |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 153 | Docker (https://www.docker.com) can be useful both for creating a |
| 154 | development environment for liblouis, and for shipping the |
| 155 | application. |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 156 | |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 157 | Setting up a developer environment can take long and can be |
| 158 | problematic especially for Windows. Thanks to Docker we can set up the |
| 159 | environment for you, we can easily distribute it as an image, which |
| 160 | can be run by anybody and will behave exactly the same for everybody. |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 161 | |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 162 | Docker images of liblouis are being built automatically each time |
| 163 | something changes in the code (see https://registry.hub.docker.com/repos/liblouis). |
| 164 | In order to use them, first get Docker at |
| 165 | http://docs.docker.com/introduction/get-docker. Download the latest |
| 166 | liblouis image with: |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 167 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 168 | #+BEGIN_SRC shell |
| 169 | $ docker pull liblouis/liblouis |
| 170 | #+END_SRC |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 171 | |
| 172 | Then, enter the development environment by running the image in a |
| 173 | Docker container: |
| 174 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 175 | #+BEGIN_SRC shell |
| 176 | $ docker run -it liblouis/liblouis bash |
| 177 | #+END_SRC |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 178 | |
| 179 | Local files and directories can be "mounted" inside the container, in |
| 180 | order to make it easier to edit files and to persist changes across |
| 181 | runs. For example, to use local table files: |
| 182 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 183 | #+BEGIN_SRC shell |
| 184 | $ docker run -it -v $(pwd)/tables:/tmp/liblouis/tables liblouis/liblouis bash |
| 185 | #+END_SRC |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 186 | |
| 187 | See the Docker documentation for more info. |
| 188 | |
| 189 | The same Docker image can be used as a development environment and as |
| 190 | the application itself. For example, to run the lou_translate tool |
| 191 | from inside a Docker container: |
| 192 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 193 | #+BEGIN_SRC shell |
| 194 | $ docker run -it liblouis/liblouis lou_translate en-us-g1.ctb |
| 195 | #+END_SRC |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 196 | |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 197 | To rebuild the image yourself, run the following command in the root |
| 198 | directory of the liblouis source: |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 199 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 200 | #+BEGIN_SRC shell |
| 201 | $ docker build -t liblouis/liblouis . |
| 202 | #+END_SRC |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 203 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 204 | A ~.dockerignore~ file is required if you want to compile the source |
| 205 | both on te host and in the Docker container. The ~.dockerignore~ file |
| 206 | can be updated from ~.gitignore~ with: |
Bert Frees | 12e9904 | 2015-11-15 12:23:40 +0100 | [diff] [blame] | 207 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 208 | #+BEGIN_SRC shell |
| 209 | $ make .dockerignore |
| 210 | #+END_SRC |
Bert Frees | 12e9904 | 2015-11-15 12:23:40 +0100 | [diff] [blame] | 211 | |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 212 | ** How to run tests |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 213 | Tests are run with |
Bert Frees | d41c9ac | 2015-03-25 14:42:43 +0100 | [diff] [blame] | 214 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 215 | #+BEGIN_SRC shell |
| 216 | $ make check |
| 217 | #+END_SRC |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 218 | |
Christian Egli | f70f4e0 | 2011-01-03 15:09:06 +0000 | [diff] [blame] | 219 | ** How to debug |
Christian Egli | 45b3d32 | 2013-01-17 09:51:56 +0000 | [diff] [blame] | 220 | First you have to build liblouis with debugging info enabled. |
| 221 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 222 | #+BEGIN_SRC shell |
| 223 | $ ./configure CFLAGS='-g -O0 -Wall -Wextra' |
| 224 | $ make |
| 225 | #+END_SRC |
Christian Egli | 45b3d32 | 2013-01-17 09:51:56 +0000 | [diff] [blame] | 226 | |
Christian Egli | f70f4e0 | 2011-01-03 15:09:06 +0000 | [diff] [blame] | 227 | Starting the programs under the tools directory within gdb is a little |
| 228 | tricky as they are linked with libtool. See the info page of libtool |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 229 | for more information. To start ~lou_checktable~ for table |
| 230 | ~wiskunde.ctb~ for example you'd have to issue the following commands: |
Christian Egli | f70f4e0 | 2011-01-03 15:09:06 +0000 | [diff] [blame] | 231 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 232 | #+BEGIN_SRC shell |
| 233 | $ libtool --mode=execute gdb ./tools/lou_checktable |
| 234 | (gdb) run tables/wiskunde.ctb |
| 235 | #+END_SRC |
Christian Egli | f70f4e0 | 2011-01-03 15:09:06 +0000 | [diff] [blame] | 236 | |
Christian Egli | c77a589 | 2012-05-11 12:11:26 +0000 | [diff] [blame] | 237 | ** How to find memory leaks |
| 238 | Valgrind is a tool that can be used to find memory errors. It is |
| 239 | recommended that you compile liblouis without any optimizations and |
| 240 | with all warnings enabled before running it through Valgrind: |
| 241 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 242 | #+BEGIN_SRC shell |
| 243 | $ ./configure CFLAGS='-g -O0 -Wall' |
| 244 | $ make |
| 245 | #+END_SRC |
Christian Egli | c77a589 | 2012-05-11 12:11:26 +0000 | [diff] [blame] | 246 | |
| 247 | Then use Valgrind to analyze liblouis. For example you can run |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 248 | ~lou_translate~ trough Valgrind: |
Christian Egli | c77a589 | 2012-05-11 12:11:26 +0000 | [diff] [blame] | 249 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 250 | #+BEGIN_SRC shell |
| 251 | $ libtool --mode=execute valgrind -v --tool=memcheck \ |
| 252 | --leak-check=full --leak-resolution=high --log-file=valgrind.log \ |
| 253 | ./tools/lou_translate en-us-g2.ctb |
| 254 | #+END_SRC |
Christian Egli | c77a589 | 2012-05-11 12:11:26 +0000 | [diff] [blame] | 255 | |
| 256 | Type a few words at the prompt, check translation and terminate |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 257 | ~lou_translate~. Now open the file ~valgrind.log~ and see if there are |
| 258 | any memory leaks reported. |
Christian Egli | c77a589 | 2012-05-11 12:11:26 +0000 | [diff] [blame] | 259 | |
| 260 | You can also just run lou_checktable for example: |
| 261 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 262 | #+BEGIN_SRC shell |
| 263 | $ libtool --mode=execute valgrind -v --tool=memcheck \ |
| 264 | --leak-check=full --leak-resolution=high --log-file=valgrind.log \ |
| 265 | ./tools/lou_checktable tables/nl-BE-g0.utb |
| 266 | #+END_SRC |
Christian Egli | c77a589 | 2012-05-11 12:11:26 +0000 | [diff] [blame] | 267 | |
| 268 | Again open valgrind.log to see if any memory leaks were reported. |
| 269 | |
Christian Egli | ae43532 | 2012-05-14 10:00:36 +0000 | [diff] [blame] | 270 | For the full experience run lou_allround under Valgrind: |
| 271 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 272 | #+BEGIN_SRC shell |
| 273 | $ libtool --mode=execute valgrind -v --tool=memcheck \ |
| 274 | --leak-check=full --show-reachable=yes \ |
| 275 | --leak-resolution=high --track-origins=yes \ |
| 276 | --log-file=valgrind.log ./tools/lou_allround |
| 277 | #+END_SRC |
Christian Egli | ae43532 | 2012-05-14 10:00:36 +0000 | [diff] [blame] | 278 | |
Christian Egli | 777a817 | 2017-05-10 14:10:12 +0200 | [diff] [blame] | 279 | *** AddressSanitizer |
| 280 | [[https://github.com/google/sanitizers/wiki/AddressSanitizer][AdressSanitizer]] is a memory error detector for C/C++. It is part of |
| 281 | both LLVM and gcc. To check liblouis build it as follows: |
| 282 | |
| 283 | #+BEGIN_SRC shell |
| 284 | $ ./autogen.sh |
| 285 | $ ./configure CFLAGS='-fsanitize=address -O1 -fno-omit-frame-pointer -g' |
| 286 | $ make |
| 287 | $ ./tools/lou_translate tables/en-ueb-g2.ctb |
| 288 | #+END_SRC |
| 289 | |
Christian Egli | 4011ccd | 2019-08-15 16:21:52 +0200 | [diff] [blame^] | 290 | Run a few translations, end the program and marvel at the output of |
Christian Egli | 777a817 | 2017-05-10 14:10:12 +0200 | [diff] [blame] | 291 | AddressSanitizer. At the time of this writing it complained pretty |
| 292 | hard: |
| 293 | |
| 294 | #+BEGIN_EXAMPLE |
| 295 | SUMMARY: AddressSanitizer: 12384 byte(s) leaked in 12 allocation(s). |
| 296 | #+END_EXAMPLE |
| 297 | |
Christian Egli | 29de938 | 2017-04-21 10:38:56 +0200 | [diff] [blame] | 298 | *** Electric Fence |
| 299 | Electric Fence is a tool that helps detect memory access that overruns |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 300 | the boundaries of a ~malloc()~ memory allocation, and access to memory |
| 301 | that has been released with ~free()~. |
Christian Egli | 29de938 | 2017-04-21 10:38:56 +0200 | [diff] [blame] | 302 | |
| 303 | Under Debian the usage is fairly straightforward: |
| 304 | |
| 305 | #+BEGIN_SRC shell |
| 306 | $ sudo apt install sudo apt install electric-fence |
| 307 | #+END_SRC |
| 308 | |
Christian Egli | 3b900dc | 2017-04-21 11:11:55 +0200 | [diff] [blame] | 309 | Then compile [[#how-to-debug][as above]] and invoke the debugger [[#how-to-debug][as above]]. Inside ~gdb~ |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 310 | set up ~LOUIS_TABLEPATH~ and ~LD_PRELOAD~ as follows: |
Christian Egli | 29de938 | 2017-04-21 10:38:56 +0200 | [diff] [blame] | 311 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 312 | #+BEGIN_SRC shell |
| 313 | $ libtool --mode=execute gdb ./tools/lou_allround |
| 314 | (gdb) set environment LOUIS_TABLEPATH ./tables,./tests/tables,./tests/tables/moreTables,./tests/tablesWithMetadata,./tests/tables/emphclass |
| 315 | (gdb) set environment LD_PRELOAD /usr/lib/libefence.so.0.0 |
| 316 | (gdb) run |
Christian Egli | 29de938 | 2017-04-21 10:38:56 +0200 | [diff] [blame] | 317 | #+END_SRC |
| 318 | |
| 319 | If there are problems with memory access the program will run into a |
| 320 | segmentation fault which you can consequently analyze in the debugger. |
| 321 | |
Christian Egli | ef45f5a | 2019-08-15 14:49:10 +0200 | [diff] [blame] | 322 | ** Static analysis |
| 323 | [[http://clang-analyzer.llvm.org/scan-build.html][scan-build]] is a command line utility to run a static analyzer over the |
| 324 | codebase. It helps to find problems such as memory leaks, dereference |
| 325 | of null pointer, etc. |
| 326 | |
| 327 | #+BEGIN_SRC shell |
| 328 | $ make maintainer-clean |
| 329 | $ ./autogen.sh |
| 330 | $ scan-build ./configure |
| 331 | $ scan-build make |
| 332 | ... |
| 333 | scan-build: 101 bugs found. |
| 334 | scan-build: Run 'scan-view /tmp/scan-build-2019-08-15-141827-5185-1' to examine bug reports. |
| 335 | #+END_SRC |
| 336 | |
| 337 | then look at the generated reports and fix (or report) the issues. |
| 338 | |
Christian Egli | 6eb6334 | 2013-06-03 10:03:54 +0000 | [diff] [blame] | 339 | ** How to analyze performance |
| 340 | Gprof helps you analyze the performance of programs. You have to |
| 341 | compile liblouis as follows: |
| 342 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 343 | #+BEGIN_SRC shell |
| 344 | $ ./configure --disable-shared |
| 345 | $ make clean all CFLAGS='-g -O0 -pg' LDFLAGS='-all-static' |
| 346 | #+END_SRC |
Christian Egli | 6eb6334 | 2013-06-03 10:03:54 +0000 | [diff] [blame] | 347 | |
| 348 | Then translate some stuff with a large table: |
| 349 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 350 | #+BEGIN_SRC shell |
| 351 | $ ./tools/lou_translate tests/tables/large.ctb |
| 352 | #+END_SRC |
Christian Egli | 6eb6334 | 2013-06-03 10:03:54 +0000 | [diff] [blame] | 353 | |
| 354 | Finally look at the call profile: |
| 355 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 356 | #+BEGIN_SRC shell |
| 357 | $ libtool --mode=execute gprof ./tools/lou_translate gmon.out |
| 358 | #+END_SRC |
Christian Egli | 6eb6334 | 2013-06-03 10:03:54 +0000 | [diff] [blame] | 359 | |
Bert Frees | d51268a | 2015-11-15 17:23:45 +0100 | [diff] [blame] | 360 | ** How to build for Windows |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 361 | See the ~README.windows~ file and the windows subdirectory. |
Christian Egli | 75cd569 | 2012-05-16 08:00:37 +0000 | [diff] [blame] | 362 | |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 363 | *** How to cross-compile for Windows |
| 364 | To compile for win32, use the MinGW win32 cross-compiler as shown |
| 365 | below. Use the prefix option to install the binaries to a temporary |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 366 | place where you can create a zip file. The ~LDFLAGS='-all-static'~ |
Christian Egli | 854386d | 2016-06-01 16:47:42 +0200 | [diff] [blame] | 367 | ensures that libgcc is linked in statically. Otherwise the users need |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 368 | to have ~libgcc_s_sjlj-1.dll~. |
Christian Egli | 75cd569 | 2012-05-16 08:00:37 +0000 | [diff] [blame] | 369 | |
Christian Egli | d5bea6c | 2016-06-03 08:38:52 +0200 | [diff] [blame] | 370 | Some users want the dlls unversioned. To achieve that add |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 371 | ~-avoid-version~ to ~LDFLAGS~. |
Christian Egli | d5bea6c | 2016-06-03 08:38:52 +0200 | [diff] [blame] | 372 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 373 | #+BEGIN_SRC shell |
| 374 | $ ./configure --build=i686-pc-linux-gnu --host=i686-w64-mingw32 --prefix=/tmp/liblouis-mingw32 |
| 375 | $ make LDFLAGS='-avoid-version -Xcompiler -static-libgcc' |
| 376 | $ make install |
| 377 | $ zip -r liblouis-mingw32msvc.zip /tmp/liblouis-mingw32 |
| 378 | #+END_SRC |
Christian Egli | 75cd569 | 2012-05-16 08:00:37 +0000 | [diff] [blame] | 379 | |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 380 | To compile for win64, use the MinGW-w64 cross-compiler: |
| 381 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 382 | #+BEGIN_SRC shell |
| 383 | $ ./configure --build=i686-pc-linux-gnu --host=x86_64-w64-mingw32 --prefix=/tmp/liblouis-w64-mingw32 |
| 384 | $ make LDFLAGS='-avoid-version -Xcompiler -static-libgcc' |
| 385 | $ make install |
| 386 | $ zip -r liblouis-w64-mingw32.zip /tmp/liblouis-w64-mingw32 |
| 387 | #+END_SRC |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 388 | |
Bert Frees | d51268a | 2015-11-15 17:23:45 +0100 | [diff] [blame] | 389 | Two makefile rules have been provided to do this automatically for you. Docker will be used if the |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 390 | right cross-compiler is not installed. To compile for win32 using the MinGW cross-compiler, run ~make |
| 391 | distwin32~. This will produce a ZIP file called ~liblouis-<version>-win32.zip~. To compile for win64 |
| 392 | using the MinGW-w64 cross-compiler, run ~make distwin64~. This will produce a ZIP file called |
| 393 | ~liblouis-<version>-win64.zip~. |
Bert Frees | d51268a | 2015-11-15 17:23:45 +0100 | [diff] [blame] | 394 | |
Bert Frees | 34df6a6 | 2015-04-10 16:10:21 +0200 | [diff] [blame] | 395 | *** TODO How to build for Windows using Cygwin |
| 396 | (possibly use a Vagrantfile as demonstration + explain that Cygwin |
| 397 | binaries can not be used outside the Cygwin environment) |
| 398 | |
| 399 | *** TODO How to build for Windows using MinGW |
| 400 | (possibly use a Vagrant file as demonstration) |
| 401 | |
Christian Egli | eddc466 | 2009-03-09 13:27:20 +0000 | [diff] [blame] | 402 | * Release Procedure |
| 403 | These steps describe what a maintainer does to make a release; they |
| 404 | are not needed for ordinary patch submission. |
| 405 | |
Christian Egli | 2d889a8 | 2015-12-07 08:56:55 +0100 | [diff] [blame] | 406 | ** Update the NEWS entry |
Christian Egli | 9e7db12 | 2017-05-18 14:30:48 +0200 | [diff] [blame] | 407 | If any new tables were added, renamed or removed please note them with |
| 408 | their file name in the NEWS entry. This is usefull for projects like |
| 409 | NVDA. |
Christian Egli | 2d889a8 | 2015-12-07 08:56:55 +0100 | [diff] [blame] | 410 | |
Christian Egli | eddc466 | 2009-03-09 13:27:20 +0000 | [diff] [blame] | 411 | ** Set the version number |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 412 | Update the version number in ~NEWS~ (with version, date, and release |
Christian Egli | d38f44a | 2019-06-03 15:55:53 +0200 | [diff] [blame] | 413 | type), ~configure.ac~ and ~windows/include/config.h~. |
Christian Egli | eddc466 | 2009-03-09 13:27:20 +0000 | [diff] [blame] | 414 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 415 | Don't forget to update the libtool versioning info in ~configure.ac~, |
Christian Egli | e580c8e | 2018-03-05 14:42:33 +0100 | [diff] [blame] | 416 | i.e. ~LIBLOUIS_REVISION~ and possibly ~LIBLOUIS_CURRENT~ and |
| 417 | ~LIBLOUIS_AGE~. Check the [[https://www.gnu.org/software/libtool/manual/html_node/Interfaces.html#Interfaces][libtool documentation on versioning]] for an |
| 418 | explanation of these values. |
Christian Egli | d1f5718 | 2011-05-18 07:16:46 +0000 | [diff] [blame] | 419 | |
Christian Egli | eddc466 | 2009-03-09 13:27:20 +0000 | [diff] [blame] | 420 | ** Commit and tag |
| 421 | Commit the changes and tag this version |
| 422 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 423 | #+BEGIN_SRC shell |
| 424 | $ git tag -s v2.6.0 -m "Release 2.6.0" |
| 425 | $ git push origin v2.6.0 |
| 426 | #+END_SRC |
Christian Egli | eddc466 | 2009-03-09 13:27:20 +0000 | [diff] [blame] | 427 | |
| 428 | If you know the exact version number that needs to be tagged use |
| 429 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 430 | #+BEGIN_SRC shell |
| 431 | $ git tag -s v2.6.0 -m "Release 2.6.0" <commit> |
| 432 | $ git push origin v2.6.0 |
| 433 | #+END_SRC |
Christian Egli | eddc466 | 2009-03-09 13:27:20 +0000 | [diff] [blame] | 434 | |
| 435 | ** Make the release |
| 436 | Check out a clean copy in a different directory, like /tmp. Run |
| 437 | autogen.sh and configure with no special prefixes. Run make distcheck. |
| 438 | This will make sure that all needed files are present, and do a |
| 439 | general sanity check. Run make dist. This will produce a tarball. |
| 440 | |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 441 | #+BEGIN_SRC shell |
| 442 | $ ./autogen.sh && ./configure && make && make distcheck && make dist |
| 443 | #+END_SRC |
Christian Egli | eddc466 | 2009-03-09 13:27:20 +0000 | [diff] [blame] | 444 | |
| 445 | ** Upload |
Christian Egli | 88bfad9 | 2015-06-01 11:16:46 +0200 | [diff] [blame] | 446 | Add the tarball to the github liblouis releases page, i.e. add it |
| 447 | under https://github.com/liblouis/liblouis/releases with the specific |
| 448 | release and add a link to it in $WEBSITE/downloads/index.md. See below |
| 449 | for instructions on how to update the web site. |
Christian Egli | eddc466 | 2009-03-09 13:27:20 +0000 | [diff] [blame] | 450 | |
Christian Egli | 2ed702e | 2009-03-12 13:06:39 +0000 | [diff] [blame] | 451 | ** Online documentation |
Christian Egli | 71647d6 | 2014-05-20 09:20:28 +0200 | [diff] [blame] | 452 | The online documentation is part of the liblouis web site. To add it to the |
| 453 | site simply copy doc/liblouis.html to $WEBSITE/documentation/liblouis.html. |
| 454 | Make sure you add the proper YAML front matter. Again see below for |
| 455 | instructions on how to update the web site. |
Christian Egli | 2ed702e | 2009-03-12 13:06:39 +0000 | [diff] [blame] | 456 | |
Christian Egli | 71647d6 | 2014-05-20 09:20:28 +0200 | [diff] [blame] | 457 | ** Web site maintenance |
| 458 | The liblouis web site at liblouis.org is maintained with the help of |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 459 | [[https://pages.github.com/][github pages]]. To edit the site just check out the repo at |
| 460 | https://github.com/liblouis/liblouis.github.io. You'll need to know a |
| 461 | few things about [[http://jekyllrb.com/][Jekyll]] and markdown, the markup that is used to edit |
| 462 | the content. In order to update the site simply edit, commit and push. |
Christian Egli | 2ed702e | 2009-03-12 13:06:39 +0000 | [diff] [blame] | 463 | |
Christian Egli | 0008734 | 2017-03-07 16:13:16 +0100 | [diff] [blame] | 464 | For the new release update the project web site. |
| 465 | |
| 466 | - Add a post containing the current NEWS to the _posts directory and |
| 467 | - add the download artifacts to the download page |
Christian Egli | 2ed702e | 2009-03-12 13:06:39 +0000 | [diff] [blame] | 468 | |
Christian Egli | 2541973 | 2011-05-09 07:38:14 +0000 | [diff] [blame] | 469 | ** Announce |
| 470 | Send an announcement to the liblouis list |
Christian Egli | 63ab27f | 2017-04-21 10:57:13 +0200 | [diff] [blame] | 471 | ~liblouis-liblouisxml@freelists.org~. See ~ANNOUNCEMENT~ for an |
| 472 | example. |
Christian Egli | 2541973 | 2011-05-09 07:38:14 +0000 | [diff] [blame] | 473 | |