File pcsx2.spec of Package pcsx2

#
# spec file for package pcsx2
#
# Copyright (c) 2015 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 http://bugs.opensuse.org/
#

%define dumbname PCSX2

Name:          pcsx2
License:       GPL-3.0
Group:         System/Emulators/Other
Version:       1.6.0.20200505T220805
Release:       0
URL:           http://pcsx2.net/
Summary:       Sony PlayStation 2 Emulator
Source:        %{name}-%{version}.tar.xz
BuildRequires: gcc-c++
BuildRequires: boost-devel
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: libaio-devel
# non-free library
#BuildRequires: libCg-devel
BuildRequires: libjpeg-devel
BuildRequires: Mesa-devel
#BuildRequires: Mesa-libGL-devel
#BuildRequires: Mesa-libGLESv3-devel
BuildRequires: openSUSE-release
BuildRequires: opencl-headers
BuildRequires: opencl-cpp-headers
BuildRequires: pkgconfig(OpenCL)
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(bzip2)
BuildRequires: pkgconfig(egl)
BuildRequires: pkgconfig(glesv2)
BuildRequires: pkgconfig(glew)
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(libpcap)
BuildRequires: pkgconfig(libsparsehash)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(sdl)
BuildRequires: pkgconfig(sdl2)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(soundtouch)
BuildRequires: png++-devel
BuildRequires: portaudio-devel
#BuildRequires: wxGTK3-devel
BuildRequires: wxWidgets-devel
#BuildRequires: wxWidgets-3_0-devel
#BuildRequires: wxWidgets-3_2-devel
# mix of SDL 1 and 2 libraries can crash wxWidgets
#Conflicts:     plugin-sound_sdlu-3_0
Recommends:    %{name}-lang = %{version}
Obsoletes:     %{name}-32bit
BuildRoot:     %{_tmppath}/%{name}-%{version}-build

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

%{lang_package}

%prep
%setup -q
# oh, don't be prissy, built with GTK3 and SDL2
sed -i -e "s:FATAL_ERROR:WARNING:g" \
	cmake/BuildParameters.cmake \
    cmake/ApiValidation.cmake
# and eat your vegetables from our system
rm -rf 3rdparty
# zerogs doesn't build and source dir must be removed without libCg-devel
rm -rf plugins/zerogs/

%build
# these options would be nice to have if they would work on openSUSE
#  -DGTK3_API='TRUE' \
#  -DSDL2_API='TRUE' \
# and that we would want for our own optimizations... which interfere with upstream ones
#export CFLAGS="%{optflags} -fno-strict-aliasing -O3"
#export CXXFLAGS="${CFLAGS}"
#  -DUSER_CMAKE_C_FLAGS="${CFLAGS}" \
#  -DUSER_CMAKE_CXX_FLAGS="${CXXLAGS}" \
%cmake \
  -DCMAKE_INSTALL_PREFIX='%{_prefix}' \
  -DCMAKE_BUILD_TYPE='Release' \
  -DPACKAGE_MODE='TRUE' \
  -DDISABLE_PCSX2_WRAPPER='TRUE' \
  -DWX28_API='FALSE' \
  -DXDG_STD='TRUE' \
  -DREBUILD_SHADER='TRUE' \
  -DPLUGIN_DIR='%{_libdir}/%{name}' \
  -DGAMEINDEX_DIR='%{_datadir}/%{name}' \
  -DDOC_DIR='%{_docdir}/%{name}' \
  -DBIN_DIR='%{_bindir}' \
  -DGLSL_API='TRUE' \
  -DEGL_API='TRUE' \
  -DSDL2_API='TRUE' \
  -DEXTRA_PLUGINS='FALSE' \
  -DUSER_CMAKE_C_FLAGS="${CFLAGS}" \
  -DUSER_CMAKE_CXX_FLAGS="${CXXLAGS}" \
  -DUSER_CMAKE_LD_FLAGS="${LDLAGS}" \
  -DDISABLE_BUILD_DATE='TRUE' \
  -DPACKAGE_MODE='TRUE' \
  ..
make %{?jobs:-j%{jobs}}

%install
%cmake_install

#mkdir -p %{_docdir}
#mv %{buildroot}%{_datadir}/doc/pcsx2 %{_docdir}/

# move translations to main language dir if there isn't a sublang or delete
# translations not supported by distro at all
for i in $(ls %{buildroot}%{_datadir}/locale | grep _); do
  new=$(echo $i | sed "s:_.*::g")
  if [ ! -d %{_datadir}/locale/$i ]; then
    if [ -d %{_datadir}/locale/$new ]; then
      mv %{buildroot}%{_datadir}/locale/$i %{buildroot}%{_datadir}/locale/$new
    else
      rm -rf %{buildroot}%{_datadir}/locale/$i
    fi
  fi
done

#install -D -m 644 %{SOURCE1} -t %{buildroot}%{_sysconfdir}/udev/rules.d/
%fdupes -s %{buildroot}
%find_lang pcsx2_Main
%find_lang pcsx2_Iconized

%files lang -f pcsx2_Main.lang -f pcsx2_Iconized.lang

%files
%defattr(-,root,root)
#%{_sysconfdir}/udev/rules.d/99-direct-access-to-sixaxis-gamepad.rules
%{_bindir}/%{dumbname}*
%{_libdir}/%{name}
%{_docdir}/%{name}
%{_datadir}/%{name}
%{_mandir}/man?/%{dumbname}.*
#%{_datadir}/locale/*/LC_MESSAGES/*.mo
%{_datadir}/applications/%{dumbname}.desktop
%{_datadir}/pixmaps/%{dumbname}.xpm

%changelog
openSUSE Build Service is sponsored by