%define pversion 1.1.1
%define sversion 0.4.0
%define wsprefs WSoundPrefs-%{pversion}
%define wmsound WSoundServer-%{sversion}

Summary: Sound tools for WindowMaker
Summary(ja): Window Maker 用のサウンド・ツール
Name: WMSoundSet
Version: %{pversion}
License: GPL2 & OPL
Release: 3%{?_dist_release}
Group: User Interface/Desktops
Source0: %{wsprefs}.tar.bz2
Source1: %{wmsound}.tar.bz2
Source2: wmsdefault.tar.gz
Source3: VineSounds.tar.gz
Source5: WSoundPrefs-%{pversion}.ja.po

Patch0: patch-af
Patch1: WSoundServer-0.4.0-WM-0.92.patch
Patch2: WSoundServer-0.4.0-config.x86_64.patch

Patch10: WSoundPrefs-%{pversion}-nls.vine.patch
Patch11: WSoundPrefs-1.1.1-wsound.patch
Patch12: WSoundPrefs-1.1.1-fix.patch
Patch13: WSoundPrefs-1.1.1-WM-0.92.patch

BuildRequires: libPropList
BuildRequires: xorg-x11-devel imake
BuildRequires: WindowMaker-devel >= 0.92.0
BuildRequires: audiofile-devel
Requires: WindowMaker >= 0.92.0
Buildroot: %{_tmppath}/%{name}-%{version}-root

%description
Sound tools for WindowMaker: 
	WSoundPrefs-%{pversion}
	WSoundServer-%{sversion}
	wmsdefault (default sound set)

%description -l ja
Window Maker で 効果音の設定等を可能にするツール集です.
以下を収録しています.
	WSoundPrefs-%{pversion}
	WSoundServer-%{sversion}
	wmsdefault (wmsoundデフォルトの音源)
WindowMaker-0.92 以上に対応しています.


%prep
%setup -q -a 1 -a 3 -c -n WMSoundSet
cd %{wmsound}
%patch0 -p0 -b .patch-af
%patch1 -p0 -b .WM-0.92~
%patch2 -p0 -b .x86_64~
cd ..

cd %{wsprefs}
%patch10 -p1 -b .nls.vine
%patch11 -p0 -b .wsound
%patch12 -p1 -b .fix
%patch13 -p1 -b .WM-0.92
cp %SOURCE5 po/ja.po
cd ..


%build
# make WSoundServer
pushd %{wmsound}
%configure --x-libraries=%{_libdir} --x-includes=%{_includedir}/X11
make
popd


# make WSoundPrefs
pushd %{wsprefs}
cp ../%{wmsound}/wslib/{get-wsound-flags,wsound.h} src/

IMAKEINCLUDE="-I%{_datadir}/X11/config" xmkmf -a

touch src/WSoundPrefs.man
PATH=$PATH:. make\
	PREFIX=%{_libdir}\
	EXTRA_DEFINES="-DI18N -DHAVE_LIBINTL_H"\
	EXTRA_INCLUDES=-I../../%{wmsound}/wslib\
	EXTRA_LIBRARIES=-L../../%{wmsound}/wslib/.libs/

make -C po
popd


%install
%define SYSDEFDIR $RPM_BUILD_ROOT/etc/X11/WindowMaker

[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}

# Install WSoundPrefs
cd %{wsprefs}
make install PREFIX=$RPM_BUILD_ROOT%{_prefix}/lib/GNUstep
mkdir -p $RPM_BUILD_ROOT%{_localedir}/ja/LC_MESSAGES/
make nlsdir=$RPM_BUILD_ROOT%{_localedir} -C po install
cd ..

# Install wmsound
cd %{wmsound}
%makeinstall
cd ..

# Install default sounds
mkdir -p $RPM_BUILD_ROOT%{_datadir}/WindowMaker 
tar xzvf %{SOURCE2} -C $RPM_BUILD_ROOT%{_datadir}/WindowMaker 

