summaryrefslogtreecommitdiff
path: root/media-sound/musescore/musescore-9999.ebuild
blob: 64805a399f3cb0f0eee98d27975dc6ae9235811b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

# https://bugs.gentoo.org/958256, bundled fluidsynth:
# src/framework/audio/thirdparty/fluidsynth/fluidsynth-2.3.3/src/gentables/CMakeLists.txt
# upstream files are >=3.16, KDDockWidgets is 3.12
CMAKE_QA_COMPAT_SKIP=yes
CHECKREQS_DISK_BUILD=3500M
inherit cmake flag-o-matic xdg check-reqs

if [[ ${PV} == "9999" ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/musescore/MuseScore.git"
else
	SRC_URI="
		https://github.com/musescore/MuseScore/archive/v${PV}.tar.gz -> ${P}.tar.gz
	"
	KEYWORDS="~amd64 ~arm64 ~x86"
	S="${WORKDIR}/MuseScore-${PV}"
fi

DESCRIPTION="WYSIWYG Music Score Typesetter"
HOMEPAGE="https://musescore.org/"
# MuseScore_General-*.tar.bz2 packaged from https://ftp.osuosl.org/pub/musescore/soundfont/MuseScore_General/
# It has to be repackaged because the files are not versioned, current version can be found in VERSION file there.
SRC_URI+=" https://dev.gentoo.org/~fordfrog/distfiles/MuseScore_General-0.2.0.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
IUSE="jack pipewire test video websockets"
REQUIRED_USE="?? ( jack pipewire )"
RESTRICT="!test? ( test )"

BDEPEND="
	dev-qt/qttools:6[linguist]
	virtual/pkgconfig
"
RDEPEND="
	dev-libs/pugixml
	dev-qt/qtbase:6[concurrent,dbus,gui,network,opengl,widgets,xml,X]
	dev-qt/qt5compat:6[qml]
	dev-qt/qtdeclarative:6
	dev-qt/qtnetworkauth:6
	dev-qt/qtscxml:6
	dev-qt/qtsvg:6
	media-libs/alsa-lib
	media-libs/flac:=
	media-libs/freetype
	media-libs/harfbuzz:=
	media-libs/libopusenc
	media-libs/opus
	media-sound/lame
	virtual/zlib:=
	jack? ( virtual/jack )
	pipewire? ( media-video/pipewire:= )
	video? ( media-video/ffmpeg:= )
	websockets? ( dev-qt/qtwebsockets:6 )
"
DEPEND="${RDEPEND}
	dev-libs/utfcpp
	test? ( dev-cpp/gtest )
"

src_unpack() {
	if [[ ${PV} == "9999" ]]; then
		git-r3_src_unpack
		unpack ${A}
	else
		default
	fi
}

src_prepare() {
	# see https://github.com/musescore/MuseScore/issues/11572
	# keep global/thirdparty/picojson, upstream is inactive
	# keep dockwindow/thirdparty/KDDockWidgets, using priv headers
	# keep audio/thirdparty/fluidsynth, using priv headers
	# keep audio/thirdparty/stb, one file, same as miniaudio
	local rm_deps=(
		audio/thirdparty/flac
		audio/thirdparty/lame
		audio/thirdparty/opus
		audio/thirdparty/opusenc
		draw/thirdparty/freetype
		global/thirdparty/pugixml
		global/thirdparty/utfcpp
		testing/thirdparty/googletest
	)

	local bundle
	for bundle in "${rm_deps[@]}"; do
		rm -r muse/framework/"${bundle}" || die
	done

	cmake_src_prepare

	# Move soundfonts to the correct directory
	mv -v "${WORKDIR}"/sound/* "${S}"/share/sound/ || die "Failed to move soundfont files"
}

src_configure() {
	# confuses rcc, bug #908808
	filter-lto

	local mycmakeargs=(
		-DCMAKE_POSITION_INDEPENDENT_CODE=ON # https://github.com/musescore/MuseScore/issues/28797
		-DCMAKE_BUILD_TYPE="release"
		-DCMAKE_CXX_FLAGS_RELEASE="${CXXFLAGS}"
		-DCMAKE_C_FLAGS_RELEASE="${CFLAGS}"
		-DCMAKE_SKIP_RPATH=TRUE
		-DGZIP_EXECUTABLE=OFF # avoid compressed manpages
		-DMUE_BUILD_IMPEXP_VIDEOEXPORT_MODULE="$(usex video)"
		-DMUE_COMPILE_USE_SYSTEM_FLAC=ON
		-DMUE_COMPILE_USE_SYSTEM_FREETYPE=ON
		-DMUE_COMPILE_USE_SYSTEM_OPUS=ON
		-DMUE_COMPILE_USE_SYSTEM_OPUSENC=ON
		-DMUE_COMPILE_USE_SYSTEM_HARFBUZZ=ON
		-DMUE_DOWNLOAD_SOUNDFONT=OFF
		-DMUSE_APP_BUILD_MODE="release"
		-DMUSE_COMPILE_USE_COMPILER_CACHE=OFF
		-DMUSE_COMPILE_USE_PCH=OFF
		-DMUSE_MODULE_AUDIO_JACK="$(usex jack)"
		-DMUSE_MODULE_DIAGNOSTICS_CRASHPAD_CLIENT=OFF
		-DMUSE_MODULE_NETWORK_WEBSOCKET="$(usex websockets)"
		-DMUSE_MODULE_UPDATE=OFF
		-DMUSE_PIPEWIRE_AUDIO_DRIVER="$(usex pipewire)"
		# tests
		-DMUSE_ENABLE_UNIT_TESTS="$(usex test)"
		-DMUE_BUILD_BRAILLE_TESTS="$(usex test)"
		-DMUE_BUILD_CONVERTER_TESTS="$(usex test)"
		-DMUE_BUILD_ENGRAVING_TESTS="$(usex test)"
		-DMUE_BUILD_IMPORTEXPORT_TESTS="$(usex test)"
		-DMUE_BUILD_NOTATION_TESTS="$(usex test)"
		-DMUE_BUILD_PLAYBACK_TESTS="$(usex test)"
		-DMUE_BUILD_PROJECT_TESTS="$(usex test)"
	)
	cmake_src_configure
}

src_test() {
	CMAKE_SKIP_TESTS=(
		# see https://github.com/musescore/MuseScore/issues/30434
		# Global_AllocatorTests* fail with gcc only, to investigate
		muse_global_tests
		# segfault
		muse_audio_tests
		# see bug #950450 too
		iex_musicxml_tests
	)

	QT_QPA_PLATFORM=offscreen cmake_src_test
}

pkg_preinst() {
	xdg_pkg_preinst

	if ! has_version "media-sound/musescore" && ! use pipewire; then
		show_pipewire_warning=1
	fi
}

pkg_postinst() {
	xdg_pkg_postinst

	if [[ -n ${show_pipewire_warning} ]]; then
		ewarn "PipeWire support is disabled but it's the default audio driver anyway!"
		ewarn "Check your configuration."
	fi
}