1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools desktop elisp-common systemd toolchain-funcs user xdg-utils
9 MY_P=TiMidity++-${MY_PV}
12 DESCRIPTION="A handy MIDI to WAV converter with OSS and ALSA output support"
13 HOMEPAGE="http://timidity.sourceforge.net/"
14 SRC_URI="mirror://sourceforge/timidity/${MY_P}.tar.xz"
18 KEYWORDS="amd64 ~arm ~arm64 ~hppa ppc ppc64 sparc x86"
19 IUSE="alsa ao emacs flac gtk jack motif nas ncurses oss selinux slang speex tk vorbis X"
21 REQUIRED_USE="tk? ( X )"
24 alsa? ( media-libs/alsa-lib )
25 ao? ( >=media-libs/libao-0.8.5 )
26 emacs? ( >=app-editors/emacs-23.1:* )
27 flac? ( media-libs/flac )
28 gtk? ( x11-libs/gtk+:2 )
29 jack? ( virtual/jack )
30 motif? ( >=x11-libs/motif-2.3:0 )
31 nas? ( >=media-libs/nas-1.4 )
32 ncurses? ( sys-libs/ncurses:0= )
33 slang? ( sys-libs/slang )
34 speex? ( media-libs/speex )
35 tk? ( dev-lang/tk:0= )
36 vorbis? ( media-libs/libvorbis )
44 app-eselect/eselect-timidity
45 alsa? ( media-sound/alsa-utils )
46 selinux? ( sec-policy/selinux-timidity )
49 PDEPEND="|| ( media-sound/timidity-eawpatches media-sound/timidity-freepats )"
51 SITEFILE=50${PN}-gentoo.el
54 enewgroup audio 18 # Just make sure it exists
55 enewuser timidity -1 -1 /var/lib/timidity audio
58 DOCS=( AUTHORS ChangeLog NEWS README "${FILESDIR}"/timidity.cfg-r1 )
61 "${FILESDIR}"/${P}-params.patch
62 "${FILESDIR}"/${P}-revert-for-required-ctl_speana_data-function.patch
63 "${FILESDIR}"/${P}-tcltk86.patch
64 "${FILESDIR}"/${P}-ar.patch
65 "${FILESDIR}"/${P}-configure-flags.patch
66 "${FILESDIR}"/${P}-pkg-config.patch
67 "${FILESDIR}"/${P}-CVE-2017-1154{6,7}.patch
68 "${FILESDIR}"/${P}-gcc5.patch # bug 606894
77 export EXTRACFLAGS="${CFLAGS}" #385817
82 use flac && audios+=",flac"
83 use speex && audios+=",speex"
84 use vorbis && audios+=",vorbis"
85 use oss && audios+=",oss"
86 use jack && audios+=",jack"
87 use ao && audios+=",ao"
91 myconf+=( --with-nas-library="/usr/$(get_libdir)/libaudio.so" --with-x )
92 use X || ewarn "Basic X11 support will be enabled because required by nas."
97 myconf+=( --with-default-output=alsa --enable-alsaseq )
100 # We disable motif by default and then only enable it if it's requested.
102 myconf+=( --enable-motif --with-x )
103 use X || ewarn "Basic X11 support will be enabled because required by motif."
107 --localstatedir=/var/state/timidity++ \
108 --with-module-dir="${EPREFIX}/usr/share/timidity" \
109 --with-lispdir="${SITELISP}/${PN}" \
111 --enable-audio=${audios} \
116 --enable-spline=cubic \
117 $(use_enable emacs) \
118 $(use_enable slang) \
119 $(use_enable ncurses) \
121 $(use_enable X spectrogram) \
122 $(use_enable X wrd) \
123 $(use_enable X xskin) \
124 $(use_enable X xaw) \
126 $(use_enable tk tcltk) \
132 emake DESTDIR="${D}" install
135 # these are only for the ALSA sequencer mode
137 newconfd "${FILESDIR}"/conf.d.timidity.2 timidity
138 newinitd "${FILESDIR}"/init.d.timidity.4 timidity
140 systemd_dounit "${FILESDIR}"/timidity.service
144 newins "${FILESDIR}"/timidity.cfg-r1 timidity.cfg
146 dodir /usr/share/timidity
147 dosym ../../../etc/timidity.cfg /usr/share/timidity/timidity.cfg
150 elisp-site-file-install "${FILESDIR}/${SITEFILE}"
153 diropts -o timidity -g nobody -m 0700
154 keepdir /var/lib/timidity
156 doicon "${FILESDIR}"/timidity.xpm
157 newmenu "${FILESDIR}"/timidity.desktop.2 timidity.desktop
159 # Order of preference: gtk, X (Xaw), ncurses, slang
160 # Do not create menu item for terminal ones
161 local interface="-id"
162 local terminal="true"
163 local nodisplay="true"
164 if use gtk || use X; then
168 use gtk && interface="-ig"
169 elif use ncurses || use slang; then
170 local interface="-is"
171 use ncurses && interface="-in"
173 sed -e "s/Exec=timidity/Exec=timidity ${interface}/" \
174 -e "s/Terminal=.*/Terminal=${terminal}/" \
175 -e "s/NoDisplay=.*/NoDisplay=${nodisplay}/" \
176 -i "${D}"/usr/share/applications/timidity.desktop || die
180 use emacs && elisp-site-regen
182 elog "A timidity config file has been installed in /etc/timidity.cfg."
183 elog "Do not edit this file as it will interfere with the eselect timidity tool."
184 elog "The tool 'eselect timidity' can be used to switch between installed patchsets."
187 elog "An init script for the alsa timidity sequencer has been installed."
188 elog "If you wish to use the timidity virtual sequencer, edit /etc/conf.d/timidity"
189 elog "and run 'rc-update add timidity <runlevel> && /etc/init.d/timidity start'"
193 elog "Only saving to wave file and ALSA soundback has been tested working."
196 xdg_desktop_database_update
200 use emacs && elisp-site-regen
201 xdg_desktop_database_update