Пакет TiMidity++: Specfile

%def_with emacs

%define prerel %nil
%define _name timidity

# Solution from OpenSuse
%global optflags_lto %nil

Name: TiMidity++
Version: 2.15.0
Release: alt1.2

Summary: Great-sounding CPU-hungry MIDI soundfile player
License: GPLv2
Group: Sound

Url: http://timidity.sourceforge.net
Source0: http://prdownloads.sourceforge.net/timidity/%name-%version%prerel.tar.bz2
Source1: timidity.init
Source2: timidity.sysconfig
Source3: timidity.desktop
Source100: TiMidity++.watch

# ALT patches
Patch0: TiMidity++-2.13.0-alt-config.patch
Patch4: TiMidity++-2.14.0-tcltk-link.patch

# Debian patches
# 0002-improve-error-message.patch
Patch100: TiMidity++-deb-improve-error-message.patch
# 0004-Fix-off-by-one-crash-error-in-panning-reverb.patch
Patch101: TiMidity++-deb-fix-off-by-one-crash-error-in-panning-reverb.patch
# 0006-Don-t-crash-when-started-in-daemon-mode.patch
Patch102: TiMidity++-deb-don-t-crash-when-started-in-daemon-mode.patch
# 0010-Pass-LDFLAGS-to-addon-linking.patch
Patch103: TiMidity++-deb-pass-ldflags-to-addon-linking.patch
# 0011-Fix-spelling-errors-found-by-lintian.patch
Patch104: TiMidity++-deb-fix-spelling-errors-found-by-lintian.patch

# SUSE patches
Patch200: TiMidity++-suse-fix-alsaseq-polling-at-idle-time.patch
Patch201: TiMidity++-suse-timidity-no-date.patch
Patch202: TiMidity++-suse-timidity-readmidi-zero-division-fix.patch
Patch203: TiMidity++-suse-timidity-resample-frac-overflow-fix.patch

%define tcl_ver 8.4.0-alt1
%define tk_ver 8.4.0-alt1

Requires: timidity-instruments
Requires: tcl >= %tcl_ver, tk >= %tk_ver

# just a file conflict
Conflicts: fluid-soundfont-lite-patches

# Automatically added by buildreq on Thu Feb 28 2019
# optimized out: emacs-base emacs-common fontconfig fontconfig-devel glib2-devel glibc-kernheaders-generic glibc-kernheaders-x86 gnu-config libICE-devel libSM-devel libX11-devel libX11-locales libXext-devel libXmu-devel libXt-devel libatk-devel libaudiofile-devel libcairo-devel libfreetype-devel libgdk-pixbuf libgdk-pixbuf-devel libgio-devel libogg-devel libp11-kit libpango-devel libpng-devel libtinfo-devel pkg-config python-base python-modules xorg-proto-devel zlib-devel
BuildRequires: libXaw3d-devel libalsa-devel libao-devel libesd-devel libflac-devel libgtk+2-devel libjack-devel libncurses-devel libopenmotif-devel libslang2-devel libspeex-devel libvorbis-devel
%{?_with_emacs:BuildRequires: emacs-nox}

BuildRequires: tcl-devel >= %tcl_ver, tk-devel >= %tk_ver

Summary(ru_RU.UTF-8): Конвертер/проигрыватель MIDI-файлов
Summary(uk_UA.UTF-8): Конвертер/програвач MIDI-файлів

%description
TiMidity++ is a converter that converts some of MIDI files
(formats : Standard MIDI file (*.MID), Recomposer files (*.RCP, *.R36,
*.G18, *.G36) and Module file (*.mod)) into formatted audio file  (ex
.RIFF  WAVE). TiMidity uses Gravis Ultrasound-compatible patch files or
Soundfonts( *.sfx, *.sf2 ) to generate digital audio data from MIDI
files. The digital audio data generated by TiMidity can be stored in a
file for processing, or played in real time through an audio device. In
real time playing, TiMidity if able to show the lyric contained in KAR
file or WRD file.

%description -l ru_RU.UTF-8
TiMidity++ -- проигрыватель MIDI-файлов, не требующий аппаратной
поддержки MIDI и использующий для синтеза внешнюю wavetable в
виде так называемых патчей (patch files) -- совместимых со
стандартом Gravis Ultrasound .pat-файлов (по одному на
инструмент). Коллекции патчей находятся в пакетах
timidity-instruments и timidity-eaw-patches.

