summaryrefslogtreecommitdiff
path: root/media-sound/ardour/ardour-9999.ebuild
blob: 9343d0abffccdb82b27c26a87e1e4062d6417d87 (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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{13..14} )
PYTHON_REQ_USE='threads(+)'
inherit desktop edo flag-o-matic optfeature python-any-r1 waf-utils toolchain-funcs xdg

DESCRIPTION="Digital Audio Workstation"
HOMEPAGE="https://ardour.org/"

if [[ ${PV} == *9999* ]]; then
	# Main repo not stable
	#EGIT_REPO_URI="https://git.ardour.org/ardour/ardour.git"
	EGIT_REPO_URI="https://github.com/Ardour/ardour.git"
	inherit git-r3
else
	# upstream doesn't provide a release tarball in github repo
	# see https://github.com/Ardour/ardour/blob/master/README-GITHUB.txt
	# official link is available here, but with token/expiration:
	# https://community.ardour.org/download?architecture=x86_64&type=source
	SRC_URI="https://dev.gentoo.org/~fordfrog/distfiles/Ardour-${PV}.tar.bz2"
	S="${WORKDIR}/Ardour-${PV}"
	KEYWORDS="~amd64 ~loong ~x86"
fi

LICENSE="GPL-2"
SLOT="9"
IUSE="doc jack phonehome pulseaudio test"
CPU_USE=(
	cpu_flags_x86_{avx,avx512f,fma3,sse}
)
IUSE+=" ${CPU_USE[@]}"
RESTRICT="!test? ( test )"

RDEPEND="
	app-arch/libarchive:=
	dev-cpp/cairomm:0[X]
	dev-cpp/glibmm:2
	dev-cpp/pangomm:1.4
	dev-libs/glib:2
	dev-libs/libsigc++:2
	dev-libs/libxml2:2=
	media-libs/alsa-lib
	media-libs/aubio:=
	media-libs/flac
	media-libs/fontconfig
	media-libs/freetype:2
	media-libs/liblo
	media-libs/liblrdf
	media-libs/libpng:=
	media-libs/libsamplerate
	media-libs/libsndfile
	media-libs/lilv
	media-libs/lv2
	media-libs/raptor:2
	media-libs/rubberband:=
	media-libs/taglib:=
	media-libs/vamp-plugin-sdk
	net-libs/libwebsockets:=
	net-misc/curl
	sys-apps/dbus
	sys-libs/readline:0=
	sci-libs/fftw:3.0=[threads]
	virtual/libusb:1
	x11-libs/cairo[X]
	x11-libs/libX11
	x11-libs/libXext
	x11-libs/libXinerama
	x11-libs/libXrandr
	x11-libs/pango
	x11-themes/hicolor-icon-theme
	jack? ( virtual/jack )
	pulseaudio? ( media-libs/libpulse )
"
#	media-libs/suil[X,gtk2] bundled suil is used, maybe probably because of ytk
#	!bundled-libs? ( media-sound/fluidsynth ) at least libltc is missing to be able to unbundle...
DEPEND="
	${RDEPEND}
	dev-libs/boost
	dev-libs/sord
	media-libs/sratom
	x11-libs/libXi
	test? ( dev-util/cppunit )
"
BDEPEND="
	${PYTHON_DEPS}
	dev-util/itstool
	sys-devel/gettext
	virtual/pkgconfig
	doc? (
		app-text/doxygen
		media-gfx/graphviz
	)
"

PATCHES=(
	"${FILESDIR}/${PN}-8.12-fix_fpu.patch"
	# see bug #966219
	"${FILESDIR}/${PN}-8.12-fix_fftranscode.patch"
)

