source: subsurface/INSTALL

Last change on this file was d82f8cb, checked in by Dirk Hohndel <dirk@…>, 5 weeks ago

Change protocoll for any git clone from Github to https

Signed-off-by: Stefan Fuchs <sfuchs@…>

  • Property mode set to 100644
File size: 9.2 KB
Line 
1Building Subsurface from Source
2===============================
3
4Subsurface uses quite a few open source libraries and frameworks to do its
5job. The most important ones include libdivecomputer, Qt, Marble
6(more precisely libmarblewidget), libxml2, libxslt, libsqlite3, libzip,
7libgrantlee5 and libgit2.
8
9Below are instructions for building Subsurface under some popular
10Linux distributions, for building Subsurface using Homebrew on a Mac,
11and for cross-building Subsurface for Windows. The lack of a working
12package management system for Windows makes it really painful to build
13Subsurface natively under Windows, so we don't support that at all.
14
15All of the prebuilt binaries that we provide (right now Windows, Mac,
16Ubuntu/Debian/LinuxMint, and openSUSE/Fedora) are built using our own
17custom "flavors" of libdivecomputer and libmarblewidget. You can get
18these from
19
20git://git.subsurface-divelog.org/marble (in the Subsurface-branch branch)
21git://git.subsurface-divelog.org/libdc (in the Subsurface-branch branch)
22
23Those branches won't have a pretty history and will include ugly merges,
24but they should always allow a fast forward pull that tracks what we believe
25developers should build against.
26
27In contrast to that both repositories also have Subsurface-clean branches.
28These should allow distros to see which patches we have applied on top of
29upstream. They will receive force pushes as we rebase to newer versions of
30upstream so they are not ideal for ongoing development (but they are of
31course easy to use for distributions as they always build "from scratch",
32anyway).
33
34The rationale for this is that we have no intention of forking either of
35these two projects. We simply are adding a few patches on top of their
36latest versions and want to do so in a manner that is both easy for our
37developers who try to keep them updated frequently, and anyone packaging
38Subsurface or trying to understand what we have done relative to their
39respective upstreams.
40
41At this point Qt5 is required, Qt5.4 or newer is recommended and on the
42Mac, in order to get native Bluetooth support, Qt5.5 is necessary.
43
44Similarly, in order for our cloud storage to be fully functional you need
45libgit2 0.23 or newer.
46
47Finally, as of Subsurface 4.5 we have switched our build system to cmake.
48qmake based builds are no longer supported.
49
50Build options for Subsurface
51----------------------------
52
53The following options are recognized when passed to cmake:
54
55 -DCMAKE_BUILD_TYPE=Release     create a release build
56 -DCMAKE_BUILD_TYPE=Debug       create a debug build
57
58The Makefile that was created using cmake can be forced into a much more
59verbose mode by calling
60
61 make VERBOSE=1
62
63Many more variables are support, the easiest way to interact with them is
64to call
65
66 ccmake .
67
68in your build directory.
69
70
71Building the development version of Subsurface under Linux
72----------------------------------------------------------
73
74On Fedora you need
75
76sudo yum install git gcc-c++ make autoconf automake libtool cmake \
77        libzip-devel libxml2-devel libxslt-devel libsqlite3x-devel \
78        libudev-devel libusbx-devel libcurl-devel libssh2-devel\
79        qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtscript-devel \
80        qt5-qtwebkit-devel qt5-qtsvg-devel qt5-qttools-devel \
81        qt5-qtconnectivity-devel qt5-qtlocation-devel
82
83Note that beginning with Fedora 22, you should be using the dnf command instead
84as yum is being deprecated.
85
86Package names are sadly different on OpenSUSE
87
88sudo zypper install git gcc-c++ make autoconf automake libtool cmake libzip-devel \
89        libxml2-devel libxslt-devel sqlite3-devel libusb-1_0-devel \
90        libqt5-linguist-devel libqt5-qttools-devel libQt5WebKitWidgets-devel \
91        libqt5-qtbase-devel libQt5WebKit5-devel libqt5-qtsvg-devel \
92        libqt5-qtscript-devel libqt5-qtdeclarative-devel \
93        libqt5-qtconnectivity-devel libqt5-qtlocation-devel libcurl-devel
94
95On Debian Stretch this seems to work
96
97sudo apt-get install git g++ make autoconf automake libtool cmake pkg-config \
98        libxml2-dev libxslt1-dev libzip-dev libsqlite3-dev \
99        libusb-1.0-0-dev libssl-dev \
100        qt5-default qt5-qmake qtchooser qttools5-dev-tools libqt5svg5-dev \
101        libqt5webkit5-dev libqt5qml5 libqt5quick5 libqt5declarative5 \
102        qtscript5-dev libssh2-1-dev libcurl4-openssl-dev qttools5-dev \
103        qtconnectivity5-dev qtlocation5-dev qtpositioning5-dev \
104        libcrypto++-dev libssl-dev
105
106Package names for Ubuntu 16.10
107
108sudo apt-get install git g++ make autoconf automake libtool cmake pkg-config \
109        libxml2-dev libxslt1-dev libzip-dev libsqlite3-dev \
110        libusb-1.0-0-dev libssl-dev \
111        qt5-default qt5-qmake qtchooser qttools5-dev-tools libqt5svg5-dev \
112        libqt5webkit5-dev libqt5qml5 libqt5quick5 qtdeclarative5-dev \
113        qtscript5-dev libssh2-1-dev libcurl4-openssl-dev qttools5-dev \
114        qtconnectivity5-dev qtlocation5-dev qtpositioning5-dev \
115        libcrypto++-dev libssl-dev
116
117On PCLinuxOS you appear to need the following packages
118
119su -c "apt-get install -y autoconf automake cmake libtool gcc-c++ git \
120lib64usb1.0-devel lib64zip-devel lib64qt5webkitwidgets-devel qttools5 \
121qttranslations5 lib64qt5xml-devel lib64qt5test-devel lib64qtscript-devel \
122lib64qt5svg-devel lib64qt5concurrent-devel lib64qt5bluetooth-devel"
123
124In order to build Subsurface, use the supplied build script. This should
125work on most systems that have all the prerequisite packages installed.
126
127You should have Subsurface sources checked out in a sane place, something
128like this:
129
130mkdir -p ~/src
131cd ~/src
132git clone https://github.com/Subsurface-divelog/subsurface.git
133./subsurface/scripts/build.sh # <- this step will take quite a while as it
134                              #    compiles a handful of libraries before
135                              #    building Subsurface
136
137Now you can run Subsurface like this:
138
139cd ~/src/subsurface/build
140./subsurface
141
142
143Note: on many Linux versions (for example on Kubuntu 15.04) the user must
144belong to the dialout group.
145
146You may need to run something like
147
148sudo usermod -a -G dialout username
149
150with your correct username and log out and log in again for that to take
151effect.
152
153If you get errors like:
154
155./subsurface: error while loading shared libraries: libGrantlee_Templates.so.5: cannot open shared object file: No such file or directory
156
157You can run the following command:
158
159sudo ldconfig ~/src/install-root/lib
160
161
162Building Subsurface under MacOSX (using Homebrew)
163-------------------------------------------------
164
1650) You need to have XCode installed. The first time (and possibly after updating OSX)
166you need to run
167
168$ xcode-select --install
169
1701)  Install Homebrew
171
172$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
173
1742) Install needed dependencies
175
176$ brew install asciidoc libzip sqlite cmake libusb pkg-config automake libtool hidapi libxml2 curl openssl libssh2
177
1783) Make the brew version of sqlite the default
179
180$ brew link --force sqlite
181
1824) Download and install Qt
183
184You can build Qt from source or use the prebuilt binaries for Mac. Start
185by downloading the online installer:
186
187$ curl -L -o ~/Downloads/qt-unified-mac-x64-online.dmg \
188        http://download.qt.io/official_releases/online_installers/qt-unified-mac-x64-online.dmg
189$ open ~/Downloads/qt-unified-mac-x64-online.dmg
190
191Double click on the Qt installer shown in the Finder window.
192
193In the installer, chose an install folder (the build script we are using
194below assumes that you accept the default of /home/<your username>/Qt), in
195"Select components" select the most recent version and (if you want to
196build Qt from source) be sure you also install the "Source Components".
197To save time and disk space you can unselect Android and IOS packages
198as well as QtWebEngine, Qt3D, Qt Canvas 3D and the Qt Extras.
199
200If you want to build from source (which takes a very long time and a lot of disk)
201
202$ cd ~/Qt/5.5/Src/
203
204$ ./configure -prefix /usr/local -opensource
205
206$ make -j4
207
208$ make install
209
2105) run the build script
211
212cd ~/src
213bash subsurface/scripts/build.sh
214
215After the above is done, Subsurface.app will be available in the
216subsurface/build directory. You can run Subsurface with the command
217
218$ open subsurface/build/Subsurface.app
219
220or you can move this folder to /Applications to install Subsurface for
221every user.
222
223
224Cross-building Subsurface on Linux for Windows
225----------------------------------------------
226
227Subsurface builds nicely with MinGW - the official builds are done as
228cross builds under Linux (currently on Ubuntu 14.04). A shell script to do
229that (plus the .nsi file to create the installer with makensis) are
230included in the packaging/windows directory.
231
232Please read through the explanations and instructions in
233packaging/windows/mxe-based-build.sh if you want to build the Windows
234version on your Linux system.
235
236
237Building Subsurface on Windows
238------------------------------
239
240This is NOT RECOMMENDED. To the best of our knowledge there is one single
241person who regularly does this. The Subsurface team does not provide support
242for Windows binary build from sources natively under Windows...
243
244
245Building Subsurface for Android
246-------------------------------
247
248To compile the mobile version you will need:
249
250-Qt for Android (this can be downloaded from: http://www.qt.io/download-open-source/)
251-Android SDK
252-Android NDK
253
254In the packaging/android folder, open the build.sh file and add the paths to the SDK,
255NDK and Qt for android at the top.
256
257After that, you can run: ./subsurface/packaging/android/build.sh
258
259This will generate an apk file in ./subsurface-mobile-build-arm/bin
Note: See TracBrowser for help on using the repository browser.