%description -l uk_UA.UTF-8
TiMidity++ -- програвач MIDI-файлів, що не потребує апаратної
підтримки MIDI та використовує для синтезу зовнішню wavetable у
вигляді т.н.  патчів (patch files) -- сумісних із стандартом
Gravis Ultrasound .pat-файлів (по одному на інструмент). Колекції
патчів знаходяться у пакунках timidity-instruments та
timidity-eaw-patches.

%prep
%setup -n %name-%version%prerel
%patch0 -p1
%patch4 -p2
%patch100 -p2
%patch101 -p2
%patch102 -p2
%patch103 -p2
%patch104 -p2
%patch200 -p1
%patch201 -p0
%patch202 -p1
%patch203 -p1
cp -a INSTALL INSTALL.orig

%build
%add_optflags -DUSE_INTERP_RESULT
%define _optlevel 3
export EXTRACFLAGS="-DUSE_NON_CONST %optflags %optflags_fastmath %optflags_notraceback"
%configure \
    --program-prefix="" \
    --enable-interface=xaw,ncurses,gtk,tcltk,%{?_with_emacs:emacs,}slang \
    --enable-audio=default,oss,alsa,esd,vorbis,ao,jack,flac,speex \
    --with-default-output=alsa \
    --enable-server \
    --enable-alsaseq \
    --enable-network \
    --enable-spectrogram \
    --enable-wrd \
    --enable-dynamic \
    --enable-vt100 \
    --enable-spline=cubic

%make_build

%install
%makeinstall

# bonus tracks
install -pDm755 %SOURCE1 %buildroot%_initdir/%_name
install -pDm644 %SOURCE2 %buildroot%_sysconfdir/sysconfig/%_name
install -pDm644 %SOURCE3 %buildroot%_desktopdir/%_name.desktop
install -pDm644 interface/pixmaps/%_name.xpm %buildroot%_liconsdir/%_name.xpm

# default config
mkdir -p %buildroot%_sysconfdir
echo "dir %_datadir/%_name" >%buildroot%_sysconfdir/%_name.cfg

# fixups
sed -i 's,%buildroot,,g' %buildroot%_usr/lib/%_name/tkmidity.tcl
%if_with emacs
sed -i  -e 's@/usr/local/bin/%_name@%_bindir/%_name@' \
	-e 's@%buildroot@@' interface/%_name.el
install -pDm644 interface/%_name.el %buildroot%_emacslispdir/%_name.el
%endif

