File krkrsdl2.spec of Package krkrsdl2
#
# spec file for package krkrsdl2
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
Name: krkrsdl2
Version: 0
Release: 0
Summary: Kirikiri SDL2 Project (Based on Kirikiri 2 and Kirikiri Z)
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License: MIT
URL: https://github.com/krkrsdl2/krkrsdl2
Source: _service
Source1: stub-build.txt
Source2: FindJXR.cmake
Patch0: buildfix.patch
Patch1: pluginfix.patch
Patch2: fonts.patch
Patch3: linkfix.patch
BuildRequires: sdl2-compat-devel
BuildRequires: libpng-devel
BuildRequires: cmake-full
BuildRequires: nasm
BuildRequires: gcc-c++
BuildRequires: pkgconfig(xext)
BuildRequires: pkgconfig(libpipewire-0.3)
BuildRequires: pkgconfig(simde)
BuildRequires: cmake(FAudio)
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(freetype2)
BuildRequires: cmake(libjpeg-turbo)
BuildRequires: pkgconfig(ogg)
BuildRequires: pkgconfig(oniguruma)
BuildRequires: pkgconfig(opus)
BuildRequires: pkgconfig(opusfile)
BuildRequires: jxrlib-devel
%description
Kirikiri SDL2 is a port of Kirikiri Z that can be run on platforms supporting SDL2, such as macOS and Linux
Please visit the following webpage for more information: https://krkrsdl2.github.io/krkrsdl2/en/
%package devel
License: MIT
Summary: tp_stub_krkrsdl2
BuildRequires: python3
Requires: %{name} = %{version}
%description devel
Kirikiri SDL2 Project (Based on Kirikiri 2 and Kirikiri Z) tp_stub_krkrsdl2
%prep
%setup -q -n %_sourcedir/%name-%version -T -D
%__mkdir -p %_builddir/%_sourcedir
%__ln -s %_sourcedir/%name-%version %_builddir/%_sourcedir
%patch 0 1 2 3
cp %{SOURCE2} %_sourcedir/%name-%version
%__mkdir stub-build
python3 src/core/base/sdl2/makestub.py stub-build
%__sed -i '100a #include <cstddef>' stub-build/tp_stub.h
%__sed -i '10a #include <guiddef.h>' external/krkrz/visual/LoadJXR.cpp
cp %{SOURCE1} stub-build/CMakeLists.txt
%build
%cmake
%cmake_build
cd %_sourcedir/%name-%version/stub-build
%cmake
%cmake_build
%install
%__install -Dm755 build/%{name} %{buildroot}%{_bindir}/%{name}
cd stub-build
%cmake_install
%__mkdir -p %{buildroot}%{_libdir}/%{name} %{buildroot}%{_sysconfdir}/ld.so.conf.d/
%__mv %{buildroot}%{_libdir}/libtp_stub.so %{buildroot}%{_libdir}/%{name}/libtp_stub.so
%__mv %{buildroot}%{_includedir}/tp_stub %{buildroot}%{_includedir}/%{name}
%__cp -p %_sourcedir/%name-%version/external/krkrz/extension/Extension.* %{buildroot}%{_includedir}/%{name}
mkdir -p %{buildroot}%{_libdir}/pkgconfig
echo 'prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib64
includedir=${prefix}/include
Name: tp_stub
Description: 構造体 tTVPWindowMessage
Version: 20250319%{version}
Cflags: -I${includedir}/%{name}
Libs: -L${libdir}/%{name} -ltp_stub' > %{buildroot}%{_libdir}/pkgconfig/tp_stub.pc
echo "%{_libdir}/%{name}" > %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}.conf
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%files
%license LICENSE
%{_bindir}/%{name}
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/
%{_libdir}/%{name}/libtp_stub.so
%config %{_sysconfdir}/ld.so.conf.d/%{name}.conf
%files devel
%{_includedir}/%{name}
%{_libdir}/pkgconfig/tp_stub.pc
%changelog