Skip to content

Commit

Permalink
SAILFISH: New port for SailfishOS
Browse files Browse the repository at this point in the history
Still has some issues documented in README.md but is already playable
  • Loading branch information
phcoder committed Sep 29, 2024
1 parent 53da0d1 commit 9e24385
Show file tree
Hide file tree
Showing 19 changed files with 1,057 additions and 17 deletions.
7 changes: 7 additions & 0 deletions backends/platform/sdl/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ MODULE_OBJS += \
psp2/psp2.o
endif

ifdef SAILFISH
MODULE_OBJS += \
sailfish/sailfish-main.o \
sailfish/sailfish-window.o \
sailfish/sailfish.o
endif

ifdef SWITCH
MODULE_OBJS += \
switch/switch-main.o \
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/sdl/posix/posix-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "common/scummsys.h"

#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3) && !defined(PSP2) && !defined(NINTENDO_SWITCH) && !defined(__EMSCRIPTEN__) && !defined(MIYOO) && !defined(MIYOOMINI)
#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3) && !defined(PSP2) && !defined(NINTENDO_SWITCH) && !defined(__EMSCRIPTEN__) && !defined(MIYOO) && !defined(MIYOOMINI) && !defined(SAILFISH)

#include "backends/platform/sdl/posix/posix.h"
#include "backends/plugins/sdl/sdl-provider.h"
Expand Down
48 changes: 48 additions & 0 deletions backends/platform/sdl/sailfish/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Welcome to Sailfish port of ScummVM.

# Building

First you need to download dependencies as we link statically with them:

``` shell
./sailfish-download.sh
```

You have to do this only once

Suppose that your SDK is in `$SDK_ROOT`

First you need to figure out your target config

``` shell
$SDK_ROOT/bin/sfdk engine exec sb2-config -l
```

``` text
SailfishOS-armv7hl
SailfishOS-i486-x86
```

Then run:

``` shell
$SDK_ROOT/bin/sfdk config --push target $TARGET
$SDK_ROOT/bin/sfdk build
```

And finally you need to sign them with your developper key:

``` shell
$SDK_ROOT/bin/sfdk engine exec -tt sb2 -t $TARGET rpmsign-external sign -k $KEY_PATH/regular_key.pem -c $KEY_PATH/regular_cert.pem RPMS/*.rpm
```


# Known issues

* Screen dimming and sleep aren't inhibited in game
* If you close ScummVM window on the panel ScummVM isn't closed and you
can't open it again
* When switching From Surface SDL to OpenGL renderer touchscreen coordinates
are garbled until restart
* make install doesn't install Sailfish-specific file. It's done in RPM spec
276 changes: 276 additions & 0 deletions backends/platform/sdl/sailfish/rpm/org.scummvm.scummvm.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
%if %{undefined outdir}
%define outdir out-sailfish.%{_arch}
%endif

%if %{undefined real_src_path}
%define real_src_path OFF
%endif

%define freetype_version 2.13.3
%define flac_version 1.4.3
%define theora_version 1.1.1
%define jpeg_turbo_version 3.0.4
%define libmad_version 0.15.1b
%define libmpeg2_version 0.5.1
%define libfaad_version 2.8.8
%define giflib_version 5.2.2
%define fribidi_version 1.0.16
%define sdl2_version 2.30.7

%define minimal_build 1

%if %{minimal_build}
%define engine_config --disable-all-engines --enable-engines=scumm
%else
%define engine_config %{nil}
%endif

%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm

Name: org.scummvm.scummvm
Summary: ScummVM: Multi-game engine
Version: 0
Release: 1
Group: Qt/Qt
License: GPLv3
URL: https://scummvm.org
Source0: %{name}-%{version}.tar.bz2
BuildRequires: pkgconfig(sdl2)
BuildRequires: SDL2_net-devel
BuildRequires: pkgconfig(ogg)
BuildRequires: pkgconfig(vorbis)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(vpx)
BuildRequires: pkgconfig(egl)
BuildRequires: pkgconfig(glesv2)
BuildRequires: cmake

