Compiling - Linux
Instructions aimed at Debian/Ubuntu & Fedora/CentOS, but could easily be adjusted to fit other Linuxes, BSD's and Solaris.
1. Get required programs
Debian / Ubuntu
sudo apt-get install libgtk2.0-dev gettext git-core cmake gpsd gpsd-clients libgps-dev build-essential wx-common libwxgtk2.8-dev libglu1-mesa-dev libgtk2.0-dev wx2.8-headers libbz2-dev libtinyxml-dev libportaudio2 portaudio19-dev
Fedora / CentOS
yum install git cmake rpm-build gcc-c++ libstdc++-devel gtk2-devel wxGTK-devel mesa-libGLU-devel mesa-libGL-devel gettext bzip2-devel portaudio-devel
OpenSuSE
zypper install git cmake gcc-c++ libstdc++-devel gtk2-devel wxWidgets-wxcontainer-devel gettext-runtime gettext-tools libbz2-devel gpsd-devel portaudio-devel tinyxml-devel rpm-build
NOTE: For late betas and 3.2, libportaudio2 and portaudio19-dev (Ubuntu), may be called libportaudio and libportaudio-dev, or similar on other distros, must be installed, due to new sound code for linux. Warning, Google Earth removes portaudio19-dev, without even mentioning it. OpenCPN will compile, but sound will not work!
Cmake must be a version > 2.8, which means Ubuntu 10.4 or later (9.10 with backport repository enabled), or Fedora 13 or later.
Important Cmake Note: Due to a bug in Cmake, the "pixbuf-bug", it is recommended to upgrade to Cmake version >= 2.8.3.
Fedora 14 is updated, while on Ubuntu 10.10, it is necessary to enable the backport repository.Tick Synaptic->Settings->Repositories->Updates>Unsupported updates(maverick-backports).
Note that these packages will install a significant number of other dependencies as well...
Optional: Remove old installation
Only required if opencpn .deb / .rpm was installed previously
Debian / Ubuntu
sudo apt-get remove opencpn
Fedora / CentOS
yum remove opencpn
OpenSUSE
zypper remove opencpn
2. Download source code.
Run this to get your local copy of the source code:
git clone git://github.com/OpenCPN/OpenCPN.git
To update an existing local copy, issue the following commands:
cd opencpn git pull
3. Build it.
Important Notice, valid from beta 2.6.1718!
Developers note: libgps API changed significantly between libgps19 and ..20. We require the libgps20 API and include files to build OpenCPN, and a "version skew" warning will be produced if they are not found. The libgps interface will not function correctly if OpenCPN is built with libgps19 include files.
-------------------------
We'll build everything in a subdirectory to keep the codebase clean (easier to catch changes).
-------------------------
We'll build everything in a subdirectory to keep the codebase clean (easier to catch changes).
cd opencpn # unless already in this directory. mkdir build cd build cmake ../ make
Notes:
Default install in /usr/local, you can change this by providing cmake appropriate option:
cmake -DPREFIX=/usr ../
If you're not into debugging, change to this to generate a smaller and marginally faster binary:
cmake -DCFLAGS="-O2 -march=native" ../
cmake is only required if you build source code for the first time, then running make is enough, even if you updated the source code.
**Ubuntu 10.10 fails to build...
Change the path in this line in CMakeCache.txt: GTK2_GTK_INCLUDE_DIR:PATH=/usr/include/gtk-2.0
4. Install it or create a package
sudo make install
OR you could do this, to make your own .deb & .rpm packages (require cmake > 2.8.2):
In the build directory issue
sudo make package
5. IDEs for Linux to work on OpenCPN
You can use various IDEs to edit OpenCPN's code on Linux, to have an easy life, choose one of Code::Blocks, KDevelop and Eclipse CDT as cmake supports generating their project files. To do so, replace the cmake configuration step with one of the following, corresponding to the IDE of your choice. In all cases you will still be able to do the commandline build as described above.
cmake -G "CodeBlocks - Unix Makefiles" ../
cmake -G "KDevelop3 - Unix Makefiles" ../
cmake -G "Eclipse CDT4 - Unix Makefiles" ../To prototype the GUI parts of the application, have a look a wxFormBuilder.
6. Others
1. Script to make the Git/Cmake process easy.
---
#! /bin/sh
#Change this line to where you want the OpenCPN source on your computer.
cd /home/thomas/Testing/GitOpenCPN
GIT=0
test -d opencpn
if test $? -eq 1
then
git clone git://opencpn.git.sourceforge.net/gitroot/opencpn/opencpn
GIT=1
fi
cd opencpn
if test $GIT -eq 0
then
git pull
fi
test -d build
if test $? -eq 1
then
mkdir build
fi
cd build
rm -f CMakeCache.txt
cmake ../
make
echo "Cmake OK!"
sudo make install
exit
---
2. Compiling older releases.
Old way from CVS, no longer maintained
cvs -z3 -d:pserver:anonymous@opencpn.cvs.sourceforge.net:/cvsroot/opencpn co -P opencpn
Earlier releases used the gnu automake toolchain, with the following basic commands:
aclocal automake --add-missing autoconf ./configure make make install