| 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 | |
|---|
| 43 | <P>You'll need automake 1.5 or later (earlier versions don't support |
|---|
| 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, 2.53 and 2.64 have all |
|---|
| 47 | been used successfully). |
|---|
| 48 | |
|---|
| 49 | <P>For building the documentation you'll need sgmltools 2 or later, |
|---|
| 50 | jadetex, docbook-to-man, and w3m. |
|---|
| 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 | |
|---|
| 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: |
|---|
| 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 |
|---|
| 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 |
|---|
| 77 | cd .. |
|---|
| 78 | patch -l build-djgpp.sh <<END |
|---|
| 79 | 24,26c24,26 |
|---|
| 80 | < binfile=djcrx202.zip |
|---|
| 81 | < gcc=gcc-2.95.2 |
|---|
| 82 | < binutils=binutils-2.9.1 |
|---|
| 83 | --- |
|---|
| 84 | > binfile=djcrx204.zip |
|---|
| 85 | > gcc=gcc-3.3.2 |
|---|
| 86 | > binutils=binutils-2.14 |
|---|
| 87 | 97c97 |
|---|
| 88 | < patch -p1 <\$patches/\$binutilsdiff |
|---|
| 89 | --- |
|---|
| 90 | > #patch -p1 <\$patches/\$binutilsdiff |
|---|
| 91 | END |
|---|
| 92 | sh build-djgpp.sh |
|---|
| 93 | </pre> |
|---|
| 94 | |
|---|
| 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 | |
|---|
| 110 | <P>Then you need to build and install the |
|---|
| 111 | <A HREF="http://www.talula.demon.co.uk/allegro/">Allegro graphics library</A>: |
|---|
| 112 | |
|---|
| 113 | <P><A |
|---|
| 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> |
|---|
| 116 | |
|---|
| 117 | <P>And follow the instructions for building using a cross-compiler which |
|---|
| 118 | you can in docs/build/djgpp.txt. In 4.0.3 these boil down to: |
|---|
| 119 | |
|---|
| 120 | <pre> |
|---|
| 121 | cd allegro-4.0.3 |
|---|
| 122 | ./fix.sh djgpp --quick |
|---|
| 123 | NATIVEPATH=$PATH |
|---|
| 124 | export NATIVEPATH |
|---|
| 125 | DJDIR=/usr/i386-pc-msdosdjgpp |
|---|
| 126 | export DJDIR |
|---|
| 127 | PATH=$DJDIR/bin:$PATH |
|---|
| 128 | CROSSCOMPILE=1 |
|---|
| 129 | export CROSSCOMPILE |
|---|
| 130 | make msg lib |
|---|
| 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 |
|---|
| 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 | |
|---|
| 141 | <H3>Mingw (Microsoft Windows)</H3> |
|---|
| 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. |
|---|
| 147 | |
|---|
| 148 | <P>Building on Windows in a native mingw environment will probably |
|---|
| 149 | require tinkering. Best bet is probably to install bash and use the |
|---|
| 150 | current configure script. I'm happy to help if you want to try this, |
|---|
| 151 | and I'll incorporate patches provided they're fairly clean. |
|---|
| 152 | |
|---|
| 153 | <H3>MSDOS for 286 and earlier (BorlandC)</H3> |
|---|
| 154 | |
|---|
| 155 | <P>Wookey currently builds this with a rather elderly BorlandC++ 3.1. |
|---|
| 156 | BorlandC++ 5.5 can be downloaded for free, but it appears to only compile to |
|---|
| 157 | 32 bit code. You can also download TurboC version 2, which might do the job |
|---|
| 158 | (I've not tried). |
|---|
| 159 | |
|---|
| 160 | <P>You can build a suitable source archive for this version using |
|---|
| 161 | `make alien_src_zip' on the source distribution on a Unix box (you need to |
|---|
| 162 | have run `./configure' first). Then unzip the src<version>.zip file |
|---|
| 163 | produced on the MSDOS machine and run <code>make.bat</code>. |
|---|
| 164 | |
|---|
| 165 | <H3>RISC OS</H3> |
|---|
| 166 | |
|---|
| 167 | <P>We now build this with Acorn C V5. It will probably still build with |
|---|
| 168 | Acorn C V4. You also need to get and install OSLib from: |
|---|
| 169 | |
|---|
| 170 | <P><A HREF="http://www.arcade.demon.co.uk/oslib/homepage.html" |
|---|
| 171 | >http://www.arcade.demon.co.uk/oslib/homepage.html</A> |
|---|
| 172 | |
|---|
| 173 | <P>You can build a suitable source archive for compiling the RISC OS version by |
|---|
| 174 | running `make alien_src_zip' on the source distribution on a Unix box (you |
|---|
| 175 | need to have run `./configure' first). However for this you'll need a |
|---|
| 176 | specially tweaked version of zip to create the zip file with the correct |
|---|
| 177 | RISC OS file types. I can supply this on request. You need to put it in the |
|---|
| 178 | top level of the source tree and call it `zip-magic'. |
|---|
| 179 | |
|---|
| 180 | <P>You'll probably need to use Acorn's Make Utility (`amu') to build - the GNU |
|---|
| 181 | make 1.02 port doesn't seem up to the job. |
|---|
| 182 | |
|---|
| 183 | <P>To build, create a fresh directory (or empty one) and unpack the contents of |
|---|
| 184 | srcN_NN.zip into it (using !SparkFS or similar). Then double-click on |
|---|
| 185 | `!ObeyMe' in the unpacked directory to rename the source files into c and h |
|---|
| 186 | subdirectories. Then double-click on `!MakeMe' to build survex. |
|---|
| 187 | |
|---|
| 188 | </BODY></HTML> |
|---|