mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-21 18:02:43 +01:00
Adding linux flatpak support
This commit is contained in:
parent
deba1190f0
commit
b473e87259
@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
# Creating flatpak directories
|
||||
mkdir -p "${APPVEYOR_BUILD_FOLDER}/.flatpak/lib" "${APPVEYOR_BUILD_FOLDER}/.flatpak/data" "${APPVEYOR_BUILD_FOLDER}/.flatpak/bin"
|
||||
|
||||
cd "$APPVEYOR_BUILD_FOLDER/src_rebuild"
|
||||
|
||||
./premake5 gmake2
|
||||
@ -9,3 +12,23 @@ for config in debug_x86 release_x86 release_dev_x86
|
||||
do
|
||||
make config=$config -j$(nproc)
|
||||
done
|
||||
|
||||
find ${APPVEYOR_BUILD_FOLDER}/src_rebuild/bin -name 'REDRIVER2*' -exec cp -t ${APPVEYOR_BUILD_FOLDER}/.flatpak/bin {} +
|
||||
|
||||
# Copy missing libraries in the runtime
|
||||
for lib in libjpeg libopenal libsndio libbsd
|
||||
do
|
||||
cp -Lf $(ldd "${APPVEYOR_BUILD_FOLDER}/src_rebuild/bin/Release/REDRIVER2" | awk '/ => / { print $3 }' | grep ${lib}) "${APPVEYOR_BUILD_FOLDER}/.flatpak/lib"
|
||||
done
|
||||
|
||||
cp -r "${APPVEYOR_BUILD_FOLDER}/data" "${APPVEYOR_BUILD_FOLDER}/.flatpak/"
|
||||
cd ${APPVEYOR_BUILD_FOLDER}
|
||||
|
||||
# Editing metadatas with the current version
|
||||
export APPVEYOR_BUILD_DATE=$(date "+%Y-%m-%d")
|
||||
sed -i -e "s/V_VERSION/$APPVEYOR_BUILD_VERSION/g" -e "s/V_DATE/$APPVEYOR_BUILD_DATE/g" .flatpak/io.github.opendriver2.Redriver2.appdata.xml
|
||||
|
||||
# Build the flatpak
|
||||
flatpak-builder --user --install build io.github.opendriver.redriver2.yaml --force-clean --arch=x86_64
|
||||
flatpak build-bundle ~/.local/share/flatpak/repo io.github.opendriver2.Redriver2.flatpak io.github.opendriver2.Redriver2
|
||||
rm -rf build/ .flatpak-builder/
|
||||
|
@ -8,7 +8,7 @@ cd "$APPVEYOR_BUILD_FOLDER/src_rebuild"
|
||||
curl "$linux_premake_url" -Lo premake5.tar.gz
|
||||
tar xvf premake5.tar.gz
|
||||
|
||||
sudo apt-get install --no-install-recommends -y g++-multilib
|
||||
sudo apt-get install --no-install-recommends -y g++-7-multilib gcc-7-multilib
|
||||
|
||||
sudo apt-get update -qq -y
|
||||
sudo apt-get install -qq aptitude -y
|
||||
@ -17,5 +17,17 @@ sudo apt-get install -qq aptitude -y
|
||||
sudo aptitude install --quiet=2 \
|
||||
libsdl2-dev:i386 \
|
||||
libopenal-dev:i386 \
|
||||
libjpeg-turbo8-dev:i386 -y
|
||||
libjpeg-turbo8-dev:i386 \
|
||||
flatpak flatpak-builder -y
|
||||
|
||||
# Setting XDG_DATA_DIRS environement variable for flatpak
|
||||
export XDG_DATA_DIRS="/var/lib/flatpak/exports/share:${HOME}/.local/share/flatpak/exports/share:$XDG_DATA_DIRS"
|
||||
|
||||
# Adding the flathub repo
|
||||
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
# Adding Platform/SDK for the Linux flatpak release
|
||||
flatpak --user install flathub org.freedesktop.Platform/x86_64/20.08 -y
|
||||
flatpak --user install flathub org.freedesktop.Sdk/x86_64/20.08 -y
|
||||
flatpak --user install flathub org.freedesktop.Sdk.Compat.i386/x86_64/20.08 -y
|
||||
flatpak --user install flathub org.freedesktop.Sdk.Extension.toolchain-i386/x86_64/20.08 -y
|
||||
|
BIN
.flatpak/icon.png
Normal file
BIN
.flatpak/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
17
.flatpak/io.github.opendriver2.Redriver2.appdata.xml
Normal file
17
.flatpak/io.github.opendriver2.Redriver2.appdata.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<component type="desktop">
|
||||
<id>io.github.opendriver2.Redriver2</id>
|
||||
<metadata_license>MIT</metadata_license>
|
||||
<project_license>MIT</project_license>
|
||||
<name>REDRIVER2</name>
|
||||
<summary>Driver 2 Playstation game reverse engineering effort</summary>
|
||||
<description>
|
||||
<p>Driver 2 Playstation game reverse engineering effort </p>
|
||||
</description>
|
||||
<categories>
|
||||
<category>Game</category>
|
||||
</categories>
|
||||
<releases>
|
||||
<release version="V_VERSION" date="V_DATE" />
|
||||
</releases>
|
||||
</component>
|
6
.flatpak/io.github.opendriver2.Redriver2.desktop
Normal file
6
.flatpak/io.github.opendriver2.Redriver2.desktop
Normal file
@ -0,0 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=REDRIVER2
|
||||
Icon=
|
||||
Exec=start.sh
|
||||
Categories=Game;
|
42
.flatpak/start.sh
Normal file
42
.flatpak/start.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /app/game/data/
|
||||
AppVersion=$(cat /app/share/appdata/io.github.opendriver2.Redriver2.appdata.xml | awk -F'"' 'NR==15 {print $2":"$4}')
|
||||
|
||||
function importDefaultData {
|
||||
cp -rf `ls /app/game/data/ | grep -v '^config.ini$'` /var/data/
|
||||
if [ ! -f /var/data/config.ini ]; then
|
||||
echo "Config file not found, importing default config."
|
||||
cp /app/game/data/config.ini /var/data/config.ini
|
||||
fi
|
||||
echo "$AppVersion" > /var/cache/REDRIVER2.cache
|
||||
}
|
||||
|
||||
if [ ! -d /var/data/DRIVER2 ]; then
|
||||
zenity --error --no-wrap --text="`printf "DRIVER2 files are missing! Add the folder in:\n ${HOME}/.var/io.github.opendriver2.Redriver2/data"`"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f /var/cache/REDRIVER2.cache ]; then
|
||||
echo "Cache not found, overwriting files."
|
||||
importDefaultData
|
||||
fi
|
||||
|
||||
if [[ $(< /var/cache/REDRIVER2.cache) != "$AppVersion" ]]; then
|
||||
echo "REDRIVER2 version not matching, overwriting files."
|
||||
importDefaultData
|
||||
fi
|
||||
|
||||
args=""
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
args+="$1 "
|
||||
shift
|
||||
done
|
||||
|
||||
cd /app/game/bin/
|
||||
case $REDRIVER2_BUILD in
|
||||
release) ./REDRIVER2 $([ ! -z "$args" ] && echo "$args"); shift;;
|
||||
dev) ./REDRIVER2_dev $([ ! -z "$args" ] && echo "$args"); shift;;
|
||||
debug) ./REDRIVER2_dbg $([ ! -z "$args" ] && echo "$args"); shift;;
|
||||
*) ./REDRIVER2 $([ ! -z "$args" ] && echo "$args"); # Fallback
|
||||
esac
|
@ -9,7 +9,7 @@ skip_tags: true
|
||||
|
||||
image:
|
||||
- Visual Studio 2019
|
||||
- Ubuntu
|
||||
- Ubuntu2004
|
||||
|
||||
environment:
|
||||
data_folder: '%APPVEYOR_BUILD_FOLDER%\data'
|
||||
@ -48,3 +48,6 @@ artifacts:
|
||||
|
||||
- path: src_rebuild\bin\*\*.tar.gz
|
||||
name: Linux Binaries
|
||||
|
||||
- path: io.github.opendriver2.Redriver2.flatpak
|
||||
name: Linux Flatpak
|
||||
|
74
io.github.opendriver.redriver2.yaml
Normal file
74
io.github.opendriver.redriver2.yaml
Normal file
@ -0,0 +1,74 @@
|
||||
---
|
||||
app-id: io.github.opendriver2.Redriver2
|
||||
runtime: org.freedesktop.Platform
|
||||
runtime-version: '20.08'
|
||||
rename-icon: 'icon'
|
||||
sdk: org.freedesktop.Sdk
|
||||
command: start.sh
|
||||
finish-args:
|
||||
- "--socket=x11"
|
||||
- "--socket=wayland"
|
||||
- "--share=ipc"
|
||||
- "--device=all"
|
||||
- "--socket=pulseaudio"
|
||||
- "--persist=."
|
||||
- "--allow=multiarch"
|
||||
- "--env=SDL_DYNAMIC_API=/app/lib/i386-linux-gnu/libSDL2-2.0.so.0"
|
||||
add-extensions:
|
||||
org.freedesktop.Platform.Compat.i386:
|
||||
directory: lib/i386-linux-gnu
|
||||
version: '20.08'
|
||||
org.freedesktop.Platform.Compat.i386.Debug:
|
||||
directory: lib/debug/lib/i386-linux-gnu
|
||||
version: '20.08'
|
||||
no-autodownload: true
|
||||
org.freedesktop.Platform.GL32:
|
||||
directory: lib/i386-linux-gnu/GL
|
||||
version: '20.08'
|
||||
subdirectories: true
|
||||
no-autodownload: true
|
||||
autodelete: false
|
||||
add-ld-path: lib
|
||||
merge-dirs: vulkan/icd.d;glvnd/egl_vendor.d
|
||||
download-if: active-gl-driver
|
||||
enable-if: active-gl-driver
|
||||
sdk-extensions:
|
||||
- org.freedesktop.Sdk.Compat.i386
|
||||
- org.freedesktop.Sdk.Extension.toolchain-i386
|
||||
build-options:
|
||||
prepend-pkg-config-path: "/app/lib32/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig"
|
||||
ldflags: "-L/app/lib32"
|
||||
append-path: "/usr/lib/sdk/toolchain-i386/bin"
|
||||
env:
|
||||
CC: i686-unknown-linux-gnu-gcc
|
||||
CXX: i686-unknown-linux-gnu-g++
|
||||
libdir: "/app/lib32"
|
||||
cleanup:
|
||||
- "/include"
|
||||
modules:
|
||||
- name: ld-i386
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- mkdir -p /app/lib/i386-linux-gnu /app/lib/debug/lib/i386-linux-gnu
|
||||
- install -Dm644 -t /app/etc ld.so.conf
|
||||
sources:
|
||||
- type: shell
|
||||
commands:
|
||||
- echo "/app/lib32" > ld.so.conf
|
||||
- name: game
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- mkdir -p /app/game/bin /app/game/data /app/bin /app/lib /app/share/applications/ /app/share/appdata /var/data/DRIVER2/ /app/share/icons/hicolor/256x256/apps
|
||||
- install start.sh /app/bin/
|
||||
- install bin/* /app/game/bin
|
||||
- cp -r data/* /app/game/data
|
||||
- install lib/* /app/lib/
|
||||
- install io.github.opendriver2.Redriver2.desktop /app/share/applications/
|
||||
- install -m644 io.github.opendriver2.Redriver2.appdata.xml /app/share/appdata/
|
||||
- install icon.png /app/share/icons/hicolor/256x256/apps/
|
||||
- chmod a+x -R /app/game/bin
|
||||
- ln -s /var/data/config.ini /app/game/bin/config.ini
|
||||
- ln -s /var/data/DRIVER2 /app/game/bin/DRIVER2
|
||||
sources:
|
||||
- type: dir
|
||||
path: .flatpak
|
Loading…
Reference in New Issue
Block a user