Alibek Omarov
2 years ago
12 changed files with 273 additions and 8 deletions
@ -0,0 +1,79 @@
@@ -0,0 +1,79 @@
|
||||
#!/bin/bash |
||||
|
||||
. scripts/lib.sh |
||||
|
||||
download_sign_key() |
||||
{ |
||||
echo -n "Downloading $1: " |
||||
curl https://community.omprussia.ru/documentation/files/doc/$1 -o $1 &> /dev/null || die "Can't download $1" && echo "OK" |
||||
} |
||||
|
||||
pack_sources() |
||||
{ |
||||
echo "Packing sources to $1..." |
||||
git ls-files --recurse-submodules | tar caf "$1" -T- |
||||
} |
||||
|
||||
dependencies="SDL2-devel ImageMagick" |
||||
build_dir="build_rpm" |
||||
|
||||
if [ "$1" == "aurora" ]; then |
||||
name="su.xash.Engine" |
||||
flavor="aurora" |
||||
else |
||||
name="harbour-xash3d-fwgs" |
||||
flavor="sailfish" |
||||
fi |
||||
|
||||
if [ $flavor == 'aurora' ]; then |
||||
download_sign_key regular_key.pem |
||||
download_sign_key regular_cert.pem |
||||
fi |
||||
|
||||
rm -fr ${build_dir}/{BUILD,SRPMS} |
||||
mkdir -p ${build_dir}/SOURCES |
||||
pack_sources ${build_dir}/SOURCES/${name}.tar |
||||
git clone https://github.com/FWGS/hlsdk-portable -b mobile_hacks |
||||
pushd hlsdk-portable |
||||
pack_sources ../${build_dir}/SOURCES/hlsdk-portable.tar |
||||
popd |
||||
|
||||
sfdk_targets=`sfdk engine exec sb2-config -l | grep default | grep -v i486` |
||||
|
||||
for each in $sfdk_targets; do |
||||
target_arch=${each##*-} |
||||
target_arch=${target_arch/.default/} |
||||
echo "Build for '$each' target with '$target_arch' architecture" |
||||
|
||||
# install deps for current target |
||||
sfdk engine exec sb2 -t $each -R -m sdk-install zypper in -y ${dependencies} |
||||
|
||||
# build RPM for current target |
||||
sfdk engine exec sb2 -t $each rpmbuild \ |
||||
--define "_topdir `pwd`/${build_dir}" \ |
||||
--define "_arch $target_arch" \ |
||||
--define "_packagename $name" \ |
||||
--define "_flavor $flavor" \ |
||||
-ba scripts/sailfish/harbour-xash3d-fwgs.spec || die "Build for ${each}: FAIL" |
||||
|
||||
# sign RPM packacge |
||||
if [ "$flavor" == "aurora" ]; then |
||||
echo -n "Signing RPMs: " |
||||
sfdk engine exec sb2 -t $each rpmsign-external sign --key `pwd`/regular_key.pem --cert `pwd`/regular_cert.pem `pwd`/${build_dir}/RPMS/${target_arch}/$name-0*.rpm || die "FAIL" && echo "OK" |
||||
fi |
||||
|
||||
echo -n "Validate RPM: " |
||||
if [ "$flavor" == "aurora" ]; then |
||||
validator_output=`sfdk engine exec rpm-validator -p regular $(pwd)/${build_dir}/RPMS/${target_arch}/$name-0* 2>&1` |
||||
else |
||||
sfdk config target=${each/.default/} |
||||
validator_output=`sfdk check $(pwd)/${build_dir}/RPMS/${target_arch}/$name-0* 2>&1` |
||||
fi |
||||
if [ $? -ne 0 ] ; then |
||||
echo "FAIL" |
||||
echo "${validator_output}" |
||||
break; |
||||
fi |
||||
echo "OK" |
||||
done |
||||
echo "All build done! All your packages in `pwd`/build_rpm/RPMS" |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash |
||||
|
||||
PASSWORD="12345" |
||||
IP="192.168.1.10" |
||||
|
||||
if [ "$1" == "aurora" ]; then |
||||
name="su.xash.Engine" |
||||
arch="armv7hl" # lame! |
||||
else |
||||
name="harbour-xash3d-fwgs" |
||||
arch="aarch64" # absolutely lame... |
||||
fi |
||||
package=$(ls build_rpm/RPMS/$arch/$name-0*.rpm) |
||||
|
||||
sshpass -p $PASSWORD scp $package defaultuser@$IP:~/ |
||||
|
||||
# sandwich of programs: |
||||
# 1. Call sshpass to automatically fill password for ssh session |
||||
# 2. Call devel-su that reads password from stdin |
||||
# 3. devel-su calls pkcon install-local -y and installs the package |
||||
echo $PASSWORD | sshpass -p $PASSWORD ssh defaultuser@$IP devel-su pkcon install-local -y $(basename $package) |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
[Desktop Entry] |
||||
Categories=Game;Shooter; |
||||
Comment=Half-Life compatible game engine |
||||
Exec=__REPLACE_EXEC__ |
||||
Icon=__REPLACE_ICON__ |
||||
Keywords=first;person;shooter;multiplayer;half-life;halflife;singleplayer; |
||||
Name=Xash3D FWGS |
||||
Name[en]=Xash3D FWGS |
||||
PrefersNonDefaultGPU=true |
||||
Terminal=false |
||||
Type=Application |
||||
X-Nemo-Application-Type=silica-qt5 |
||||
|
||||
[X-Sailjail] |
||||
Permissions=Audio;Internet;Microphone;PublicDir; |
||||
OrganizationName=su.xash |
||||
ApplicationName=Engine |
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
# Based on harbour-quake2 spec file |
||||
|
||||
Name: %{_packagename} |
||||
Summary: Xash3D FWGS |
||||
Release: 1 |
||||
Version: 0.20 |
||||
Group: Amusements/Games |
||||
License: GPLv2 |
||||
BuildArch: %{_arch} |
||||
URL: https://github.com/FWGS/xash3d-fwgs |
||||
Source0: %{name}.tar |
||||
Source1: hlsdk-portable.tar |
||||
BuildRequires: SDL2-devel ImageMagick |
||||
|
||||
%define __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$ |
||||
|
||||
%description |
||||
Xash3D FWGS is a game engine compatible with Half-Life 1 and mods. |
||||
|
||||
%prep |
||||
tar -xf %{_topdir}/SOURCES/%{name}.tar |
||||
python3 waf configure \ |
||||
-T release \ |
||||
--sailfish=%{_flavor} \ |
||||
--enable-stbtt \ |
||||
--enable-bundled-deps \ |
||||
--enable-packaging \ |
||||
--disable-gl \ |
||||
--enable-gles2 \ |
||||
--enable-gl4es \ |
||||
--prefix=/usr \ |
||||
--libdir=%{_datadir}/%{name}/lib \ |
||||
--bindir=%{_bindir} |
||||
|
||||
mkdir -p hlsdk-portable |
||||
pushd hlsdk-portable |
||||
tar -xf %{_topdir}/SOURCES/hlsdk-portable.tar |
||||
python3 waf configure -T release |
||||
popd |
||||
|
||||
%build |
||||
python3 waf build -j$(($(nproc)+1)) |
||||
pushd hlsdk-portable |
||||
python3 waf build -j$(($(nproc)+1)) |
||||
popd |
||||
|
||||
%install |
||||
python3 waf install --destdir=%{buildroot} |
||||
pushd hlsdk-portable |
||||
python3 waf install --destdir=%{buildroot}%{_datadir}/%{name}/rodir |
||||
popd |
||||
# rename real binary |
||||
mv %{buildroot}/usr/bin/xash3d %{buildroot}/usr/bin/%{name} |
||||
|
||||
install -d %{buildroot}/%{_datadir}/applications |
||||
sed "s/__REPLACE_ICON__/su.xash.Engine/g;s/__REPLACE_EXEC__/su.xash.Engine/g;" scripts/sailfish/harbour-xash3d-fwgs.desktop > %{buildroot}/%{_datadir}/applications/%{name}.desktop |
||||
chmod 644 %{buildroot}/%{_datadir}/applications/%{name}.desktop |
||||
|
||||
install -d %{buildroot}/%{_datadir}/icons/hicolor/86x86/apps |
||||
install -d %{buildroot}/%{_datadir}/icons/hicolor/108x108/apps |
||||
install -d %{buildroot}/%{_datadir}/icons/hicolor/128x128/apps |
||||
install -d %{buildroot}/%{_datadir}/icons/hicolor/172x172/apps |
||||
convert game_launch/icon-xash-material.png -resize 86x86 %{buildroot}/%{_datadir}/icons/hicolor/86x86/apps/%{name}.png |
||||
convert game_launch/icon-xash-material.png -resize 108x108 %{buildroot}/%{_datadir}/icons/hicolor/108x108/apps/%{name}.png |
||||
convert game_launch/icon-xash-material.png -resize 128x128 %{buildroot}/%{_datadir}/icons/hicolor/128x128/apps/%{name}.png |
||||
convert game_launch/icon-xash-material.png -resize 172x172 %{buildroot}/%{_datadir}/icons/hicolor/172x172/apps/%{name}.png |
||||
|
||||
%files |
||||
%defattr(-,root,root,-) |
||||
%attr(755,root,root) %{_bindir}/%{name} |
||||
%attr(755,root,root) %{_datadir}/%{name}/lib/* |
||||
%attr(644,root,root) %{_datadir}/%{name}/rodir/valve/extras.pk3 |
||||
%attr(755,root,root) %{_datadir}/%{name}/rodir/valve/cl_dlls/* |
||||
%attr(755,root,root) %{_datadir}/%{name}/rodir/valve/dlls/* |
||||
%attr(644,root,root) %{_datadir}/icons/hicolor/86x86/apps/%{name}.png |
||||
%attr(644,root,root) %{_datadir}/icons/hicolor/108x108/apps/%{name}.png |
||||
%attr(644,root,root) %{_datadir}/icons/hicolor/128x128/apps/%{name}.png |
||||
%attr(644,root,root) %{_datadir}/icons/hicolor/172x172/apps/%{name}.png |
||||
%{_datadir}/applications/%{name}.desktop |
||||
|
||||
%changelog |
||||
* Thu Jun 1 2023 a1batross <a1ba.omarov@gmail.com> |
||||
- initial port |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh |
||||
|
||||
die() |
||||
{ |
||||
echo "$@" |
||||
exit 1 |
||||
} |
||||
|
||||
echo "Xash3D FWGS installed as Sailfish RPM" |
||||
|
||||
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html |
||||
# $XDG_DATA_HOME defines the base directory relative to which user-specific data files should be stored. |
||||
# If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used. |
||||
if [ -z "$XDG_DATA_HOME" ]; then |
||||
export XDG_DATA_HOME="$HOME/.local/share" |
||||
fi |
||||
|
||||
if [ -z "$XASH3D_BASEDIR" ]; then |
||||
export XASH3D_BASEDIR="$XDG_DATA_HOME/xash3d-fwgs/" |
||||
fi |
||||
|
||||
mkdir -p "$XASH3D_BASEDIR" |
||||
cd "$XASH3D_BASEDIR" || die "Can't cd into $XASH3D_BASEDIR" |
||||
echo "XASH3D_BASEDIR is $XASH3D_BASEDIR" |
||||
|
||||
#if [ -z "$XASH3D_EXTRAS_PAK1" ]; then |
||||
# export XASH3D_EXTRAS_PAK1=/app/share/xash3d/valve/extras.pk3 |
||||
#fi |
||||
#echo "XASH3D_EXTRAS_PAK1 is $XASH3D_EXTRAS_PAK1" |
||||
|
||||
exec $DEBUGGER /app/lib32/xash3d/xash3d "$@" |
Loading…
Reference in new issue