Monday, April 25, 2005

Making your own Perl - Part1

I'm a Perl programmer. I've been working with the language for about five years now. The language is general purpose, but it has it's origins in sed, awk, and UNIX shell text processing. That is the purpose I use it for most of the time.

Anyway, My company was using(still is actually) an older version of Perl due to the fact that Activestate doesn't support the DBD::Oracle driver. I spent about four or five hours compiling a new Perl executable and Driver. I also added in a few other things. It was, for the most part, not too difficult, but I thought I'd share how I did it so that other's who are looking for solutions to the problems I encountered can solve them. Today I will cover the Perl executable.

To compile Perl, you need to do the following:
  1. Download a stable Perl from CPAN.
  2. Download the MinGW compiler from Here(You only need the MinGW install file. This is listed under Current/MinGW(and is currently MinGW-3.1.0-1.exe).
  3. Download dmake from CPAN. It's a special version of make(that is somewhat old) that seems to be the only one that works to compile Perl with MinGW.
  4. Uncompress/Install them(windows users will need a tool to decompress tar.gz files. WinZip handles it. IZarc, unfortunately, does not. I used the 7za.exe command line tool from 7-Zip).
  5. place the uncompressed Perl directory somewhere on the C drive so that the full path to that directory has NO spaces in it(so don't try to compile under "My Documents" for example). For my part, I created a folder called "Dev" directly on the C drive, then I dropped the stable Perl source in a folder called "src". So the Perl source was in "C:\Dev\src\perl-5.8.6".
  6. When MinGW installs, it should locate itself on the C Drive. From the dmake archive, lift the dmake.exe executable and the sub-folder "startup" and place them in "C:\MinGW\Bin".
  7. Add "C:\MinGW\Bin" to your PATH directory.
  8. Chdir to C:\Dev\src\perl-5.8.6.
  9. chdir to "win32".
  10. in the win32 directory, type dmake -f "makefile.mk". (That "-f" is really important. Without it, dmake will automatically try to use the "Makefile" file instead of "makefile.mk". The "Makefile" file is written for the Microsoft "nmake" utility and the VC++ compiler.)
  11. If you are running Windows NT, 2000, or XP, then you should be seeing some successful compilation going on, this will take a while. (If the compile stops with an error, usually followed by the words "dmake exited with a status of 1" or something like that. Then you'll have to start doing your research. I haven't had any problems with compilation at this stage. So if you do, it's time to google.)
  12. When the compilation finishes, assuming it didn't terminate with errors, it will be time to test. Type: dmake -f makefile.mk test.
  13. This will, again, take some time. Some of the tests will be skipped, but for me all tests not skipped passed. Once again, failure will require research on your part.
  14. Once you've reached all tests passed, it's time to install. Type: dmake -f makefile.mk install on the command line. install's are just files being copied, or documentation being made. Don't be surprised to see a lot of errors when the HTML files generate, usually the errors are not fatal, and the documentation will be created.
  15. Now it's time to code some Perl. That's pretty much it. The perl executable will be located at C:\Perl\Bin(You can change this in the Makefile if you want, but you can't put Perl in a path without spaces so this one does just as well as any). Now it's time to learn how to use it.
That's all there is to it. If you have problems it sometimes helps to read README.Win32 in the main directory. Tomorrow I will start with the Oracle module, if I have time.

0 Comments:

Post a Comment

<< Home