summaryrefslogtreecommitdiffstats
path: root/INSTALL
blob: bbda32e124816382fe8623ffc855aaa9412e00cc (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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
Building Subsurface from Source
===============================

Subsurface uses a few open source libraries and frameworks to do its
job. The most important ones include libdivecomputer, Qt, Marble
(more precisely libmarblewidget), libxml2, libxslt, libsqlite3, libzip,
and libgit2.

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, so we don't support that at all.

All of the prebuilt binaries that we provide (right now Windows, Mac,
Ubuntu/Debian/LinuxMint, and openSUSE/Fedora) are built using our own
custom "flavors" of libdivecomputer and libmarblewidget. You can get
these from

git://git.subsurface-divelog.org/marble (in the Subsurface-4.4 branch)
git://git.subsurface-divelog.org/libdc (in the Subsurface-4.4 branch)

Both of these repositories also have a Subsurface-testing branch. That
branch is explicitly marked as NOT STABLE and will receive force pushes.
The rationale for this is that we have no intention of forking either of
these two projects. We simply are adding a few patches on top of their
latest versions and so those testing branches get frequently rebased.

Also, all of the prebuilt binaries (with the exception of the Ubuntu 12.04
build) are now Qt5 based and Qt5 is considered the stable and supported
framework to use for building Subsurface. The sources contain a best
effort patch in packaging/ubuntu/0001-Make-build-with-Qt4.patch that
attempts to continue to allow building with Qt4, but that is not
officially supported and will result in missing functionality.

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

The following options are recognized 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
 LIBMARBLEDEVEL=path  Search for marble library and includes in path
 SPECIAL_MARBLE_PREFIX=1 Use libssrfmarblewidget as library name
                      This is needed when building with our marble branch
 LIBGIT2DEVEL=path    Search for libgit2 library and includes in path
 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
		      recognized.
 DEFINES+=SHOW_PLOT_INFO_TABLE=1
		      Only available in debug builds, this creates a
		      second window that shows all elements in the
		      plot_info structure as a table - very useful when
		      debugging issues with the profile

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

sudo yum install git gcc-c++ make autoconf automake libtool cmake \
	libzip-devel libxml2-devel libxslt-devel libsqlite3x-devel \
	libgit2-devel libudev-devel libusbx-devel \
	qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtscript-devel \
	qt5-qtwebkit-devel qt5-qtsvg-devel qt5-qttools-devel

Package names are sadly different on OpenSUSE

sudo zypper install git gcc-c++ make autoconf automake libtool cmake libzip-devel \
	libxml2-devel libxslt-devel sqlite3-devel libgit2-devel libusb-1_0-devel \
	libqt5-linguist-devel libqt5-qttools-devel libQt5WebKitWidgets-devel \
	libqt5-qtbase-devel libQt5WebKit5-devel libqt5-qtsvg-devel \
	libqt5-qtscript-devel libqt5-qtdeclarative-devel

On Debian Jessie this seems to work

sudo apt-get install git g++ make autoconf libtool cmake pkg-config \
	libxml2-dev libxslt1-dev libzip-dev libsqlite3-dev \
	libusb-1.0-0-dev libgit2-dev \
	qt5-default qt5-qmake qtchooser qttools5-dev-tools libqt5svg5-dev \
	libqt5webkit5-dev libqt5qml5 libqt5quick5 libqt5declarative5 \
	qtscript5-dev

On Debian style distributions you can install the required development
packages by running (once Qt version of subsurface is available in your
distribution)
$ sudo apt-get build-dep subsurface
but on many of them this will give you the build dependencies for the
official package (which is often way out of date). So be careful that this
doesn't get you a Qt4 based environment

In order to build Subsurface, you have two options:

1. the easy way
~~~~~~~~~~~~~~~

Use the supplied build script. This should work on most systems that have
all the prerequisite packages installed...

You should have Subsurface sources checked out in a sane place, something
like this:

mkdir -p ~/src
cd ~/src
git clone -b v4.4.1 git://subsurface-divelog.org/subsurface
./subsurface/scripts/build.sh # <- this step will take quite a while as it
                              #    compiles a handful of libraries before
			      #    building Subsurface

Now you can run Subsurface like this:

./subsurface/scripts/run.sh

2. the harder way
~~~~~~~~~~~~~~~~~

First you need to compile our version of libdivecomputer:

$ mkdir ~/src # unless you have this already
$ cd ~/src
$ git clone -b Subsurface-4.4 git://subsurface-divelog.org/libdc libdivecomputer
       # or -b Subsurface-testing to get the testing version - careful,
       #                          careful - this gets rebased and may be broken
       # -> when not building a release version of Subsurface but the
       #    latest master, it may be necessary to build against the
       #    Subsurface-testing branch

$ cd libdivecomputer
$ autoreconf --install
$ ./configure --disable-shared
$ make
$ sudo make install

Then you compile our custom branch of libmarblewidget

$ cd ~/src
$ git clone -b Subsurface-4.4 git://subsurface-divelog.org/marble marble-source
       # or -b Subsurface-testing to get the testing version - careful,
       #                          careful - this gets rebased and may be broken

$ mkdir marble-build
$ cd marble-build
$ cmake -DQTONLY=ON -DQT5BUILD=ON \
	-DBUILD_MARBLE_APPS=OFF -DBUILD_MARBLE_EXAMPLES=OFF \
	-DBUILD_MARBLE_TESTS=OFF -DBUILD_MARBLE_TOOLS=OFF \
	-DBUILD_TESTING=OFF -DWITH_DESIGNER_PLUGIN=OFF \
	-DBUILD_WITH_DBUS=OFF ../marble-source
$ make # <- this step will take quite a while... if you have more cores
       #    try make -j8 or something like that
$ sudo make install

Finally you can compile Subsurface:

$ cd ~/src
$ git clone git://subsurface-divelog.org/subsurface.git
$ cd subsurface
$ git checkout v4.4      # this get's you the last release
                         # skip this step to build the latest development
			 # version
$ qmake SPECIAL_MARBLE_PREFIX=1
# on Fedora/OpenSUSE you need qmake-qt5
$ make
$ sudo make install    # [optionally, add: prefix=/usr/local]

At least on Fedora and OpenSUSE you need to make sure that /usr/local/lib
is searched for shared libraries (this is where the steps above installed
libdivecomputer and libmarblewidget in order not to conflict with system
pacakges). So you need to do the following:

$ sudo echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
$ sudo ldconfig

Now you should be able to start the Subsurface binary you just created
with

$ ./subsurface


Building Subsurface under MacOSX (using Homebrew)
-------------------------------------------------

0) You need to have XCode installed. The first time (and possibly after updating OSX)
you need to run