# install configurations
mkdir -p %{SYSDEFDIR}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/WindowMaker/{Sounds,SoundSets}
(
	cd VineSounds
	for i in Sounds SoundSets ; do
		cp $i/* $RPM_BUILD_ROOT%{_datadir}/WindowMaker/$i/
	done
	cd Defaults
	cp * %{SYSDEFDIR}
)

# prepare documents with preserving time stamps
mkdir -p doc/WSoundPrefs
cp -p %{wsprefs}/{AUTHORS,ChangeLog,COPYING*,INSTALL} doc/WSoundPrefs
mkdir -p doc/WSoundServer
cp -p %{wmsound}/{AUTHORS,COPYING,ChangeLog,INSTALL,NEWS,README} doc/WSoundServer

# remove files
rm -f $RPM_BUILD_ROOT%{_libdir}/libwsound.la

%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,root)
%doc doc/*
%{_sysconfdir}/X11/WindowMaker/*
%{_prefix}/lib/GNUstep/Applications/WSoundPrefs.app/
%{_includedir}/wsound.h
%{_libdir}/libwsound.a
%{_libdir}/libwsound.so*
#%{_libdir}/libwsound.la
%{_localedir}/ja/LC_MESSAGES/WSoundPrefs.mo
%{_datadir}/WindowMaker/Sounds/
%{_datadir}/WindowMaker/SoundSets/
%{_bindir}/get-wsound-flags
%{_bindir}/wsoundserver
%{_bindir}/wsoundplay
%{_bindir}/getsoundset
%{_bindir}/setsoundset
%{_mandir}/man1/get-wsound-flags.1x*
%{_mandir}/man1/getsoundset.1x*
%{_mandir}/man1/setsoundset.1x*
%{_mandir}/man1/wsoundplay.1x*
%{_mandir}/man1/wsoundserver.1x*


%changelog
* Sat Apr 23 2011 Shu KONNO <owa@bg.wakwak.com> 1.1.1-3
- rebuilt with rpm-4.8.1-3
- added BR: libPropList

* Mon Feb 22 2010 Shu KONNO <owa@bg.wakwak.com> 1.1.1-2
- added BR: audiofile-devel
- rebuilt with new environment

* Tue Jun 03 2008 Shu KONNO <owa@bg.wakwak.com> 1.1.1-1vl5
- applied new versioning policy and utf-8
- added BuildRequires: xorg-x11-devel imake
- set IMAKEINCLUDE to xmkmf

* Wed Aug 02 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.1-0vl9
- changed Group to User Interface/Desktops

* Tue Mar 07 2006 Shu KONNO <owa@bg.wakwak.com> 1.1.1-0vl8
- added WSoundServer-0.4.0-config.x86_64.patch
- rebuilt for x86_64 architecture support

* Sat Feb 25 2006 Shu KONNO <owa@bg.wakwak.com> 1.1.1-0vl7
- rebuilt for VineSeed

* Sun Nov 13 2005 Shu KONNO <owa@bg.wakwak.com> 1.1.1-0vl6
- added WSoundServer-0.4.0.WM-0.92.patch
- added WSoundPrefs-1.1.1.WM-0.92.patch
- added %{_mandir}/man1/get-wsound-flags.1x*
- changed encoding to utf-8 of WSoundPrefs-1.1.1.ja.po
- changed app path with '/usr/X11R6/lib/GNUstep/Applications/WSoundPrefs.app'
- rebuilt for WindowMaker-0.92.0

* Fri Dec 20 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.1.1-0vl5
- rebuilt for VineSeed

* Fri Dec 20 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.1.1-0vl4.2
- added Patch3 for better compatibility with WindowMaker-0.80.2

* Fri Dec 20 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.1.1-0vl4.1
- rebuilt with WindowMaker-0.80.2

* Wed Jul 18 2001 <sagami@vinelinux.org>
- 1.1.1-0vl4: erase unneeded files in %%doc and minor spec fixes
- added patch to build with current audiofile.h in audiofile-0.2.1
- added patch to include wsound.h correctly

* Tue Jan 23 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 1.1.1-0vl3
- use better macros
- added forgotten %%clean section

* Fri Sep 08 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 1.1.1-0vl2
- modified %files section to handle compressed man page(s)

* Sun Apr  2 2000 Jun Nishii <jun@vinelinux.org>
- WMSoundSet-1.1.1
- WSoundPrefs-1.1.1, WSoundServer-0.4.0
- requires WindowMaker >= 0.62.1

* Thu Oct 14 1999 Jun Nishii <jun@vinelinux.org>
- WMSoundSet-1.0-1
- build for Vine-1.9
- WSoundPrefs-1.1.0, WSoundServer-0.2.1
- requires WindowMaker >= 0.61.1

* Sat Mar 27 1999 Jun Nishii <jun@vinelinux.org>
- added new sounds and use them as a default set

* Sun Mar 14 1999 Jun Nishii <jun@vinelinux.org>
- remove requires WindowMaker >= 0.51.2

* Sun Mar 14 1999 Jun Nishii <jun@vinelinux.org>
- updated WSoundPrefs to 0.9.3

* Sun Mar 7 1999 Jun Nishii <jun@vinelinux.org>
- updated WSoundPrefs to 0.9.2
- updated wmsound to 0.9.3

* Tue Feb 24 1999 Jun Nishii <jun@vinelinux.org>
- updated wmsound to 0.9.2
- added Japanese summary and description
- change Group name

* Tue Feb 2 1999 Jun Nishii <jun@vinelinux.org>
- updated to 0.9.1

* Sat Dec 19 1998 Jun Nishii <jun@vinelinux.org>
- modify ja.po

* Thu Dec 17 1998 Jun Nishii <jun@vinelinux.org>
- merge ja.po

* Sat Dec 12 1998 Jun Nishii <jun@vinelinux.org>
- use /dev/dsp as a default audio device