%description
ScummVM: Multi-game engine

%build
mkdir -p %{outdir}
mkdir -p %{outdir}/scummvm
mkdir -p %{outdir}/pkgconfig
if ! [ -d %{outdir}/freetype-install ]; then
cd %{outdir}
tar xvf ../rpmdeps/freetype-%{freetype_version}.tar.xz
cd freetype-%{freetype_version}
./configure --prefix=$PWD/../freetype-install --disable-shared --enable-static
make %{?_smp_mflags}
make install
cd ../..
fi
if ! [ -d %{outdir}/flac-install ]; then
cd %{outdir}
tar xvf ../rpmdeps/flac-%{flac_version}.tar.xz
cd flac-%{flac_version}
./configure --disable-shared --enable-static --disable-examples --disable-programs
make %{?_smp_mflags}
make DESTDIR=$PWD/../flac-install INSTALL_ROOT=$PWD/../flac-install install
cd ../..
fi
if ! [ -d %{outdir}/theora-install ]; then
cd %{outdir}
tar xvf ../rpmdeps/libtheora-%{theora_version}.tar.xz
cd libtheora-%{theora_version}
./configure --disable-shared --enable-static --disable-examples --disable-programs
make %{?_smp_mflags}
make DESTDIR=$PWD/../theora-install INSTALL_ROOT=$PWD/../theora-install install
cd ../..
fi
if ! [ -d %{outdir}/jpeg-install ]; then
cd %{outdir}
tar xvf ../rpmdeps/libjpeg-turbo-%{jpeg_turbo_version}.tar.gz
cd libjpeg-turbo-%{jpeg_turbo_version}
%cmake -DENABLE_SHARED=FALSE
make %{?_smp_mflags}
make DESTDIR=$PWD/../jpeg-install INSTALL_ROOT=$PWD/../jpeg-install install
cd ../..
fi
if ! [ -d %{outdir}/libmad-install ]; then
cd %{outdir}
tar xvf ../rpmdeps/libmad-%{libmad_version}.tar.gz
cd libmad-%{libmad_version}
ASFLAGS=-marm CFLAGS="-O2 -marm" ./configure --disable-shared --enable-static --disable-examples --disable-programs CFLAGS="-O2 -marm" ASFLAGS=-marm
make CFLAGS="-O2 -marm" ASFLAGS=-marm %{?_smp_mflags}
make DESTDIR=$PWD/../libmad-install INSTALL_ROOT=$PWD/../libmad-install install
cd ../..
fi
if ! [ -d %{outdir}/mpeg2-install ]; then
cd %{outdir}
tar xvf ../rpmdeps/libmpeg2-%{libmpeg2_version}.tar.gz
cd libmpeg2-%{libmpeg2_version}
./configure --disable-shared --enable-static --disable-examples --disable-programs
make %{?_smp_mflags}
make DESTDIR=$PWD/../mpeg2-install INSTALL_ROOT=$PWD/../mpeg2-install install
cd ../..
fi
if ! [ -d %{outdir}/faad-install ]; then
cd %{outdir}
tar xvf ../rpmdeps/faad2-%{libfaad_version}.tar.gz
cd faad2-%{libfaad_version}
./configure --disable-shared --enable-static --disable-examples --disable-programs
make %{?_smp_mflags}
make DESTDIR=$PWD/../faad-install INSTALL_ROOT=$PWD/../faad-install install
cd ../..
fi
if ! [ -d %{outdir}/giflib-install ]; then
cd %{outdir}
tar xvf ../rpmdeps/giflib-%{giflib_version}.tar.gz
cd giflib-%{giflib_version}
make %{?_smp_mflags} libgif.a
make DESTDIR=$PWD/../giflib-install INSTALL_ROOT=$PWD/../giflib-install install-include
install -d "$PWD/../giflib-install/usr/local/lib"
install -m 644 libgif.a "$PWD/../giflib-install/usr/local/lib/libgif.a"
cd ../..
fi
if ! [ -d %{outdir}/fribidi-install ]; then
cd %{outdir}
tar xvf ../rpmdeps/fribidi-%{fribidi_version}.tar.xz
cd fribidi-%{fribidi_version}
./configure --disable-shared --enable-static --prefix=$PWD/../fribidi-install
make %{?_smp_mflags}
make install
cd ../..
fi
if ! [ -d %{outdir}/sdl-install ]; then
cd %{outdir}
tar xvf ../rpmdeps/SDL2-%{sdl2_version}.tar.gz
cd SDL2-%{sdl2_version}
for x in ../../sdl-patches/*.patch; do
echo "Applying patch $x"
patch -p1 -i "$x"
done
cd ..
cmake \
-Bsdl-build \
-DSDL_PULSEAUDIO=ON \
-DSDL_RPATH=OFF \
-DSDL_STATIC=ON \
-DSDL_SHARED=OFF \
-DSDL_WAYLAND=ON \
-DSDL_X11=OFF \
-DSDL_DBUS=ON \
-DSDL_WAYLAND_LIBDECOR=OFF \
-DSDL_WAYLAND_QT_TOUCH=OFF \
SDL2-%{sdl2_version}
make -C sdl-build %{?_smp_mflags}
make -C sdl-build install DESTDIR=$PWD/sdl-install INSTALL_ROOT=$PWD/sdl-install
cd ..
fi
sed "s@Libs: .*@Libs: $PWD/%{outdir}/freetype-install/lib/libfreetype.a@g" < %{outdir}/freetype-install/lib/pkgconfig/freetype2.pc > %{outdir}/pkgconfig/freetype2.pc
sed "s@Libs: .*@Libs: $PWD/%{outdir}/fribidi-install/lib/libfribidi.a@g" < %{outdir}/fribidi-install/lib/pkgconfig/fribidi.pc > %{outdir}/pkgconfig/fribidi.pc
export PKG_CONFIG_PATH=$PWD/%{outdir}/pkgconfig:$PKG_CONFIG_PATH
cd %{outdir}/scummvm;
../../../../../../configure --host=sailfish \
--with-jpeg-prefix=../jpeg-install/usr \
--with-mad-prefix=../libmad-install/usr/local \
--with-flac-prefix=../flac-install/usr/local \
--with-theoradec-prefix=../theora-install/usr/local \
--with-mpeg2-prefix=../mpeg2-install/usr/local \
--with-faad-prefix=../faad-install/usr/local \
--with-gif-prefix=../giflib-install/usr/local \
--enable-fribidi --with-fribidi-prefix=../fribidi-install/usr/local/org.scummvm.scummvm \
--with-sdl-prefix=../sdl-install/usr/local --enable-static \
%{engine_config} --disable-tinygl
cd ../..
%{__make} -C %{outdir}/scummvm %{_make_output_sync} %{?_smp_mflags}

%install
rm -rf %{buildroot}/*
%{__make} -C %{outdir}/scummvm DESTDIR=%{buildroot} INSTALL_ROOT=%{buildroot} install
# TODO: Move this stuff into make
mkdir -p %{buildroot}/usr/share/applications
mkdir -p %{buildroot}/usr/share/icons/hicolor/86x86/apps
mkdir -p %{buildroot}/usr/share/icons/hicolor/108x108/apps
mkdir -p %{buildroot}/usr/share/icons/hicolor/128x128/apps
mkdir -p %{buildroot}/usr/share/icons/hicolor/172x172/apps
cp ../../../../dists/sailfish/org.scummvm.scummvm.desktop %{buildroot}/usr/share/applications/org.scummvm.scummvm.desktop
cp ../../../../dists/sailfish/86x86.png %{buildroot}/usr/share/icons/hicolor/86x86/apps/org.scummvm.scummvm.png
cp ../../../../dists/sailfish/108x108.png %{buildroot}/usr/share/icons/hicolor/108x108/apps/org.scummvm.scummvm.png
cp ../../../../dists/sailfish/128x128.png %{buildroot}/usr/share/icons/hicolor/128x128/apps/org.scummvm.scummvm.png
cp ../../../../dists/sailfish/172x172.png %{buildroot}/usr/share/icons/hicolor/172x172/apps/org.scummvm.scummvm.png

%files
%defattr(755,root,root,-)
%{_bindir}/org.scummvm.scummvm

%defattr(644,root,root,-)

%{_datadir}/org.scummvm.scummvm/applications/%{name}.desktop
%{_datadir}/org.scummvm.scummvm/doc/scummvm/AUTHORS
%{_datadir}/org.scummvm.scummvm/doc/scummvm/CONTRIBUTING.md
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.Apache
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.BSD
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.BSL
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.FREEFONT
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.GLAD
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.ISC
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.LGPL
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.LUA
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.MIT
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.MKV
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.MPL
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.OFL
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYING.TINYGL
%{_datadir}/org.scummvm.scummvm/doc/scummvm/COPYRIGHT
%{_datadir}/org.scummvm.scummvm/doc/scummvm/CatharonLicense.txt
%{_datadir}/org.scummvm.scummvm/doc/scummvm/NEWS.md
%{_datadir}/org.scummvm.scummvm/doc/scummvm/README.md
%{_datadir}/org.scummvm.scummvm/icons/hicolor/scalable/apps/org.scummvm.scummvm.svg
%{_datadir}/org.scummvm.scummvm/man/man6/scummvm.6
%{_datadir}/org.scummvm.scummvm/metainfo/org.scummvm.scummvm.metainfo.xml
%{_datadir}/org.scummvm.scummvm/pixmaps/org.scummvm.scummvm.xpm
%{_datadir}/org.scummvm.scummvm/scummvm/achievements.dat
%{_datadir}/org.scummvm.scummvm/scummvm/classicmacfonts.dat
%{_datadir}/org.scummvm.scummvm/scummvm/encoding.dat
%{_datadir}/org.scummvm.scummvm/scummvm/fonts-cjk.dat
%{_datadir}/org.scummvm.scummvm/scummvm/fonts.dat
%{_datadir}/org.scummvm.scummvm/scummvm/vkeybd_default.zip
%{_datadir}/org.scummvm.scummvm/scummvm/vkeybd_small.zip
%{_datadir}/org.scummvm.scummvm/scummvm/gui-icons.dat
%{_datadir}/org.scummvm.scummvm/scummvm/helpdialog.zip
%{_datadir}/org.scummvm.scummvm/scummvm/macgui.dat
%{_datadir}/org.scummvm.scummvm/scummvm/residualvm.zip
%{_datadir}/org.scummvm.scummvm/scummvm/scummclassic.zip
%{_datadir}/org.scummvm.scummvm/scummvm/scummmodern.zip
%{_datadir}/org.scummvm.scummvm/scummvm/scummremastered.zip
%{_datadir}/org.scummvm.scummvm/scummvm/shaders.dat
%{_datadir}/org.scummvm.scummvm/scummvm/translations.dat
%{_datadir}/org.scummvm.scummvm/scummvm/wwwroot.zip
%if !%{minimal_build}
%{_datadir}/org.scummvm.scummvm/scummvm/access.dat
%{_datadir}/org.scummvm.scummvm/scummvm/bagel.dat
%{_datadir}/org.scummvm.scummvm/scummvm/cryomni3d.dat
%{_datadir}/org.scummvm.scummvm/scummvm/drascula.dat
%{_datadir}/org.scummvm.scummvm/scummvm/freescape.dat
%{_datadir}/org.scummvm.scummvm/scummvm/grim-patch.lab
%{_datadir}/org.scummvm.scummvm/scummvm/hadesch_translations.dat
%{_datadir}/org.scummvm.scummvm/scummvm/hugo.dat
%{_datadir}/org.scummvm.scummvm/scummvm/kyra.dat
%{_datadir}/org.scummvm.scummvm/scummvm/lure.dat
%{_datadir}/org.scummvm.scummvm/scummvm/mm.dat
%{_datadir}/org.scummvm.scummvm/scummvm/mort.dat
%{_datadir}/org.scummvm.scummvm/scummvm/myst3.dat
%{_datadir}/org.scummvm.scummvm/scummvm/nancy.dat
%{_datadir}/org.scummvm.scummvm/scummvm/neverhood.dat
%{_datadir}/org.scummvm.scummvm/scummvm/pred.dic
%{_datadir}/org.scummvm.scummvm/scummvm/prince_translation.dat
%{_datadir}/org.scummvm.scummvm/scummvm/queen.tbl
%{_datadir}/org.scummvm.scummvm/scummvm/sky.cpt
%{_datadir}/org.scummvm.scummvm/scummvm/supernova.dat
%{_datadir}/org.scummvm.scummvm/scummvm/teenagent.dat
%{_datadir}/org.scummvm.scummvm/scummvm/titanic.dat
%{_datadir}/org.scummvm.scummvm/scummvm/tony.dat
%{_datadir}/org.scummvm.scummvm/scummvm/toon.dat
%{_datadir}/org.scummvm.scummvm/scummvm/ultima.dat
%{_datadir}/org.scummvm.scummvm/scummvm/ultima8.dat
%{_datadir}/org.scummvm.scummvm/scummvm/wintermute.zip
%endif
%{_datadir}/applications/org.scummvm.scummvm.desktop
%{_datadir}/icons/hicolor/108x108/apps/org.scummvm.scummvm.png
%{_datadir}/icons/hicolor/128x128/apps/org.scummvm.scummvm.png
%{_datadir}/icons/hicolor/172x172/apps/org.scummvm.scummvm.png
%{_datadir}/icons/hicolor/86x86/apps/org.scummvm.scummvm.png
10 changes: 10 additions & 0 deletions backends/platform/sdl/sailfish/sailfish-download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
wget -O rpmdeps/freetype-2.13.3.tar.xz https://download.savannah.gnu.org/releases/freetype/freetype-2.13.3.tar.xz
wget -O rpmdeps/flac-1.4.3.tar.xz https://ftp.osuosl.org/pub/xiph/releases/flac/flac-1.4.3.tar.xz
wget -O rpmdeps/libjpeg-turbo-3.0.4.tar.gz https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.4/libjpeg-turbo-3.0.4.tar.gz
wget -O rpmdeps/libmad-0.15.1b.tar.gz https://downloads.sourceforge.net/mad/libmad-0.15.1b.tar.gz
wget -O rpmdeps/libmpeg2-0.5.1.tar.gz https://libmpeg2.sourceforge.net/files/libmpeg2-0.5.1.tar.gz
wget -O rpmdeps/faad2-2.8.8.tar.gz https://sourceforge.net/projects/faac/files/faad2-src/faad2-2.8.0/faad2-2.8.8.tar.gz
wget -O rpmdeps/giflib-5.2.2.tar.gz https://sourceforge.net/projects/giflib/files/giflib-5.2.2.tar.gz
wget -O rpmdeps/fribidi-1.0.16.tar.xz https://github.com/fribidi/fribidi/releases/download/v1.0.16/fribidi-1.0.16.tar.xz
wget -O rpmdeps/libtheora-1.1.1.tar.xz https://ftp.osuosl.org/pub/xiph/releases/theora/libtheora-1.1.1.tar.xz
wget -O rpmdeps/SDL2-2.30.7.tar.gz https://github.com/libsdl-org/SDL/releases/download/release-2.30.7/SDL2-2.30.7.tar.gz
Loading

0 comments on commit 9e24385

Please sign in to comment.