summaryrefslogtreecommitdiffstats
path: root/INSTALL
blob: 49d8d911ccf339318091d16534e9eb6735c2b3f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
Building Subsurface from Source
===============================

Subsurface uses a few open source libraries and frameworks to do its
job. The most important ones include libdivecomputer, Qt4, Marble
(more precisely libmarble; this is what causes the need for Qt4 as
Marble as of the time of this writing hasn't been ported to Qt5, yet),
libxml2, libxslt, libsqlite3, and libzip.

Below are instructions for building Subsurface under some popular
Linux distributions, for building Subsurface using Homebrew on a Mac,
and for cross-building Subsurface for Windows. The lack of a working
package management system for Windows makes it really painful to build
Subsurface natively under Windows, we have some hints how to do so
here as well.


Build options for Subsurface
----------------------------

The following options are recognised when passed to qmake:

 -config debug        Create a debug build
 -config release      Create a release build
		      The default depends on how Qt was built.
 V=1                  Disable the "silent" build mode
 LIBDCDEVEL=1         Search for libdivecomputer in ../libdivecomputer
 INCLUDEPATH+=xxx     Add xxx to the include paths to the compiler
		      (pass the actual path, without -I)
 LIBS+=xxx            Add xxx to the linker flags. -l and -L options are
		      recognised.

The INCLUDEPATH and LIBS options are useful to tell the buildsystem
about non-standard installation paths for the dependencies (such as
Marble). They can be repeated as often as needed, or multiple
arguments can be passed on the same switch, separated by a space. For
example:

  qmake LIBS+="-L$HOME/marble/lib -L$HOME/libdivecomputer/lib" \
	INCLUDEPATH+="$HOME/marble/include $HOME/libdivecomputer/include"


Building Subsurface 4 under Linux
---------------------------------

On Fedora you need qt-devel, marble-devel, libzip-devel,
libxml2-devel, libxslt-devel, libsqlite3x-devel, libudev-devel. If you are going
to compile libdivecomputer, you need libusb-devel, too.

On Debian style distributions you can install the required development
packages by running
$ apt-get build-dep subsurface

If you want to install the required packages individually instead you
need libqt4-dev, libmarble-dev, libzip-dev, libxml2-dev,
libsqlite3-dev, libxslt1-dev, libzip-dev (and libusb-1.0-0-dev if
you're going to compile libdivecomputer).

Unfortunately the marble version in Debian stable (and possibly
Ubuntu) appears to be missing essential header files used in
Subsurface. We hack around this right now by including this header
file but that of course causes potential version conflicts.

To compile libdivecomputer:
$ git clone git://git.libdivecomputer.org/libdivecomputer
$ cd libdivecomputer
$ git checkout release-0.4
$ autoreconf --install
$ ./configure --disable-shared
$ make
$ sudo make install

To compile Subsurface:
$ git clone git://subsurface.hohndel.org/subsurface.git
$ cd subsurface
$ qmake # qmake-qt4 on some flavors of Linux
$ make
$ sudo make install     [optionally, add: prefix=/usr/local]

Note: on Fedora qmake will appear as qmake-qt4

Building the Qt version under MacOSX
------------------------------------

1)  Install Homebrew

$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

2) Install needed dependencies

$ brew install asciidoc libzip qt sqlite cmake libusb pkg-config

3) Make the brew version of sqlite the default

$ brew link --force sqlite

4) Install Marble

$ mkdir -p ~/src/marble/build
$ git clone -b 4.11.2 git://anongit.kde.org/marble ~/src/marble/sources
$ cd ~/src/marble/build
$ cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local ../sources
 - or -
$ cmake -DCMAKE_BUILD_TYPE=Release -DQTONLY=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local ../sources
$ cd src/lib
$ make -j4
$ install_name_tool -id /usr/local/lib/`echo libmarblewidget.??.dylib` libmarblewidget.dylib
$ cp *dylib /usr/local/lib/
$ mkdir -p /usr/local/include/marble
$ cd ../../../sources/src/lib
$ cp $(find . -name '*.h') /usr/local/include/marble/

5) Install Libdivecomputer

$ brew install automake libtool
$ cd ~/src
$ git clone git://git.libdivecomputer.org/libdivecomputer
$ cd libdivecomputer
$ git checkout release-0.4
$ autoreconf --install
$ ./configure --disable-shared
$ make
$ make install