src_prepare() {
	default

	local optflags=(
		$(usev cpu_flags_x86_sse sse)
	)
	# these flags imply sse and avx
	if use cpu_flags_x86_sse && use cpu_flags_x86_avx; then
		optflags+=(
			avx
			$(usev cpu_flags_x86_avx512f avx512f)
			$(usev cpu_flags_x86_fma3 fma)
		)
	fi

	# use only flags defined by users
	sed 's/flag_line = o.*/flag_line = \": '"${optflags[*]}"'\"/' \
		-i wscript || die

	# shebang
	python_fix_shebang wscript
	python_fix_shebang waf

	# fix hardcoded cpp, apply `gcc -E` needs patching but will fail w/ clang
	tc-export CPP
	sed -e "s@obj.command = 'cpp'@obj.command = '${CPP/-gcc -E/-cpp}'@" \
		-i gtk2_ardour/wscript || die

	# skip non-generic tests with failures
	sed -e "\@'test/fpu_test.cc',@d" -i libs/ardour/wscript || die
}

src_configure() {
	# avoid bug https://bugs.gentoo.org/800067
	local -x AS="$(tc-getCC) -c"

	# -Werror=odr
	# https://tracker.ardour.org/view.php?id=9649
	# https://bugs.gentoo.org/917095
	filter-lto

	append-ldflags -Wl,-rpath,"${EPREFIX}/usr/$(get_libdir)/ardour${SLOT}"

	local backends=(
		alsa
		dummy
		$(usev jack)
		$(usev pulseaudio)
	)

	# VST support is enabled by default given --no-lxvst is not called.
	# But please keep in mind the README (obsolete?) made by upstream.
	# https://github.com/Ardour/ardour/blob/master/PACKAGER_README
	tc-export CC CXX
	local myconf=(
		--configdir="${EPREFIX}"/etc
		--cxx17
		--freedesktop
		--no-execstack
		--noconfirm
		--optimize
		--with-backends=$(IFS=','; echo "${backends[*]}")
		$(usev !cpu_flags_x86_sse --no-fpu-optimization)
		$(usev !phonehome --no-phone-home)
		$(usev test --test)
		# not possible right now  --use-external-libs
		# missing dependency: https://github.com/c4dm/qm-dsp
	)

	waf-utils_src_configure "${myconf[@]}"
}

src_compile() {
	waf-utils_src_compile
	waf-utils_src_compile i18n
	if use doc; then
		pushd doc >/dev/null || die
		doxygen -u Doxyfile || die
		doxygen Doxyfile || die
		find . \( -iname '*.map' -o -iname '*.md5' \) -delete || die
		popd >/dev/null || die
	fi
}

src_test() {
	pushd "${S}"/libs/ardour/ >/dev/null || die
	edo ./run-tests.sh
	popd >/dev/null || die
}

src_install() {
	use doc && local HTML_DOCS=( doc/html/. )

	waf-utils_src_install

	mv ${PN}.1 ${PN}${SLOT}.1 || die
	doman ${PN}${SLOT}.1

	local s
	for s in 16 22 32 48 256 512; do
		newicon -s ${s} gtk2_ardour/resources/Ardour-icon_${s}px.png ardour${SLOT}.png
	done

	sed -i \
		-e "s/\(^Name=\).*/\1Ardour ${SLOT}/" \
		-e 's/;AudioEditing;/;X-AudioEditing;/' \
		build/gtk2_ardour/ardour${SLOT}.desktop || die
	domenu build/gtk2_ardour/ardour${SLOT}.desktop

	insinto /usr/share/mime/packages
	newins build/gtk2_ardour/ardour.xml ardour${SLOT}.xml
	rm "${D}/usr/share/mime/packages/ardour.xml" || die

	# the appdata directory is deprecated
	# no patch because this causes the translation fail
	mv "${ED}"/usr/share/{appdata,metainfo} || die
}

pkg_postinst() {
	xdg_pkg_postinst

	optfeature "another synth used by default if installed" media-plugins/gmsynth-lv2
	optfeature "exporting audio in mp3" media-video/ffmpeg[lame]

	elog "Please do _not_ report problems with the package to ${PN} upstream."
	elog "If you think you've found a bug, check the upstream binary package"
	elog "before you report anything to upstream."
}