Menu

Compiling Hale

Grokmoo

Compiling under GNU/Linux (Debian, Ubuntu, or similar)

You need to first set up your system to be able to use subversion and build java programs.

$sudo apt-get install build-essential checkinstall subversion openjdk-6-jdk

Next, it is a good idea to have some dedicated space for it where you build directories. While you could use any directory, it is recommended you put it somewhere where it won't be deleted by accident. For that purpose you can use /usr/local/src

$sudo mkdir /usr/local/src

Note: In Debian, sudo is not part of the admin group, first make sudo part of the admin group.

Then make sure that you as a user has permissions to do everything in it.

$sudo chown $USER /usr/local/src

The $User here represents the user, so for e.g. if your username is shirish then it should look like this:

$sudo chown $shirish /usr/local/src

Now let's go to that directory first.

$sudo cd /usr/local/src

Checking out the trunk for the first time

Now you should be in the directory, let's check out the current branch (0.6) for the first time.

/usr/local/src$ svn checkout https://hale.svn.sourceforge.net/svnroot/hale/branches/0.6 hale

Or more simply:

/usr/local/src$ svn co https://hale.svn.sourceforge.net/svnroot/hale/branches/0.6 hale

What this does is make a directory called hale in your directory. You should see the progress on the command-line/stdout. Something similar to this:

A    hale/core/baseWeapons.json
A    hale/core/racialTypes.json
A    hale/core/factions.json
A    hale/core/itemQualities.json

etc, it will go on until outputting:

Checked out revision 659

The version number given here is not important as that will change overtime. It is important that you see a version number, as that indicates the command was successful.

The compilation process

Now you are ready to compile the game.

For users of GNU/Linux systems, the script "build.sh" can be used to automatically build the source. Then, you simply run "hale.sh" to run the game:

/usr/local/src/hale$sh build.sh
/usr/local/src/hale$sh hale.sh

Otherwise, you can follow these steps to compile the game manually.

First, create the "bin" directory to store the Java class files:

/usr/local/src/hale$mkdir bin

Next, verify that your "compilerargs.txt" file is set up correctly for your system:

-d bin
-sourcepath src
-classpath bin:lib/lwjgl.jar:lib/TWL.jar:lib/xpp3-1.1.4c.jar:lib/json-smart-1.0.9.jar

src/net/sf/hale/Game.java

The above is for GNU/Linux. On Windows systems, you will need to replace all instances of ":" above with ";".

Now, compile the game using the script. This generates all the Java .class files.

/usr/local/src/hale$javac @compilerargs.txt

Change your directory to the bin directory:

/usr/local/src/hale$cd bin

Create the Java JAR file, which packages up all the individual .class files into one package for easy use.

/usr/local/src/hale/bin$jar cf hale.jar *

Move the JAR file up into the top level hale directory so the "hale.sh" script can find it.

/usr/local/src/hale/bin$cp hale.jar ../

Change to the top level directory.

/usr/local/src/hale/bin$ cd ../

Finally, use the hale.sh script to run the game.

/usr/local/src/hale$sh hale.sh

Note that as a developer, you may want to use the .class files directly instead of the .jar file. To do that, you can modify the -classpath part of the hale.sh file. Remove "hale.jar" from the classpath and replace it with "bin/":

Doing updates using Subversion

For updating it next time go to the hale directory and do an "svn update".

/usr/local/src/hale $svn update

OR

/usr/local/src/hale $svn up

If there is an update available, it should then be downloaded and applied. If it does download something, at the end it will give an svn number. Something like:

Updated to revision 659

If needed you can use it svn to find out some information about the latest update, e.g.

/usr/local/src/hale$svn info
                  Path: .
                  URL: https://hale.svn.sourceforge.net/svnroot/hale
                  Repository Root: https://hale.svn.sourceforge.net/svnroot/hale
                  Repository UUID: 79138c0d-6c29-4585-9bb0-dfb8b7d9c970
                  Revision: 659
                  Node Kind: directory
                  Schedule: normal
                  Last Changed Author: grokmoo
                  Last Changed Rev: 659
                  Last Changed Date: 2011-11-10 19:42:48 +0530 (Thu, 10 Nov 2011)

Usually developers put up a note or two about the changes they made, you can see them by doing svn log.

/usr/local/src/hale$svn log

One can also have a log downloaded each time and written to a text file each time its upated.

/usr/local/src/hale$svn log > svnlog.txt

The log shows the note/changelog made by the developer which is usually fixing things or enhancing feature requests. For instance these are the last few svn checkins by the dev:

/usr/local/src/hale$svn log
------------------------------------------------------------------------
r659 | grokmoo | 2011-11-10 19:42:48 +0530 (Thu, 10 Nov 2011) | 1 line
fixed (i think) issue with exception in portrait viewer
------------------------------------------------------------------------
r658 | grokmoo | 2011-11-10 08:26:55 +0530 (Thu, 10 Nov 2011) | 1 line
added default items, creatures, item lists, and recipes for creation of new campaigns
------------------------------------------------------------------------

Using Eclipse

Hale can be easily imported into Eclipse.

  • From the file menu, select New->Java Project.
  • Enter the location of the Hale source into the "Project Location", or checkout hale into your workspace and enter "hale" as the name.
  • You can click finish and Eclipse should automatically find all the libraries.
  • Now, select the project in the package explorer, then go to Project->Properties in the menu.
  • Select "Java Build Path", and then the "Libraries" tab.
  • Make sure the following libraries are listed:
    json-smart-1.0.9.jar
    lwjgl.jar
    TWL.jar
    xpp3-1.1.4c.jar
  • You need to specify a native library for LWJGL in order for it to work. Expand the lwjgl.jar entry, and edit the "Native library location" entry.
  • Use the file selector to specify the lib/native/linux directory within the top level "hale" directory. On Windows, use lib/native/windows
  • You should now be able to cleanly build hale with no errors or warnings.

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.