From 76bc4ed7fd658432bedf70c7355efca2cdb757b3 Mon Sep 17 00:00:00 2001
From: GloriousEggroll <gloriouseggroll@gmail.com>
Date: Wed, 20 Mar 2024 23:48:14 -0600
Subject: [PATCH] reorganize packaging files, add rpm spec sheet

---
 .../org.openwinecomponents.umu.launcher.yml   | 183 ++++++++++++++++++
 packaging/rpm/umu-launcher.spec               |  49 +++++
 2 files changed, 232 insertions(+)
 create mode 100644 packaging/flatpak/org.openwinecomponents.umu.launcher.yml
 create mode 100644 packaging/rpm/umu-launcher.spec

diff --git a/packaging/flatpak/org.openwinecomponents.umu.launcher.yml b/packaging/flatpak/org.openwinecomponents.umu.launcher.yml
new file mode 100644
index 000000000..fc30c8a1d
--- /dev/null
+++ b/packaging/flatpak/org.openwinecomponents.umu.launcher.yml
@@ -0,0 +1,183 @@
+id: org.openwinecomponents.umu.launcher
+runtime: org.freedesktop.Platform
+runtime-version: &runtime-version '23.08'
+x-gl-version: &gl-version '1.4'
+x-gl-versions: &gl-versions 23.08;23.08-extra;1.4
+x-gl-merge-dirs: &gl-merge-dirs vulkan/icd.d;glvnd/egl_vendor.d;OpenCL/vendors;lib/dri;lib/d3d;vulkan/explicit_layer.d;vulkan/implicit_layer.d
+sdk: org.freedesktop.Sdk
+command: umu-run
+separate-locales: false
+
+sdk-extensions:
+  - org.freedesktop.Sdk.Compat.i386
+  - org.freedesktop.Sdk.Extension.toolchain-i386
+
+finish-args:
+  - --allow=devel
+  - --allow=multiarch
+  - --device=all
+  - --allow=bluetooth
+  - --allow=per-app-dev-shm
+  - --env=PATH=/app/bin:/app/utils/bin:/usr/bin:/usr/lib/extensions/vulkan/MangoHud/bin:/usr/lib/extensions/vulkan/gamescope/bin:/usr/lib/extensions/vulkan/OBSVkCapture/bin
+  - --filesystem=xdg-data/lutris:rw
+  - --filesystem=xdg-data/Steam:rw
+  - --filesystem=xdg-data/applications:rw
+  - --filesystem=~/.steam:rw
+  - --filesystem=~/Games:rw
+  - --filesystem=~/.local/share:rw
+  - --filesystem=~/.var/app/com.valvesoftware.Steam:rw
+  - --filesystem=~/.var/app/org.openwinecomponents.umu.launcher:rw
+  - --filesystem=xdg-documents
+  - --filesystem=xdg-desktop
+  - --env=TZ=
+  - --unset-env=TZ
+  - --env=LC_ADDRESS=C
+  - --env=LC_COLLATE=C
+  - --env=LC_MONETARY=C
+  - --env=LC_MEASUREMENT=C
+  - --env=LC_NAME=C
+  - --env=LC_NUMERIC=C
+  - --env=LC_TELEPHONE=C
+  - --env=SDL_VIDEODRIVER=
+  - --unset-env=SDL_VIDEODRIVER
+  - --env=DBUS_FATAL_WARNINGS=0
+  - --env=XDG_CONFIG_DIRS=/etc/xdg:/usr/lib/x86_64-linux-gnu/GL:/usr/lib/i386-linux-gnu/GL
+  # Wine uses UDisks2 to enumerate disk drives
+  - --system-talk-name=org.freedesktop.UDisks2
+  # should fix access to SD card on the deck
+  - --filesystem=/run/media
+  # There are still quite a few users using /mnt/ for external drives
+  - --filesystem=/mnt
+  # should fix steamdeck controler navigation
+  - --filesystem=/run/udev:ro
+  # should fix discord rich presence
+  - --filesystem=xdg-run/app/com.discordapp.Discord:create
+  - --persist=.
+  - --share=ipc
+  - --socket=wayland
+  - --socket=x11
+  - --socket=pulseaudio
+  - --share=network
+  - --talk-name=org.freedesktop.Notifications
+  - --talk-name=org.kde.StatusNotifierWatcher
+  # Required for bwrap to work
+  - --talk-name=org.freedesktop.portal.Background
+
+add-extensions:
+  org.freedesktop.Platform.Compat.i386:
+    directory: lib/i386-linux-gnu
+    version: *runtime-version
+
+  org.freedesktop.Platform.Compat.i386.Debug:
+    directory: lib/debug/lib/i386-linux-gnu
+    version: *runtime-version
+    no-autodownload: true
+
+  org.freedesktop.Platform.GL32:
+    directory: lib/i386-linux-gnu/GL
+    version: *gl-version
+    versions: *gl-versions
+    subdirectories: true
+    no-autodownload: true
+    autodelete: false
+    add-ld-path: lib
+    merge-dirs: *gl-merge-dirs
+    download-if: active-gl-driver
+    enable-if: active-gl-driver
+    autoprune-unless: active-gl-driver
+
+  org.freedesktop.Platform.GL32.Debug:
+    directory: lib/debug/lib/i386-linux-gnu/GL
+    version: *gl-version
+    versions: *gl-versions
+    subdirectories: true
+    no-autodownload: true
+    merge-dirs: *gl-merge-dirs
+    enable-if: active-gl-driver
+    autoprune-unless: active-gl-driver
+
+  org.freedesktop.Platform.VAAPI.Intel.i386:
+    directory: lib/i386-linux-gnu/dri/intel-vaapi-driver
+    version: *runtime-version
+    versions: *runtime-version
+    autodelete: false
+    no-autodownload: true
+    add-ld-path: lib
+    download-if: have-intel-gpu
+    autoprune-unless: have-intel-gpu
+
+  org.freedesktop.Platform.ffmpeg-full:
+    directory: lib/ffmpeg
+    add-ld-path: .
+    version: *runtime-version
+    no-autodownload: true
+    autodelete: false
+
+  org.freedesktop.Platform.ffmpeg_full.i386:
+    directory: lib32/ffmpeg
+    add-ld-path: .
+    version: *runtime-version
+    no-autodownload: true
+    autodelete: false
+
+  com.valvesoftware.Steam.CompatibilityTool:
+    subdirectories: true
+    directory: share/steam/compatibilitytools.d
+    version: stable
+    versions: stable;beta;test
+    no-autodownload: true
+    autodelete: true
+
+  com.valvesoftware.Steam.Utility:
+    subdirectories: true
+    directory: utils
+    version: stable
+    versions: stable;beta;test
+    add-ld-path: lib
+    merge-dirs: bin;lib/python3.10/site-packages;share/vulkan/explicit_layer.d;share/vulkan/implicit_layer.d;share/steam/compatibilitytools.d;
+    no-autodownload: true
+    autodelete: true
+
+modules:
+  # --- umu ---
+  - name: umu-run
+    buildsystem: simple
+    build-commands:
+      - install -D umu-run-cli /app/bin/umu-run
+      - install -D umu-launcher.tar.gz /app/share/umu/umu-launcher.tar.gz
+    sources:
+      - type: file
+        path: umu-run-cli
+      - type: file
+        url: https://github.com/Open-Wine-Components/umu-launcher/releases/download/0.1-RC3/umu-launcher.tar.gz
+        sha256: e25c4dd0636d04e7c8c534cf3c5bbdca5ae0d49f146ee8395306174700899952
+
+  - name: platform-bootstrap
+    buildsystem: simple
+    build-commands:
+      - |
+        set -e
+        mkdir -p /app/bin
+        mkdir -p /app/lib/i386-linux-gnu
+        mkdir -p /app/lib/i386-linux-gnu/GL
+        mkdir -p /app/lib/i386-linux-gnu/dri/intel-vaapi-driver
+        mkdir -p /app/lib/debug/lib/i386-linux-gnu
+        mkdir -p /app/lib/debug/lib/i386-linux-gnu/GL
+        install -Dm644 -t /app/etc ld.so.conf
+        mkdir -p /app/lib{,32}/ffmpeg
+        mkdir -p /app/share/steam/compatibilitytools.d
+        mkdir -p /app/utils /app/share/vulkan
+        ln -srv /app/{utils/,}share/vulkan/explicit_layer.d
+        ln -srv /app/{utils/,}share/vulkan/implicit_layer.d
+        mkdir -p /app/links/lib
+        ln -srv /app/lib /app/links/lib/x86_64-linux-gnu
+        ln -srv /app/lib32 /app/links/lib/i386-linux-gnu
+    sources:
+      - type: inline
+        dest-filename: ld.so.conf
+        contents: |
+          # We just make any GL32 extension have higher priority
+          include /run/flatpak/ld.so.conf.d/app-*-org.freedesktop.Platform.GL32.*.conf
+          /app/lib32
+          /app/lib/i386-linux-gnu
+          /lib64
diff --git a/packaging/rpm/umu-launcher.spec b/packaging/rpm/umu-launcher.spec
new file mode 100644
index 000000000..889f2adde
--- /dev/null
+++ b/packaging/rpm/umu-launcher.spec
@@ -0,0 +1,49 @@
+%define commit 0237fb45fc52ef7d94649d9c4939753168bf31bc
+%global shortcommit %(c=%{commit}; echo ${c:0:7})
+
+%global build_timestamp %(date +"%Y%m%d")
+
+%global rel_build 1.%{build_timestamp}.%{shortcommit}%{?dist}
+
+Name:           umu-launcher
+Version:        1.0.0
+Release:        %{rel_build}
+Summary:        A tool for launching non-steam games with proton
+
+License:        GPLv3
+URL:            https://github.com/Open-Wine-Components/umu-launcher
+
+BuildRequires:  meson >= 0.54.0
+BuildRequires:  ninja-build
+BuildRequires:  cmake
+BuildRequires:  g++
+BuildRequires:  gcc-c++
+BuildRequires:  scdoc
+BuildRequires:  git
+
+
+%description
+%{name} A tool for launching non-steam games with proton
+
+%prep
+git clone --single-branch --branch main https://github.com/Open-Wine-Components/umu-launcher.git
+cd umu-launcher
+git checkout %{commit}
+git submodule update --init --recursive
+
+%build
+cd umu-launcher
+./configure.sh --prefix=/usr
+make
+
+%install
+cd umu-launcher
+make DESTDIR=%{buildroot} install
+
+%files
+%{_bindir}/umu-run
+%{_datadir}/man/*
+%{_datadir}/umu/*
+
+%changelog
+