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