source: git/doc/HACKING.htm @ 87fcddb

stereo-2025warn-only-for-hanging-survey
Last change on this file since 87fcddb was fc1d89b, checked in by Olly Betts <olly@…>, 12 months ago

Update to use innosetup 6.2.2

The Hungarian translation is now official. Update the unofficial
Romanian translation.

  • Property mode set to 100644
File size: 6.5 KB
Line 
1<HTML><HEAD>
2<TITLE>Survex Hacker's Guide</TITLE>
3<STYLE type="text/css"><!--
4BODY, TD, CENTER, UL, OL {font-family: sans-serif;}
5-->
6</STYLE>
7</HEAD><BODY BGCOLOR=white TEXT=black>
8<H1>Hacking Survex</H1>
9
10<p>(That's hacking in the "tinkering with code" sense, not in the
11"breaking into other people's computer systems" sense).
12
13<p>This is currently a random collection of notes that need to be written
14down while I remember.  With time it should evolve into a more
15coherent document.  If you have any questions which this should answer
16but doesn't then ask me and I'll add them.
17
18<H2>Network code debugging</H2>
19
20<P>You can pick which network simplifications are attempted using "-z"
21with an argument listing code letters.  So:
22
23<ul>
24<li>-z=    no special simplifications (articulation still performed)
25<li>-z=l   remove "lollipops"
26<li>-z=p   remove parallel legs
27<li>-z=d   convert deltas to stars
28</ul>
29
30<P>And you can combine these in any combination:
31
32<ul>
33<li>-z=lp  remove "lollipops" and parallel legs
34<li>-z=lpd remove "lollipops" and parallel legs; convert deltas to stars
35</ul>
36
37<P>"-z=lpd" is the default (in 0.99 at least - more transformations may
38conceivably be added in future, although the simple common cases are
39already covered).
40
41<H2>Developing on Unix Platforms</H2>
42
43<P>You'll need automake 1.5 or later (earlier versions don't support
44per-executable CFLAGS; 1.6 has been tested and works, but wasn't a
45very stable release - automake 1.6.1 is a better bet)
46and autoconf 2.50 or later (autoconf 2.52, 2.53, 2.64 and 2.71 have all
47been used successfully).
48
49<p>The wxWidgets library is used for aven's UI.  Currently &gt;= 3.0.0 is
50supported.
51
52<p>The PROJ library is used for coordinate conversions.  Currently &gt;= 6.2.0 is
53supported.
54
55<P>The Perl Locale::PO module is used for process message translation files.
56
57<P>For building the documentation you'll need docbook-utils (also
58known as docbook-tools) and w3m.
59
60<P>And for building unifont.pixelfont, you'll need unifont installed.
61
62<P>On Debian, you can install the required packages using:
63
64<pre>
65sudo apt-get install autoconf automake liblocale-po-perl libproj-dev libwxgtk3.0-gtk3-dev inkscape netpbm docbook-utils w3m unifont
66</pre>
67
68<H2>Building on Non-Unix Platforms</H2>
69
70<H3>Mingw (Microsoft Windows)</H3>
71
72<P>Currently I build this with a Linux hosted cross-compiler.  I use
73the packaged cross-compiler in the debian testing/unstable distribution:
74
75<pre>
76sudo apt-get install mingw-w64-i686-dev
77</pre>
78
79<p>
80I then install the various libraries by compiling from source.  For wxWidgets
81I apply a
82<a href="https://survex.com/software/wxWidgets-3.2.4.patch">patch</a> to
83disable a pointless and annoying compiler ABI check
84(with this check aven stops working each time my cross compiler package is
85upgraded to a new GCC version; without it everything works fine).
86</p>
87
88<p>
89Then I configure, build and install with:
90</p>
91
92<pre>
93./configure --prefix=/usr/i686-w64-mingw32 --host i686-w64-mingw32 --with-msw --with-opengl --enable-display --disable-shared host_alias=i686-w64-mingw32 DOCBOOK_TO_MAN="xmlto man --skip-validation"
94make
95sudo make install
96</pre>
97
98<p>
99For sqlite (needed by PROJ):
100</p>
101
102<pre>
103wget https://www.sqlite.org/2021/sqlite-autoconf-3360000.tar.gz
104tar xvf sqlite-autoconf-3360000.tar.gz
105mkdir BUILD
106cd BUILD
107../configure --prefix=/usr/i686-w64-mingw32 --host i686-w64-mingw32 --disable-shared --disable-fts4 --disable-fts5 --disable-json1 --disable-rtree host_alias=i686-w64-mingw32
108make
109sudo make install
110</pre>
111
112<p>
113Sadly newer versions of PROJ have to be built with cmake.  For PROJ 9.3.0
114I used the following (TIFF is apparently useful for some grids, but would also
115need libtiff):
116</p>
117
118<pre>
119mkdir BUILD
120cd BUILD
121cmake .. -DCMAKE_TOOLCHAIN_FILE=~/git/survex/cross-mingw.cmake -DCMAKE_INSTALL_PREFIX=/usr/i686-w64-mingw32 -DENABLE_CURL=OFF -DENABLE_TIFF=OFF -DBUILD_PROJSYNC=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DFETCHCONTENT_FULLY_DISCONNECTED=ON -DBUILD_TESTING=OFF
122make
123sudo make install
124</pre>
125
126<p>where <tt>cross-mingw.cmake</tt> contains:</p>
127
128<pre>
129# the name of the target operating system
130set(CMAKE_SYSTEM_NAME Windows)
131
132# which compilers to use for C and C++
133set(CMAKE_C_COMPILER   i686-w64-mingw32-gcc)
134set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
135
136# where is the target environment located
137set(CMAKE_FIND_ROOT_PATH  /usr/i686-w64-mingw32)
138
139# adjust the default behaviour of the FIND_XXX() commands:
140# search programs in the host environment
141set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
142
143# search headers and libraries in the target environment
144set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
145set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
146</pre>
147
148<p>
149For ffmpeg 4.4.1:
150</p>
151
152<pre>
153sudo apt-get install yasm
154mkdir BUILD
155cd BUILD
156../configure --prefix=/usr/i686-w64-mingw32 --cross-prefix=i686-w64-mingw32- --enable-cross-compile --target-os=mingw32 --arch=i686 --disable-shared --disable-decoders --disable-demuxers --disable-programs --disable-network --disable-bsfs --disable-protocols --disable-devices
157make
158sudo make install
159</pre>
160
161<P>Building on Windows in a native mingw environment will probably
162require tinkering.  Best bet is probably to install bash and use the
163current configure script.  I'm happy to help if you want to try this,
164and I'll incorporate patches provided they're fairly clean.
165
166<H2>Microsoft Windows Installer Builder</H2>
167
168<P>We use <A HREF="http://www.jrsoftware.org/isinfo.php">InnoSetup</A> to
169build the MS Windows Installer.  Survex 1.4.8 was built using InnoSetup
1706.2.2.
171
172<P>Here are some random notes:
173
174<H3>Packages Needed</H3>
175
176<P>On Debian unstable/testing:
177
178<pre>
179sudo apt-get install wine wx3.0-i18n
180</pre>
181
182<P>And then run:
183
184<pre>
185wine ~/Downloads/innosetup-6.2.2.exe
186</pre>
187
188<H3>Translations</H3>
189
190<P>In addition to the translations included with InnoSetup as standard, we also
191add these, which you can find in the <code>lib</code> subdirectory of Survex's
192source tree:
193
194<UL>
195<li>ChineseSimplified.isl (6.1.0+)
196<li>ChineseTraditional.isl (6.1.0+)
197<li>EnglishBritish.isl (6.1.0+)
198<li>Greek.isl (6.1.0+)
199<li>Indonesian.isl (6.1.0+)
200<li>Romanian.isl (6.1.0+)
201</UL>
202
203These are taken from the <a href="https://jrsoftware.org/files/istrans/">Inno
204Setup Translations</a> page.
205
206<H3>survex.iss</H3>
207
208<P>This file is generated by configure (from the template survex.iss.in).
209We could instead have a static survex.iss which uses #include to pull in
210a file with the Survex version info in, but the current method works well
211enough so we'll stick with it for now (I suspect #include was introduced since
212we started using InnoSetup).
213
214</BODY></HTML>
Note: See TracBrowser for help on using the repository browser.