source: subsurface/INSTALL @ ac72bcfa

Mtestandroid_testdcDownloadforatdotdegitMergegitdebuggitpicturesiosmergeKirigamiPortpictimeshiftresolutionIndependencespinnertestTomaztestingv4.4-branchv4.5-branch
Last change on this file since ac72bcfa was ac72bcfa, checked in by Dirk Hohndel <dirk@…>, 3 years ago

Updated Mac build instructions

This uses Qt5 downloaded from their website (as Qt5 from homebrew
fails to link and thus is not working for me) and our custom
libdivecomputer and marble

[Dirk Hohndel: reformatted, minor typos fixed, removed the conflicting

MacPorts? instructions]

Signed-off-by: Robert C. Helling <helling@…>
Signed-off-by: Dirk Hohndel <dirk@…>

  • Property mode set to 100644
File size: 13.3 KB
Line 
1Building Subsurface from Source
2===============================
3
4Subsurface uses 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,
7and 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, we have some hints how to do so
14here as well.
15
16As of Subsurface 4.3 all of the prebuilt binaries that we provide (right
17now Windows64, Windows32, Mac, Ubuntu and LinuxMint) are built using our
18own custom "flavors" of libdivecomputer and libmarblewidget. You can get
19these from
20
21git://git.subsurface-divelog.org/marble (in the Subsurface-4.3 branch)
22git://git.subsurface-divelog.org/libdc (in the Subsurface-4.3 branch)
23
24Both of these repositories also have a Subsurface-testing branch. That
25branch is explicitly marked as NOT STABLE and will receive force pushes.
26The rationale for this is that we have no intention of forking either of
27these two projects. We simply are adding a few patches on top of their
28latest versions and so those testing branches get frequently rebased.
29
30Also, all of the prebuilt binaries (with the exception of the Windows32
31build) are now Qt5 based and Qt5 is considered the stable and supported
32framework to use for building Subsurface.
33
34Build options for Subsurface
35----------------------------
36
37The following options are recognized when passed to qmake:
38
39 -config debug        Create a debug build
40 -config release      Create a release build
41                      The default depends on how Qt was built.
42 V=1                  Disable the "silent" build mode
43 LIBDCDEVEL=1         Search for libdivecomputer in ../libdivecomputer
44 LIBMARBLEDEVEL=path  Search for marble library and includes in path
45 SPECIAL_MARBLE_PREFIX=1 Use libssrfmarblewidget as library name
46                      This is needed when building with our marble branch
47 LIBGIT2DEVEL=path    Search for libgit2 library and includes in path
48 INCLUDEPATH+=xxx     Add xxx to the include paths to the compiler
49                      (pass the actual path, without -I)
50 LIBS+=xxx            Add xxx to the linker flags. -l and -L options are
51                      recognized.
52
53The INCLUDEPATH and LIBS options are useful to tell the buildsystem
54about non-standard installation paths for the dependencies (such as
55Marble). They can be repeated as often as needed, or multiple
56arguments can be passed on the same switch, separated by a space. For
57example:
58
59  qmake LIBS+="-L$HOME/marble/lib -L$HOME/libdivecomputer/lib" \
60        INCLUDEPATH+="$HOME/marble/include $HOME/libdivecomputer/include"
61
62
63Building Subsurface 4 under Linux
64---------------------------------
65
66On Fedora you need
67
68sudo yum install git gcc-c++ make autoconf automake libtool cmake \
69        libzip-devel libxml2-devel libxslt-devel libsqlite3x-devel \
70        libgit2-devel libudev-devel libusbx-devel \
71        qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtscript-devel \
72        qt5-qtwebkit-devel qt5-qtsvg-devel qt5-qttools-devel
73
74Package names are sadly different on OpenSUSE
75
76sudo zypper install git gcc-c++ make autoconf automake libtool cmake libzip-devel \
77        libxml2-devel libxslt-devel sqlite3-devel libgit2-devel libusb-1_0-devel \
78        libqt5-linguist-devel libqt5-qttools-devel libQt5WebKitWidgets-devel \
79        libqt5-qtbase-devel libQt5WebKit5-devel libqt5-qtsvg-devel \
80        libqt5-qtscript-devel libqt5-qtdeclarative-devel
81
82On Debian Jessie this seems to work
83
84sudo apt-get install git g++ make autoconf libtool cmake pkg-config \
85        libxml2-dev libxslt1-dev libzip-dev libsqlite3-dev \
86        libusb-1.0-0-dev libgit2-dev \
87        qt5-default qtchooser qttools5-dev-tools libqt5svg5-dev libqt5webkit5-dev \
88        libqt5qml5 libqt5quick5 libqt5declarative5 qtscript5-dev
89
90On Debian style distributions you can install the required development
91packages by running (once Qt version of subsurface is available in your
92distribution)
93$ sudo apt-get build-dep subsurface
94but on many of them this will give you the build dependencies for the
95official package (which is often way out of date). So be careful that this
96doesn't get you a Qt4 based environment
97
98
99First you need to compile our version of libdivecomputer:
100
101$ mkdir ~/src # unless you have this already
102$ cd ~/src
103$ git clone -b Subsurface-4.3 git://subsurface-divelog.org/libdc libdivecomputer
104       # or -b Subsurface-testing to get the testing version - careful,
105       #                          careful - this gets rebased and may be broken
106
107$ cd libdivecomputer
108$ autoreconf --install
109$ ./configure --disable-shared
110$ make
111$ sudo make install
112
113Then you compile our custom branch of libmarblewidget
114
115$ cd ~/src
116$ git clone -b Subsurface-4.3 git://subsurface-divelog.org/marble marble-source
117       # or -b Subsurface-testing to get the testing version - careful,
118       #                          careful - this gets rebased and may be broken
119
120$ mkdir marble-build
121$ cd marble-build
122$ cmake -DQTONLY=ON -DQT5BUILD=ON \
123        -DBUILD_MARBLE_APPS=OFF -DBUILD_MARBLE_EXAMPLES=OFF \
124        -DBUILD_MARBLE_TESTS=OFF -DBUILD_MARBLE_TOOLS=OFF \
125        -DBUILD_TESTING=OFF -DWITH_DESIGNER_PLUGIN=OFF \
126        -DBUILD_WITH_DBUS=OFF ../marble-source
127$ make # <- this step will take quite a while... if you have more cores
128       #    try make -j8 or something like that
129$ sudo make install
130
131Finally you can compile Subsurface:
132
133$ cd ~/src
134$ git clone git://subsurface-divelog.org/subsurface.git
135$ cd subsurface
136$ cd git checkout v4.3   # this get's you the last release
137                         # skip this step to build the latest development
138                         # version
139$ qmake SPECIAL_MARBLE_PREFIX=1
140# on Fedora/OpenSUSE you need qmake-qt5
141$ make
142$ sudo make install    # [optionally, add: prefix=/usr/local]
143
144At least on Fedora and OpenSUSE you need to make sure that /usr/local/lib
145is searched for shared libraries (this is where the steps above installed
146libdivecomputer and libmarblewidget in order not to conflict with system
147pacakges). So you need to do the following:
148
149$ sudo echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
150$ sudo ldconfig
151
152Now you should be able to start the Subsurface binary you just created
153with
154
155$ ./subsurface
156
157
158Building Subsurface under MacOSX (using Homebrew)
159-------------------------------------------------
160
1610) You need to have XCode installed. The first time (and possibly after updating OSX)
162you need to run
163
164$ xcode-select --install
165
1661)  Install Homebrew
167
168$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
169
1702) Install needed dependencies
171
172$ brew install asciidoc libzip sqlite cmake libusb pkg-config
173
1743) Make the brew version of sqlite the default
175
176$ brew link --force sqlite
177
1784) Download Qt from http://www.qt.io/download-open-source/
179
180In the installer, chose an install folder (e.g., /home/username/Qt5), in
181"Select components" select the most recent version and be sure you also
182install the "Source Components".
183
184Build it (takes a long time)
185
186$ cd ~/Qt5/5.4/Src/
187
188$ ./configure -prefix /usr/local -opensource
189
190$ make -j4
191
192$ make install
193
1945) Install custom subsurface Marble
195
196$ cd ~/src
197$ git clone -b Subsurface-4.3 git://subsurface-divelog.org/marble marble-source
198$ cd marble-source
199$ mkdir marble-build
200$ cd marble-build
201$ cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=TRUE -DWITH_PHONON=OFF \
202        -DQT5BUILD=ON -DCMAKE_INSTALL_PREFIX=/usr/local ../../marble-source
203$ cd src/lib/marble
204$ make -j4
205
2065) Install Libdivecomputer
207
208$ brew install automake libtool
209$ cd ~/src
210$ git clone -b Subsurface-4.3 git://subsurface-divelog.org/libdc libdivecomputer
211$ cd libdivecomputer
212$ autoreconf --install
213$ ./configure --disable-shared
214$ make -j4
215$ make install
216
217
2186) Compile Subsurface
219
220$ cd ~/src
221$ git clone git://subsurface-divelog.org/subsurface.git
222$ cd subsurface
223$ qmake SPECIAL_MARBLE_PREFIX=1 INCLUDEPATH+=/usr/local/include \
224        LIBS+=-L/usr/local/lib \
225        LIBS+='-L/usr/local/Cellar/libzip/0.11.2/lib -lzip -lz' \
226        INCLUDEPATH+=/usr/local/Cellar/libzip/0.11.2/include V=1 \
227        LIBMARBLEDEVEL=../marble-source/marble-build/
228$ make -j4
229$ make install_mac_bundle
230
231After the above is done, Subsurface will be installed to /Applications.
232
233Another option is to create a .dmg for distribution:
234
235$ qmake
236$ make
237$ make mac-create-dmg
238
239
240Cross-building Subsurface on Linux for Windows
241----------------------------------------------
242
243Subsurface builds nicely with MinGW - the official builds are done as
244cross builds under Linux (currently on Fedora 20). A shell script to do
245that (plus the .nsi file to create the installer with makensis) are
246included in the packaging/windows directory.
247
248Everywhere below the mingw64- prefix is used for the cross tools. If you
249really need a 32bit binary you need to use mingw32- as prefix and you may
250also run into issues creating an installable binary with Qt5 (i.e., you
251may have to go back to Qt4).
252
253The best way to get libdivecomputer to build appears to be
254
255$ mkdir -p ~/src
256$ cd ~/src
257$ git clone -b Subsurface-4.3 git://subsurface-divelog.org/libdc libdivecomputer
258       # or -b Subsurface-testing to get the testing version - careful,
259       #                          careful - this gets rebased and may be broken
260
261$ cd libdivecomputer
262$ autoreconf --install
263$ mingw64-configure --disable-shared
264$ mingw64-make
265$ sudo mingw64-make install
266
267To compile Marble, use:
268
269$ cd ~/src
270$ git clone -b Subsurface-4.3 git://subsurface-divelog.org/marble marble-source
271       # or -b Subsurface-testing to get the testing version - careful,
272       #                          careful - this gets rebased and may be broken
273
274$ mkdir marble-build
275$ cd marble-build
276$ mingg64-cmake -DQTONLY=ON -DQT5BUILD=ON \
277        -DBUILD_MARBLE_APPS=OFF -DBUILD_MARBLE_EXAMPLES=OFF \
278        -DBUILD_MARBLE_TESTS=OFF -DBUILD_MARBLE_TOOLS=OFF \
279        -DBUILD_TESTING=OFF -DWITH_DESIGNER_PLUGIN=OFF \
280        -DBUILD_WITH_DBUS=OFF ../marble-source
281$ mingw64-make # <- this step will take quite a while... if you have more cores
282               #    try ming64-make -j8 or something like that
283$ sudo mingw64-make install
284
285
286To compile libgit2, use:
287
288$ mkdir -p ~/src/libgit2/build
289$ git clone git://github.com/libgit2/libgit2 ~/src/libgit2
290$ cd ~/src/libgit2/build
291$ mingw64-cmake ..
292$ mingw64-make
293$ sudo mingw64-make install
294
295To compile Subsurface, use:
296
297$ cd ~/src
298$ git clone git://subsurface-divelog.org/subsurface.git
299$ cd subsurface
300$ cd git checkout v4.3   # this get's you the last release
301                         # skip this step to build the latest development
302                         # version
303$ packagin/windows/mingw-make.sh Qt5 SPECIAL_MARBLE_PREFIX=1
304$ packaging/windows/mingw-make.sh install
305$ packaging/windows/mingw-make.sh installer
306
307The last step assumes that you have a link from packaging/windows/dll to
308the correct directory in your MinGW installation. On my machine that is
309/usr/i686-w64-mingw64/sys-root/mingw/bin
310Similarly, the paths used in packaging/windows/mingw-make.sh may need to
311be adjusted according to your distributions layout
312
313Also, at least one version of Qt DLLs shipping with Fedora was
314self-inconsistent at caused random crashes at startup. Unless you have
315good reasons to build your own binaries, on Windows you may be better off
316with the pre-compiled binaries we provide.
317
318
319Building Subsurface on Windows
320------------------------------
321
322This is NOT RECOMMENDED. To the best of our knowledge there is one single
323person who regularly does this (and he provided these instructions). The
324Subsurface team does not provide support for Windows binary build from
325sources...
326
3271) Install msys-git:
328http://msysgit.github.io
329
330Tools part of MSYS are required for building Subsurface, while you also
331need Git to be upstream and contribute to the project.
332Make sure that the msys/bin (or git/bin) folder is in PATH.
333
3342) Install Qt
335http://qt-project.org/downloads
336
337Subsurface is currently built against Qt 4.8.5.
338
3393) Install a MinGW toolchain
340https://docs.google.com/open?id=0B4D8x6CJEmtuczdiQklwMEs4RUU
341
342Qt 4.8.5 comes without a compiler and you will have to download it from
343a separate location. Other compiler may work, but there are no guaranties for
344that. Make sure that the mingw/bin folder is in PATH.
345
3464) Install Libdivecomputer
347Use similar steps to the previous section, without the sudo command.
348
3495) Install CMake (required for building Marble):
350http://www.cmake.org/cmake/resources/software.html
351
352Make sure that the cmake/bin folder is in PATH.
353
3545) Download and build Marble
355http://marble.kde.org/sources.php
356http://techbase.kde.org/Projects/Marble/WindowsCompiling#Compiling_Marble_using_MingW
357
358Make sure you build both the Debug and Release versions.
359
3606) Install pkg-config
361http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip
362
363pkg-config depends on DLL files such as libglib-2.0-0.dll and has to be in
364PATH, so it's best that you copy the executable to msys/bin.
365
3667) Install other dependencies
367Subsurface also depends on the following libraries:
368
369* libxml2
370http://www.xmlsoft.org/downloads.html
371* libxslt
372http://xmlsoft.org/XSLT/
373* libusb-1.0
374http://sourceforge.net/apps/trac/libusb-win32/wiki
375* zlib
376http://www.zlib.net/
377* libzip
378http://www.nih.at/libzip/
379
380Once you have the libraries, create .pc files (pkg-config) for them and place
381the files in a folder that is indicated by the PKG_CONFIG_PATH environment
382variable - e.g. PKG_CONFIG_PATH=c:\msys\pkg-config
383
384To build subsurface, use:
385
386$ git clone git://subsurface-divelog.org/subsurface.git
387$ cd subsurface
388$ qmake
389$ make
390$ make install
391$ make installer
Note: See TracBrowser for help on using the repository browser.