File timidity.spec of Package timidity

# spec file for package timidity
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%if 0%{?suse_version} < 1140
%define have_arts	1
%define have_arts	0

Name:           timidity
Summary:        Software Synthesizer and MIDI Player
License:        GPL-2.0+
Group:          Productivity/Multimedia/Sound/Midi
Version:        2.13.99
Release:        0
%define package_version 2.13.2
%define _use_internal_dependency_generator 0
%define my_provides /tmp/my-provides
BuildRequires:  alsa-devel
BuildRequires:  automake
BuildRequires:  esound-devel
BuildRequires:  flac-devel
BuildRequires:  gtk2-devel
BuildRequires:  libao-devel
BuildRequires:  libjack-devel
BuildRequires:  libogg-devel
BuildRequires:  libvorbis-devel
BuildRequires:  ncurses-devel
BuildRequires:  slang-devel
BuildRequires:  speex-devel
BuildRequires:  tk-devel
BuildRequires:  update-desktop-files
BuildRequires:  xaw3d
BuildRequires:  xorg-x11
Recommends:     fluid-soundfont-gm fluid-soundfont-gs
%if %{have_arts}
BuildRequires:  arts-devel
%if 0%{?suse_version} > 1020
BuildRequires:  fdupes
BuildRequires:  xaw3d-devel
PreReq:         %insserv_prereq  %fillup_prereq
# Source:         TiMidity++-%{package_version}.tar.bz2
Source:         timidity-2.14.0-pre.tar.bz2
Source1:        timidity-patches.tar.bz2
Source2:        %name.desktop
Source3:        timidity.png
Source4:        timidity.cfg
Source5:        %{name}.init
Source6:        %{name}.sysconf
Source7:        README.SuSE
Patch1:         0001-Fix-possible-invalid-access-below-the-array-range.patch
Patch2:         0002-Fix-alsaseq-polling-at-idle-time.patch
Patch3:         0003-Fix-the-faulty-check-of-parameters-in-server_c.c-con.patch
Patch4:         0004-Add-missing-void-argument-for-function-declarations.patch
Patch5:         0005-Add-missing-quotes-in-autoconf-utils.m4.patch
Patch6:         0006-Add-the-lzma-decompression-support.patch
Patch7:         0007-Fix-the-missing-return-value-in-emacs_c.c.patch
Patch8:         0008-Fix-type-punning-in-smplfile.c.patch
Patch9:         0009-Use-AS_HELP_STRING-to-make-the-help-output-more-read.patch
Patch100:       timidity-no_date.patch
Patch101:       timidity-add_fluid_cfgs.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

TiMidity plays MIDI files without external MIDI instruments and
converts MIDI files to WAV using GUS/patch and SoundFont for voice

# setup -q -n TiMidity++-%{package_version} -a 1
%setup -q -n timidity -a 1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
for f in ./utils/bitset.c ./utils/bitset.h ./utils/nkflib.c; do
	iconv -f EUC-JISX0213 -t UTF-8 $f > $f.utf8 && mv $f.utf8 $f

echo >> autoconf/arts.m4
autoreconf --force --install
%configure \
	--enable-dynamic=ncurses,emacs,slang,vt100,xskin,gtk,tcltk,alsaseq,server \
%if %{have_arts}
	--enable-audio=alsa,arts,oss,esd,vorbis,jack,ao,flac,speex \
	--enable-audio=alsa,oss,esd,vorbis,jack,ao,flac,speex \
	--with-default-output=alsa \
	--enable-network \
	--enable-spectrogram \
	--enable-wrd \
	--with-module-dir=%{_libdir}/timidity \
make %{?_smp_mflags} WISH=tclsh CFLAGS="$RPM_OPT_FLAGS"

%makeinstall WISH=tclsh
mkdir -p $RPM_BUILD_ROOT%{_datadir}/X11/app-defaults/
cp interface/ $RPM_BUILD_ROOT/usr/share/X11/app-defaults/TiMidity
# for japanese locale
# UTF-8 version
mkdir -p $RPM_BUILD_ROOT%{_datadir}/X11/{ja,ja_JP.UTF-8,ja_JP.eucJP,ja_JP.ujis}/app-defaults
iconv -feuc-jp -tutf-8 interface/ > $RPM_BUILD_ROOT%{_datadir}/X11/ja/app-defaults/TiMidity
ln -s ../../ja/app-defaults/TiMidity $RPM_BUILD_ROOT%{_datadir}/X11/ja_JP.UTF-8/app-defaults/TiMidity
# EUC-jp version
cp interface/ $RPM_BUILD_ROOT%{_datadir}/X11/ja_JP.eucJP/app-defaults/TiMidity
ln -s ../../ja_JP.eucJP/app-defaults/TiMidity $RPM_BUILD_ROOT%{_datadir}/X11/ja_JP.ujis/app-defaults/TiMidity
# copy documents
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
cp %{SOURCE7} $RPM_BUILD_ROOT%{_docdir}/%{name}
for i in *.ja; do
  iconv -f euc-jp -t utf8 $i > $RPM_BUILD_ROOT%{_docdir}/%{name}/$i
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}/en
(cd doc/C
  for i in * ; do
    case $i in
      cp $i $RPM_BUILD_ROOT%{_docdir}/%{name}/en
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}/ja_JP
(cd doc/ja_JP.eucJP
  for i in * ; do
    case $i in
      iconv -f euc-jp -t utf8 $i > $RPM_BUILD_ROOT%{_docdir}/%{name}/ja_JP/$i
# copy sample patches and config file
mkdir -p $RPM_BUILD_ROOT%{_datadir}/timidity
cp -a timidity-patches/* $RPM_BUILD_ROOT%{_datadir}/timidity
mkdir -p $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
mkdir -p $RPM_BUILD_ROOT%{_datadir}/xemacs/site-lisp/lisp
cp interface/timidity.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
cp interface/timidity.el $RPM_BUILD_ROOT%{_datadir}/xemacs/site-lisp/lisp
%suse_update_desktop_file -i -u %name AudioVideo Midi
mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
cp %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/pixmaps
mkdir -p $RPM_BUILD_ROOT/etc
install -c -m 644 %{SOURCE4} $RPM_BUILD_ROOT/etc

# boot scripts
%__install -D %{S:5} %{buildroot}/etc/init.d/%{name}
%__install -d %{buildroot}/usr/sbin
ln -s ../../etc/init.d/%{name} %{buildroot}/usr/sbin/rc%{name}
# fillup sysconfig.timidity
%__install -m 644 -D %{S:6} %{buildroot}/var/adm/fillup-templates/sysconfig.timidity

# exclude plugins from the provide-list
cat << EOF > %{my_provides}
grep -v $RPM_BUILD_ROOT%{_libdir}/timidity | %{__find_provides}
chmod 755 %{my_provides}
%define __find_provides %{my_provides}
%if 0%{?suse_version} > 1020
%fdupes -s $RPM_BUILD_ROOT


%stop_on_removal timidity

%restart_on_update %name

%config(noreplace) %{_datadir}/timidity/timidity.cfg
%config /etc/timidity.cfg
%doc %{_mandir}/man*/*
%doc %{_docdir}/%{name}

openSUSE Build Service is sponsored by