minimise d/rules diff to master
[alioth/musescore.git] / debian / rules
1 #!/usr/bin/make -f
2
3 ifeq (,$(findstring terse,${DEB_BUILD_OPTIONS}))
4 export DH_VERBOSE=1
5 export V=1
6 export VERBOSE=1
7 endif
8
9 LC_ALL:=C.UTF-8
10 export LC_ALL
11
12 MSPPKG=musescore
13 MSCPKG=${MSPPKG}-common
14 MSPDIR=debian/${MSPPKG}
15 MSCDIR=debian/${MSCPKG}
16 MSHARE=usr/share/mscore-*
17
18 DEB_HOST_ARCH?=$(shell dpkg-architecture -qDEB_HOST_ARCH)
19 DEB_HOST_ARCH_OS?=$(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
20
21 OUR_CPPFLAGS:=
22 OUR_CFLAGS:=
23 OUR_CXXFLAGS:=
24 OUR_LDFLAGS:=   -Wl,--as-needed
25
26 # defined for most of the code anyway; doing this here helps the PCH
27 OUR_CPPFLAGS+=  -DQT_NO_DEBUG
28 # avoid stray debugging output
29 OUR_CPPFLAGS+=  -DNDEBUG
30 # disable phoning home
31 OUR_CPPFLAGS+=  -DMSCORE_NO_UPDATE_CHECKER
32
33 # better debugging if requested
34 ifneq (,$(findstring optdbg,${DEB_BUILD_OPTIONS}))
35 OUR_CFLAGS+=    -Og
36 OUR_CXXFLAGS+=  -Og
37 endif
38
39 # things that cannot be passed via CPPFLAGS
40 OUR_CPPFLAGS+=  -I$(shell pwd)/debian/q-include
41
42 export DEB_BUILD_MAINT_OPTIONS := hardening=+all
43 export DEB_CPPFLAGS_MAINT_APPEND := ${OUR_CPPFLAGS}
44 export DEB_CFLAGS_MAINT_APPEND := ${OUR_CFLAGS}
45 export DEB_CXXFLAGS_MAINT_APPEND := ${OUR_CXXFLAGS}
46 export DEB_LDFLAGS_MAINT_APPEND := ${OUR_LDFLAGS}
47
48 %:
49         dh $@ --buildsystem=cmake
50
51 CMAKE_DEFS:=    -DCMAKE_SKIP_RPATH=ON
52 CMAKE_DEFS+=    -DDOWNLOAD_SOUNDFONT=OFF
53 CMAKE_DEFS+=    -DUSE_SYSTEM_FREETYPE=ON \
54                 -DFREETYPE_INCLUDE_DIRS=/usr/include/freetype2/
55
56 ifneq (linux,${DEB_HOST_ARCH_OS})
57 CMAKE_DEFS+=    -DBUILD_PORTMIDI=OFF
58 endif
59
60 # disable phoning home
61 CMAKE_DEFS+=    -DBUILD_WEBKIT=OFF
62
63 override_dh_auto_configure:
64         rm -rf debian/q-include
65         mkdir debian/q-include
66         printf '#define DEB_PKG_VERSION "%s (%s %s/%s)"\n' \
67             "$$(dpkg\-parsechangelog | sed -n '/^Version: */{s///p;q;}')" \
68             "$$(lsb_release -si)" \
69             "$$(lsb_release -sc)" \
70             "${DEB_HOST_ARCH}" \
71             >debian/q-include/DEB_PKG_VERSION.h
72         exec dh_auto_configure -- ${CMAKE_DEFS}
73
74 override_dh_auto_build:
75         env GNUMAKEFLAGS="$$GNUMAKEFLAGS --output-sync" \
76             dh_auto_build -- lrelease all
77
78 override_dh_auto_test:
79         exec mksh debian/buildtest ${DEB_BUILD_OPTIONS}
80
81 override_dh_install-indep:
82         # move stuff to packages
83         dh_install
84         # make system-wide soundfonts available
85         cd ${MSCDIR}/${MSHARE} && mkdir -p sound && \
86             ln -sf ../../sounds/sf2 ../../sounds/sf3 ../../sounds/sfz sound/
87
88 override_dh_auto_clean:
89         rm -rf debian/q-include
90         dh_auto_clean