[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 |
---|
[c746b4d] | 44 | per-executable CFLAGS) and autoconf 2.50 or later (for AC_ARG_VAR). |
---|
[d7bb9a7] | 45 | There seem to be problems with trying to use autoconf 2.53 - autoconf 2.52 |
---|
| 46 | works though. It's possible automake 1.6 may be problematic - we've not |
---|
| 47 | tried it, but there are reports of it requiring tweaks to existing packages. |
---|
[c746b4d] | 48 | For building the documentation you'll need sgmltools 2 or later, |
---|
| 49 | docbook-to-man, and w3m. |
---|
[e7839be] | 50 | |
---|
| 51 | <H2>Building on Non-Unix Platforms</H2> |
---|
| 52 | |
---|
| 53 | <H3>DJGPP (MSDOS for 386 or better)</H3> |
---|
| 54 | |
---|
| 55 | <P>Currently I build this with a Linux hosted cross-compiler. I built |
---|
| 56 | this myself mostly following instructions from: |
---|
| 57 | |
---|
| 58 | <P><A |
---|
| 59 | HREF="http://www.objsw.com/CrossGCC/">http://www.objsw.com/CrossGCC/</A> |
---|
| 60 | |
---|
| 61 | <P>I suggest using binutils-2.10 rather than binutils-2.9.1. The newer version |
---|
| 62 | includes the patch they supply, so the instructions boil down to this |
---|
| 63 | sequence of commands: |
---|
| 64 | |
---|
| 65 | <pre> |
---|
| 66 | bash |
---|
| 67 | mkdir ~/djcross |
---|
| 68 | cd ~/djcross |
---|
| 69 | wget ftp://ftp.objsw.com/pub/crossgcc/build-djgpp.sh |
---|
| 70 | mkdir tars |
---|
| 71 | cd tars |
---|
| 72 | # can't get it to build with djcrx203 |
---|
| 73 | wget ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/old/djcrx202.zip |
---|
| 74 | # can't get 2.95.3 to build |
---|
| 75 | wget http://sunsite.org.uk/gnu/gcc/gcc-2.95.2.tar.gz |
---|
| 76 | # can't get 2.10.1 to build |
---|
| 77 | wget http://sunsite.org.uk/gnu/binutils/binutils-2.10.tar.gz |
---|
| 78 | cd .. |
---|
| 79 | patch -l build-djgpp.sh <<END |
---|
| 80 | 26c26 |
---|
| 81 | < binutils=binutils-2.9.1 |
---|
| 82 | --- |
---|
| 83 | > binutils=binutils-2.10 |
---|
| 84 | 97c97 |
---|
| 85 | < patch -p1 <\$patches/\$binutilsdiff |
---|
| 86 | --- |
---|
| 87 | > #patch -p1 <\$patches/\$binutilsdiff |
---|
| 88 | END |
---|
| 89 | sh build-djgpp.sh |
---|
| 90 | </pre> |
---|
| 91 | |
---|
| 92 | <P>Then you need to build and install the allegro graphics library: |
---|
| 93 | |
---|
| 94 | <P><A |
---|
[857f8a6] | 95 | HREF="http://prdownloads.sourceforge.net/alleg/allegro-4.0.1.tar.gz" |
---|
| 96 | >http://prdownloads.sourceforge.net/alleg/allegro-4.0.1.tar.gz</A> |
---|
[e7839be] | 97 | |
---|
[857f8a6] | 98 | <P>And follow the instructions for building using a cross-compiler which |
---|
| 99 | you can find starting from readme.txt. In 4.0.1 these boil down to: |
---|
[e7839be] | 100 | |
---|
[b63c928d] | 101 | <pre> |
---|
[857f8a6] | 102 | cd allegro-4.0.1 |
---|
| 103 | ./fix.sh djgpp --quick |
---|
[b63c928d] | 104 | NATIVEPATH=$PATH |
---|
| 105 | export NATIVEPATH |
---|
| 106 | DJDIR=/opt/crosstools/i386-pc-msdosdjgpp |
---|
| 107 | export DJDIR |
---|
[857f8a6] | 108 | PATH=$DJDIR/bin:/opt/crosstools/bin:$PATH |
---|
[b63c928d] | 109 | CROSSCOMPILE=1 |
---|
| 110 | export CROSSCOMPILE |
---|
| 111 | make |
---|
| 112 | make install |
---|
| 113 | PATH=$NATIVEPATH |
---|
| 114 | </pre> |
---|
| 115 | |
---|
| 116 | <P>Building Survex under DOS in a native djgpp environment will require |
---|
| 117 | some tinkering. Best bet is either to install bash and use the current |
---|
[e7839be] | 118 | configure script, or perhaps simpler to modify miniam.pl to generate a |
---|
| 119 | suitable makefile. I'm happy to help if you want to try this, and |
---|
| 120 | I'll incorporate patches provided they're fairly clean. |
---|
| 121 | |
---|
| 122 | <H3>Mingw (MS Windows)</H3> |
---|
| 123 | |
---|
| 124 | <P>Currently I build this with a Linux hosted cross-compiler. I use |
---|
| 125 | the packaged cross-compiler in the debian testing/unstable distribution. |
---|
| 126 | You can probably install these on other distributions using alien to |
---|
| 127 | convert them to RPMs or similar. Alternatively, before that |
---|
| 128 | I used to use pre-built binaries for gcc 2.95.2 obtained from: |
---|
| 129 | |
---|
| 130 | <P><A HREF="http://www.devolution.com/~slouken/SDL/Xmingw32/" |
---|
| 131 | >http://www.devolution.com/~slouken/SDL/Xmingw32/</A> |
---|
| 132 | |
---|
| 133 | <P>Building on Windows in a native mingw environment will probably |
---|
| 134 | require tinkering. Best bet is probably to install bash and use the |
---|
| 135 | current configure script. I'm happy to help if you want to try this, |
---|
| 136 | and I'll incorporate patches provided they're fairly clean. |
---|
| 137 | |
---|
| 138 | <P>Building on Windows with MSVC/BorlandC/Watcom/... is likely to be more |
---|
| 139 | work, but could be a worthwhile project. I'd suggest patching the |
---|
| 140 | perl script miniam.pl to generate a suitable makefile. Again, send |
---|
| 141 | patches if you get this to work. |
---|
| 142 | |
---|
| 143 | <H3>MSDOS for 286 and earlier (BorlandC)</H3> |
---|
| 144 | |
---|
| 145 | <P>Wookey currently builds this with a rather elderly BorlandC++ 3.1. |
---|
| 146 | BorlandC++ 5.5 can be downloaded for free, but it appears to only compile to |
---|
| 147 | 32 bit code. You can also download TurboC version 2, which might do the job |
---|
[857f8a6] | 148 | (I've not tried). |
---|
[e7839be] | 149 | |
---|
| 150 | <P>You can build a suitable source archive for this version using |
---|
| 151 | `make alien_src_zip' on the source distribution on a Unix box (you need to |
---|
[857f8a6] | 152 | have run `./configure' first). Then unzip the src<version>.zip file |
---|
| 153 | produced on the MSDOS machine and run <code>make.bat</code>. |
---|
[e7839be] | 154 | |
---|
| 155 | <H3>RISC OS</H3> |
---|
| 156 | |
---|
| 157 | <P>We now build this with Acorn C V5. It will probably still build with |
---|
| 158 | Acorn C V4. You also need to get and install OSLib from: |
---|
| 159 | |
---|
| 160 | <P><A HREF="http://www.arcade.demon.co.uk/oslib/homepage.html" |
---|
| 161 | >http://www.arcade.demon.co.uk/oslib/homepage.html</A> |
---|
| 162 | |
---|
| 163 | <P>You can build a suitable source archive for compiling the RISC OS version by |
---|
| 164 | running `make alien_src_zip' on the source distribution on a Unix box (you |
---|
| 165 | need to have run `./configure' first). However for this you'll need a |
---|
| 166 | specially tweaked version of zip to create the zip file with the correct |
---|
| 167 | RISC OS file types. I can supply this on request. You need to put it in the |
---|
| 168 | top level of the source tree and call it `zip-magic'. |
---|
| 169 | |
---|
| 170 | <P>You'll probably need to use Acorn's Make Utility (`amu') to build - the GNU |
---|
| 171 | make 1.02 port doesn't seem up to the job. |
---|
| 172 | |
---|
| 173 | <P>To build, create a fresh directory (or empty one) and unpack the contents of |
---|
| 174 | srcN_NN.zip into it (using !SparkFS or similar). Then double-click on |
---|
| 175 | `!ObeyMe' in the unpacked directory to rename the source files into c and h |
---|
| 176 | subdirectories. Then double-click on `!MakeMe' to build survex. |
---|
| 177 | |
---|
| 178 | |
---|
| 179 | <H2>SURVEXHOME environmental variable</H2> |
---|
| 180 | |
---|
| 181 | <P>Survex needs various support files. Under UNIX the path to the |
---|
| 182 | support files needs to be built into the programs, but this causes a |
---|
| 183 | problem if the support files need to be installed elsewhere for some |
---|
| 184 | reason and the programs can't be rebuilt. To get around this problem, |
---|
| 185 | you can define an environmental variable SURVEXHOME to point to a |
---|
| 186 | directory in which to look for support files. |
---|
| 187 | |
---|
| 188 | <P>This mechanism may sometimes useful on other operating systems. |
---|
| 189 | |
---|
| 190 | <P>Under UNIX, use "setenv SURVEXHOME /home/user/survex" (csh) |
---|
| 191 | or "SURVEXHOME=/home/user/survex ; export SURVEXHOME" (sh). |
---|
| 192 | |
---|
| 193 | <P>For DOS, put SET SURVEXHOME=C:\SURVEX in your AUTOEXEC.BAT file |
---|
| 194 | |
---|
| 195 | <P>For RISC OS put *Set SURVEXHOME ADFS::4.$.Survex.!Survex into your |
---|
| 196 | Boot !Run or !DeskTop |
---|
| 197 | |
---|
| 198 | </BODY></HTML> |
---|