%files
%_bindir/%_name
%_usr/lib/%_name
%_mandir/*/*
%if_with emacs
%_emacslispdir/%_name.el
%endif
%_desktopdir/%_name.desktop
%_liconsdir/*
%_initdir/%_name
%_sysconfdir/sysconfig/%_name
%config(noreplace) %_sysconfdir/%_name.cfg
%doc ChangeLog INSTALL.orig README
%doc doc/C/{README*,FAQ}

%changelog
* Mon Nov 08 2021 Grigory Ustinov <grenka@altlinux.org> 2.15.0-alt1.2
- NMU: fixed FTBFS.

* Wed May 15 2019 Michael Shigorin <mike@altlinux.org> 2.15.0-alt1.1
- introduced emacs knob (on by default)

* Tue May 14 2019 Vladimir D. Seleznev <vseleznv@altlinux.org> 2.15.0-alt1
- 2.15.0.
- Applied patches from Debian and SUSE projects.

* Thu Feb 28 2019 Dmitry V. Levin <ldv@altlinux.org> 2.14.0-alt7.qa2
- NMU: updated build dependencies, built with libpng16.so.16.

* Wed Mar 22 2017 Vladimir D. Seleznev <vseleznv@altlinux.org> 2.14.0-alt7.qa1
- NMU: rebuild against Tcl/Tk 8.6

* Thu Apr 24 2014 Michael Shigorin <mike@altlinux.org> 2.14.0-alt7
- added LSB header to initscript to help the cause :) (thanks debian)

* Thu Apr 24 2014 Michael Shigorin <mike@altlinux.org> 2.14.0-alt6
- added Conflicts: fluid-soundfont-lite-patches (thanks repocop)

* Thu Apr 24 2014 Michael Shigorin <mike@altlinux.org> 2.14.0-alt5
- fixed timidity.el regarding buildroot (thanks repocop)

* Sun Apr 13 2014 Michael Shigorin <mike@altlinux.org> 2.14.0-alt4
- added watch file just in case
- converted description to utf8
- buildreq

* Tue Sep 25 2012 Dmitry V. Levin <ldv@altlinux.org> 2.14.0-alt3
- Built with libslang2-devel.

* Fri Sep 21 2012 Andriy Stepanov <stanv@altlinux.ru> 2.14.0-alt2
- cleanup spec

* Fri Sep 21 2012 Andriy Stepanov <stanv@altlinux.ru> 2.14.0-alt1
- version update

* Sun Mar 20 2011 Michael Shigorin <mike@altlinux.org> 2.13.2-alt13
- re-added lost BR, thx at@

* Wed Dec 08 2010 Michael Shigorin <mike@altlinux.org> 2.13.2-alt12
- rebuilt against current libao

* Thu Nov 12 2009 Repocop Q. A. Robot <repocop@altlinux.org> 2.13.2-alt11.qa1
- NMU (by repocop): the following fixes applied:
  * pixmap-in-deprecated-location for TiMidity++
  * postclean-05-filetriggers for spec file

* Mon Oct 26 2009 Michael Shigorin <mike@altlinux.org> 2.13.2-alt11
- fixed thinko in uk_UA summary (closes: #22031)

* Wed Sep 02 2009 Michael Shigorin <mike@altlinux.org> 2.13.2-alt10
- introduced initscript (closes: #20433)
- replaced debian menufile with freedesktop one
- %_sysconfdir/%_name.cfg is now non-autoreplaceable config

* Wed Dec 03 2008 Michael Shigorin <mike@altlinux.org> 2.13.2-alt9
- applied repocop patch

* Wed Nov 28 2007 Michael Shigorin <mike@altlinux.org> 2.13.2-alt8
- rebuilt against tcl/tk 8.5 libs
- demacrified Url

* Tue Sep 18 2007 Kirill A. Shutemov <kas@altlinux.ru> 2.13.2-alt7.1
- NMU
- Drop BuildRequires: kernel-headers-std. Use glibc-kernheaders instead.

* Thu Jul 05 2007 Michael Shigorin <mike@altlinux.org> 2.13.2-alt7
- added "nopoll" patch by Niko Kiirala <niko kiirala com> to reduce
  TiMidity power usage when idling and stream tracing's not used:
  http://fedev.blogspot.com/2007/07/timidity-power-usage.html

* Tue Mar 27 2007 Michael Shigorin <mike@altlinux.org> 2.13.2-alt6
- removed NAS support (considered obsolete, see #11227)
- dropped ARTS support (just in case)
- adjusted BuildRequires

* Mon Feb 19 2007 Michael Shigorin <mike@altlinux.org> 2.13.2-alt5
- replaced partial FLAC patch with more complete and correct one
  by Alexander Chumachenko (led@; #10864) -- thanks, sent upstream
- added speex patch (#10865, by led@ too; updated to patch
  configure as well since autoconf -fisv fails) and sent it altogether
- updated and cleaned up buildrequires (+missing libXaw-devel)
- changed default output to ALSA

* Sat Dec 09 2006 Michael Shigorin <mike@altlinux.org> 2.13.2-alt4
- added FLAC 1.1.3 patch by FLAC developers, kindly provided by
  Pavlov Konstantin (thresh@)

* Fri Oct 13 2006 Michael Shigorin <mike@altlinux.org> 2.13.2-alt3
- thanks Damir Shayhutdinov (damir@) who got around to fixing
  the build; and Andrey Rahmatullin (wrar@) who hinted me before

* Tue Jun 20 2006 Michael Shigorin <mike@altlinux.org> 2.13.2-alt2
- package takeover
- spec cleanup
- applied Gentoo patches (gcc4, gtk26, gnuconfig, exiterror)
  to build with current gcc on x86_64
- dirty libdir hack to avoid turning off tcltk interface living there
- stolen some Gentoo configure flags -- report please if that was wrong

* Mon Mar 27 2006 Michael Shigorin <mike@altlinux.org> 2.13.2-alt1
- 2.13.2 (NMU)

* Tue Feb 22 2005 ALT QA Team Robot <qa-robot@altlinux.org> 2.13.1-alt1.1
- Rebuilt with libflac-1.1.2-alt1

* Thu Sep 30 2004 Yuri N. Sedunov <aris@altlinux.ru> 2.13.1-alt1
- 2.13.1
- fixed build to run timidity faster.
- fixed url.
- built new gtk2 interface.
- enabled libao, flac and speex support.

* Wed Apr 14 2004 Yuri N. Sedunov <aris@altlinux.ru> 2.13.0-alt1.1
- removed silly requirements.

* Mon Mar 29 2004 Yuri N. Sedunov <aris@altlinux.ru> 2.13.0-alt1
- new version.

* Wed Jan 28 2004 Yuri N. Sedunov <aris@altlinux.ru> 2.12.0-alt1pre1
- fixed build with alsa >= 1.0.0 (gentoo patch).

* Thu Jun 19 2003 Yuri N. Sedunov <aris@altlinux.ru> 2.12.0-alt0.95pre1
- enabled NAS support.
- improved menus.
- url fixed.

* Sat Oct  5 2002 Sergey Bolshakov <s.bolshakov@belcaf.com> 2.12.0-alt0.9pre1
- rebuilt with tcl 8.4

* Thu Sep 19 2002 Yuri N. Sedunov <aris@altlinux.ru> 2.12.0-alt0.8pre1
- rebuilt with gcc-3.2, new XFree86.
- updated buildrequires.
- made building always with alsa2.

* Wed Jul 31 2002 Stanislav Ievlev <inger@altlinux.ru> 2.12.0-alt0.7pre1
- rebuild with new vorbis

* Thu Jun 13 2002 Sergey Bolshakov <s.bolshakov@belcaf.com> 2.12.0-alt0.6pre1
- rebuilt in new env

* Wed May 22 2002 Yuri N. Sedunov <aris@altlinux.ru> 2.12.0-alt0.5pre1
- beta version. (alsa2 supported).
- slang interface added.

* Sat Feb 2 2002  Yuri N. Sedunov <aris@altlinux.ru> 2.11.3-alt1
- Updated to 2.11.3
- ogg-vorbis output mode added.
- not ready for alsa2.

* Tue Dec 25 2001 Yuri N. Sedunov <aris@altlinux.ru> 2.10.4-alt1
- Adopted for Sisyphus
- Updated to 2.10.4

* Sun Mar 18 2001 AEN <aen@logic.ru> 2.10.3-ipl1mdk
- new version
* Wed Jan 10 2001 AEN <aen@logic.ru>
- adopted for RE

* Fri Nov 03 2000 Geoffrey Lee <snailtalk@mandrakesoft.com> 2.10.2-1mdk
- new and shiny vesrion.
- reenable gtk (why was it ever disabled?!)
- cleanup of stale patches.

* Wed Oct 18 2000 Geoffrey Lee <snailtalk@mandrakesoft.com> 2.10.1-1mdk
- shiny new version.
- remove the strip and bzip2 code.
- get a new source instead of using patches.

* Wed Aug 09 2000 Maurizio De Cecco <maurizio@mandrakesoft.com> 2.10.0-1mdk
- Version 2.10.0
- Fixed man location for FHS

* Mon Aug 07 2000 Frederic Lepied <flepied@mandrakesoft.com> 2.9.5-2mdk
- automatically added BuildRequires

* Tue Jun 20 2000 Maurizio De Cecco <maurizio@mandrakesoft.com> 2.9.5-1mdk
- Version 2.9.5

* Tue Jun 20 2000 Maurizio De Cecco <maurizio@mandrakesoft.com>
- Version 2.9.4

* Tue Apr 11 2000 Maurizio De Cecco <maurizio@mandrakesoft.com>
- Fixed Distribution name

* Thu Mar 16 2000 Maurizio De Cecco  <maurizio@mandrakesoft.com>
- Adapted to the new Group structure

* Mon Mar 06 2000 Geoffrey Lee <snailtalk@linux-mandrake.com>
- 2.9.0
- change license: it's majorly wrong
- change the buildroot

* Tue Feb 08 2000 Geoffrey Lee <snailtalk@linux-mandrake.com> 2.8.2-1mdk
- 2.8.2

*  Fri Dec 3 1999 Maurizio De Cecco  <maurizio@mandrakesoft.com>
- 2.8.1

* Tue Oct 26 1999 Maurizio De Cecco  <maurizio@mandrakesoft.com>
- 2.7.0: Note that 2.7.0 change the place where data and config files
  are, so old patches do not work anymore; i removed the patches, 
  and timidity.cgf is now in /usr/share/timidity with the other
  files; you need timidity-instruments-1.0-4mdk with this package.

* Fri Aug  6 1999 Bernhard Rosenkränzer <bero@mandrakesoft.com>
- 2.3.0
- fix download URL

* Fri Jul 16 1999 Bernhard Rosenkränzer <bero@mandrakesoft.com>
- 2.1.1

* Mon May 10 1999 Bernhard Rosenkränzer <bero@mandrakesoft.com>
- Change paths to match the timidity-instruments package

* Wed Apr 28 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- Mandrake adaptations.
- handle RPM_OPT_FLAGS.