Packaging: Add SPEC and PKGBUILD
This commit is contained in:
parent
ca6b99401b
commit
7d8ae9aa11
|
@ -169,6 +169,11 @@ Fedora package names:
|
|||
alsa-lib-devel autoconf automake brotli-devel clang cmake dbus-devel egl-wayland-devel extra-cmake-modules fontconfig-devel gcc-c++ gtk3-devel libavcodec-free-devel libavformat-free-devel libavutil-free-devel libcurl-devel libdecor-devel libevdev-devel libICE-devel libinput-devel libSM-devel libswresample-free-devel libswscale-free-devel libX11-devel libXau-devel libxcb-devel libXcomposite-devel libXcursor-devel libXext-devel libXfixes-devel libXft-devel libXi-devel libxkbcommon-devel libxkbcommon-x11-devel libXpresent-devel libXrandr-devel libXrender-devel libtool lld llvm make mesa-libEGL-devel mesa-libGL-devel nasm ninja-build openssl-devel patch pcre2-devel perl-Digest-SHA pipewire-devel pulseaudio-libs-devel systemd-devel wayland-devel xcb-util-cursor-devel xcb-util-devel xcb-util-errors-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xcb-util-xrm-devel zlib-devel
|
||||
```
|
||||
|
||||
Arch package names:
|
||||
```
|
||||
base-devel clang cmake curl dbus extra-cmake-modules freetype git libjpeg-turbo libpng libwebp libx11 libxrandr lld llvm ninja qt6-base qt6-imageformats qt6-svg qt6-tools wayland zstd
|
||||
```
|
||||
|
||||
#### Building
|
||||
|
||||
1. Clone the repository: `git clone https://github.com/stenzek/duckstation.git`, `cd duckstation`.
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||
# SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
|
||||
# NOTE: These package files are intended for your own personal/private use.
|
||||
# You do not have permission to upload them independently to other package repositories.
|
||||
|
||||
pkgname=duckstation
|
||||
pkgver=0
|
||||
pkgrel=1
|
||||
pkgdesc='PlayStation 1, aka. PSX Emulator'
|
||||
arch=('x86_64' 'aarch64')
|
||||
url='https://www.duckstation.org/'
|
||||
license=('CC-BY-NC-ND-4.0')
|
||||
|
||||
# We want to keep debug symbols for backtraces.
|
||||
# Our cmake build already generates symbols.
|
||||
options=('!strip' '!debug')
|
||||
|
||||
# User-selectable dependencies (as .so), and packages.
|
||||
depends=('libjpeg.so' # libjpeg or libjpeg-turbo
|
||||
'libudev.so'
|
||||
'curl'
|
||||
'dbus'
|
||||
'freetype2'
|
||||
'hicolor-icon-theme'
|
||||
'libpng'
|
||||
'libwebp'
|
||||
'libx11'
|
||||
'libxrandr'
|
||||
'qt6-base'
|
||||
'qt6-imageformats'
|
||||
'qt6-svg'
|
||||
'wayland'
|
||||
'zlib'
|
||||
'zstd'
|
||||
)
|
||||
|
||||
# qttools only needed for building (moc/uic/rcc/lupdate)
|
||||
# Same with the compilers.
|
||||
makedepends=('base-devel'
|
||||
'clang'
|
||||
'cmake'
|
||||
'extra-cmake-modules'
|
||||
'git'
|
||||
'lld'
|
||||
'llvm'
|
||||
'ninja'
|
||||
'qt6-tools')
|
||||
|
||||
source=(
|
||||
"${pkgname}::git+file://${startdir}/../../.."
|
||||
)
|
||||
sha256sums=(
|
||||
"SKIP"
|
||||
)
|
||||
|
||||
# Name of the .desktop file that will be installed.
|
||||
_desktopname=org.duckstation.DuckStation
|
||||
|
||||
# https://wiki.archlinux.org/title/VCS_package_guidelines#Git
|
||||
# --dirty omitted, we need to ignore changes to this script because
|
||||
# makepkg is fricking weird and edits the build recipe, instead of
|
||||
# just setting in the resulting file?!
|
||||
pkgver() {
|
||||
cd "$pkgname"
|
||||
git describe | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
|
||||
}
|
||||
|
||||
prepare() {
|
||||
cd "${pkgname}"
|
||||
|
||||
# Are we creating a CI/official build?
|
||||
_tagpath="${startdir}/../../../src/scmversion/tag.h"
|
||||
if [[ -f "${_tagpath}" ]]; then
|
||||
echo "Copying SCM release tag..."
|
||||
cp "${_tagpath}" src/scmversion
|
||||
fi
|
||||
|
||||
# build dependencies
|
||||
if [[ ! -z "$DEPSDIR" ]]; then
|
||||
_depsdir="$DEPSDIR"
|
||||
echo "Using existing dependencies from ${_depsdir}."
|
||||
else
|
||||
_depsdir="$PWD/deps"
|
||||
echo "Building dependencies to ${_depsdir}..."
|
||||
./scripts/deps/build-dependencies-linux.sh \
|
||||
-system-freetype -system-harfbuzz -system-libjpeg \
|
||||
-system-libpng -system-libwebp -system-zstd -system-qt \
|
||||
"${_depsdir}"
|
||||
fi
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${pkgname}"
|
||||
|
||||
rm -fr build-arch
|
||||
cmake -B build-arch \
|
||||
-G Ninja \
|
||||
-DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
||||
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
||||
-DCMAKE_PREFIX_PATH="${_depsdir}" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
|
||||
-DALLOW_INSTALL=ON \
|
||||
-DINSTALL_SELF_CONTAINED=ON \
|
||||
-DCMAKE_INSTALL_PREFIX="${pkgdir}/opt/duckstation"
|
||||
ninja -C build-arch
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${pkgname}"
|
||||
ninja -C build-arch install
|
||||
|
||||
# install wrapper script
|
||||
install -Dm755 scripts/packaging/duckstation-qt "${pkgdir}/usr/bin/duckstation-qt"
|
||||
|
||||
# install desktop file and icon
|
||||
install -Dm644 scripts/${_desktopname}.desktop "${pkgdir}/usr/share/applications/${_desktopname}.desktop"
|
||||
install -Dm644 scripts/${_desktopname}.png "${pkgdir}/usr/share/icons/hicolor/512x512/apps/${_desktopname}.png"
|
||||
|
||||
# install license
|
||||
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
|
||||
install -Dm644 data/resources/thirdparty.html "${pkgdir}/usr/share/licenses/${pkgname}/thirdparty.html"
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [[ -z "$I_WANT_A_BROKEN_WAYLAND_UI" ]]; then
|
||||
echo "Forcing X11 instead of Wayland, due to various protocol limitations"
|
||||
echo "and Qt issues. If you want to use Wayland, launch DuckStation with"
|
||||
echo "I_WANT_A_BROKEN_WAYLAND_UI=YES set."
|
||||
export QT_QPA_PLATFORM=xcb
|
||||
else
|
||||
echo "Wayland is not being disabled. Do not complain when things break."
|
||||
fi
|
||||
|
||||
exec /opt/duckstation/duckstation-qt "$@"
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
# SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||
# SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
|
||||
# NOTE: These package files are intended for your own personal/private use.
|
||||
# You do not have permission to upload them independently to other package repositories.
|
||||
|
||||
Name: duckstation
|
||||
Version: 0.0.0
|
||||
Release: 0%{?dist}
|
||||
Summary: Fast PlayStation 1 Emulator
|
||||
License: CC-BY-NC-ND-4.0
|
||||
|
||||
BuildRequires: alsa-lib-devel, clang, cmake, dbus-devel, egl-wayland-devel, extra-cmake-modules, gcc-c++
|
||||
BuildRequires: extra-cmake-modules, freetype-devel, libavcodec-free-devel, libavformat-free-devel
|
||||
BuildRequires: libavutil-free-devel, libcurl-devel, libevdev-devel, libswresample-free-devel
|
||||
BuildRequires: libswscale-free-devel, libpng-devel, libwebp-devel, libX11-devel, libXrandr-devel
|
||||
BuildRequires: libzstd-devel, lld, llvm, make, mesa-libEGL-devel, mesa-libGL-devel, ninja-build
|
||||
BuildRequires: patch, pipewire-devel pulseaudio-libs-devel, wayland-devel, zlib-devel
|
||||
BuildRequires: qt6-qtbase-devel, qt6-qtbase-private-devel, qt6-qttools, qt6-qttools-devel
|
||||
|
||||
Requires: bash curl dbus freetype libpng libwebp libzstd
|
||||
Requires: qt6-qtbase qt6-qtbase-gui qt6-qtimageformats qt6-qtsvg
|
||||
|
||||
# Don't want extra flags producing a slower build than our other formats.
|
||||
%undefine _hardened_build
|
||||
%undefine _annotated_build
|
||||
%undefine _fortify_level
|
||||
%undefine _include_frame_pointers
|
||||
|
||||
# Defines -O2, -flto, and others. We manage LTO ourselves.
|
||||
%global _general_options "-O2" "-pipe"
|
||||
%global _preprocessor_defines ""
|
||||
|
||||
# We include debug information in the main package for user backtrace reporting.
|
||||
%global debug_package %{nil}
|
||||
|
||||
Source0: %{expand:%%(pwd)}
|
||||
|
||||
%description
|
||||
DuckStation is an simulator/emulator of the Sony PlayStation(TM) console, focusing on playability, speed, and long-term maintainability. The goal is to be as accurate as possible while maintaining performance suitable for low-end devices.
|
||||
"Hack" options are discouraged, the default configuration should support all playable games with only some of the enhancements having compatibility issues.
|
||||
"PlayStation" and "PSX" are registered trademarks of Sony Interactive Entertainment Europe Limited. This project is not affiliated in any way with Sony Interactive Entertainment.
|
||||
|
||||
%prep
|
||||
%setup -n duckstation -c -T
|
||||
git clone file://%{SOURCEURL0} .
|
||||
if [ -f "%{SOURCEURL0}/src/scmversion/tag.h" ]; then
|
||||
echo "Copying SCM release tag..."
|
||||
cp "%{SOURCEURL0}/src/scmversion/tag.h" src/scmversion
|
||||
fi
|
||||
|
||||
%build
|
||||
|
||||
if [ ! -d "${PWD}/deps" ]; then
|
||||
scripts/deps/build-dependencies-linux.sh -system-freetype -system-harfbuzz -system-libjpeg -system-libpng -system-libwebp -system-zstd -system-qt "${PWD}/deps"
|
||||
fi
|
||||
|
||||
rm -fr build
|
||||
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=${PWD}/deps \
|
||||
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
||||
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
|
||||
-DALLOW_INSTALL=ON -DINSTALL_SELF_CONTAINED=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=%{buildroot}/opt/%{name}
|
||||
ninja -C build %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
rm -fr %{buildroot}
|
||||
ninja -C build install
|
||||
install -Dm755 scripts/packaging/duckstation-qt %{buildroot}/usr/bin/duckstation-qt
|
||||
install -Dm644 scripts/org.duckstation.DuckStation.png %{buildroot}/usr/share/icons/hicolor/512x512/apps/org.duckstation.DuckStation.png
|
||||
install -Dm644 scripts/org.duckstation.DuckStation.desktop %{buildroot}/usr/share/applications/org.duckstation.DuckStation.desktop
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
/opt/duckstation
|
||||
/usr/bin/duckstation-qt
|
||||
/usr/share/icons/hicolor/512x512/apps/org.duckstation.DuckStation.png
|
||||
/usr/share/applications/org.duckstation.DuckStation.desktop
|
||||
|
||||
%changelog
|
||||
|
|
@ -217,6 +217,7 @@ function(add_core_resources target)
|
|||
if(ALLOW_INSTALL)
|
||||
if(INSTALL_SELF_CONTAINED)
|
||||
install_imported_dep_library(cpuinfo::cpuinfo)
|
||||
install_imported_dep_library(DiscordRPC::discord-rpc)
|
||||
endif()
|
||||
install(DIRECTORY "$<TARGET_FILE_DIR:${target}>/resources" DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
|
|
|
@ -313,6 +313,7 @@ function(add_util_resources target)
|
|||
set_target_properties(${target} PROPERTIES INSTALL_RPATH "$ORIGIN")
|
||||
|
||||
# Copy dependency libraries to installation directory.
|
||||
install_imported_dep_library(SDL2::SDL2)
|
||||
install_imported_dep_library(Shaderc::shaderc_shared)
|
||||
install_imported_dep_library(spirv-cross-c-shared)
|
||||
install_imported_dep_library(SoundTouch::SoundTouchDLL)
|
||||
|
|
Loading…
Reference in New Issue