[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 | |
---|
| 62 | <P>I suggest using binutils-2.10 rather than binutils-2.9.1. The newer version |
---|
| 63 | includes the patch they supply, so the instructions boil down to this |
---|
| 64 | sequence of commands: |
---|
| 65 | |
---|
| 66 | <pre> |
---|
| 67 | bash |
---|
| 68 | mkdir ~/djcross |
---|
| 69 | cd ~/djcross |
---|
| 70 | wget ftp://ftp.objsw.com/pub/crossgcc/build-djgpp.sh |
---|
| 71 | mkdir tars |
---|
| 72 | cd tars |
---|
| 73 | # can't get it to build with djcrx203 |
---|
| 74 | wget ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/old/djcrx202.zip |
---|
| 75 | # can't get 2.95.3 to build |
---|
| 76 | wget http://sunsite.org.uk/gnu/gcc/gcc-2.95.2.tar.gz |
---|
| 77 | # can't get 2.10.1 to build |
---|
| 78 | wget http://sunsite.org.uk/gnu/binutils/binutils-2.10.tar.gz |
---|
| 79 | cd .. |
---|
| 80 | patch -l build-djgpp.sh <<END |
---|
| 81 | 26c26 |
---|
| 82 | < binutils=binutils-2.9.1 |
---|
| 83 | --- |
---|
| 84 | > binutils=binutils-2.10 |
---|
| 85 | 97c97 |
---|
| 86 | < patch -p1 <\$patches/\$binutilsdiff |
---|
| 87 | --- |
---|
| 88 | > #patch -p1 <\$patches/\$binutilsdiff |
---|
| 89 | END |
---|
| 90 | sh build-djgpp.sh |
---|
| 91 | </pre> |
---|
| 92 | |
---|
[c372fc9] | 93 | <P>Then you need to build and install the |
---|
| 94 | <A HREF="http://www.talula.demon.co.uk/allegro/">Allegro graphics library</A>: |
---|
[e7839be] | 95 | |
---|
| 96 | <P><A |
---|
[857f8a6] | 97 | HREF="http://prdownloads.sourceforge.net/alleg/allegro-4.0.1.tar.gz" |
---|
| 98 | >http://prdownloads.sourceforge.net/alleg/allegro-4.0.1.tar.gz</A> |
---|
[e7839be] | 99 | |
---|
[61b4202] | 100 | <P>Allegro 4.0.2 has been released, but the list of changes doesn't show |
---|
| 101 | anything relevant to the routines caverot uses, so I've not bothered to |
---|
| 102 | upgrade. |
---|
| 103 | |
---|
[857f8a6] | 104 | <P>And follow the instructions for building using a cross-compiler which |
---|
| 105 | you can find starting from readme.txt. In 4.0.1 these boil down to: |
---|
[e7839be] | 106 | |
---|
[b63c928d] | 107 | <pre> |
---|
[857f8a6] | 108 | cd allegro-4.0.1 |
---|
| 109 | ./fix.sh djgpp --quick |
---|
[b63c928d] | 110 | NATIVEPATH=$PATH |
---|
| 111 | export NATIVEPATH |
---|
| 112 | DJDIR=/opt/crosstools/i386-pc-msdosdjgpp |
---|
| 113 | export DJDIR |
---|
[857f8a6] | 114 | PATH=$DJDIR/bin:/opt/crosstools/bin:$PATH |
---|
[b63c928d] | 115 | CROSSCOMPILE=1 |
---|
| 116 | export CROSSCOMPILE |
---|
| 117 | make |
---|
| 118 | make install |
---|
| 119 | PATH=$NATIVEPATH |
---|
| 120 | </pre> |
---|
| 121 | |
---|
| 122 | <P>Building Survex under DOS in a native djgpp environment will require |
---|
| 123 | some tinkering. Best bet is either to install bash and use the current |
---|
[e7839be] | 124 | configure script, or perhaps simpler to modify miniam.pl to generate a |
---|
| 125 | suitable makefile. I'm happy to help if you want to try this, and |
---|
| 126 | I'll incorporate patches provided they're fairly clean. |
---|
| 127 | |
---|
[c372fc9] | 128 | <H3>Mingw (Microsoft Windows)</H3> |
---|
[e7839be] | 129 | |
---|
| 130 | <P>Currently I build this with a Linux hosted cross-compiler. I use |
---|
| 131 | the packaged cross-compiler in the debian testing/unstable distribution. |
---|
| 132 | You can probably install these on other distributions using alien to |
---|
| 133 | convert them to RPMs or similar. Alternatively, before that |
---|
| 134 | I used to use pre-built binaries for gcc 2.95.2 obtained from: |
---|
| 135 | |
---|
[61b4202] | 136 | <P><A HREF="http://www.libsdl.org/extras/win32/cross/" |
---|
| 137 | >http://www.libsdl.org/extras/win32/cross/</A> |
---|
[e7839be] | 138 | |
---|
[ec803c0] | 139 | <!-- |
---|
| 140 | for opengl, we need glut too: |
---|
| 141 | http://www.xmission.com/~nate/glut.html |
---|
| 142 | download glut-X.XX-bin.zip and unzip into the compiler directories: |
---|
| 143 | unzip glut-3.7.6-bin.zip |
---|
| 144 | mv glut-3.7.6-bin/glut.h /usr/i586-mingw32msvc/include/GL |
---|
| 145 | mv glut-3.7.6-bin/glut32.lib /usr/i586-mingw32msvc/lib/libglut.a |
---|
| 146 | mv glut-3.7.6-bin/glut32.dll mingw_extras |
---|
| 147 | --> |
---|
[e7839be] | 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 | <P>Building on Windows with MSVC/BorlandC/Watcom/... is likely to be more |
---|
| 154 | work, but could be a worthwhile project. I'd suggest patching the |
---|
| 155 | perl script miniam.pl to generate a suitable makefile. Again, send |
---|
| 156 | patches if you get this to work. |
---|
| 157 | |
---|
| 158 | <H3>MSDOS for 286 and earlier (BorlandC)</H3> |
---|
| 159 | |
---|
| 160 | <P>Wookey currently builds this with a rather elderly BorlandC++ 3.1. |
---|
| 161 | BorlandC++ 5.5 can be downloaded for free, but it appears to only compile to |
---|
| 162 | 32 bit code. You can also download TurboC version 2, which might do the job |
---|
[857f8a6] | 163 | (I've not tried). |
---|
[e7839be] | 164 | |
---|
| 165 | <P>You can build a suitable source archive for this version using |
---|
| 166 | `make alien_src_zip' on the source distribution on a Unix box (you need to |
---|
[857f8a6] | 167 | have run `./configure' first). Then unzip the src<version>.zip file |
---|
| 168 | produced on the MSDOS machine and run <code>make.bat</code>. |
---|
[e7839be] | 169 | |
---|
| 170 | <H3>RISC OS</H3> |
---|
| 171 | |
---|
| 172 | <P>We now build this with Acorn C V5. It will probably still build with |
---|
| 173 | Acorn C V4. You also need to get and install OSLib from: |
---|
| 174 | |
---|
| 175 | <P><A HREF="http://www.arcade.demon.co.uk/oslib/homepage.html" |
---|
| 176 | >http://www.arcade.demon.co.uk/oslib/homepage.html</A> |
---|
| 177 | |
---|
| 178 | <P>You can build a suitable source archive for compiling the RISC OS version by |
---|
| 179 | running `make alien_src_zip' on the source distribution on a Unix box (you |
---|
| 180 | need to have run `./configure' first). However for this you'll need a |
---|
| 181 | specially tweaked version of zip to create the zip file with the correct |
---|
| 182 | RISC OS file types. I can supply this on request. You need to put it in the |
---|
| 183 | top level of the source tree and call it `zip-magic'. |
---|
| 184 | |
---|
| 185 | <P>You'll probably need to use Acorn's Make Utility (`amu') to build - the GNU |
---|
| 186 | make 1.02 port doesn't seem up to the job. |
---|
| 187 | |
---|
| 188 | <P>To build, create a fresh directory (or empty one) and unpack the contents of |
---|
| 189 | srcN_NN.zip into it (using !SparkFS or similar). Then double-click on |
---|
| 190 | `!ObeyMe' in the unpacked directory to rename the source files into c and h |
---|
| 191 | subdirectories. Then double-click on `!MakeMe' to build survex. |
---|
| 192 | |
---|
| 193 | </BODY></HTML> |
---|