$ xcode-select --install

1)  Install Homebrew

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

2) Install needed dependencies

$ brew install asciidoc libzip sqlite cmake libusb pkg-config

3) Make the brew version of sqlite the default

$ brew link --force sqlite

4) Download Qt from http://www.qt.io/download-open-source/

In the installer, chose an install folder (e.g., /home/username/Qt5), in
"Select components" select the most recent version and be sure you also
install the "Source Components".

Build it (takes a long time)

$ cd ~/Qt5/5.4/Src/

$ ./configure -prefix /usr/local -opensource

$ make -j4

$ make install

5) Install custom subsurface Marble

$ cd ~/src
$ git clone -b Subsurface-4.4 git://subsurface-divelog.org/marble marble-source
$ cd marble-source
$ mkdir marble-build
$ cd marble-build
$ cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=TRUE \
	-DQT5BUILD=ON -DCMAKE_INSTALL_PREFIX=/usr/local ../../marble-source
$ cd src/lib/marble
$ make -j4
$ make install

5) Install Libdivecomputer

$ brew install automake libtool
$ cd ~/src
$ git clone -b Subsurface-4.4 git://subsurface-divelog.org/libdc libdivecomputer
       # -> when not building a release version of Subsurface but the
       #    latest master, it may be necessary to build against the
       #    Subsurface-testing branch
