source: subsurface/INSTALL

Last change on this file was 02f4490, checked in by Dirk Hohndel <dirk@…>, 4 weeks ago

Mac build: update instructions

Signed-off-by: Dirk Hohndel <dirk@…>

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