Build Sokoban RPM for Sailfish OS

This commit is contained in:
aerique 2024-10-09 17:14:30 +00:00 committed by P. Ruetz
parent 50bc5c0e4b
commit 09a5c4913b
5 changed files with 149 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View file

@ -0,0 +1,46 @@
# Dockerfile
FROM sfosbid:latest
WORKDIR /home/nemo
RUN git clone https://gitlab.com/embeddable-common-lisp/ecl.git ecl
RUN git clone https://gitlab.com/eql/lqml.git lqml
RUN sudo chown -R nemo:sailfish-system /home/nemo
# Build and install ECL in build environment.
WORKDIR /home/nemo/ecl
RUN git checkout 23.9.9
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R zypper install --no-confirm gcc make
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R ./configure
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R make
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R make install
# LQML
WORKDIR /home/nemo/lqml/src/build
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R zypper addrepo --refresh https://repo.sailfishos.org/obs/sailfishos:/chum/4.6_aarch64/sailfishos:chum.repo
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R sh -c 'echo "repo_gpgcheck = off" >> /etc/zypp/zypp.conf'
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R zypper install --no-confirm opt-qt5-qtdeclarative-devel opt-qt5-qtconnectivity-devel opt-qt5-qtlocation-devel opt-qt5-qtmultimedia-devel opt-qt5-qtquickcontrols2-devel opt-qt5-qtsensors-devel
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R /opt/qt5/bin/qmake ../lqml-lib.pro
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R make
# Prepare Sokoban directory.
WORKDIR /home/nemo/lqml/examples
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R ./copy.sh sokoban
# Build Sokoban.
WORKDIR /home/nemo/lqml/examples/sokoban/build
RUN rm -rf * .qmake.stash
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R /opt/qt5/bin/qmake ..
RUN sb2 -t SailfishOS-latest-aarch64 -m sdk-install -R make
# Build RPM.
COPY platforms/img/logo.png ./harbour-sokoban.png
COPY platforms/sailfish-os/harbour-sokoban.desktop .
RUN mkdir -p rpm
COPY platforms/sailfish-os/harbour-sokoban.spec ./rpm/
RUN sudo chown -R nemo:sailfish-system .
RUN mb2 -t SailfishOS-latest-aarch64 build
CMD echo -e "In another terminal execute:\n - 'docker cp ${HOSTNAME}:$(pwd)/RPMS/$(basename RPMS/*.rpm) .'\nto copy the RPM out of the container." && read -p "Then press <Enter> to terminate this container."

View file

@ -0,0 +1,50 @@
# Example Dockerfile to Build Sokoban for AARCH64
## Dependency
This project depends on [SFOSBID](https://codeberg.org/aerique/sfosbid).
This Git repository needs to be cloned somewhere and then, in the root of
that project's directory, the following commands should be issued:
- `bin/download.sh`
- `bin/build.sh`
Once this has been successfully built we can continue with building the
Sokoban RPM.
## Building the Sokoban RPM
Go to the LQML project's root directory, then:
- `cd examples/sokoban`
- `docker build -t sokoban -f platforms/sailfish-os/Dockerfile .`
- this takes a long time, especially if one is on another architecture
than the one being built
- `docker run -it sokoban`
A message will be displayed on how to copy the RPM out of the running
container.
## Installing the Sokoban RPM
Get the RPM onto your Sailfish OS phone either by using SSH, by putting it
online somewhere, emailing it to yourself, etc.
Then either in Downloads, Transfers or using the file manager install the RPM.
There should now be an new icon in your apps menu called "Sokoban".
## Building for other architectures
All relevant command are called with `sb2 -t SailfishOS-latest-aarch64 …`,
so creating a new Dockerfile or replacing `SailfishOS-latest-aarch64` with
one of the other installed architectures this project should build for that
architecture.
Available architectures in [SFOSBID](https://codeberg.org/aerique/sfosbid):
- `aarch64`
- `armv7hl` (this is the old 32-bit Sailfish OS architecture)
- `i486`
Building for the other architectures has not been tested.

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
X-Nemo-Single-Instance=no
X-Nemo-Application-Type=no-invoker
Icon=harbour-sokoban
Exec=qt-runner harbour-sokoban
Name=Sokoban
[X-Sailjail]
Sandboxing=Disabled

View file

@ -0,0 +1,43 @@
Name: harbour-sokoban
Summary: Sokoban game for Sailfish OS
Version: 0.1
Release: 1
Group: Amusements/Games
URL: https://gitlab.com/eql/lqml/-/tree/master/examples/sokoban
License: "It's complicated."
%description
Sokoban LQML Example for Sailfish OS.
# These are all installed in /opt/qt5 and not detected on RPM install.
%global __requires_exclude ^libQt5.*?\\.so.*$
%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/128x128/apps
install -m 755 app %{buildroot}%{_bindir}/harbour-sokoban
install -m 644 ../../../../ecl/build/libecl.so.23.9.9 %{buildroot}%{_libdir}/libecl.so.23.9.9
install -m 644 harbour-sokoban.desktop %{buildroot}%{_datadir}/applications/harbour-sokoban.desktop
install -m 644 harbour-sokoban.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/harbour-sokoban.png
strip %{buildroot}%{_bindir}/harbour-sokoban
strip %{buildroot}%{_libdir}/libecl.so.23.9.9
cd %{buildroot}%{_libdir}
ln -s libecl.so.23.9.9 libecl.so.23.9
ln -s libecl.so.23.9.9 libecl.so.23
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
# XXX no idea how and why this is created
%exclude %{_libdir}/documentation.list
%{_bindir}/harbour-sokoban
%{_libdir}/libecl.so.23
%{_libdir}/libecl.so.23.9
%{_libdir}/libecl.so.23.9.9
%{_datadir}/applications/harbour-sokoban.desktop
%{_datadir}/icons/hicolor/128x128/apps/harbour-sokoban.png