File pcsx2.spec of Package pcsx2

# Copyright (c) 2008 SuSE Linux Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://www.suse.de/feedback/
#

# norootforbuild

Name:         pcsx2
License:      GPL
Group:        System/Emulators
Autoreqprov:  on
Version:      0.9.6
Release:      0
Summary:      Sony PlayStation 2 Emulator
Source:       %name-%version.tar.gz
Patch:        %name-cdvdiso-fopen64.patch
Patch1:       %name-optflags.patch
Patch2:       %name-spu2null-overflow.patch
Patch3:       %name-cdvdisoefp-header.patch
BuildRequires: gtk2-devel xorg-x11-Mesa-devel dos2unix libgobject-2_0-0 libbz2-devel libjpeg-devel glew-devel Cg libCg-devel gcc-c++ SDL-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Sony PlayStation 2 emulator. Requires a BIOS image in %_libdir/%name/bios
or in .%name/bios in your HOME directory (will be created when you first run
PCSX2). Check http://www.pcsx2.net/guide.php#Bios for details on which files
you need and how to obtain them.

%prep
%setup -n %name
%patch -p1
%patch1
%patch2
%patch3

%build
export RPM_OPT_FLAGS
dos2unix `find . -name \*.sh`
sh build.sh all

%install
mkdir -p $RPM_BUILD_ROOT%_libdir/%name
cd bin
rmdir inis logs memcards snap sstates
cp -a * .pixmaps $RPM_BUILD_ROOT%_libdir/%name
cd ..

mkdir -p $RPM_BUILD_ROOT%_bindir
cat <<EOT >$RPM_BUILD_ROOT%_bindir/%name
#!/bin/sh
if test ! -e \$HOME/.%name
then
	mkdir \$HOME/.%name
	ln -s %_libdir/%name/* %_libdir/%name/.pixmaps \$HOME/.%name
	rm \$HOME/.%name/bios
	for i in inis logs memcards snap sstates bios
	do
		mkdir \$HOME/.%name/\$i
	done
fi
for i in %_libdir/%name/bios/*
do
	test "$i" != "%_libdir/%name/bios/*" && ln -s \$i \$HOME/.%name/bios/ 2>/dev/null
done
cd \$HOME/.%name
exec ./%name "\$@"
EOT
chmod 755 $RPM_BUILD_ROOT%_bindir/%name

%files
%defattr(-,root,root)
%_libdir/%name
%_bindir/%name
openSUSE Build Service is sponsored by