[e7839be] | 1 | <HTML><HEAD> |
---|
| 2 | <TITLE>Survex Hacker's Guide</TITLE> |
---|
| 3 | <STYLE type="text/css"><!-- |
---|
| 4 | BODY, 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 |
---|
| 14 | down while I remember. With time it should evolve into a more |
---|
| 15 | coherent document. If you have any questions which this should answer |
---|
| 16 | but 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" |
---|
| 21 | with 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 |
---|
| 38 | conceivably be added in future, although the simple common cases are |
---|
| 39 | already covered). |
---|
| 40 | |
---|
| 41 | <H2>Developing on Unix Platforms</H2> |
---|
| 42 | |
---|
[b63c928d] | 43 | <P>You'll need automake 1.5 or later (earlier versions don't support |
---|
[61b4202] | 44 | per-executable CFLAGS; 1.6 has been tested and works, but wasn't a |
---|
| 45 | very stable release - automake 1.6.1 is a better bet) |
---|
| 46 | and autoconf 2.50 or later (autoconf 2.52 and 2.53 have |
---|
| 47 | both been used successfully). |
---|
[c372fc9] | 48 | |
---|
| 49 | <P>For building the documentation you'll need sgmltools 2 or later, |
---|
[c746b4d] | 50 | docbook-to-man, and w3m. |
---|
[e7839be] | 51 | |
---|
| 52 | <H2>Building on Non-Unix Platforms</H2> |
---|
| 53 | |
---|
| 54 | <H3>DJGPP (MSDOS for 386 or better)</H3> |
---|
| 55 | |
---|
| 56 | <P>Currently I build this with a Linux hosted cross-compiler. I built |
---|
| 57 | this myself mostly following instructions from: |
---|
| 58 | |
---|
| 59 | <P><A |
---|
| 60 | HREF="http://www.objsw.com/CrossGCC/">http://www.objsw.com/CrossGCC/</A> |
---|
| 61 | |
---|
[e364af7] | 62 | <P>I suggest using binutils-2.14 rather than binutils-2.9.1, and also newer |
---|
| 63 | version of the DJGPP crosscompiler kit (djcrx - use 204 which is in beta at |
---|
| 64 | the time of writing) and GCC. Newer binutils versions include the patch they |
---|
| 65 | supply, so the instructions boil down to this sequence of commands: |
---|
[e7839be] | 66 | |
---|
| 67 | <pre> |
---|
| 68 | bash |
---|
| 69 | mkdir ~/djcross |
---|
| 70 | cd ~/djcross |
---|
| 71 | wget ftp://ftp.objsw.com/pub/crossgcc/build-djgpp.sh |
---|
| 72 | mkdir tars |
---|
| 73 | cd tars |
---|
[e364af7] | 74 | wget http://www.mirror.ac.uk/sites/ftp.delorie.com/pub/djgpp/current/v2/beta/djcrx204.zip |
---|
| 75 | wget http://www.mirror.ac.uk/sites/ftp.gnu.org/gnu/gcc/gcc-3.3.2.tar.gz |
---|
| 76 | wget http://www.mirror.ac.uk/sites/ftp.gnu.org/gnu/binutils/binutils-2.14.tar.gz |
---|
[e7839be] | 77 | cd .. |
---|
| 78 | patch -l build-djgpp.sh <<END |
---|
[e364af7] | 79 | 24,26c24,26 |
---|
| 80 | < binfile=djcrx202.zip |
---|
| 81 | < gcc=gcc-2.95.2 |
---|
[e7839be] | 82 | < binutils=binutils-2.9.1 |
---|
| 83 | --- |
---|
[e364af7] | 84 | > binfile=djcrx204.zip |
---|
| 85 | > gcc=gcc-3.3.2 |
---|
| 86 | > binutils=binutils-2.14 |
---|
[e7839be] | 87 | 97c97 |
---|
| 88 | < patch -p1 <\$patches/\$binutilsdiff |
---|
| 89 | --- |
---|
| 90 | > #patch -p1 <\$patches/\$binutilsdiff |
---|
| 91 | END |
---|
| 92 | sh build-djgpp.sh |
---|
| 93 | </pre> |
---|
| 94 | |
---|
[e364af7] | 95 | If the build of GCC fails, you may need to apply this patch: |
---|
| 96 | |
---|
| 97 | <pre> |
---|
| 98 | --- gcc-3.3.2-orig/libiberty/getpwd.c 2001-10-07 22:53:31.000000000 +0100 |
---|
| 99 | +++ gcc-3.3.2/libiberty/getpwd.c 2004-01-12 02:00:41.000000000 +0000 |
---|
| 100 | @@ -50,2 +50,3 @@ |
---|
| 101 | |
---|
| 102 | +#undef MAXPATHLEN |
---|
| 103 | #ifdef MAXPATHLEN |
---|
| 104 | </pre> |
---|
| 105 | |
---|
| 106 | You may also need to configure and build GCC without support for C++ (the script |
---|
| 107 | downloaded configures all languages and builds C and C++). Sorry if that's |
---|
| 108 | a bit vague - email Olly if you can't work out what to do. |
---|
| 109 | |
---|
[c372fc9] | 110 | <P>Then you need to build and install the |
---|
| 111 | <A HREF="http://www.talula.demon.co.uk/allegro/">Allegro graphics library</A>: |
---|
[e7839be] | 112 | |
---|
| 113 | <P><A |
---|
[e364af7] | 114 | HREF="http://prdownloads.sourceforge.net/alleg/allegro-4.0.3.tar.gz" |
---|
| 115 | >http://prdownloads.sourceforge.net/alleg/allegro-4.0.3.tar.gz</A> |
---|
[61b4202] | 116 | |
---|
[857f8a6] | 117 | <P>And follow the instructions for building using a cross-compiler which |
---|
[e364af7] | 118 | you can in docs/build/djgpp.txt. In 4.0.3 these boil down to: |
---|
[e7839be] | 119 | |
---|
[b63c928d] | 120 | <pre> |
---|
[e364af7] | 121 | cd allegro-4.0.3 |
---|
[857f8a6] | 122 | ./fix.sh djgpp --quick |
---|
[b63c928d] | 123 | NATIVEPATH=$PATH |
---|
| 124 | export NATIVEPATH |
---|
[e364af7] | 125 | DJDIR=/usr/i386-pc-msdosdjgpp |
---|
[b63c928d] | 126 | export DJDIR |
---|
[e364af7] | 127 | PATH=$DJDIR/bin:$PATH |
---|
[b63c928d] | 128 | CROSSCOMPILE=1 |
---|
| 129 | export CROSSCOMPILE |
---|
[e364af7] | 130 | make msg lib |
---|
[b63c928d] | 131 | make install |
---|
| 132 | PATH=$NATIVEPATH |
---|
| 133 | </pre> |
---|
| 134 | |
---|
| 135 | <P>Building Survex under DOS in a native djgpp environment will require |
---|
| 136 | some tinkering. Best bet is either to install bash and use the current |
---|
[e7839be] | 137 | configure script, or perhaps simpler to modify miniam.pl to generate a |
---|
| 138 | suitable makefile. I'm happy to help if you want to try this, and |
---|
| 139 | I'll incorporate patches provided they're fairly clean. |
---|
| 140 | |
---|
[c372fc9] | 141 | <H3>Mingw (Microsoft Windows)</H3> |
---|
[e7839be] | 142 | |
---|
| 143 | <P>Currently I build this with a Linux hosted cross-compiler. I use |
---|
| 144 | the packaged cross-compiler in the debian testing/unstable distribution. |
---|
| 145 | You can probably install these on other distributions using alien to |
---|
| 146 | convert them to RPMs or similar. Alternatively, before that |
---|
| 147 | I used to use pre-built binaries for gcc 2.95.2 obtained from: |
---|
| 148 | |
---|
[61b4202] | 149 | <P><A HREF="http://www.libsdl.org/extras/win32/cross/" |
---|
| 150 | >http://www.libsdl.org/extras/win32/cross/</A> |
---|
[e7839be] | 151 | |
---|
| 152 | <P>Building on Windows in a native mingw environment will probably |
---|
| 153 | require tinkering. Best bet is probably to install bash and use the |
---|
| 154 | current configure script. I'm happy to help if you want to try this, |
---|
| 155 | and I'll incorporate patches provided they're fairly clean. |
---|
| 156 | |
---|
| 157 | <P>Building on Windows with MSVC/BorlandC/Watcom/... is likely to be more |
---|
| 158 | work, but could be a worthwhile project. I'd suggest patching the |
---|
| 159 | perl script miniam.pl to generate a suitable makefile. Again, send |
---|
| 160 | patches if you get this to work. |
---|
| 161 | |
---|
| 162 | <H3>MSDOS for 286 and earlier (BorlandC)</H3> |
---|
| 163 | |
---|
| 164 | <P>Wookey currently builds this with a rather elderly BorlandC++ 3.1. |
---|
| 165 | BorlandC++ 5.5 can be downloaded for free, but it appears to only compile to |
---|
| 166 | 32 bit code. You can also download TurboC version 2, which might do the job |
---|
[857f8a6] | 167 | (I've not tried). |
---|
[e7839be] | 168 | |
---|
| 169 | <P>You can build a suitable source archive for this version using |
---|
| 170 | `make alien_src_zip' on the source distribution on a Unix box (you need to |
---|
[857f8a6] | 171 | have run `./configure' first). Then unzip the src<version>.zip file |
---|
| 172 | produced on the MSDOS machine and run <code>make.bat</code>. |
---|
[e7839be] | 173 | |
---|
| 174 | <H3>RISC OS</H3> |
---|
| 175 | |
---|
| 176 | <P>We now build this with Acorn C V5. It will probably still build with |
---|
| 177 | Acorn C V4. You also need to get and install OSLib from: |
---|
| 178 | |
---|
| 179 | <P><A HREF="http://www.arcade.demon.co.uk/oslib/homepage.html" |
---|
| 180 | >http://www.arcade.demon.co.uk/oslib/homepage.html</A> |
---|
| 181 | |
---|
| 182 | <P>You can build a suitable source archive for compiling the RISC OS version by |
---|
| 183 | running `make alien_src_zip' on the source distribution on a Unix box (you |
---|
| 184 | need to have run `./configure' first). However for this you'll need a |
---|
| 185 | specially tweaked version of zip to create the zip file with the correct |
---|
| 186 | RISC OS file types. I can supply this on request. You need to put it in the |
---|
| 187 | top level of the source tree and call it `zip-magic'. |
---|
| 188 | |
---|
| 189 | <P>You'll probably need to use Acorn's Make Utility (`amu') to build - the GNU |
---|
| 190 | make 1.02 port doesn't seem up to the job. |
---|
| 191 | |
---|
| 192 | <P>To build, create a fresh directory (or empty one) and unpack the contents of |
---|
| 193 | srcN_NN.zip into it (using !SparkFS or similar). Then double-click on |
---|
| 194 | `!ObeyMe' in the unpacked directory to rename the source files into c and h |
---|
| 195 | subdirectories. Then double-click on `!MakeMe' to build survex. |
---|
| 196 | |
---|
| 197 | </BODY></HTML> |
---|