6) Compile Subsurface

$ cd ~/src
$ git clone git://subsurface.hohndel.org/subsurface.git
$ cd subsurface
$ qmake
$ make
$ make install_mac_bundle

After the above is done, Subsurface will be installed to
/Applications.

Another option is to create a .dmg for distribution:

$ qmake
$ make
$ make mac-create-dmg

NOTES: macdeployqt assumes that the plugins are located "next" to the
frameworks. The frameworks are linked from /usr/local/lib - but the
plugins are not in /usr/local/plugins.
The easiest workaround is to create a symbolic link from
/usr/local/plugins to /usr/local/Cellar/qt/4.8.5/plugins (or whatever
version of Qt you have built earlier).

Cross-building Subsurface on Linux for Windows
----------------------------------------------

Subsurface builds nicely with MinGW - the official builds are done as
cross builds under Linux (currently on Fedora 19). A shell script to do
that (plus the .nsi file to create the installer with makensis) are
included in the packaging/windows directory.

The best way to get libdivecomputer to build appears to be

$ mkdir -p ~/src
$ git clone git://git.libdivecomputer.org/libdivecomputer ~/src/libdivecomputer
$ cd ~/src/libdivecomputer
$ git checkout release-0.4
$ mingw32-configure --disable-shared
$ mingw32-make
$ sudo mingw32-make install

To compile Marble, use:

$ mkdir -p ~/src/marble/build
$ git clone -b v4.11.2 git://anongit.kde.org/marble ~/src/marble/sources
$ cd ~/src/marble/build
$ mingw32-cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=TRUE ../sources
 - or -
$ mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DQTONLY=TRUE ../sources
$ mingw32-make -j4
$ mingw32-make install

To compile Subsurface, use:

$ mkdir -p ~/src/subsurface
$ git clone git://subsurface.hohndel.org/subsurface.git ~/src/subsurface
$ cd ~/src/subsurface
$ packaging/windows/mingw-make.sh
$ packaging/windows/mingw-make.sh install
$ packaging/windows/mingw-make.sh installer

The last step assumes that you have a link from packaging/windows/dll to
the correct directory in your MinGW installation. On my machine that is
/usr/i686-w64-mingw32/sys-root/mingw/bin
Similarly, the paths used in packaging/windows/mingw-make.sh may need to
be adjusted according to your distributions layout


Building Subsurface on Windows
------------------------------

1) Install msys-git:
http://msysgit.github.io

Tools part of MSYS are required for building Subsurface, while you also
need Git to be upstream and contribute to the project.
Make sure that the msys/bin (or git/bin) folder is in PATH.

2) Install Qt
http://qt-project.org/downloads

Subsurface is currently built against Qt 4.8.5.

3) Install a MinGW toolchain
https://docs.google.com/open?id=0B4D8x6CJEmtuczdiQklwMEs4RUU

Qt 4.8.5 comes without a compiler and you will have to download it from
a separate location. Other compiler may work, but there are no guaranties for
that. Make sure that the mingw/bin folder is in PATH.

4) Install Libdivecomputer
Use similar steps to the previous section, without the sudo command.

5) Install CMake (required for building Marble):
http://www.cmake.org/cmake/resources/software.html

Make sure that the cmake/bin folder is in PATH.

5) Download and build Marble
http://marble.kde.org/sources.php
http://techbase.kde.org/Projects/Marble/WindowsCompiling#Compiling_Marble_using_MingW

Make sure you build both the Debug and Release versions.

6) Install pkg-config
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip

pkg-config depends on DLL files such as libglib-2.0-0.dll and has to be in
PATH, so it's best that you copy the executable to msys/bin.

7) Install other dependencies
Subsurface also depends on the following libraries:

* libxml2
http://www.xmlsoft.org/downloads.html
* libxslt
http://xmlsoft.org/XSLT/
* libusb-1.0
http://sourceforge.net/apps/trac/libusb-win32/wiki
* zlib
http://www.zlib.net/
* libzip
http://www.nih.at/libzip/

Once you have the libraries, create .pc files (pkg-config) for them and place
the files in a folder that is indicated by the PKG_CONFIG_PATH environment
variable - e.g. PKG_CONFIG_PATH=c:\msys\pkg-config

To build subsurface, use:

$ git clone git://subsurface.hohndel.org/subsurface.git
$ cd subsurface
$ qmake
$ make
$ make install
$ make installer