another warning that’s outside my scope
[alioth/musescore.git] / debian / rules
1 #!/usr/bin/make -f
2
3 CWD:=$(abspath .)
4
5 ifeq (,$(filter terse,${DEB_BUILD_OPTIONS}))
6 export DH_VERBOSE=1
7 export V=1
8 export VERBOSE=1
9 endif
10
11 LC_ALL:=C.UTF-8
12 export LC_ALL
13
14 shellescape='$(subst ','\'',$(1))'
15 shellexport=$(1)=$(call shellescape,${$(1)})
16
17 MSPPKG=musescore
18 MSCPKG=${MSPPKG}-common
19 MSPDIR=debian/${MSPPKG}
20 MSCDIR=debian/${MSCPKG}
21 MSHARE=usr/share/mscore-*
22
23 DEB_HOST_ARCH?=$(shell dpkg-architecture -qDEB_HOST_ARCH)
24 DEB_HOST_ARCH_OS?=$(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
25
26 OUR_CPPFLAGS:=
27 OUR_CFLAGS:=
28 OUR_CXXFLAGS:=
29 OUR_LDFLAGS:=
30
31 # unclutter build log; these are upstream’s to fix
32 OUR_CPPFLAGS+=  -Wno-deprecated-declarations
33 OUR_CPPFLAGS+=  -Wno-deprecated-copy
34
35 # only needed when backporting to buster and older
36 #OUR_LDFLAGS+=  -Wl,--as-needed
37
38 # defined for most of the code anyway; doing this here helps the PCH
39 OUR_CPPFLAGS+=  -DQT_NO_DEBUG
40 # avoid stray debugging output
41 OUR_CPPFLAGS+=  -DNDEBUG
42 # disable phoning home
43 OUR_CPPFLAGS+=  -DMSCORE_NO_UPDATE_CHECKER
44
45 # better debugging if requested
46 ifneq (,$(findstring optdbg,${DEB_BUILD_OPTIONS}))
47 OUR_CFLAGS+=    -Og -g3
48 OUR_CXXFLAGS+=  -Og -g3
49 endif
50
51 # things that cannot be passed via CPPFLAGS
52 OUR_CPPFLAGS+=  -I${CWD}/debian/q-include
53
54 dpkgbuildflagsmkescape=$(subst \,\\\,$(1))
55 export DEB_BUILD_MAINT_OPTIONS:=hardening=+all
56 export DEB_CPPFLAGS_MAINT_APPEND:=$(call dpkgbuildflagsmkescape,${OUR_CPPFLAGS})
57 export DEB_CFLAGS_MAINT_APPEND:=$(call dpkgbuildflagsmkescape,${OUR_CFLAGS})
58 export DEB_CXXFLAGS_MAINT_APPEND:=$(call dpkgbuildflagsmkescape,${OUR_CXXFLAGS})
59 export DEB_LDFLAGS_MAINT_APPEND:=$(call dpkgbuildflagsmkescape,${OUR_LDFLAGS})
60 include /usr/share/dpkg/buildflags.mk
61 ifneq (,$(wildcard /usr/share/dpkg/buildtools.mk))
62 include /usr/share/dpkg/buildtools.mk
63 endif
64 include /usr/share/dpkg/pkg-info.mk
65
66 %:
67         dh $@ --buildsystem=cmake
68
69 CMAKE_DEFS:=    -DCMAKE_SKIP_RPATH=ON
70 CMAKE_DEFS+=    -DDOWNLOAD_SOUNDFONT=OFF
71 CMAKE_DEFS+=    -DUSE_SYSTEM_FREETYPE=ON \
72                 -DFREETYPE_INCLUDE_DIRS=/usr/include/freetype2/
73 CMAKE_DEFS+=    -DBUILD_WEBKIT=OFF
74
75 ifneq (linux,${DEB_HOST_ARCH_OS})
76 CMAKE_DEFS+=    -DBUILD_PORTMIDI=OFF
77 endif
78
79 override_dh_auto_configure:
80         rm -rf debian/q-include
81         mkdir debian/q-include
82         printf '#define DEB_PKG_VERSION "%s (%s %s/%s)"\n' \
83             $(call shellescape,${DEB_VERSION}) \
84             "$$(lsb_release -si)" \
85             "$$(lsb_release -sc)" \
86             $(call shellescape,${DEB_HOST_ARCH}) \
87             >debian/q-include/DEB_PKG_VERSION.h
88         exec dh_auto_configure -- ${CMAKE_DEFS}
89
90 override_dh_auto_build:
91         env GNUMAKEFLAGS="$$GNUMAKEFLAGS --output-sync" \
92             dh_auto_build -- lrelease all
93
94 override_dh_auto_test:
95         exec mksh debian/buildtest ${DEB_BUILD_OPTIONS}
96
97 execute_after_dh_install-indep:
98         # make system-wide soundfonts available
99         cd ${MSCDIR}/${MSHARE} && mkdir -p sound && \
100             ln -sf ../../sounds/sf2 ../../sounds/sf3 ../../sounds/sfz sound/
101
102 execute_after_dh_auto_clean:
103         rm -rf debian/q-include
104         -chmod -R g-w . # work around #796257 for Debian reproducible-builds