Imported Upstream version 2.17
[debian/cpmtools] / README.win32.cygwin.txt
1 README.win32.cygwin.txt
2 -----------------------
3
4 Building cpmtools-2.9 in Windows XP using:
5
6 - cpmtools http://www.moria.de/~michael/cpmtools/
7 - cygwin and the ncurses library - http://www.cygwin.com/
8
9 "The experts will always complain about shorter documents that do do not
10 provide enough details to confuse the rest of us, and longer documents that
11 do not omit enough details to confuse the rest of us. No documentation is
12 needed for people of that calibre."
13
14 - Bill Buckels, November 2008
15
16 This document is provided in the hope that it will be useful, but WITHOUT ANY
17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 A PARTICULAR PURPOSE. In particular, Bill Buckels has no warranty obligations
19 or liability resulting from its use in any way whatsoever. If you don't agree
20 then don't read it.
21
22 Introduction
23 ------------
24
25 This document is intended as a general guideline. An annotated summary is
26 provided directly below especially for expert users followed by annotated
27 details.
28
29 Please review the other documentation and source code that comes with
30 cpmtools for more information about cpmtools. Please review the cygwin
31 documentation for more information about cygwin.
32
33 At time of this writing, I have used the latest versions of the packages
34 listed above to build the latest version of cpmtools in its entirety. I have
35 documented the steps I followed below. 
36
37 Although there are probably other environments and compilers that can build
38 cpmtools for Windows I have not been successful in using the other several I
39 tried. Using a complete cygwin installation I had no problems and I had
40 cpmtools built in moments after I had cygwin installed and the cpmtools
41 source in place as documented below.
42
43 Intended Audience
44 -----------------
45
46 This document takes two tracks for installing cpmtools binary executables
47 after they have been built in cygwin:
48
49 1. End users who will run cpmtools from within the cygwin shell. This
50 includes unix users who do not want to use the native Windows command line.
51
52 2. End users who will run cpmtools from the native Windows command line. The
53 average Windows user does not have cygwin, and probably won't want to install
54 cygwin or learn a unix-like shell to use cpmtools.
55
56 The consideration here is where cpmtools looks for its CP/M disk format
57 definitions file (diskdefs) when not in a unix-like environment like cygwin
58 and this consideration will affect the way you build cpmtools since this path
59 is hardcoded into the binary executables.
60
61 My hope is that this document will help address the needs of both types of
62 Windows end users and those who wish to provide cpmtools to them.
63
64 Summary 
65 -------
66
67 - Install cygwin with ncurses.
68 - Download cpmtools-2.9.tar.tar to your cygwin home directory.
69 - Start cygwin from the shortcut on the Windows desktop.
70
71 - Enter the following commands:
72
73 tar -xvf cpmtools.tar.tar
74 cd cpmtools-2.9
75 ./configure --with-diskdefs=/usr/local/share/diskdefs
76 make
77 mkdir /usr/local/share
78 mkdir /usr/local/share/man
79 mkdir /usr/local/share/man/man1
80 mkdir /usr/local/share/man/man5
81 make install
82
83 Assumptions
84 -----------
85
86 The above builds cpmtools under cygwin for end users who will use cpmtools in
87 the cygwin shell and who will use the default installation.
88
89 I am assuming in this summary that all has gone well and that anyone who
90 deviates from what I have done or who has customized their cygwin
91 installation will be able to troubleshoot their own problems,
92
93 I therefore make the following related assumptions in this summary:
94
95 - That compiler related programs and libraries required to build cpmtools
96 under cygwin (including ncurses) are installed.
97
98 - That you wish to download into and work under your home directory. You may
99 also consider whether a better place to download is in /usr/local/src and
100 whether you should install in the binaries in /opt/cpmtools/ and things of
101 that nature.
102  
103 Default Format
104 --------------
105
106 You can change the default format to accomodate the special needs of your
107 users so they don't need to type their favorite format. The following line
108 can be entered to configure for an apple-do default format:
109
110 ./configure --with-defformat="apple-do" --with-diskdefs=/usr/local/share/diskdefs
111
112 Native Windows Installation
113 ---------------------------
114
115 If you wish to distribute your binaries to Windows end users who will not
116 have the cygwin shell and who will use the Windows command line, you have 2
117 options:
118
119 1. Require your users to always work in the same directory as diskdefs.
120
121 - or -
122
123 2. Hardcode the default diskdefs path into your binary executables and
124 require your users to always use the expected directory for diskdefs.
125
126 The following line shows how to configure for an apple-do default format and
127 to set the default diskdefs path in a mannner that is acceptable to Windows
128 to a relative path from the root of the current drive:
129
130 ./configure --with-defformat="apple-do" --with-diskdefs=/cpmtools/diskdefs
131
132 Cross-Cygwin Binary Installation
133 --------------------------------
134
135 You can still use the binaries built as above and installed using "make
136 install" in cygwin if you add the following line to /etc/fstab (assuming your
137 cygdrive is the Windows C:drive):
138
139 c:\cygwin\usr\local\share /cpmtools
140
141 Making a Zip Installation for Native Windows Users
142 --------------------------------------------------
143
144 If your target is the Windows user who does not have cygwin you can do the
145 following in cygwin in your build directory to create a zip file that will
146 contain the cpmtools binary executables:
147
148 - mkdir cpmtools
149 - cp *.exe cpmtools/.
150 - cp diskdefs cpmtools/.
151 - cp /bin/cygwin1.dll cpmtools/.
152 - cp /bin/cygncurses-8.dll cpmtools/.
153 - zip -R cpmtools/*.*
154
155 Making Documentation for Native Windows Users
156 ---------------------------------------------
157
158 If you wish to provide the cpmtools manual pages in html format you can use
159 man2html to generate your html in ugly format and redirect to a file and edit
160 by hand. Here's an example:
161
162 man2html -r cpm.5 > cpm.html
163
164 If you wish to avoid html and provide the cpmtools manual pages in text
165 format you can use troff to generate your text in ugly format and redirect to
166 a file and edit by hand. Here's an example:
167
168 troff -a cpm.5 > cpm.txt
169
170 This concludes the summary. 
171
172 Details, Alternatives, and Other Fluff
173 --------------------------------------
174
175 1.cygwin
176 --------
177
178 Cygwin gave me a complete and free environment to both configure and build
179 cpmtools in its entirety.
180
181 I installed cygwin from http://www.cygwin.com/ in its entirety which included
182 the ncurses library and when prompted to select a download site I chose 
183 ftp://mirrors.kernel.org/sourceware/cygwin/
184
185 The site you pick will depend on your own preference and how much of cygwin
186 you decide to install will be up to you. I have a good Internet connection
187 and a large hard disk so installing ALL of cygwin was no problem for me.
188 Those who don't may wish to attempt an incremental installation which I
189 personally found to be annoying and tedious.
190
191 It is not necessary to install ALL cygwin options. Another alternative is to
192 take the minimalistic approach and just install the compiler related
193 programs and libraries required to build cpmtools (including ncurses). If you
194 have missed something you will still be able to select additional components
195 via Cygwin Setup.
196
197 By default cygwin installs into c:\cygwin and puts a shortcut on the Windows
198 desktop. By default the cygwin shell starts in your cygwin home directory
199 under c:\cygwin\home\. I used the cygwin default paths for my installation of
200 cygwin.
201
202 2. cpmtoools
203 ------------
204
205 I then downloaded Download cpmtools-2.9 from 
206 http://www.moria.de/~michael/cpmtools/
207 and used WinRAR to extract cpmtools-2.9 to  
208 C:\cygwin\home\bbuckels\cpmtools-2.9\
209
210 I have noted in the summary that tar can be used. Use whatever you are
211 comfortable with to handle things from unix of a tarball nature.
212
213 3. Building 
214 -----------
215
216 3.1. I started cygwin by clicking on the cygwin shortcut on my desktop which
217 placed me into my cygwin home directory in the cygwin shell.
218
219 3.2  Now in the cygwin shell, I changed to the cpmtools directory by typing
220 the following and pressing the [Enter] key:
221
222 cd cpmtools-2.9
223
224
225 3.3 Running the configure script
226 --------------------------------
227
228 Before making cpmtools, the configure script must be run to create the
229 cpmtools makefile and the config.h header file required by cpmtools.
230
231 I ran the configure script with two options; to set the default format for
232 cpmtools to Apple II DOS 3.3 disk images and to tell cpmtools where to find
233 the diskdefs format definitions file (which is required to run cpmtools. See
234 far below.)
235
236 3.3.2 Building for use in the cygwin shell
237 ------------------------------------------
238
239 If I was building for use in the cygwin shell and I was using the default
240 paths used by "make install" noted far below, to be certain that my diskdefs
241 file would be found and to set my default format to "apple-do" I would type
242 the following and press the [Enter] key:
243
244 ./configure --with-defformat="apple-do" --with-diskdefs=/usr/local/share/diskdefs
245
246 3.3.1  Building for the Native Windows command line
247 ---------------------------------------------------
248
249 To set the default format to "apple-do" and to provide a relative path for
250 native Windows to my diskefs file which I would later copy to C:\cpmtools\ ,
251 I typed the following and pressed the [Enter] key:
252
253 ./configure --with-defformat="apple-do" --with-diskdefs=/cpmtools/diskdefs
254
255 Note: Windows paths are typed into the Windows native command line with
256 backslashes in the MS- DOS tradition. Historically the forward slash used by
257 unix as a path separator was used as a switch character in MS-DOS utilities
258 and this has carried forward with the commands that come with Windows. But in
259 a program, local Windows paths can be used with forward slashes instead and
260 they still work. Backslashes will cause problems for configure so use forward
261 slashes.
262
263 3.4. The configure script created my cpmtools makefile and config.h with the
264 options I chose. I then ran make by typing the following and pressing the
265 [Enter] Key.
266
267 make
268
269 This concludes the first part of the details section of this document and I
270 have covered the basic steps that I followed to build cpmtools. What you do
271 will likely be a close variation.
272
273 4. Installing
274 -------------
275
276 4.1 Some of this is also noted in the summary. Also keep in mind that if
277 cpmtools is used outside of cygwin access to the documentation which is in
278 the form of unix-style man pages will not be available unless reformatted to
279 a media type that Windows users are familiar with.
280
281 4.1.1 Installing for the cygwin shell
282 -----------------------------------
283
284 You can review the summary and the cpmtools INSTALL document for more
285 information on unix-like installations. Installation of cpmtools for use in
286 the cygwin shell follows those conventions.
287
288 If installing cpmtools to be used in cygwin using the cpmtools defaults and
289 assuming the directories below don't already exist, you will need to manually
290 create the following directories using the mkdir command as follows:
291
292 mkdir /usr/local/share
293 mkdir /usr/local/share/man
294 mkdir /usr/local/share/man/man1
295 mkdir /usr/local/share/man/man5
296
297 This is because the manual pages (man pages) will not be installed if you
298 don't. If you install the man pages, then when you need help on cpmtools in
299 cygwin, you can just enter "man cpmls" or "man cpmchmod", etc. 
300
301 After you make the directories above enter the following command:
302
303 make install
304
305 Assuming all has gone well, cpmtools is now part of your cygwin installation
306 and can be used wherever you work in cygwin. 
307
308 4.1.2 Installing for Use Outside Cygwin
309 ---------------------------------------
310
311 Please also read the summary.
312
313 The requirements of my installation were to create a directory structure for
314 a binary executable version of cpmtools targetted at Apple II disk image
315 users that would run at the native Windows cmd prompt. I offer the following
316 for general reference. The cygwin paths are based on my installation of
317 cygwin and are presented using conventional windows pathname notation.
318
319 4.1.2.1 Dll's
320 -------------
321
322 Two dll's from the c:\cygwin\bin\ directory were required:
323
324 cygwin1.dll
325 cygncurses-8.dll
326
327 Regardless of installation, for this cygwin and this ncurses version access
328 to these dll's will be required by this version of the cpmtools excecutables.
329
330 4.2 Manually Placing Files for Use Outside Cygwin
331 -------------------------------------------------
332
333 I did my installation by hand. 
334
335 My executables were created in c:\cygwin\home\bbuckels\cpmtools-2.9\ (my
336 cygwin home directory) which is also where the diskdefs file was.
337
338 I used Windows Explorer to manually do the following:
339
340 4.2.1 create c:\cpmtools\ directory.
341 4.2.2 copy all 8 exes into c:\cpmtools\
342 4.2.3 copy both dll's listed above into c:\cpmtools\
343 4.2.4 copy diskdefs into c:\cpmtools\
344
345 This gave me my directory structure and files for testing and distribution.
346
347 I also placed an Apple II CP/M disk image called EXMPLCPM.dsk in c:\cpmtools\
348 as a test target.
349
350
351 5. Additional Notes 
352 -------------------
353
354 5.1 diskdefs - CP/M disk format definitions
355 --------------------------------------------
356
357 The diskdefs file is a plain ascii text file that serves as a database of
358 disk and disk image format definitions. It can be reviewed for available CP/M
359 formats and their names. For Apple II CP/M 80 users the disk image formats
360 apple-do and apple-po are available.
361
362 The possible locations where cpmtools first looks for the diskdefs file:
363
364 - Can vary depending on the preferences of the person who builds the cpmtools
365 binaries (executables) from the source code.
366
367 - The location is also installation dependent and the diskdefs file may also
368 have been renamed (but we hope not).
369
370 If it's not found the current (work) directory is then searched for a file
371 called diskdefs.
372
373 On a unix-like system, a ${prefix}/share/ style path like /usr/local/share/
374 is a possible place that cpmtools could be made to first look for diskdefs.
375
376 In a Win32 system sometimes unix-like shells like cygwin are used to run
377 cpmtools instead of Windows cmd. For those installations unix-like
378 conventions probably should apply.
379
380 For cpmtools installations targetted at the average Windows user who does not
381 have a unix-like shell and uses the Windows cmd prompt to run cpmtools there
382 is no standard shared place that cpmtools can be made to first look for
383 diskdefs. Pathed File names like \cpm\diskdefs or even c:\cpmtools\diskdefs
384 are possible.
385
386 5.2 Difficulties in using the Windows File System
387 ---------------------------------------------------
388
389 This is not a troubleshooting guide. Unless you wish to find-out for yourself
390 as I did just how many problems you can face with all of this, or you are
391 really an expert, please do yourself a favour and try to stay within what I
392 am suggesting as standard or alternative ways of building cpmtools.
393
394 Missing libaries and compiler tools can be solved by trial and error and
395 reading the cygwin and cpmtools documentation.
396
397 There are however some things about path names and file names that you need
398 to be aware of, some of which I have mentioned throughout this document and
399 some which I deliberately did not mention yet, like avoiding absolute paths
400 and drive letters.
401
402 If you use a drive letter like C: when hardcoding a path to diskdefs you are
403 making several assumptions:
404
405 First off, you are assuming that your build of cpmtools will only be run from
406 within Windows cmd shell on the local drive C:, (not from a bash-like shell
407 like cygwin which doesn't support drive letters the same way Windows cmd and
408 Windows itself does), and that diskdefs will not be on another drive, and
409 that drive C: exists in the first place, and that diskdefs is not on a
410 Windows network either unless drive C:,X:,Y:,Z:,etc is a mapped network
411 drive. It is questionable whether cpmtools build process for diskdefs pathing
412 supports UNC pathing anyway. I couldn't get \\ to work since the first slash
413 disappears in the configure script and the second slash becomes an escape
414 sequence for the next letter. 
415
416 Relative pathing will work and if you want to use conventions like
417 /cpmtools-2.9/diskedefs this will work. Environments like ${USERPROFILE}
418 aren't a good idea even if I could have got them to work since they are not
419 portable for several reasons and I will say no more on this except I
420 recommend that any path that you decide to use for diskdefs will only be
421 almost portable between shells if off the root directory and contains forward
422 slashes and no drive letters or colons.
423
424 I hope what I have said proved less confusing to read than to write if you
425 have bothered to read it. If you are not confused yet read further.
426
427 - Since cpmtools has special meanings for A: and B: as command line targets
428 it probably isn't a good idea to use these drives especially.
429
430 - Some programmers and users have no difficulty in shifts between unix-like
431 and Windows pathing. Some will be familiar with how colons are used on
432 systems like Mac OSX. I think the only point to be made here is to consider
433 your target audience and all the things you can anticipate going wrong with
434 interoperability of all of this, (cpmtools being a set of command line
435 tools), and build cpmtools accordingly for the needs of you or your users,
436 then test what you have built with all this in mind.
437
438 5.3 Testing your build of cpmtools
439 ----------------------------------
440
441 To test what you have built I suggest you start with cpmls and cpmcp and an
442 apple disk image or equivalent.
443
444 John Elliot said "If you have appropriate rights, the CPMTOOLS should be able
445 to access the floppy drive by using "A:" or "B:" as the name of the disc
446 image.". I say don't bother mucking with your physical disk drive unless you
447 have a physical CP/M disk of a format supported by cpmtools safely in the
448 drive.
449
450 Get an apple CP/M disk image and use it for testing is what I suggest. The
451 following examples assume you have an Apple II DOS 3.3 order disk image
452 called EXMPLCPM.dsk for testing.
453
454 To list the files:
455
456 cpmls -f apple-do EXMPLCPM.dsk
457
458 The following example shows how to copy a file from an Apple II DOS 3.3 order
459 cpm disk image to the current directory:
460
461 cpmcp -f apple-do EXMPLCPM.dsk bhead.c 0:bhead.c
462
463 The following example shows how to copy a file to an Apple II DOS 3.3 order
464 cpm disk image from the current directory:
465
466 cpmcp -f apple-do EXMPLCPM.dsk 0:bhead.c bhead.c
467
468 To test the other utilities in cpmtools like cpmrm, cpmchattr, cpmchmod,
469 fsck.cpm and fsed.cpm, review the appropriate manpages for usage.
470
471 Those are simple tests as well using an apple-do format disk image. For
472 mkfs.cpm I will leave it to those more capable than I to decide what to do
473 there. Compared to them I am merely dangerous.
474
475 Acknowledgements and Stuff
476 --------------------------
477
478 Michael Haardt - for cpmtools in the first place and for his tireless and
479 ongoing efforts in supporting cpmtools in the second.
480
481 John Elliot - for bringing cpmtools to Windows.
482
483 My focus is on Windows XP (and other Windows) users and making this available
484 to them. At this point in time my focus is also on Apple II Z80 Softcard
485 users. Thankfully Michael Haardt has considered Apple II disk images in
486 cpmtools. My focus is also on the Aztec C Z80 MS-DOS cross-compiler which
487 creates Apple II CP/M programs in Windows XP.
488
489 Between Michael and John, with cpmtools I can now easily get these onto an
490 Apple disk image and transfer the disk image over to my real Apple II which
491 has a Z80 softcard clone using my Microdrive with a CF card and make a real
492 CP/M disk from the image with DISKMAKER.8 or DSK2FILE then run my Aztec C
493 CP/M programs using the real thing. I can also use the emulator that came
494 with Apple II Oasis to run the disk image.
495
496 Apparently nothing is missing from cpmtools for Windows XP that is available
497 on cpmtools for unix-like systems and I am thankful for that. Hopefully you
498 will be too.
499
500 I would also like to acknowledge the following individuals from the
501 comp.os.cpm and apple2.sys usenet newsgroups who gave their experience,
502 thoughts and encouragement during my adventure with all of this and in no
503 particular order:
504
505 David Schmidt - for cygwin feedback.
506 Udo Munk - for cygwin feedback. 
507 Peter Dassow - for cygwin feedback.
508 Stevo Tarkin - for msys feedback.
509 Volker Pohlers - for msys and pdcurses feedback.
510 Rolf Harmann - for linux feedback.
511 Richard Brady - who may or may not know watfor:) 
512
513 If I missed anyone, I thank them too. I am somewhat new to some of this and
514 needed all the help I received. cygwin is now my friend.
515
516 Bill Buckels
517 bbuckels@mts.net
518 November 2008