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