source: subsurface/INSTALL @ 899d3ae

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

Update INSTALL file with package names for Debian and OpenSUSE

Still TODO are Mac and cross building

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

  • Property mode set to 100644
File size: 12.7 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  # on Fedora/OpenSUSE you need qmake-qt5
140$ make
141$ sudo make install    # [optionally, add: prefix=/usr/local]
142
143At least on Fedora you need to make sure that /usr/local/lib is searched
144for shared libraries (this is where the steps above installed
145libdivecomputer and libmarblewidget in oder not to conflict with system
146pacakges). So you need to do the following:
147$ sudo echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
148$ sudo ldconfig
149
150Now you should be able to start the Subsurface binary you just created
151with
152
153$ ./subsurface
154
155
156Building Subsurface under MacOSX (using Homebrew)
157-------------------------------------------------
158
1590) You need to have XCode installed. The first time (and possibly after updating OSX)
160you need to run
161
162$ xcode-select --install
163
1641)  Install Homebrew
165
166$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
167
1682) Install needed dependencies
169
170$ brew install asciidoc libzip qt sqlite cmake libusb pkg-config
171
1723) Make the brew version of sqlite the default
173
174$ brew link --force sqlite
175
1764) Install Marble
177
178$ mkdir -p ~/src/marble/build
179$ git clone -b KDE/4.11 git://anongit.kde.org/marble ~/src/marble/sources
180$ cd ~/src/marble/build
181$ cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local ../sources
182 - or -
183$ cmake -DCMAKE_BUILD_TYPE=Release -DQTONLY=TRUE -DCMAKE_INSTALL_PREFIX=/usr/local ../sources
184$ cd src/lib
185$ make -j4
186$ install_name_tool -id /usr/local/lib/`echo libmarblewidget.??.dylib` libmarblewidget.dylib
187$ cp *dylib /usr/local/lib/
188$ mkdir -p /usr/local/include/marble
189$ cd ../../../sources/src/lib
190$ cp $(find . -name '*.h') /usr/local/include/marble/
191
1925) Install Libdivecomputer
193
194$ brew install automake libtool
195$ cd ~/src
196$ git clone git://git.libdivecomputer.org/libdivecomputer
197$ cd libdivecomputer
198$ git checkout release-0.4
199$ autoreconf --install
200$ ./configure --disable-shared
201$ make
202$ make install
203
2046) Compile Subsurface
205
206$ cd ~/src
207$ git clone git://subsurface-divelog.org/subsurface.git
208$ cd subsurface
209$ qmake
210$ make
211$ make install_mac_bundle
212
213After the above is done, Subsurface will be installed to
214/Applications.
215
216Another option is to create a .dmg for distribution:
217
218$ qmake
219$ make
220$ make mac-create-dmg
221
222NOTES: macdeployqt assumes that the plugins are located "next" to the
223frameworks. The frameworks are linked from /usr/local/lib - but the
224plugins are not in /usr/local/plugins.
225The easiest workaround is to create a symbolic link from
226/usr/local/plugins to /usr/local/Cellar/qt/4.8.5/plugins (or whatever
227version of Qt you have built earlier).
228
229Building the Qt version under MacOSX (using MacPorts)
230-----------------------------------------------------
231
2321)  Install MacPorts
233
234Please refer to http://www.macports.org/install.php
235
2362)  Install needed dependencies
237
238$ sudo port -vp install asciidoc libzip libusb sqlite cmake qt4-mac marble libdivecomputer libgit2
239
2403)  Check dependencies' versions
241
242$ port installed qt4-mac libdivecomputer marble libzip asciidoc libusb sqlite cmake
243The following ports are currently installed:
244  asciidoc @8.6.9_1 (active)
245  cmake @2.8.12_3 (active)
246  libdivecomputer @0.4.1_0 (active)
247  libgit2 @0.20.0_0 (active)
248  libusb @1.0.18_0 (active)
249  libzip @0.11.1_0 (active)
250  marble @4.12.2_0 (active)
251  qt4-mac @4.8.5_1 (active)
252
2534) Compile Subsurface
254
255$ cd ~/src
256$ git clone git://subsurface-divelog.org/subsurface.git
257$ cd subsurface
258$ qmake
259$ make
260$ make install_mac_bundle
261
262Cross-building Subsurface on Linux for Windows
263----------------------------------------------
264
265Subsurface builds nicely with MinGW - the official builds are done as
266cross builds under Linux (currently on Fedora 19). A shell script to do
267that (plus the .nsi file to create the installer with makensis) are
268included in the packaging/windows directory.
269
270The best way to get libdivecomputer to build appears to be
271
272$ mkdir -p ~/src
273$ git clone git://git.libdivecomputer.org/libdivecomputer ~/src/libdivecomputer
274$ cd ~/src/libdivecomputer
275$ git checkout release-0.4
276$ mingw32-configure --disable-shared
277$ mingw32-make
278$ sudo mingw32-make install
279
280To compile Marble, use:
281
282$ mkdir -p ~/src/marble/build
283$ git clone -b KDE/4.11 git://anongit.kde.org/marble ~/src/marble/sources
284$ cd ~/src/marble/build
285$ mingw32-cmake -DCMAKE_BUILD_TYPE=Debug -DQTONLY=TRUE ../sources
286 - or -
287$ mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DQTONLY=TRUE ../sources
288$ mingw32-make -j4
289$ mingw32-make install
290
291To compile libgit2, use:
292
293$ mkdir -p ~/src/libgit2/build
294$ git clone git://github.com/libgit2/libgit2 ~/src/libgit2
295$ cd ~/src/libgit2/build
296$ mingw32-cmake ..
297$ mingw32-cmake --build .
298
299To compile Subsurface, use:
300
301$ mkdir -p ~/src/subsurface
302$ git clone git://subsurface-divelog.org/subsurface.git ~/src/subsurface
303$ cd ~/src/subsurface
304$ packaging/windows/mingw-make.sh
305$ packaging/windows/mingw-make.sh install
306$ packaging/windows/mingw-make.sh installer
307
308The last step assumes that you have a link from packaging/windows/dll to
309the correct directory in your MinGW installation. On my machine that is
310/usr/i686-w64-mingw32/sys-root/mingw/bin
311Similarly, the paths used in packaging/windows/mingw-make.sh may need to
312be adjusted according to your distributions layout
313
314
315Building Subsurface on Windows
316------------------------------
317
3181) Install msys-git:
319http://msysgit.github.io
320
321Tools part of MSYS are required for building Subsurface, while you also
322need Git to be upstream and contribute to the project.
323Make sure that the msys/bin (or git/bin) folder is in PATH.
324
3252) Install Qt
326http://qt-project.org/downloads
327
328Subsurface is currently built against Qt 4.8.5.
329
3303) Install a MinGW toolchain
331https://docs.google.com/open?id=0B4D8x6CJEmtuczdiQklwMEs4RUU
332
333Qt 4.8.5 comes without a compiler and you will have to download it from
334a separate location. Other compiler may work, but there are no guaranties for
335that. Make sure that the mingw/bin folder is in PATH.
336
3374) Install Libdivecomputer
338Use similar steps to the previous section, without the sudo command.
339
3405) Install CMake (required for building Marble):
341http://www.cmake.org/cmake/resources/software.html
342
343Make sure that the cmake/bin folder is in PATH.
344
3455) Download and build Marble
346http://marble.kde.org/sources.php
347http://techbase.kde.org/Projects/Marble/WindowsCompiling#Compiling_Marble_using_MingW
348
349Make sure you build both the Debug and Release versions.
350
3516) Install pkg-config
352http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip
353
354pkg-config depends on DLL files such as libglib-2.0-0.dll and has to be in
355PATH, so it's best that you copy the executable to msys/bin.
356
3577) Install other dependencies
358Subsurface also depends on the following libraries:
359
360* libxml2
361http://www.xmlsoft.org/downloads.html
362* libxslt
363http://xmlsoft.org/XSLT/
364* libusb-1.0
365http://sourceforge.net/apps/trac/libusb-win32/wiki
366* zlib
367http://www.zlib.net/
368* libzip
369http://www.nih.at/libzip/
370
371Once you have the libraries, create .pc files (pkg-config) for them and place
372the files in a folder that is indicated by the PKG_CONFIG_PATH environment
373variable - e.g. PKG_CONFIG_PATH=c:\msys\pkg-config
374
375To build subsurface, use:
376
377$ git clone git://subsurface-divelog.org/subsurface.git
378$ cd subsurface
379$ qmake
380$ make
381$ make install
382$ make installer
Note: See TracBrowser for help on using the repository browser.