Author Topic: Victory over the FPC compiler!  (Read 1316 times)

Offline Burzmali

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Victory over the FPC compiler!
« on: July 18, 2009, 04:46:36 PM »
Finally!

I have managed to compile both GH1 and GH2 in both ASCII and SDL mode in 64-bit Ubuntu using the Free Pascal compiler!

All I had to do was:

1. Rewrite parts of JEDI-SDL's sdlutils.pas to be compliant with FPC.
2. Clean up a section of GH1's sdlgfx.pp to play nice with the latest version of JEDI-SDL (or whatever it was unhappy about)

If anyone wants a zip of the compiled version of any, let me know and I'll try to bundle it up.  Though I make no promises about it working on anything other than 64 bit Ubuntu with SDL installed.

Offline Burzmali

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Victory over the FPC compiler!
« Reply #1 on: July 21, 2009, 06:05:42 AM »
Now that I have a fairly strong grasp on exactly what it takes to compile GH1 & 2 in Linux, I figured I'd check out how to wrap it up in a package to add to the repositories for debian and ubuntu.

After reading through the guides, I am still at a loss for how to submit a program like GH.  I could probably package a C/C++ program with a little work, but a PASCAL program seems out of my league at this point, and my Google-fu hasn't turned up much help.

I can see that someone (Kari Pahula) had submitted GH1 to the repositories successfully at one point, but I don't know if he/she reads these forums so I don't know if they can help.

In the end, does anyone have any experience on this front or can I look forward to losing several more hours doing fierce battle with debhelper? ;)

Offline Snakebit STI

  • Full Member
  • ***
  • Posts: 136
    • View Profile
Victory over the FPC compiler!
« Reply #2 on: July 21, 2009, 06:24:40 AM »
Quoting: Burzmali
I figured I'd check out how to wrap it up in a package to add to the repositories for debian and ubuntu.

Yay! \(^^)/
Quoting: Burzmali
After reading through the guides, I am still at a loss for how to submit a program like GH.

Aw... (;_;)
Did you use a guide for the compiling? If so, can you link it? Maybe check the GH wiki too and see if the info on compiling is relevant.

Offline Burzmali

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Victory over the FPC compiler!
« Reply #3 on: July 21, 2009, 06:41:55 AM »
Compiling I can do.  I could make a tarball or zip not problem.  However, in order to submit a package, you need to submit source with very specific instructions on how to compile and a whole bunch more.

Offline Snakebit STI

  • Full Member
  • ***
  • Posts: 136
    • View Profile
Victory over the FPC compiler!
« Reply #4 on: July 21, 2009, 08:38:22 AM »
I meant, "can you give specific instructions to the rest of us, or is that unnecessary because you have a snazzy guide that you can link us to?"

Offline Burzmali

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Victory over the FPC compiler!
« Reply #5 on: July 21, 2009, 09:23:25 AM »
Ah, here's the basic steps, let me know if you need more detail on any:

1. Download source from Sourceforge (I typically use SVN to grab the latest and greatest)

2. Install the SDL packages libsdl-image1.2, libsdl-ttf2.0-0, libsdl1.2debian (might be able to use libsdl1.2debian-all instead, might need the -dev versions as well, I'm not quite sure)

3. Install FPC package fpc

4. Download JEDI-SDL from http://jedi-sdl.pascalgamedevelopment.com/ and extract to {JEDI-SDL source}

5. Using fpc, compile the ascii version of the game somewhere to make sure it works, if you are having problems with the ascii version, the sdl version will be a nightmare (the command is fpc gearhead -dASCII)

6. Edit the file sdlutils.pas (located at {JEDI-SDL source}/sdl/pas) to make it compliant with Free PASCAL.  This entails adjusting the file so all objects converted to pointers are 8 bytes instead of Turbo PASCAL's 4.  I have the file done already if you need a copy.

7. Copy the sdl.inc file from {JEDI-SDL source}/sdl/pas to {JEDI-SDL source}/sdl-image/pas and {JEDI-SDL source}/sdl-ttf/pas (This is how I did it, there is probably a better way.  Also, those paths are from memory, you should make sure you have yours right).

8.  Finally, you can now compile.  You have to include 3 JEDI-SDL folders listed above.  I can get the command line I used tonight, I don't have it handy.

8a.  If you want to compile GH1, you need to edit the sdlgfx.pp file to repair a call to TSDL_keyboardevent before compiling.

Offline Daemonward

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Victory over the FPC compiler!
« Reply #6 on: July 21, 2009, 10:36:56 AM »
Quoting: Burzmali
4. Download JEDI-SDL from http://jedi-sdl.pascalgamedevelopment.com/ and extract to {JEDI-SDL source}

So we should download JEDI-SDL v1.0 Final RC 2?

In my previous attempts at compiling GearHead I always downloaded the the latest CVS of JEDI-SDL v1.0 from the CVS repository like the GH Compiling Guide recommends. Though following its instructions I never could get the SDL version to compile. I think that article could use some updates.

Edit: It would be great if you could sent me a copy of your sdlutils.pas. I took a look at the file, but I'm not familiar enough with pascal to figure out what parts I would need to change.

Offline Burzmali

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Victory over the FPC compiler!
« Reply #7 on: July 21, 2009, 12:48:38 PM »
I really don't think it matters which version you use.  I used the Final RC 2 version, but the CVS isn't too different.  I can give you the file, but I don't great place to stash it at the moment.  Send me an email burzmali at yahoocom

Offline Burzmali

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Victory over the FPC compiler!
« Reply #8 on: July 22, 2009, 05:34:37 AM »
Btw, here are the compiling strings I used:

fpc -FE{Destination Dir} -Fu{JEDI-SDL source}/SDL/Pas -Fu/{JEDI-SDL source}/SDL_ttf/Pas -Fu{JEDI-SDL source}/SDL_Image/Pas trunk/arena -dSDLMODE

fpc -FE{Destination Dir} -Fu{JEDI-SDL source}/SDL/Pas -Fu{JEDI-SDL source}/SDL_ttf/Pas -Fu{JEDI-SDL source}/SDL_Image/Pas trunk/gearhead

Offline Daemonward

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Victory over the FPC compiler!
« Reply #9 on: July 22, 2009, 10:10:50 AM »
Quoting: Burzmali
I really don't think it matters which version you use. I used the Final RC 2 version, but the CVS isn't too different.


That's good to know. Downloading Final RC 2 version is much more convenient than getting the CVS. The compiling guide claims that using the public release makes things "way more complicated" but doesn't give any further explanation.

Offline Daemonward

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Victory over the FPC compiler!
« Reply #10 on: July 22, 2009, 12:26:40 PM »
Quoting: Burzmali
Send me an email burzmali at yahoocom


Thanks for sending me the file!

Yes! It compiles! It compiles! Thanks Burzmali!

Quoting: Burzmali
I can give you the file, but I don't great place to stash it at the moment.

You could put it up at the GearHead Yahoo! group. It isn't very active now that GearHead has it's own forums and wiki, but it does allow members to upload and download files.

Offline Burzmali

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Victory over the FPC compiler!
« Reply #11 on: July 22, 2009, 12:41:58 PM »
True, I am pretty sure the Mozilla License would allow it (http://www.mozilla.org/MPL/MPL-1.1.html)