stepmania-3.9-11kkr2009.0.spec

%define	distname	StepMania
%define	name	stepmania
%define	version	3.9
%define release	%mkrel 11

%define __autoreconf %{_bindir}/autoreconf

%define build_mp3 1
%{?_with_mp3: %global build_mp3 1}
%{?_without_mp3: %global build_mp3 0}

Summary:	A rythm game
Name:		%{name}
Version:	%{version}
Release:	%{release}
License:	MIT
Url:		http://www.stepmania.com/wiki/Downloads
Group:		Games/Arcade
Source0:	%{distname}-%{version}-src.tar.bz2
Source1:	ffmpeg-0.4.9-pre1-sm.tar.gz
Patch0:		StepMania-3.9-home.patch
Patch1:		StepMania-3.9-pkgdir.patch
Patch2:		StepMania-3.9-ffmpeg-staticlink.patch
Patch10:	010_all_alsa.patch
Patch30:	030_all_64bits.patch
Patch40:	040_all_alias.patch
Patch50:	050_all_gcc.patch
Patch60:	060_all_gettid.patch
Patch70:	070_all_lua.patch
Patch80:	080_all_sdl.patch
Patch90:	090_all_vorbis.patch
Patch100:	100_all_jpeg.patch
Patch110:	110_all_gcc43.patch
Patch500:	ffmpeg-0.4.9-pre1-gcc4-1.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot

BuildRequires:  oggvorbis-devel
BuildRequires:  jpeg-devel
BuildRequires:  SDL-devel
BuildRequires:  lua-devel
BuildRequires:	gtk2-devel
BuildRequires:	MesaGLU-devel
%if %{build_mp3}
BuildRequires:	mad-devel
%endif
Requires:	%{name}-data

%description
StepMania is a music/rhythm game. The player presses different buttons in time 
to the music and to note patterns that scroll across the screen. Features 3D 
graphics, visualizations, support for gamepads/dance pads, a step recording 
mode, and more!
To add songs, simply copy the content of your folder containing songs 
to ~/StepMania/Songs as user, or to /usr/share/StepMania/Songs as root.

