2013-12-12 16:10:49 +00:00
|
|
|
Building Subsurface from Source
|
|
|
|
===============================
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2015-09-03 01:33:39 +00:00
|
|
|
Subsurface uses quite a few open source libraries and frameworks to do its
|
2017-09-02 11:40:58 +00:00
|
|
|
job. The most important ones include libdivecomputer, Qt, libxml2, libxslt,
|
|
|
|
libsqlite3, libzip, libgrantlee5 and libgit2.
|
2013-12-12 16:10:49 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
Below are instructions for building Subsurface
|
|
|
|
- on some popular Linux distributions,
|
|
|
|
- MacOSX,
|
|
|
|
- Windows (cross-building)
|
|
|
|
- Android (cross-building)
|
|
|
|
- iOS (cross-building)
|
2013-12-12 16:10:49 +00:00
|
|
|
|
2014-12-14 21:11:37 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
Getting Subsurface source
|
|
|
|
-------------------------
|
2018-04-21 14:23:03 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
You can get the sources to the latest development version from our git
|
2018-04-23 11:16:46 +00:00
|
|
|
repository:
|
|
|
|
git clone http://github.com/Subsurface-divelog/subsurface.git
|
|
|
|
|
|
|
|
You keep it updated by doing:
|
|
|
|
git checkout master
|
|
|
|
git pull -r
|
|
|
|
|
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
|
|
|
|
Getting our flavor of libdivecomputer
|
|
|
|
-------------------------------------
|
|
|
|
|
|
|
|
All our prebuilt binaries (see https://subsurface-divelog.org/download)
|
|
|
|
are built using our own custom "flavor" of libdivecomputer
|
|
|
|
see https://github.com/Subsurface-divelog/libdc.git
|
|
|
|
|
|
|
|
In order to get the modified sources, do
|
|
|
|
- locate yourself in the subsurface repo on your local computer
|
|
|
|
- run "git submoule init"
|
|
|
|
- run "git submodule update"
|
|
|
|
|
|
|
|
The branches won't have a pretty history and will include ugly merges,
|
|
|
|
but they should always allow a fast forward pull that tracks what we
|
|
|
|
believe developers should build against. All our patches are contained
|
2018-04-25 15:37:31 +00:00
|
|
|
in the "Subsurface-NG".
|
2018-04-23 08:13:47 +00:00
|
|
|
|
|
|
|
This should allow distros to see which patches we have applied on top of
|
2015-08-26 18:44:56 +00:00
|
|
|
upstream. They will receive force pushes as we rebase to newer versions of
|
|
|
|
upstream so they are not ideal for ongoing development (but they are of
|
|
|
|
course easy to use for distributions as they always build "from scratch",
|
|
|
|
anyway).
|
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
The rationale for this is that we have no intention of forking the
|
|
|
|
project. We simply are adding a few patches on top of their latest
|
|
|
|
version and want to do so in a manner that is both easy for our
|
2015-08-26 18:44:56 +00:00
|
|
|
developers who try to keep them updated frequently, and anyone packaging
|
|
|
|
Subsurface or trying to understand what we have done relative to their
|
|
|
|
respective upstreams.
|
2014-12-14 21:11:37 +00:00
|
|
|
|
2015-09-03 01:33:39 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
Getting Qt5
|
|
|
|
-----------
|
|
|
|
|
|
|
|
We use Qt5 in order to only maintain one UI across platforms. Qt5.8 is the
|
|
|
|
oldest version supported.
|
|
|
|
|
|
|
|
Download the Open Source version from https://www.qt.io/download and
|
|
|
|
follow the Qt instructions to install it or alternatively follow the
|
|
|
|
instruction specific to a distribution (see build instructions).
|
|
|
|
|
|
|
|
To save time and disk space you can unselect Android and IOS packages
|
|
|
|
(Of course unless you want to build Android/iOS versions) as well as
|
|
|
|
- Qt Data Visualisation
|
|
|
|
- Qt Purchasing
|
|
|
|
- Qt Virtual Keyboard",
|
|
|
|
- Qt WebEngine
|
|
|
|
- Qt Network Authorization
|
|
|
|
- Qt Remote Objects
|
|
|
|
- Qt WebGL Streaming
|
|
|
|
- Qt 3D2
|
|
|
|
- Qt Canvas 3D
|
|
|
|
- Qt Extras
|
|
|
|
This can be done later by use of MaintenanceTool.app in your Qt folder.
|
|
|
|
|
2018-04-23 16:01:30 +00:00
|
|
|
Remark: most Qt installations do not make Qt available on the command
|
2018-04-23 08:13:47 +00:00
|
|
|
line, which is needed. In order to make Qt available you need to
|
2018-04-23 16:01:30 +00:00
|
|
|
add qmake to the path, do something like
|
|
|
|
PATH=$PATH:<Qt location>/<version>/<type>/bin
|
2018-04-23 08:13:47 +00:00
|
|
|
|
2018-04-23 11:16:46 +00:00
|
|
|
QtWebKit is needed, if you want to print, but no longer part of Qt5,
|
2018-04-23 14:54:12 +00:00
|
|
|
so you need to download it and compile. In case you just want to test
|
|
|
|
without print possibility omit this step.
|
2018-04-23 08:13:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
Other third party library dependencies
|
|
|
|
--------------------------------------
|
|
|
|
|
|
|
|
In order for our cloud storage to be fully functional you need
|
2015-09-03 01:33:39 +00:00
|
|
|
libgit2 0.23 or newer.
|
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
|
|
|
|
cmake build system
|
|
|
|
------------------
|
|
|
|
|
2018-04-23 16:01:30 +00:00
|
|
|
Our main build system is based on cmake. But qmake is needed
|
|
|
|
for the googlemaps plugin and the iOS build.
|
2018-04-23 08:13:47 +00:00
|
|
|
|
|
|
|
Download from https://cmake.org/download and follow the instructions
|
|
|
|
to install it or alternatively follow the instruction specific to a
|
|
|
|
distribution (see build instructions).
|
|
|
|
|
|
|
|
|
2015-04-09 22:46:25 +00:00
|
|
|
|
2013-12-12 16:10:49 +00:00
|
|
|
Build options for Subsurface
|
|
|
|
----------------------------
|
|
|
|
|
2018-04-23 11:16:46 +00:00
|
|
|
The following options are recognised when passed to cmake:
|
2015-04-09 22:46:25 +00:00
|
|
|
|
|
|
|
-DCMAKE_BUILD_TYPE=Release create a release build
|
|
|
|
-DCMAKE_BUILD_TYPE=Debug create a debug build
|
|
|
|
|
|
|
|
The Makefile that was created using cmake can be forced into a much more
|
|
|
|
verbose mode by calling
|
2013-12-12 16:10:49 +00:00
|
|
|
|
2015-04-09 22:46:25 +00:00
|
|
|
make VERBOSE=1
|
2013-12-12 16:10:49 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
Many more variables are supported, the easiest way to interact with them is
|
2015-09-03 01:33:39 +00:00
|
|
|
to call
|
|
|
|
|
|
|
|
ccmake .
|
|
|
|
|
|
|
|
in your build directory.
|
|
|
|
|
|
|
|
|
2015-11-10 01:35:15 +00:00
|
|
|
Building the development version of Subsurface under Linux
|
|
|
|
----------------------------------------------------------
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2014-12-14 21:11:37 +00:00
|
|
|
On Fedora you need
|
|
|
|
|
|
|
|
sudo yum install git gcc-c++ make autoconf automake libtool cmake \
|
|
|
|
libzip-devel libxml2-devel libxslt-devel libsqlite3x-devel \
|
2016-06-18 11:18:20 +00:00
|
|
|
libudev-devel libusbx-devel libcurl-devel libssh2-devel\
|
2014-12-14 21:11:37 +00:00
|
|
|
qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtscript-devel \
|
2015-07-07 13:14:13 +00:00
|
|
|
qt5-qtwebkit-devel qt5-qtsvg-devel qt5-qttools-devel \
|
2015-11-24 14:29:15 +00:00
|
|
|
qt5-qtconnectivity-devel qt5-qtlocation-devel
|
2015-06-11 09:02:22 +00:00
|
|
|
|
|
|
|
Note that beginning with Fedora 22, you should be using the dnf command instead
|
|
|
|
as yum is being deprecated.
|
2014-12-14 21:11:37 +00:00
|
|
|
|
2014-12-15 22:53:04 +00:00
|
|
|
Package names are sadly different on OpenSUSE
|
|
|
|
|
|
|
|
sudo zypper install git gcc-c++ make autoconf automake libtool cmake libzip-devel \
|
2016-06-18 11:18:20 +00:00
|
|
|
libxml2-devel libxslt-devel sqlite3-devel libusb-1_0-devel \
|
2014-12-15 22:53:04 +00:00
|
|
|
libqt5-linguist-devel libqt5-qttools-devel libQt5WebKitWidgets-devel \
|
|
|
|
libqt5-qtbase-devel libQt5WebKit5-devel libqt5-qtsvg-devel \
|
2015-07-07 13:14:13 +00:00
|
|
|
libqt5-qtscript-devel libqt5-qtdeclarative-devel \
|
2015-12-16 14:34:03 +00:00
|
|
|
libqt5-qtconnectivity-devel libqt5-qtlocation-devel libcurl-devel
|
2014-12-15 22:53:04 +00:00
|
|
|
|
2017-02-20 06:19:05 +00:00
|
|
|
On Debian Stretch this seems to work
|
2014-12-15 22:53:04 +00:00
|
|
|
|
2016-01-07 15:20:27 +00:00
|
|
|
sudo apt-get install git g++ make autoconf automake libtool cmake pkg-config \
|
2014-12-15 22:53:04 +00:00
|
|
|
libxml2-dev libxslt1-dev libzip-dev libsqlite3-dev \
|
2016-06-18 11:18:20 +00:00
|
|
|
libusb-1.0-0-dev libssl-dev \
|
2014-12-27 17:04:14 +00:00
|
|
|
qt5-default qt5-qmake qtchooser qttools5-dev-tools libqt5svg5-dev \
|
|
|
|
libqt5webkit5-dev libqt5qml5 libqt5quick5 libqt5declarative5 \
|
2015-07-07 13:14:13 +00:00
|
|
|
qtscript5-dev libssh2-1-dev libcurl4-openssl-dev qttools5-dev \
|
2016-12-03 20:33:56 +00:00
|
|
|
qtconnectivity5-dev qtlocation5-dev qtpositioning5-dev \
|
2017-10-22 23:11:54 +00:00
|
|
|
libcrypto++-dev libssl-dev qml-module-qtpositioning qml-module-qtlocation \
|
|
|
|
qml-module-qtquick2
|
2013-12-12 16:10:49 +00:00
|
|
|
|
2017-02-20 06:19:05 +00:00
|
|
|
Package names for Ubuntu 16.10
|
|
|
|
|
|
|
|
sudo apt-get install git g++ make autoconf automake libtool cmake pkg-config \
|
|
|
|
libxml2-dev libxslt1-dev libzip-dev libsqlite3-dev \
|
|
|
|
libusb-1.0-0-dev libssl-dev \
|
|
|
|
qt5-default qt5-qmake qtchooser qttools5-dev-tools libqt5svg5-dev \
|
|
|
|
libqt5webkit5-dev libqt5qml5 libqt5quick5 qtdeclarative5-dev \
|
|
|
|
qtscript5-dev libssh2-1-dev libcurl4-openssl-dev qttools5-dev \
|
|
|
|
qtconnectivity5-dev qtlocation5-dev qtpositioning5-dev \
|
2017-10-22 23:11:54 +00:00
|
|
|
libcrypto++-dev libssl-dev qml-module-qtpositioning qml-module-qtlocation \
|
|
|
|
qml-module-qtquick2
|
2017-02-20 06:19:05 +00:00
|
|
|
|
2015-02-18 07:23:22 +00:00
|
|
|
On PCLinuxOS you appear to need the following packages
|
|
|
|
|
|
|
|
su -c "apt-get install -y autoconf automake cmake libtool gcc-c++ git \
|
|
|
|
lib64usb1.0-devel lib64zip-devel lib64qt5webkitwidgets-devel qttools5 \
|
|
|
|
qttranslations5 lib64qt5xml-devel lib64qt5test-devel lib64qtscript-devel \
|
2015-07-07 13:14:13 +00:00
|
|
|
lib64qt5svg-devel lib64qt5concurrent-devel lib64qt5bluetooth-devel"
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2015-02-18 08:17:02 +00:00
|
|
|
In order to build Subsurface, use the supplied build script. This should
|
2015-07-07 13:14:13 +00:00
|
|
|
work on most systems that have all the prerequisite packages installed.
|
2015-02-17 21:18:05 +00:00
|
|
|
|
|
|
|
You should have Subsurface sources checked out in a sane place, something
|
|
|
|
like this:
|
|
|
|
|
|
|
|
mkdir -p ~/src
|
|
|
|
cd ~/src
|
2017-04-15 10:33:38 +00:00
|
|
|
git clone https://github.com/Subsurface-divelog/subsurface.git
|
2015-02-17 21:18:05 +00:00
|
|
|
./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:
|
|
|
|
|
2015-10-15 16:52:51 +00:00
|
|
|
cd ~/src/subsurface/build
|
2015-10-14 03:05:47 +00:00
|
|
|
./subsurface
|
2015-02-17 21:18:05 +00:00
|
|
|
|
2013-12-09 19:48:16 +00:00
|
|
|
|
2015-07-04 16:17:42 +00:00
|
|
|
Note: on many Linux versions (for example on Kubuntu 15.04) the user must
|
|
|
|
belong to the dialout group.
|
|
|
|
|
|
|
|
You may need to run something like
|
|
|
|
|
|
|
|
sudo usermod -a -G dialout username
|
|
|
|
|
|
|
|
with your correct username and log out and log in again for that to take
|
|
|
|
effect.
|
|
|
|
|
2015-07-04 16:00:30 +00:00
|
|
|
If you get errors like:
|
|
|
|
|
2015-10-14 03:05:47 +00:00
|
|
|
./subsurface: error while loading shared libraries: libGrantlee_Templates.so.5: cannot open shared object file: No such file or directory
|
2015-07-04 16:00:30 +00:00
|
|
|
|
|
|
|
You can run the following command:
|
|
|
|
|
2015-07-04 16:17:42 +00:00
|
|
|
sudo ldconfig ~/src/install-root/lib
|
2015-07-04 16:00:30 +00:00
|
|
|
|
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
Building Subsurface under MacOSX
|
|
|
|
--------------------------------
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2018-04-23 14:54:12 +00:00
|
|
|
You have 2 options for the first time install, either using homebrew
|
|
|
|
or by manually building the dependencies from source, depending on
|
|
|
|
what else you have installed on your mac.
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
0) You need to have XCode installed. The first time (and possibly after updating OSX)
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
0.1) run "xcode-select --install"
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2018-04-23 11:16:46 +00:00
|
|
|
homebrew option:
|
|
|
|
|
|
|
|
1) brew install libzip cmake libusb pkg-config automake libtool hidapi curl libssh2
|
|
|
|
|
|
|
|
2) cd <repo>/..; bash <repo>/scripts/build.sh
|
|
|
|
|
|
|
|
|
|
|
|
Manual option:
|
|
|
|
1) install pkg-config
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
1.1) download http://sourceforge.net/projects/macpkg/files/PkgConfig/0.26/PkgConfig.pkg/download
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
1.2) run "PkgConfig.pkg"
|
2014-12-25 22:44:59 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
1.3) run "sudo ln -s /opt/pkgconfig/bin/pkg-config /usr/local/bin/pkg-config"
|
2014-12-25 22:44:59 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
2) install autoconf tools
|
2014-12-25 22:44:59 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
2.1) curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
|
2014-12-25 22:44:59 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
2.2) tar -xzf autoconf-latest.tar.gz
|
2014-12-25 22:44:59 +00:00
|
|
|
|
2018-04-23 14:54:12 +00:00
|
|
|
2.3) cd autoconf-*; ./configure && make && sudo make install; cd ..
|
2014-12-25 22:44:59 +00:00
|
|
|
|
2018-04-23 14:54:12 +00:00
|
|
|
3) cd <repo>/..; bash <repo>/scripts/build.sh -build-deps -desktop
|
2014-12-25 22:44:59 +00:00
|
|
|
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2015-04-09 22:46:25 +00:00
|
|
|
After the above is done, Subsurface.app will be available in the
|
2015-08-17 00:42:55 +00:00
|
|
|
subsurface/build directory. You can run Subsurface with the command
|
|
|
|
|
2018-04-23 11:16:46 +00:00
|
|
|
A) open subsurface/build/Subsurface.app
|
|
|
|
this will however not show diagnostic output
|
|
|
|
|
|
|
|
B) subsurface/build/Subsurface.app/Contents/MacOS/Subsurface
|
|
|
|
the TAB key is your friend :-)
|
|
|
|
|
|
|
|
Debugging can be done with either Xcode or QtCreator.
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2018-04-23 11:16:46 +00:00
|
|
|
To install the app for all users, move subsurface/build/Subsurface.app to /Applications.
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2014-02-26 16:21:13 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
Cross-building Subsurface on MacOSX for iOS
|
|
|
|
-------------------------------------------
|
|
|
|
|
|
|
|
1) build SubSurface under MacOSX
|
|
|
|
2) build as described in subsurface/packaging/ios
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-09 01:29:04 +00:00
|
|
|
Cross-building Subsurface on Linux for Windows
|
|
|
|
----------------------------------------------
|
|
|
|
|
|
|
|
Subsurface builds nicely with MinGW - the official builds are done as
|
2015-10-14 03:05:47 +00:00
|
|
|
cross builds under Linux (currently on Ubuntu 14.04). A shell script to do
|
2013-10-09 01:29:04 +00:00
|
|
|
that (plus the .nsi file to create the installer with makensis) are
|
2013-12-12 16:10:49 +00:00
|
|
|
included in the packaging/windows directory.
|
2013-10-09 01:29:04 +00:00
|
|
|
|
2015-10-14 03:05:47 +00:00
|
|
|
Please read through the explanations and instructions in
|
|
|
|
packaging/windows/mxe-based-build.sh if you want to build the Windows
|
|
|
|
version on your Linux system.
|
2014-12-16 02:19:21 +00:00
|
|
|
|
2013-10-09 01:29:04 +00:00
|
|
|
|
|
|
|
Building Subsurface on Windows
|
|
|
|
------------------------------
|
|
|
|
|
2014-12-16 02:19:21 +00:00
|
|
|
This is NOT RECOMMENDED. To the best of our knowledge there is one single
|
2015-02-12 00:38:08 +00:00
|
|
|
person who regularly does this. The Subsurface team does not provide support
|
2015-10-14 03:05:47 +00:00
|
|
|
for Windows binary build from sources natively under Windows...
|
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
The lack of a working package management system for Windows makes it
|
2018-04-23 11:16:46 +00:00
|
|
|
really painful to build Subsurface natively under Windows,
|
2018-04-23 08:13:47 +00:00
|
|
|
so we don't support that at all.
|
2015-08-18 07:06:37 +00:00
|
|
|
|
2018-04-23 08:13:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
Cross-building Subsurface on Linux for Android
|
|
|
|
----------------------------------------------
|
2015-08-18 07:06:37 +00:00
|
|
|
|
|
|
|
To compile the mobile version you will need:
|
|
|
|
|
|
|
|
-Qt for Android (this can be downloaded from: http://www.qt.io/download-open-source/)
|
|
|
|
-Android SDK
|
|
|
|
-Android NDK
|
|
|
|
|
|
|
|
In the packaging/android folder, open the build.sh file and add the paths to the SDK,
|
|
|
|
NDK and Qt for android at the top.
|
|
|
|
|
|
|
|
After that, you can run: ./subsurface/packaging/android/build.sh
|
|
|
|
|
|
|
|
This will generate an apk file in ./subsurface-mobile-build-arm/bin
|