Hammer Script
Script for automating the process of installing dependencies and compiling Worldforge projects in a self contained environment. This is useful for building and installing worldforge for development and testing purposes.
Please read the whole process over carefully before undertaking as some sections include notes following which might be relevant to you.
Contents |
Install Packages
You also need to install a couple of development packages. Under Debian or Ubuntu this could be done with following command.
sudo apt-get -y install g++ make autoconf automake libtool dpkg-dev cvs git-core libdevil-dev liblua5.1-0-dev libtolua++5.1-dev libzzip-dev \
libbz2-dev libxaw7-dev libxxf86vm-dev libopenal-dev libalut-dev libsigc++-2.0-dev libcurl4-openssl-dev \
libjpeg62-dev libpng12-dev libtiff4-dev libsdl1.2-dev nvidia-cg-toolkit libpcre3-dev libxrandr-dev libmng-dev \
libgcrypt-dev libboost-all-dev cmake-core libfreeimage-dev libxcursor-dev libfreetype6-dev swig
Notes for Ubuntu/Debian-squeeze+: You will likely need to change "cmake-core" to "cmake" in the previous command.
Note for Ubuntu 12.04: You will need to change libjpeg62-dev to libjpeg-dev as the 62 version will remove needed packages.
Note for Madriva 64 bit: You will need to substitute lib64freeimage-dev for libfreeimage-dev
Also nvidia-cg-toolkit might fail to install. If it does go to here and download it. Then just merge into your /usr directory.
If you plan on building Cyphesis, you must also install the PostgreSQL dev package plus a few others:
apt-get -y install postgresql postgresql-server-dev-8.4 libcppunit-dev docbook-utils
Do note that there are also a couple of OGRE and CEGUI packages available, such as this and this. If you want to use this script (or build ogre from source) make sure what you have no ubuntu libogre package installed due to linker error arising.
For Fedora/RHEL/Centos
yum groupinstall "Development Tools" yum install libXaw-devel libsigc++20-devel swig cppunit-devel alsa-lib-devel SDL-devel openal-soft-devel \ freealut-devel freeimage-devel pcre-devel lua-devel bzip2-devel zziplib-devel freetype-devel boost-devel \ python-devel cmake curl-devel libcrypt-devel tolua++-devel bullet-devel postgresql-devel readline-devel \ docbook-utils
To install nvidia Cg, first configure rpmfusion repos (http://rpmfusion.org/Configuration) then
yum install Cg
Download and Install
Pull the Hammer script from the Git repository into the folder you want to use for Worldforge (example: /home/<yourname>/worldforge).
git clone git://github.com/worldforge/hammer.git cd hammer
If you already have an older version of Hammer installed you probably need to make sure that it's getting the source from Github, since we've moved all of our repositories there instead of hosting them ourself. Do this with this command, when standing inside the "hammer" directory:
git remote set-url origin git://github.com/worldforge/hammer.git
In order to keep your version of the hammer client updated you should also issue this command while standing inside the "hammer" directory.
git pull
Setting Up Build Environment
Installing dependencies
To install all needed dependencies (Ogre3D / CEGUI) into our build environment execute this command:
./hammer.sh install-deps all
Getting the source
Next we will download all the sources for the Worldforge projects and all needed libraries. Execute this command to begin:
./hammer.sh checkout all
Build
Now we are ready to build! Just execute this command to build all projects:
./hammer.sh build all
To build a specific project, type the following instead:
./hammer.sh build <project>
You may also supply your own Make options like this:
./hammer.sh build all "-j3"
Running
You will find the binaries in the local/bin folder. Example: to run Ember just type this:
./work/local/bin/ember
If you get an error such as "error while loading shared libraries: some_lib_name.so.x: cannot open shared object file: No such file or directory", then your LD_LIBRARY_PATH environment variable has not been set up correctly. Do the following to add the ./local/lib path to the linker search path:
export LD_LIBRARY_PATH="/path/to/the/hammer/folder/work/local/lib:$LD_LIBRARY_PATH"
Clean
To delete build files for a project/library to perform a clean build execute:
./hammer.sh clean <target>
Example: clean the ember client:
./hammer.sh clean clients/ember
Note that all build artifacts are placed in the "work" directory. This includes both the code and the compiled files.
Logging
Hammer redirects output from make and configure to log files. After executing hammer you will find these inside the work/logs folder. Each project gets its own folder that contains the log files.
Help
This script has built-in help texts that can help you out. To access them type:
./hammer.sh help
Script fixes or improvements
This script is hosted here in the Worldforge Github repository. To contribute fixes just fork the project, create commits and issue a pull request through GitHub.
Troubleshooting
For a list of Commonly encountered errors and how to fix them please visit the Troubleshooting page.