Debian Codegraph @

debian/rules

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