|
**Disclaimer** This tutorial makes no effort to teach you how to program the C language. 1.) There are too many good tutorials and books out there that already do it. 2.) It assumes you have a working knowledge of AmigaDOS, directory structures, CLI commands, etc. 3.) I make no guarantee that these sources will compile on your particular system, but see no reason why they wouldn't on a properly set up machine. The aim of this tutorial is to show you sources that compile under gcc using MUI as the API and actually do something (relatively) useful. If you're not already comfortable with C, this tutorial is not for you. However, if you understand the basics of C this tutorial should not present any problems for you. Finally, since in C there are many different ways to do things, these tutorials only represent my way of solving a problem, my style, etc. They may not represent the easiest or syntatically correct way to do things, but they work and create stable programs.
I've seen many posts to newgroups and mailing lists concerning the use of gcc and MUI. I personally have spent many frustrating hours trying to decipher what I need and what I don't, where to put what, etc. So, I've decided to create this Tutorial to hopefully get you up and running quickly!
NOTE: ftp.geekgadgets.org has been down for sometime now, so these links go to the mirror at ftp.back2roots.org
Create a directory called GG somewhere on your hardrive. Plan on using at least 100 megs to get a basic installation up and running. Next, inside of GG create a directory called junk. This is where we will download all of our files and extract them from in this tutorial. The first file you will need is BOOT.lha , so download this archive to junk. Now extract BOOT.lha into the GG directory. This will create two directories Sys and bin. This contains some basic utilities such as gzip, sh, tar and ixemul.library. You've begun to create your gcc tree!
Note: Inside the 'bin' directory are two utilities if you don't have a tar and a gzip utility. Personnally, I use the interface driven 'unarc' (OS 3.9) to 'un-Gzip' and to 'un-Tar'. This is much easier than typing in at the command line paths and switches, etc. I realize there are probably easier, better, etc. ways, but it's what I've become accustomed to using. Use whatever works for you.
OK! you should have something that looks like this:
YourDrive:GG/bin/gzip sh tar YourDrive:GG/Sys/Libs/ixemul.library YourDrive:GG/junk/BOOT.lha
Now download these files (or a newer equivalent if it exists) as a bare minimum depending on what you plan on developing to your junk directory. Your development environment will grow as you download other components when you need them. I've provided hyperlinks,but I recommend using a dedicated FTP program because it's typically faster and you can always ensure you've checked for the latest versions:
OK extract gcc-2.95.3-4-bin.tgz into your junk directory. This will extract to another archive called gcc-2.95.3-4-tar. Now extract the tar file into the junk directory. This will expand the following directories: bin, guide, include, info, lib, m68k-amigaos, man. Copy all these directories except bin over to your GG directory (since a bin directory already exists there). Instead, open up the bin directory in junk and "Select Contents" to drag the files into your GG/bin directory that was previously created when you extracted the BOOT.lha archive.
NOTE: Personally, I use Directory Opus, the GPL 4.x version. This makes it easy to ensure everything get's moved where it needs to and the tree structure is accurately maintained.
Your tree should now look something like this:
YourDrive:GG/bin/... YourDrive:GG/guide/... YourDrive:GG/include/... YourDrive:GG/info/... YourDrive:GG/junk/... YourDrive:GG/lib/... YourDrive:GG/m68k-amigaos/... YourDrive:GG/man/... YourDrive:GG/Sys/...
At this point delete all of the extracted directories from junk to eliminate any confusion. (You can delete gcc-2.95.3-4-bin.tgz and gcc-2.95.3-4-bin.tar at this point as well). Be careful not delete any of the files that you downloaded and have yet to extract!
Use the same basic procedure for the rest of the files you downloaded. (i.e., if the directory doesn't exist, you can move it over. If it exists, put the files (and/or directories) in the applicable directory in your tree), then delete them when your finished moving them.
Add these lines (edit path as appropriate) to your user-startup:
assign GG: YourDrive:GG assign LIBS: GG:Sys/Libs add path GG:bin add assign BIN: GG:bin stack 102400
Once you're finished with the geek gadgets files create a directory called os-include in the GG directory and copy all of the OS "include" directories (and files) from CD-ROM (or wherever you got them...)in there. The OS Includes (either from the Amiga Developer CD 2.1 or Geek Gadgets Version 2) or the 3.9 versions were freely available from Amiga.com. Not sure if they still are.
Note: When I installed my system I used the Geek Gadgets Ver 2 CD Rom because they're ready to go with gcc and the geek gadgets development environment. If you have the Amiga Dev ver 2.1 CD or download them you'll need to generate the protos.
You should basically have something that looks like this (you probably won't have all of these
directories, however):
You will also need this SDK: mui38dev.lha (from Aminet) or here:
Finally, un-lha the MUI Developer archive, go to the 'MUI/Developer/C/Include' directory and copy the corresponding file from the directory to the coresponding include directory in GG. (I.E. put the clib/muimaster_protos.h file into the 'include/clib' directory, etc, etc. Always maintaining the path structure.)
IMPORTANT:There's one caveat, use this version of proto/muimaster.h (or generate your own) instead of the one supplied with the MUI dev kit in 'C/include/proto'. That is, download this version I've provided and put it in your 'GG/include/proto' directory.
Now, reboot and I'll see you at Tutorial 2 where we're gonna test this thing...