%prep
%setup -q -n %{distname}-%{version}-src -a 1
%patch0 -p1 -b .home
%patch1 -p1 -b .pkgdir
%patch2 -p1 -b .ffmpegstatic
%patch10 -p1 -b .alsa
%patch30 -p0 -b .64bits
%patch40 -p1 -b .alias
%patch50 -p0 -b .gcc
%patch60 -p1 -b .gettid
%patch70 -p1 -b .lua
%patch80 -p0 -b .sdl
%patch90 -p1 -b .vorbis
%patch100 -p1 -b .jpeg
%patch110 -p0 -b .gcc43
%{__autoreconf}
pushd ffmpeg-0.4.9-pre1-sm/
%patch500 -p1 -b .ffmpeggcc4
%{__mkdir_p} include/ffmpeg
%{__ln_s} $(pwd)/*/*.h include/ffmpeg/
popd


%build
pushd ffmpeg-0.4.9-pre1-sm/
CFLAGS="%{optflags} -O3" ./configure --disable-ffserver --disable-ffplay
%make
popd
%configure \
  --bindir=%{_gamesbindir} \
  --datadir=%{_gamesdatadir} \
%if %build_mp3
  --with-mp3
%else
  --without-mp3
%endif

%make

%install
rm -rf %buildroot
%makeinstall_std
install -d -m 0755 -p $RPM_BUILD_ROOT%{_iconsdir}
install -m 0644 %{_topdir}/BUILD/%{distname}-%{version}-src/src/%{distname}.xpm $RPM_BUILD_ROOT%{_iconsdir}/

install -d -m 0755 -p $RPM_BUILD_ROOT%{_libdir}/%{distname}
mv $RPM_BUILD_ROOT%{_gamesbindir}/GtkModule.so $RPM_BUILD_ROOT%{_libdir}/%{distname}/
chmod 0644 $RPM_BUILD_ROOT%{_libdir}/%{distname}/GtkModule.so

install -d -m 0755 -p $RPM_BUILD_ROOT%{_datadir}/applications
cat << EOF > %buildroot%{_datadir}/applications/mandriva-%{name}.desktop
[Desktop Entry]
Type=Application
Exec=soundwrapper %{_gamesbindir}/stepmania
Name=StepMania
Comment=A rythm game
Icon=%{distname}
Categories=Game;ArcadeGame;
EOF

install -d %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/mandriva-%{name}.desktop << EOF
[Desktop Entry]
Name=StepMania
Comment=A rythm game
Exec=soundwrapper %_gamesbindir/%{name}
Icon=%{distname}
Terminal=false
Type=Application
Categories=Game;ArcadeGame;X-MandrivaLinux-MoreApplications-Games-Arcade;
EOF

%clean
rm -rf $RPM_BUILD_ROOT

%post
%update_menus

%postun
%clean_menus

%files
%doc README-FIRST.html NEWS
%defattr(-,root,root)
%{_gamesbindir}/%{name}
%{_libdir}/%{distname}/GtkModule.so
%{_iconsdir}/%{distname}.xpm
%{_datadir}/applications/mandriva-*.desktop
%{_datadir}/applications/mandriva-%{name}.desktop




%changelog
* Fri Jan 30 2009 kakurasan <kakurasan AT gmail DOT com> 3.9-11kkr2009.0
- fix bgmovie problem(link statically with FFmpeg 0.4.9-pre1-sm)

* Wed Jan 28 2009 kakurasan <kakurasan AT gmail DOT com> 3.9-10kkr2009.0
- replace patches with ones from Gentoo

* Thu Apr 10 2008 Olivier Blin <oblin AT mandriva DOT com> 3.9-9mdv2009.0
+ Revision: 192566
- fix menu directory creation
- fix linkage of functions in avcodec namespace by including avcodec
  as extern C (patch from Pixel)
- fix int64_c declaration
- do not handle duplicate averror type (for latest ffmpeg)
- inline gettid syscall (no _syscallX macros anymore in glibc)
- restore BuildRoot

  + Thierry Vignaud <tvignaud AT mandriva DOT com>
    - auto convert menu to XDG
    - kill re-definition of %%buildroot on Pixel's request
    - kill desktop-file-validate's 'warning: key "Encoding" in group "Desktop Entry" is deprecated'


* Sat Dec 02 2006 Olivier Blin <oblin AT mandriva DOT com> 3.9-8mdv2007.0
+ Revision: 90010
- update crypto patch with selected fixes from cryptopp CVS to fix x86_64 build
- explicitely call replace method on 'this'
- fix "extra qualification 'class::' on member 'member'" errors
- do not use the same variable name as SDL internal SDL_EventMask
- add meny entry
- buildrequire lua-devel 5.0
- bunzip patches
- Import stepmania

* Wed May 17 2006 Olivier Blin <oblin AT mandriva DOT com> 3.9-7mdk
- BuildRequires MesaGLU-devel (thanks iurt!)

* Mon May 15 2006 Olivier Blin <oblin AT mandriva DOT com> 3.9-6mdk
- Patch2: fix build for changes introduced in ffmpeg 4629 and 4754
- Patch3: search files in home directory
  (~/StepMania/ for data, ~/.StepMania/ for settings)
- Patch4: search files and libraries in package directories
- install GtkModule in pkglibdir
- remove wrapper script since binary looks for data in pkgdatadir
- move soundwrapper for wrapper to menu entry
- lowercase package name
- mkrel
- apply patches unconditionnally
- remove hardcoded requires
- require stepmania-data
- BuildRequires gtk2-devel
- fix BuildRequires (remove lib prefix)
- install binary in _gamesbindir and data in _gamesdatadir
- use makeinstall_std
- fix rpm and menu groups
- enable mp3 by default (and allow to build without)

* Fri Apr 21 2006 Nicolas Chipaux <chipaux AT mandriva DOT com> 3.9-5mdk
- fix

* Thu Apr 20 2006 Nicolas Chipaux <chipaux AT mandriva DOT com> 3.9-4mdk
- x86_64 build

* Thu Apr 20 2006 Nicolas Chipaux <chipaux AT mandriva DOT com> 3.9-3mdk
- no mkrel please

* Wed Apr 19 2006 Nicolas Chipaux <chipaux AT mandriva DOT com> 3.9-2mdk
- fix licence
- change description 
- complete the mp3 build flag

* Thu Apr 13 2006 Nicolas Chipaux <chipaux AT mandriva DOT com> 3.9-1mdk
- first for mandriva