aboutsummaryrefslogtreecommitdiff
blob: de51689d1328e7d2fd4c8241dce006ff913d0663 (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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake readme.gentoo-r1 xdg

DESCRIPTION="RPG Maker 2000/2003 and EasyRPG games interpreter"
HOMEPAGE="https://easyrpg.org/player/
	https://github.com/EasyRPG/Player"
SRC_URI="https://easyrpg.org/downloads/player/${PV}/${P}.tar.xz"

# EasyRPG Player itself is GPLv3+.
# The program's logos are CC-BY-SA 4.0.
# --
# The program bundles several 3rd-party libraries.
#
# FMMidi files - licensed under the 3-clause BSD license.
# Since the files do not end up in the executable due to the configuration,
# we ignore it.
# - src/midisequencer.cpp
# - src/midisequencer.h
# - src/midisynth.cpp
# - src/midisynth.h
#
# dr_wav files - licensed under (public-domain or MIT-0):
# - src/external/dr_wav.h
# rang files - licensed under the Unlicense:
# - src/external/rang.hpp
# Note that both dr_wav and rang are un-bundled and replaced with versions
# provided by Gentoo packages. However, since these are header-only libraries,
# their licenses are still included in the LICENSE variable.
#
# PicoJSON is used only for Emscripten builds (and unbundled before build).
# --
# The program also uses a couple of 3rd-party fonts. Since these are not
# loaded at runtime, but rather baked into the executable at compile time,
# their licenses are also added to the License tag.
#
# Baekmuk files - licensed under the Baekmuk license:
# - resources/shinonome/korean/
#
# Shinonome files - released into the public domain:
# - resources/shinonome/
#
# ttyp0 files - licensed under the ttyp0 license,
# a variant of the MIT license:
# - resources/ttyp0/
#
# WenQuanYi files - licensed under
# GPLv2-or-later with Font Embedding Exception:
# - resources/wenquanyi/
#
#
# The upstream tarball contains also "Teenyicons", under the MIT license,
# but those are used only for Emscripten builds.

LICENSE="Baekmuk CC-BY-4.0 GPL-2+-with-font-exception GPL-3+ public-domain
	TTYP0 Unlicense || ( MIT-0 public-domain )"
SLOT="0"

KEYWORDS="~amd64"

IUSE="doc fluidsynth harfbuzz +sound truetype +wildmidi"
REQUIRED_USE="
	fluidsynth? ( sound )
	harfbuzz? ( truetype )
	wildmidi? ( sound )
"

PATCHES=(
	"${FILESDIR}"/${P}-backport-unbundle-dr_wav.patch
	"${FILESDIR}"/${P}-backport-unbundle-rang.patch
	"${FILESDIR}"/${P}-backport-update-for-fmt10.patch
	"${FILESDIR}"/${P}-unbundle-picojson.patch
)

DEPEND="
	dev-cpp/rang
	>=dev-games/liblcf-${PV}
	dev-libs/libfmt:=
	media-libs/libpng:=
	>=media-libs/libsdl2-2.0.5[joystick,sound?,video]
	sys-libs/zlib
	x11-libs/pixman
	harfbuzz? ( media-libs/harfbuzz:=[truetype] )
	truetype? ( media-libs/freetype:= )
	sound? (
			 media-libs/dr_wav
			 media-libs/libsndfile
			 media-libs/libvorbis
			 media-libs/opusfile
			 media-libs/speexdsp
			 media-sound/mpg123
			 media-libs/libxmp
			 fluidsynth? ( media-sound/fluidsynth )
			 wildmidi? ( media-sound/wildmidi )
			 !fluidsynth? ( !wildmidi? ( media-libs/alsa-lib ) )
		   )
"
RDEPEND="${DEPEND}
	fluidsynth? ( media-sound/fluid-soundfont )
"
BDEPEND="virtual/pkgconfig
	doc? ( app-doc/doxygen[dot] )
"

DOC_CONTENTS="
EasyRPG Player chooses its library for MIDI output in increasing order:
1. FluidSynth
2. WildMIDI
3. ALSA

With all three enabled, it first tries to send MIDI messages to FluidSynth. If
that fails it falls back to WildMIDI then to ALSA. Currently, the capability to
find and configure a suitable MIDI client through ALSA is limited. It is
recommended to enable one of the other backends, otherwise you are likely to
have no sound.
This package enables support for the ALSA backend only if the other two are
disabled.

For the requirements for suitable ALSA MIDI clients please reference the source
code at src/platform/linux/midiout_device_alsa.cpp
"

src_prepare() {
	# Install prebuilt manpage instead of rebuilding it conditionally.
	sed -i -e "s/if(ASCIIDOCTOR_EXECUTABLE)/if(FALSE)/" \
		-e "s/SUPPORT_AUDIO=1/SUPPORT_AUDIO=$(usex sound 1 0)/" CMakeLists.txt || die
	cmake_src_prepare
}

src_configure() {
	local mycmakeargs=(
		-DPLAYER_BUILD_LIBLCF=OFF

		# Use the first default choice
		-DPLAYER_WITH_SPEEXDSP=$(usex sound)
		-DPLAYER_WITH_SAMPLERATE=no

		-DPLAYER_WITH_MPG123=$(usex sound)
		-DPLAYER_WITH_OGGVORBIS=$(usex sound)
		-DPLAYER_WITH_OPUS=$(usex sound)
		-DPLAYER_WITH_XMP=$(usex sound)

		# Avoid vendoring, use FluidSynth or WildMIDI (or ALSA) instead
		-DPLAYER_ENABLE_FMMIDI=no
		-DPLAYER_WITH_FLUIDSYNTH=$(usex fluidsynth)
		-DPLAYER_WITH_WILDMIDI=$(usex wildmidi)
		-DPLAYER_WITH_NATIVE_MIDI=$(usex sound $(usex fluidsynth no $(usex wildmidi no yes)) no)
		# Serves as fallback when FluidSynth isn't found
		-DPLAYER_WITH_FLUIDLITE=no
		# Enable dr_wav for faster WAV decoding, fall back to libsndfile
		-DPLAYER_ENABLE_DRWAV=$(usex sound)
		-DPLAYER_WITH_LIBSNDFILE=$(usex sound)

		# The text shaping engine is strictly dependent on the availability
		# of TrueType fonts
		-DPLAYER_WITH_HARFBUZZ=$(usex harfbuzz)
		-DPLAYER_WITH_FREETYPE=$(usex harfbuzz yes $(usex truetype))
	)
	cmake_src_configure
}

src_compile() {
	cmake_src_compile
	if use doc; then
		einfo "Building the documentation might take a while..."
		cmake_build doc
	fi
}

src_test() {
	cmake_build check
}

src_install() {
	cmake_src_install
	if use doc; then
		docinto /usr/share/doc/${PF}/html
		dodoc -r "${BUILD_DIR}"/doc/*
	fi
	readme.gentoo_create_doc
}

pkg_postinst() {
	xdg_pkg_postinst
	readme.gentoo_print_elog
}