$ cd libdivecomputer
$ autoreconf --install
$ ./configure --disable-shared
$ make -j4
$ make install


6) Compile Subsurface

$ cd ~/src
$ git clone git://subsurface-divelog.org/subsurface.git
$ cd subsurface
$ qmake SPECIAL_MARBLE_PREFIX=1 INCLUDEPATH+=/usr/local/include \
	LIBS+=-L/usr/local/lib \
	LIBS+='-L/usr/local/Cellar/libzip/0.11.2/lib -lzip -lz' \
	INCLUDEPATH+=/usr/local/Cellar/libzip/0.11.2/include V=1 \
	LIBMARBLEDEVEL=../marble-source/marble-build/
$ make -j4
$ 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


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 20). A shell script to do
that (plus the .nsi file to create the installer with makensis) are
included in the packaging/windows directory.

Everywhere below the mingw64- prefix is used for the cross tools. If you
really need a 32bit binary you need to use mingw32- as prefix and you may
also run into issues creating an installable binary with Qt5 (i.e., you
may have to go back to Qt4).

The best way to get libdivecomputer to build appears to be

$ mkdir -p ~/src
$ cd ~/src
$ git clone -b Subsurface-4.4 git://subsurface-divelog.org/libdc libdivecomputer
       # or -b Subsurface-testing to get the testing version - careful,
       #                          careful - this gets rebased and may be broken
       # -> when not building a release version of Subsurface but the
       #    latest master, it may be necessary to build against the
       #    Subsurface-testing branch

$ cd libdivecomputer
$ autoreconf --install
$ mingw64-configure --disable-shared
$ mingw64-make
$ sudo mingw64-make install

To compile Marble, use:

$ cd ~/src
$ git clone -b Subsurface-4.4 git://subsurface-divelog.org/marble marble-source
       # or -b Subsurface-testing to get the testing version - careful,
       #                          careful - this gets rebased and may be broken

$ mkdir marble-build
$ cd marble-build
$ mingw64-cmake -DQTONLY=ON -DQT5BUILD=ON \
	-DBUILD_MARBLE_APPS=OFF -DBUILD_MARBLE_EXAMPLES=OFF \
	-DBUILD_MARBLE_TESTS=OFF -DBUILD_MARBLE_TOOLS=OFF \
	-DBUILD_TESTING=OFF -DWITH_DESIGNER_PLUGIN=OFF \
	-DBUILD_WITH_DBUS=OFF ../marble-source
$ mingw64-make # <- this step will take quite a while... if you have more cores
               #    try ming64-make -j8 or something like that
$ sudo mingw64-make install


To compile libgit2, use:

$ mkdir -p ~/src/libgit2/build
$ git clone git://github.com/libgit2/libgit2 ~/src/libgit2
$ cd ~/src/libgit2/build
$ mingw64-cmake ..
$ mingw64-make
$ sudo mingw64-make install

To compile Subsurface, use:

$ cd ~/src
$ git clone git://subsurface-divelog.org/subsurface.git
$ cd subsurface
$ cd git checkout v4.4   # this get's you the last release
                         # skip this step to build the latest development
			 # version
$ packagin/windows/mingw-make.sh Qt5 SPECIAL_MARBLE_PREFIX=1
$ 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-mingw64/sys-root/mingw/bin
Similarly, the paths used in packaging/windows/mingw-make.sh may need to
be adjusted according to your distributions layout

Also, at least one version of Qt DLLs shipping with Fedora was
self-inconsistent at caused random crashes at startup. Unless you have
good reasons to build your own binaries, on Windows you may be better off
with the pre-compiled binaries we provide.


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

This is NOT RECOMMENDED. To the best of our knowledge there is one single
person who regularly does this. The Subsurface team does not provide support
for Windows binary build from sources...