Devel:Installation

From GeopsyWiki
Jump to: navigation, search

Development is preferably achieved under Linux. Other platforms are not documented.

Necessary 3rd party tools

A recent version of g++, gfortran, git and Qt are first required. For code edition, we recommend using Qt Creator which is provided in Qt sdk.

Some packages may require additional 3rd party libraries. Refer to the usual installation instructions for details.

Initialization

git configuration

This is not absolutely required but if you are going to make modifications, it is better to have your authorship properly set up in the repository. If not already done on your system:

git config --global user.name "Your name"
git config --global user.email "your.email@your.domain"
git config --global core.editor vi

admin directory

The list of packages is saved in a git repository called geopsyprojects. Configure it by editing option.sub.

There are three main branches: "devel", "testing", and "stable". Change the argument of git fetch and git checkout to select another branch. Switching to another branch afterward is possible.

mkdir geopsy-dev
cd geopsy-dev
git clone git://download.geopsy.org/geopsyprojects
mv geopsyprojects admin
cd admin

Switch to the desired branch ("devel" in this example).

git fetch git://download.geopsy.org/geopsyprojects devel:devel
git checkout devel

Configure destination and installation paths. Destination path is the directory where executables and libraries first go after compilation. Installation path points to the directory where files are copied during a 'make install'. Destination directory is written during any compilation ('make'), hence user permissions are required. For development, installation and destination path are usually identical and 'make install' is never run. It avoids multiple copies of the same include files and confusions while editing them (e.g. editing installed files instead of source files).

cp options.sub.example options.sub
vi options.sub

PREFIX is set be default to '/usr/local/Geopsy.org'. If this is fine, make sure that you have enough permissions. To create a new user writable directory:

sudo mkdir /usr/local/Geopsy.org
sudo chown yourusername /usr/local/Geopsy.org

Configure the list of package to build by default.

cp projects.default.example projects.default
vi projects.default
cd ..

projects.* files simply set PROJECTS environment variable. It contains a list of paths to projects (relative to the development root directory, geopsy-dev in this example). List 'user' contains the most popular applications and libraries of geopsy packages. Comment all other lists because you might not have sufficient permissions to access their git repository). List 'scripts' contains 'devpro' which bootstrap is explained here below.

devpro scripts

A package of multi-purpose scripts to ease coding experience. Bootstrap is a little tricky...

git clone git://download.geopsy.org/devpro
cd devpro

Switch to the same branch as above (e.g. "devel").

 git fetch git://download.geopsy.org/devpro devel:devel
 git checkout devel

Setup the minimal configuration for devpro scripts:

mkdir ~/.devpro
echo "REF_QT_VERSION=4.7.2" >> ~/.devpro/info

Bootstrap of devpro project

$(pwd)/src/dpconfigure
source ../admin/options.sub
./configure $CONFIGURE_OPTIONS
make
cd ..

If you want to use a separate build directory, run instead the following commands:

$(pwd)/src/dpconfigure
source ../admin/options.sub
./configure $CONFIGURE_OPTIONS -build-dir /path/to/build/dir/devpro
cd /path/to/build/dir/devpro
make

Define path to geopsy-dev/bin (or other DEST_DIR if configured differently in admin/options.sub) in your PATH (e.g. ~/.bashrc).

export PATH=/usr/local/Geopsy.org/bin:$PATH

Download all packages for a specific branch

cd geopsy-dev
dpsubdo dpcheckout devel

Configure and compile

Configure packages forcing the options from admin/options.sub (option '-f').

cd geopsy-dev
dpsubconfig -f

You may have warnings about a missing .pro file issued by dpstableh when running dpsubconfig for the first time. To fix it:

 dpsubdo dpstableh

Build the general Makefile

dpsubpro
qmake

Under MacOSX, with the Qt binaries, the default QMAKESPEC can be macx-xcode. To force the generation of makefiles, run qmake this way:

qmake -spec macx-g++

Compile...

make debug

Qt Creator

Qt Creator does not like 3rd party and script projects included in the package list, so remove them from the global Makefile once these projects are successfully compiled. You will run into errors if you remove these lines before a first successful build.

TEMPLATE = subdirs
CONFIG += ordered debug_and_release
SUBDIRS = \
          devpro \
          3rdparty/dfftpack \
          3rdparty/mseed \
          3rdparty/slink \
          lib/QGpCoreTools \
          lib/QGpGuiTools \
          lib/SciFigs \

In file geopsy-dev.pro, remove all lines starting with 3rdparty and devpro corresponding to projects not built with qmake.

Start Qt creator and open geopsy-dev.pro file located in geopsy-dev.