stepmania-3.9-13kkr2010.1.spec

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

%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
# added: Source1, Patch2, Patch15
# modified: Patch4, Patch12
# dropped: Patch9, Patch10, Patch11
Source0:	%{distname}-%{version}-src.tar.bz2
Source1:	ffmpeg-0.4.9-pre1-sm.tar.gz
Patch0:         StepMania-3.9-x86_64-build.patch
Patch1:		StepMania-3.9-build_crypto.patch
Patch2:		StepMania-3.9-ffmpeg-staticlink.patch
Patch3:		StepMania-3.9-home.patch
Patch4:		StepMania-3.9-pkgdir.patch
Patch5:		StepMania-3.9-eventmask.patch
Patch6:		StepMania-3.9-extraqual.patch
Patch7:		StepMania-3.9-replace-this.patch
Patch8:		StepMania-3.9-src-gettid.patch
#Patch9:	stepmania-3.9-ffmpeg-all-4.patch
#Patch10:	stepmania-3.9-ffmpeg-headers.patch
#Patch11:	stepmania-3.9-ffmpeg-pixfmt.patch
Patch12:	stepmania-3.9-select_style.patch
Patch13:	stepmania-3.9-gcc43.patch
Patch14:	stepmania-3.9-fix-str-fmt.patch
Patch15:	ffmpeg-0.4.9-pre1-gcc4-1.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot
#BuildRequires:  ffmpeg-devel
BuildRequires:  oggvorbis-devel
BuildRequires:  jpeg-devel
BuildRequires:  SDL-devel
BuildRequires:  lua5.0-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 .x86_64
%patch1 -p1 -b .crypto
%patch2 -p1 -b .ffmpegstatic
%patch3 -p1 -b .home
%patch4 -p1 -b .pkgdir
%patch5 -p1 -b .eventmask
%patch6 -p1 -b .extraqual
%patch7 -p1 -b .replace
%patch8 -p1 -b .gettid
#%patch9 -p1 -b .ffmpeg-4
#%patch10 -p1 -b .ffmpeg-headers
#%patch11 -p1 -b .ffmpeg-pixfmt
%patch12 -p1 -b .select-style
%patch13 -p1 -b .gcc
%patch14 -p1 -b .str
autoreconf
pushd ffmpeg-0.4.9-pre1-sm/
%patch15 -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
export CFLAGS="%{optflags} -O1"
export CXXFLAGS="%{optflags} -O1"
%configure2_5x \
  --disable-dependency-tracking \
  --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

%clean
rm -rf $RPM_BUILD_ROOT

%if %mdkversion < 200900
%post
%update_menus
%endif

%if %mdkversion < 200900
%postun
%clean_menus
%endif

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


%changelog
* Thu Jul 29 2010 kakurasan <kakurasan AT gmail DOT com> 3.9-13kkr2010.1
- fix bgmovie problem(link statically with FFmpeg 0.4.9-pre1-sm)

* Thu May 27 2010 Olivier Blin <oblin AT mandriva DOT com> 3.9-12mdv2010.1
+ Revision: 546412
- fix selecting style and thus allow to play, patch from Arch Linux (to handle hardcoded switch values outside of default enum range)
- sync with ffmpeg patches from Arch Linux (to fix build with latest ffmpeg, PIX_FMT_RGBA and img_convert)

* Sun Apr 19 2009 trem <trem AT mandriva DOT org> 3.9-11mdv2009.1
+ Revision: 368073
- fix patch stepmania-3.9-fix-str-fmt.patch (so now stepmania start)

* Sat Feb 07 2009 Funda Wang <fwang AT mandriva DOT org> 3.9-10mdv2009.1
+ Revision: 338417
- disable ffmpeg support in cooker
- use O1 according to :
  http://www.stepmania.com/wiki/FAQ:_Linux_version#I_never_trust_binaries.3B_how_hard_is_it_to_compile_this_program_from_source.3F
- detect newer ffmpeg
- newer ffmpeg
- add gcc 43 patch and str fmt patch
- adopt to new ffmpeg (patch from gentoo)

  + Thierry Vignaud <tv AT mandriva DOT org>
    - rebuild early 2009.0 package (before pixel changes)

  + Pixel <pixel AT mandriva DOT com>
    - rpm filetriggers deprecates update_menus/update_scrollkeeper/update_mime_database/update_icon_cache/update_desktop_database/post_install_gconf_schemas

* 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 <tv AT mandriva DOT org>
    - 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