This commit is contained in:
0x0000ff 2021-09-02 17:24:48 +02:00 committed by GitHub
commit d3799ec6f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 672 additions and 0 deletions

11
snap/gui/re3.desktop Normal file
View File

@ -0,0 +1,11 @@
[Desktop Entry]
Version=1.1
Type=Application
Name=re3
GenericName=GTA III for Linux
icon=${SNAP}/meta/gui/re3.svg
Exec=re3
Actions=
Categories=Game
Keywords=gta;grand;gta3;re3

21
snap/gui/re3.svg Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" sodipodi:docname="re3_red.svg" inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)" id="svg8" version="1.1" viewBox="0 0 270.93331 270.93334" height="1024" width="1024" inkscape:export-filename="/home/hazelnot/Design/re3_red.png" inkscape:export-xdpi="96" inkscape:export-ydpi="96">
<defs id="defs2"/>
<sodipodi:namedview inkscape:window-maximized="1" inkscape:window-y="0" inkscape:window-x="0" inkscape:window-height="1359" inkscape:window-width="2560" inkscape:snap-page="true" inkscape:showpageshadow="false" inkscape:pagecheckerboard="false" showgrid="false" inkscape:document-rotation="0" inkscape:current-layer="g837" inkscape:document-units="mm" inkscape:cy="492.8848" inkscape:cx="549.85584" inkscape:zoom="0.7" inkscape:pageshadow="2" inkscape:pageopacity="0" borderopacity="1" bordercolor="#000000" pagecolor="#606060" id="base" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" lock-margins="false" units="px"/>
<metadata id="metadata5">
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g id="g837" transform="matrix(2.1130708,0,0,2.1130708,14.956432,63.50059)">
<path id="path1450" style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:1.25;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#c60000;stroke-width:1.836;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1" d="M 0.91799998,0.91799998 V 54.101316 H 17.960888 v 2.33009 c 0,2.95453 1.347497,6.384348 3.911905,8.332308 2.564408,1.947971 5.514112,2.433445 8.500257,2.433445 h 46.367194 v -14.5464 c 2.171993,1.134845 4.548071,1.450557 6.948413,1.450557 h 17.042893 c 2.98614,0 5.93584,-0.485482 8.50025,-2.433442 2.5644,-1.94796 3.91191,-5.377273 3.91191,-8.331793 V 30.964744 c 0,-1.094128 -0.25094,-2.296243 -0.70487,-3.457153 0.45593,-1.16196 0.70487,-2.363609 0.70487,-3.453019 V 11.81656 c 0,-2.9682265 -1.29681,-6.3966108 -3.85713,-8.3907028 -2.56031,-1.9940909 -5.55104,-2.50785722 -8.55503,-2.50785722 H 83.819398 c -3.003989,0 -5.99213,0.51376632 -8.55245,2.50785722 C 74.832145,3.7645045 74.436551,4.1470248 74.074773,4.5591214 73.713016,4.1470532 73.317379,3.7644843 72.8826,3.4258572 70.322288,1.4317663 67.332073,0.91799998 64.328081,0.91799998 H 47.285195 c -2.976748,0 -5.937909,0.51342982 -8.482687,2.46289872 C 36.275393,1.4370808 33.325985,0.91799998 30.37305,0.91799998 Z" inkscape:label="Border"/>
<g id="g1475" inkscape:label="Text" style="display:inline" transform="translate(-51.547657,-77.439255)">
<path style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:1.25;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:11.136;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1" d="m 84.566726,139.06892 c -4.562445,0 -6.843668,-1.73285 -6.843668,-5.19856 v -24.61088 c 0,-0.0877 -0.04387,-0.13161 -0.131609,-0.13161 h -3.22442 v 16.84595 H 60.679694 V 83.92475 h 23.887032 c 4.518575,0 6.777863,1.776721 6.777863,5.330164 v 12.239636 c 0,2.01801 -1.118676,3.15862 -3.356029,3.42183 2.281223,0.30709 3.421834,1.46964 3.421834,3.48764 v 20.07037 c 0,0.0877 0.04387,0.13161 0.131609,0.13161 h 33.823507 v 10.46292 z M 77.723058,94.585079 c 0,-0.08774 -0.04387,-0.131609 -0.131609,-0.131609 h -3.22442 v 6.31723 h 3.22442 c 0.08774,0 0.131609,-0.0439 0.131609,-0.13161 z m 33.955122,0 c 0,-0.08774 -0.0439,-0.131609 -0.13161,-0.131609 h -3.09281 c -0.0877,0 -0.13161,0.04387 -0.13161,0.131609 v 5.856601 h 3.35603 z m -10.1997,31.388741 c -4.562444,0 -6.843666,-1.73285 -6.843666,-5.19855 V 89.254914 c 0,-3.553443 2.281222,-5.330164 6.843666,-5.330164 h 17.04337 c 4.56244,0 6.84366,1.776721 6.84366,5.330164 v 20.991636 h -17.04336 v 5.13275 c 0,0.0877 0.0439,0.13161 0.13161,0.13161 h 3.09281 c 0.0877,0 0.13161,-0.0439 0.13161,-0.13161 v -2.50057 h 13.68733 v 7.89654 c 0,3.4657 -2.28122,5.19855 -6.84366,5.19855 z" id="path1452" transform="translate(-2.6458322)" inkscape:label="re"/>
<path style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:1.25;font-family:Pricedown;-inkscape-font-specification:Pricedown;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#c60000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:11.136;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1" d="m 135.23613,125.97382 c -4.56245,0 -6.84367,-1.73285 -6.84367,-5.19855 v -7.89654 h 13.68733 v 2.50057 c 0,0.0877 0.0439,0.13161 0.13161,0.13161 h 3.09281 c 0.0877,0 0.13161,-0.0439 0.13161,-0.13161 v -6.11982 c 0,-0.0877 -0.0439,-0.13161 -0.13161,-0.13161 h -16.71434 v -8.35717 h 16.71434 c 0.0877,0 0.13161,-0.0439 0.13161,-0.13161 v -6.054011 c 0,-0.08774 -0.0439,-0.131609 -0.13161,-0.131609 h -3.09281 c -0.0877,0 -0.13161,0.04387 -0.13161,0.131609 v 2.434766 h -13.55572 v -7.764931 c 0,-3.553443 2.28122,-5.330164 6.84366,-5.330164 h 16.91176 c 4.56245,0 6.84367,1.776721 6.84367,5.330164 v 12.239636 c 0,2.01801 -1.14061,3.15862 -3.42184,3.42183 2.28123,0.30709 3.42184,1.46964 3.42184,3.48764 v 12.37125 c 0,3.4657 -2.28122,5.19855 -6.84367,5.19855 z" id="path1458" inkscape:label="3"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -0,0 +1,443 @@
###############################################
# Launcher common exports for any desktop app #
###############################################
function prepend_dir() {
local var="$1"
local dir="$2"
if [ -d "$dir" ]; then
eval "export $var=\"\$dir\${$var:+:\$$var}\""
fi
}
function append_dir() {
local var="$1"
local dir="$2"
if [ -d "$dir" ]; then
eval "export $var=\"\${$var:+\$$var:}\$dir\""
fi
}
function can_open_file() {
return `head -c0 "$1" &> /dev/null`;
}
function update_xdg_dirs_values() {
local save_initial_values=false
local XDG_DIRS="DOCUMENTS DESKTOP DOWNLOAD MUSIC PICTURES VIDEOS PUBLICSHARE TEMPLATES"
unset XDG_SPECIAL_DIRS_PATHS
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" ]; then
source "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
fi
if [ -z ${XDG_SPECIAL_DIRS+x} ]; then
save_initial_values=true
fi
for d in $XDG_DIRS; do
var="XDG_${d}_DIR"
value="$(eval echo $(echo \$${var}))"
if [ "$save_initial_values" = true ]; then
XDG_SPECIAL_DIRS+=("$var")
XDG_SPECIAL_DIRS_INITIAL_PATHS+=("$value")
fi
XDG_SPECIAL_DIRS_PATHS+=("$value")
done
}
function is_subpath() {
dir=$(realpath $1)
parent=$(realpath $2)
[ "${dir##$parent/}" != "$dir" ] && return 0 || return 1
}
WITH_RUNTIME=no
if [ -z "$RUNTIME" ]; then
RUNTIME=$SNAP
else
# add general paths not added by snapcraft due to runtime snap
append_dir LD_LIBRARY_PATH $RUNTIME/lib/$ARCH
append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib
append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH
append_dir PATH $RUNTIME/usr/bin
WITH_RUNTIME=yes
fi
# XKB config
export XKB_CONFIG_ROOT=$RUNTIME/usr/share/X11/xkb
# Give XOpenIM a chance to locate locale data.
# This is required for text input to work in SDL2 games.
export XLOCALEDIR=$RUNTIME/usr/share/X11/locale
# Set XCursors path
export XCURSOR_PATH=$RUNTIME/usr/share/icons
prepend_dir XCURSOR_PATH $SNAP/data-dir/icons
# Mesa Libs for OpenGL support
append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/mesa
append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/mesa-egl
# Tell libGL and libva where to find the drivers
export LIBGL_DRIVERS_PATH=$RUNTIME/usr/lib/$ARCH/dri
append_dir LD_LIBRARY_PATH $LIBGL_DRIVERS_PATH
export LIBVA_DRIVERS_PATH=$RUNTIME/usr/lib/$ARCH/dri
# Unity7 export (workaround for https://launchpad.net/bugs/1638405)
append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/libunity
# Pulseaudio export
append_dir LD_LIBRARY_PATH $RUNTIME/usr/lib/$ARCH/pulseaudio
# EGL vendor files on glvnd enabled systems
[ -d /var/lib/snapd/lib/glvnd/egl_vendor.d ] && \
prepend_dir __EGL_VENDOR_LIBRARY_DIRS /var/lib/snapd/lib/glvnd/egl_vendor.d
# EGL vendor files
append_dir __EGL_VENDOR_LIBRARY_DIRS $RUNTIME/etc/glvnd/egl_vendor.d
append_dir __EGL_VENDOR_LIBRARY_DIRS $RUNTIME/usr/share/glvnd/egl_vendor.d
# Tell GStreamer where to find its plugins
export GST_PLUGIN_PATH=$SNAP/usr/lib/$ARCH/gstreamer-1.0
export GST_PLUGIN_SYSTEM_PATH=$RUNTIME/usr/lib/$ARCH/gstreamer-1.0
# gst plugin scanner doesn't install in the correct path: https://github.com/ubuntu/snapcraft-desktop-helpers/issues/43
export GST_PLUGIN_SCANNER=$RUNTIME/usr/lib/$ARCH/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner
# XDG Config
[ "$WITH_RUNTIME" = yes ] && prepend_dir XDG_CONFIG_DIRS $RUNTIME/etc/xdg
prepend_dir XDG_CONFIG_DIRS $SNAP/etc/xdg
# Define snaps' own data dir
[ "$WITH_RUNTIME" = yes ] && prepend_dir XDG_DATA_DIRS $RUNTIME/usr/share
prepend_dir XDG_DATA_DIRS $SNAP/usr/share
prepend_dir XDG_DATA_DIRS $SNAP/share
prepend_dir XDG_DATA_DIRS $SNAP/data-dir
prepend_dir XDG_DATA_DIRS $SNAP_USER_DATA
# Set XDG_DATA_HOME to local path
export XDG_DATA_HOME=$SNAP_USER_DATA/.local/share
ensure_dir_exists $XDG_DATA_HOME
# Workaround for GLib < 2.53.2 not searching for schemas in $XDG_DATA_HOME:
# https://bugzilla.gnome.org/show_bug.cgi?id=741335
prepend_dir XDG_DATA_DIRS $XDG_DATA_HOME
# Set cache folder to local path
export XDG_CACHE_HOME=$SNAP_USER_COMMON/.cache
if [[ -d $SNAP_USER_DATA/.cache && ! -e $XDG_CACHE_HOME ]]; then
# the .cache directory used to be stored under $SNAP_USER_DATA, migrate it
mv $SNAP_USER_DATA/.cache $SNAP_USER_COMMON/
fi
ensure_dir_exists $XDG_CACHE_HOME
# Create $XDG_RUNTIME_DIR if not exists (to be removed when LP: #1656340 is fixed)
ensure_dir_exists $XDG_RUNTIME_DIR -m 700
# Ensure the app finds locale definitions (requires locales-all to be installed)
append_dir LOCPATH $RUNTIME/usr/lib/locale
# If any, keep track of where XDG dirs were so we can potentially migrate the content later
update_xdg_dirs_values
# Setup user-dirs.* or run xdg-user-dirs-update if needed
needs_xdg_update=false
needs_xdg_reload=false
needs_xdg_links=false
if [ "$HOME" != "$SNAP_USER_DATA" ] && ! is_subpath "$XDG_CONFIG_HOME" "$HOME"; then
for f in user-dirs.dirs user-dirs.locale; do
if [ -f "$HOME/.config/$f" ]; then
mv "$HOME/.config/$f" "$XDG_CONFIG_HOME"
needs_xdg_reload=true
fi
done
fi
if can_open_file "$REALHOME/.config/user-dirs.dirs"; then
# shellcheck disable=SC2154
if [ "$needs_update" = true ] || [ "$needs_xdg_reload" = true ]; then
sed "/^#/!s#\$HOME#${REALHOME}#g" "$REALHOME/.config/user-dirs.dirs" > "$XDG_CONFIG_HOME/user-dirs.dirs"
md5sum < "$REALHOME/.config/user-dirs.dirs" > "$XDG_CONFIG_HOME/user-dirs.dirs.md5sum"
# It's possible user-dirs.dirs exists when user-dirs.locale doesn't. This
# simply means the user opted to never ask to translate their user dirs
if can_open_file "$REALHOME/.config/user-dirs.locale"; then
cp -a "$REALHOME/.config/user-dirs.locale" "$XDG_CONFIG_HOME"
md5sum < "$REALHOME/.config/user-dirs.locale" > "$XDG_CONFIG_HOME/user-dirs.locale.md5sum"
elif [ -f "$XDG_CONFIG_HOME/user-dirs.locale.md5sum" ]; then
rm "$XDG_CONFIG_HOME/user-dirs.locale.md5sum"
fi
needs_xdg_reload=true
fi
else
needs_xdg_update=true
needs_xdg_links=true
fi
if [ $needs_xdg_reload = true ]; then
update_xdg_dirs_values
needs_xdg_reload=false
fi
# Check if we can actually read the contents of each xdg dir
for ((i = 0; i < ${#XDG_SPECIAL_DIRS_PATHS[@]}; i++)); do
if ! can_open_file "${XDG_SPECIAL_DIRS_PATHS[$i]}"; then
needs_xdg_update=true
needs_xdg_links=true
break
fi
done
# If needs XDG update and xdg-user-dirs-update exists in $PATH, run it
if [ $needs_xdg_update = true ] && command -v xdg-user-dirs-update >/dev/null; then
xdg-user-dirs-update
update_xdg_dirs_values
fi
# Create links for user-dirs.dirs
if [ $needs_xdg_links = true ]; then
for ((i = 0; i < ${#XDG_SPECIAL_DIRS_PATHS[@]}; i++)); do
b=$(realpath "${XDG_SPECIAL_DIRS_PATHS[$i]}" --relative-to="$HOME")
if [[ "$b" != "." && -e $REALHOME/$b ]]; then
[ -d $HOME/$b ] && rmdir $HOME/$b 2> /dev/null
[ ! -e $HOME/$b ] && ln -s $REALHOME/$b $HOME/$b
fi
done
else
# If we aren't creating new links, check if we have content saved in old locations and move it
for ((i = 0; i < ${#XDG_SPECIAL_DIRS[@]}; i++)); do
old="${XDG_SPECIAL_DIRS_INITIAL_PATHS[$i]}"
new="${XDG_SPECIAL_DIRS_PATHS[$i]}"
if [ -L "$old" ] && [ -d "$new" ] && [ `readlink "$old"` != "$new" ]; then
mv -vn "$old"/* "$new"/ 2>/dev/null
elif [ -d "$old" ] && [ -d "$new" ] && [ "$old" != "$new" ] &&
(is_subpath "$old" "$SNAP_USER_DATA" || is_subpath "$old" "$SNAP_USER_COMMON"); then
mv -vn "$old"/* "$new"/ 2>/dev/null
fi
done
fi
# If detect wayland server socket, then set environment so applications prefer
# wayland, and setup compat symlink (until we use user mounts. Remember,
# XDG_RUNTIME_DIR is /run/user/<uid>/snap.$SNAP so look in the parent directory
# for the socket. For details:
# https://forum.snapcraft.io/t/wayland-dconf-and-xdg-runtime-dir/186/10
# Applications that don't support wayland natively may define DISABLE_WAYLAND
# (to any non-empty value) to skip that logic entirely.
wayland_available=false
if [[ -n "$XDG_RUNTIME_DIR" && -z "$DISABLE_WAYLAND" ]]; then
wdisplay="wayland-0"
if [ -n "$WAYLAND_DISPLAY" ]; then
wdisplay="$WAYLAND_DISPLAY"
fi
wayland_sockpath="$XDG_RUNTIME_DIR/../$wdisplay"
wayland_snappath="$XDG_RUNTIME_DIR/$wdisplay"
if [ -S "$wayland_sockpath" ]; then
# if running under wayland, use it
#export WAYLAND_DEBUG=1
wayland_available=true
# create the compat symlink for now
if [ ! -e "$wayland_snappath" ]; then
ln -s "$wayland_sockpath" "$wayland_snappath"
fi
fi
fi
# Make PulseAudio socket available inside the snap-specific $XDG_RUNTIME_DIR
if [ -n "$XDG_RUNTIME_DIR" ]; then
pulsenative="pulse/native"
pulseaudio_sockpath="$XDG_RUNTIME_DIR/../$pulsenative"
if [ -S "$pulseaudio_sockpath" ]; then
export PULSE_SERVER="unix:${pulseaudio_sockpath}"
fi
fi
# GI repository
[ "$WITH_RUNTIME" = yes ] && prepend_dir GI_TYPELIB_PATH $RUNTIME/usr/lib/$ARCH/girepository-1.0
[ "$WITH_RUNTIME" = yes ] && prepend_dir GI_TYPELIB_PATH $RUNTIME/usr/lib/girepository-1.0
prepend_dir GI_TYPELIB_PATH $SNAP/usr/lib/$ARCH/girepository-1.0
prepend_dir GI_TYPELIB_PATH $SNAP/usr/lib/girepository-1.0
prepend_dir GI_TYPELIB_PATH $SNAP/usr/lib/gjs/girepository-1.0
# Keep an array of data dirs, for looping through them
IFS=':' read -r -a data_dirs_array <<< "$XDG_DATA_DIRS"
# Font Config and themes
export FONTCONFIG_PATH=$RUNTIME/etc/fonts
export FONTCONFIG_FILE=$RUNTIME/etc/fonts/fonts.conf
function make_user_fontconfig {
echo "<fontconfig>"
if [ -d $REALHOME/.local/share/fonts ]; then
echo " <dir>$REALHOME/.local/share/fonts</dir>"
fi
if [ -d $REALHOME/.fonts ]; then
echo " <dir>$REALHOME/.fonts</dir>"
fi
for ((i = 0; i < ${#data_dirs_array[@]}; i++)); do
if [ -d "${data_dirs_array[$i]}/fonts" ]; then
echo " <dir>${data_dirs_array[$i]}/fonts</dir>"
fi
done
echo ' <include ignore_missing="yes">conf.d</include>'
# We need to include this default cachedir first so that caching
# works: without it, fontconfig will try to write to the real user home
# cachedir and be blocked by AppArmor.
echo ' <cachedir prefix="xdg">fontconfig</cachedir>'
if [ -d $REALHOME/.cache/fontconfig ]; then
echo " <cachedir>$REALHOME/.cache/fontconfig</cachedir>"
fi
echo "</fontconfig>"
}
if [ $needs_update = true ]; then
rm -rf $XDG_DATA_HOME/{fontconfig,fonts,fonts-*,themes,.themes}
# This fontconfig fragment is installed in a location that is
# included by the system fontconfig configuration: namely the
# etc/fonts/conf.d/50-user.conf file.
ensure_dir_exists $XDG_CONFIG_HOME/fontconfig
async_exec make_user_fontconfig > $XDG_CONFIG_HOME/fontconfig/fonts.conf
# the themes symlink are needed for GTK 3.18 when the prefix isn't changed
# GTK 3.20 looks into XDG_DATA_DIR which has connected themes.
if [ -d $SNAP/data-dir/themes ]; then
ln -sf $SNAP/data-dir/themes $XDG_DATA_HOME
ln -sfn $SNAP/data-dir/themes $SNAP_USER_DATA/.themes
else
ln -sf $RUNTIME/usr/share/themes $XDG_DATA_HOME
ln -sfn $RUNTIME/usr/share/themes $SNAP_USER_DATA/.themes
fi
fi
# Build mime.cache
# needed for gtk and qt icon
if [ $needs_update = true ]; then
rm -rf $XDG_DATA_HOME/mime
if [ ! -f $RUNTIME/usr/share/mime/mime.cache ]; then
if command -v update-mime-database >/dev/null; then
cp --preserve=timestamps -dR $RUNTIME/usr/share/mime $XDG_DATA_HOME
async_exec update-mime-database $XDG_DATA_HOME/mime
fi
fi
fi
# Gio modules and cache (including gsettings module)
export GIO_MODULE_DIR=$XDG_CACHE_HOME/gio-modules
function compile_giomodules {
if [ -f $1/glib-2.0/gio-querymodules ]; then
rm -rf $GIO_MODULE_DIR
ensure_dir_exists $GIO_MODULE_DIR
ln -s $1/gio/modules/*.so $GIO_MODULE_DIR
$1/glib-2.0/gio-querymodules $GIO_MODULE_DIR
fi
}
if [ $needs_update = true ]; then
async_exec compile_giomodules $RUNTIME/usr/lib/$ARCH
fi
# Setup compiled gsettings schema
GS_SCHEMA_DIR=$XDG_DATA_HOME/glib-2.0/schemas
function compile_schemas {
if [ -f "$1" ]; then
rm -rf $GS_SCHEMA_DIR
ensure_dir_exists $GS_SCHEMA_DIR
for ((i = 0; i < ${#data_dirs_array[@]}; i++)); do
schema_dir="${data_dirs_array[$i]}/glib-2.0/schemas"
if [ -f "$schema_dir/gschemas.compiled" ]; then
# This directory already has compiled schemas
continue
fi
if [ -n "$(ls -A $schema_dir/*.xml 2>/dev/null)" ]; then
ln -s $schema_dir/*.xml $GS_SCHEMA_DIR
fi
if [ -n "$(ls -A $schema_dir/*.override 2>/dev/null)" ]; then
ln -s $schema_dir/*.override $GS_SCHEMA_DIR
fi
done
# Only compile schemas if we copied anyting
if [ -n "$(ls -A $GS_SCHEMA_DIR/*.xml $GS_SCHEMA_DIR/*.override 2>/dev/null)" ]; then
"$1" $GS_SCHEMA_DIR
fi
fi
}
if [ $needs_update = true ]; then
async_exec compile_schemas $RUNTIME/usr/lib/$ARCH/glib-2.0/glib-compile-schemas
fi
# Enable gsettings user changes
# symlink the dconf file if home plug is connected for read
DCONF_DEST_USER_DIR=$SNAP_USER_DATA/.config/dconf
if [ ! -f $DCONF_DEST_USER_DIR/user ]; then
if [ -f $REALHOME/.config/dconf/user ]; then
ensure_dir_exists $DCONF_DEST_USER_DIR
ln -s $REALHOME/.config/dconf/user $DCONF_DEST_USER_DIR
fi
fi
# symlink the runtime dconf file as well
if [ -r $XDG_RUNTIME_DIR/../dconf/user ]; then
ensure_dir_exists $XDG_RUNTIME_DIR/dconf
ln -sf ../../dconf/user $XDG_RUNTIME_DIR/dconf/user
fi
# Testability support
append_dir LD_LIBRARY_PATH $SNAP/testability
append_dir LD_LIBRARY_PATH $SNAP/testability/$ARCH
append_dir LD_LIBRARY_PATH $SNAP/testability/$ARCH/mesa
# Gdk-pixbuf loaders
export GDK_PIXBUF_MODULE_FILE=$XDG_CACHE_HOME/gdk-pixbuf-loaders.cache
export GDK_PIXBUF_MODULEDIR=$RUNTIME/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders
if [ $needs_update = true ] || [ ! -f $GDK_PIXBUF_MODULE_FILE ]; then
rm -f $GDK_PIXBUF_MODULE_FILE
if [ -f $RUNTIME/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders ]; then
async_exec $RUNTIME/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders > $GDK_PIXBUF_MODULE_FILE
fi
fi
# Icon themes cache
if [ $needs_update = true ]; then
rm -rf $XDG_DATA_HOME/icons
ensure_dir_exists $XDG_DATA_HOME/icons
for ((i = 0; i < ${#data_dirs_array[@]}; i++)); do
# The runtime and theme content snaps should already contain icon caches
# so we skip them to optimise app start time.
if [[ "${data_dirs_array[$i]}" == "$SNAP/data-dir" || "${data_dirs_array[$i]}" == "$RUNTIME/"* ]]; then
continue
fi
for theme in "${data_dirs_array[$i]}/icons/"*; do
if [ -f "$theme/index.theme" -a ! -f "$theme/icon-theme.cache" ]; then
theme_dir=$XDG_DATA_HOME/icons/$(basename "$theme")
if [ ! -d "$theme_dir" ]; then
ensure_dir_exists "$theme_dir"
ln -s $theme/* "$theme_dir"
if [ -f $RUNTIME/usr/sbin/update-icon-caches ]; then
async_exec $RUNTIME/usr/sbin/update-icon-caches "$theme_dir"
elif [ -f $RUNTIME/usr/sbin/update-icon-cache.gtk2 ]; then
async_exec $RUNTIME/usr/sbin/update-icon-cache.gtk2 "$theme_dir"
fi
fi
fi
done
done
fi
# GTK theme and behavior modifier
# Those can impact the theme engine used by Qt as well
gtk_configs=(gtk-3.0/settings.ini gtk-3.0/bookmarks gtk-2.0/gtkfilechooser.ini)
for f in ${gtk_configs[@]}; do
dest="$XDG_CONFIG_HOME/$f"
if [ ! -L "$dest" ]; then
ensure_dir_exists `dirname $dest`
ln -s $REALHOME/.config/$f $dest
fi
done
# create symbolic link to ibus socket path for ibus to look up its socket files
# (see comments #3 and #6 on https://launchpad.net/bugs/1580463)
IBUS_CONFIG_PATH=$XDG_CONFIG_HOME/ibus
ensure_dir_exists $IBUS_CONFIG_PATH
[ -d $IBUS_CONFIG_PATH/bus ] && rm -rf $IBUS_CONFIG_PATH/bus
ln -sfn $REALHOME/.config/ibus/bus $IBUS_CONFIG_PATH

76
snap/local/common/init Normal file
View File

@ -0,0 +1,76 @@
#################
# Launcher init #
#################
START=$(date +%s.%N)
declare -A PIDS
function async_exec() {
$@ &
PIDS[$!]=$@
}
function wait_for_async_execs() {
for i in ${!PIDS[@]}
do
wait $i && continue || echo "ERROR: ${PIDS[$i]} exited abnormally with status $?"
done
}
# ensure_dir_exists calls `mkdir -p` if the given path is not a directory.
# This speeds up execution time by avoiding unnecessary calls to mkdir.
#
# Usage: ensure_dir_exists <path> [<mkdir-options>]...
#
function ensure_dir_exists() {
[ -d "$1" ] || mkdir -p "$@"
}
# On Fedora $SNAP is under /var and there is some magic to map it to /snap.
# # We need to handle that case and reset $SNAP
SNAP=`echo $SNAP | sed -e "s|/var/lib/snapd||g"`
needs_update=true
. $SNAP_USER_DATA/.last_revision 2>/dev/null || true
if [ "$SNAP_DESKTOP_LAST_REVISION" = "$SNAP_REVISION" ]; then
needs_update=false
fi
# Set $REALHOME to the users real home directory
REALHOME=`getent passwd $UID | cut -d ':' -f 6`
# Set config folder to local path
export XDG_CONFIG_HOME=$SNAP_USER_DATA/.config
ensure_dir_exists $XDG_CONFIG_HOME -m 700
# If the user has modified their user-dirs settings, force an update
if [[ -f "$XDG_CONFIG_HOME/user-dirs.dirs.md5sum" ]]; then
if [[ "$(md5sum < "$REALHOME/.config/user-dirs.dirs")" != "$(cat "$XDG_CONFIG_HOME/user-dirs.dirs.md5sum")" ||
( -f "$XDG_CONFIG_HOME/user-dirs.locale.md5sum" &&
"$(md5sum < "$REALHOME/.config/user-dirs.locale")" != "$(cat "$XDG_CONFIG_HOME/user-dirs.locale.md5sum")" ) ]]; then
needs_update=true
fi
else
needs_update=true
fi
if [ "$SNAP_ARCH" == "amd64" ]; then
ARCH="x86_64-linux-gnu"
elif [ "$SNAP_ARCH" == "armhf" ]; then
ARCH="arm-linux-gnueabihf"
elif [ "$SNAP_ARCH" == "arm64" ]; then
ARCH="aarch64-linux-gnu"
elif [ "$SNAP_ARCH" == "ppc64el" ]; then
ARCH="powerpc64le-linux-gnu"
else
ARCH="$SNAP_ARCH-linux-gnu"
fi
export SNAP_LAUNCHER_ARCH_TRIPLET=$ARCH
# Don't LD_PRELOAD bindtextdomain for classic snaps
if ! grep -qs "^\s*confinement:\s*classic\s*" $SNAP/meta/snap.yaml; then
if [ -f $SNAP/lib/bindtextdomain.so ]; then
export LD_PRELOAD=$LD_PRELOAD:$SNAP/lib/bindtextdomain.so
fi
fi

View File

@ -0,0 +1,14 @@
###############################
# Mark update and exec binary #
###############################
[ $needs_update = true ] && echo "SNAP_DESKTOP_LAST_REVISION=$SNAP_REVISION" > $SNAP_USER_DATA/.last_revision
wait_for_async_execs
if [ -n "$SNAP_DESKTOP_DEBUG" ]; then
echo "desktop-launch elapsed time: " $(date +%s.%N --date="$START seconds ago")
echo "Now running: exec $@"
fi
exec "$@"

View File

@ -0,0 +1,20 @@
#!/usr/bin/make -f
SRC_DIR ?= .
DEST_LAUNCHER = desktop-launch
build: $(DEST_LAUNCHER)
clean:
rm -f $(DEST_LAUNCHER)
$(DEST_LAUNCHER):
@echo "#!/bin/bash" > $(DEST_LAUNCHER)
@cat $(SRC_DIR)/init >> $(DEST_LAUNCHER)
@cat $(SRC_DIR)/desktop-exports >> $(DEST_LAUNCHER)
@cat $(SRC_DIR)/launcher-specific >> $(DEST_LAUNCHER)
@cat $(SRC_DIR)/mark-and-exec >> $(DEST_LAUNCHER)
install: $(DEST_LAUNCHER)
install -D -m755 $(DEST_LAUNCHER) "$(DESTDIR)"/bin/$(DEST_LAUNCHER)

View File

@ -0,0 +1 @@
../common/desktop-exports

1
snap/local/glib-only/init Symbolic link
View File

@ -0,0 +1 @@
../common/init

View File

@ -0,0 +1,4 @@
##############################
# Glib minimum specific part #
##############################

View File

@ -0,0 +1 @@
../common/mark-and-exec

5
snap/local/re3-launch Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
set +e
(cd $SNAP_USER_COMMON/GTAIII; re3)
(cd $SNAP_COMMON/GTAIII; re3)

75
snap/snapcraft.yaml Normal file
View File

@ -0,0 +1,75 @@
name: re3
base: core20
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Rebuild of GTA III new platforms.
description: |
Rebuild of GTA III for new platforms.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
apps:
re3:
command: usr/bin/re3-launch
command-chain: [bin/desktop-launch]
environment:
PULSE_RUNTIME_PATH: /var/run/pulse
PULSE_SYSTEM: 1
# GTA_III_RE_DIR: $SNAP_USER_COMMON/GTAIII
plugs:
- opengl
- audio-playback
parts:
desktop-glib-only:
source: snap/local
source-subdir: glib-only
source-type: local
plugin: make
build-packages:
- libglib2.0-dev
stage-packages:
- libglib2.0-bin
my-part:
after :
- desktop-glib-only
source-type: local
source: .
plugin: dump
source-subdir: build
override-build: |
./premake5Linux --with-librw gmake2
make -C build config=release_linux-amd64-librw_gl3_glfw-oal
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/bin
install -m 755 bin/linux-amd64-librw_gl3_glfw-oal/Release/re3 $SNAPCRAFT_PART_INSTALL/usr/bin
install -m 755 snap/local/re3-launch $SNAPCRAFT_PART_INSTALL/usr/bin
build-packages:
- libglew-dev
- libglfw3-dev
- libmpg123-dev
- libopenal-dev
- libpulse-dev
- libsndfile1-dev
stage-packages:
- libasound2
- libflac8
- libgl1
- libglew2.1
- libglfw3
- libglvnd0
- libglx0
- libmpg123-0
- libogg0
- libopenal1
- libpulse0
- libsndfile1
- libsndio7.0
- libvorbis0a
- libvorbisenc2
- libx11-6
- libxau6
- libxcb1
- libxdmcp6
- libgl1-mesa-dri
- libgl1-mesa-glx
- libglu1-mesa
- mesa-utils