Skip to content

Commit

Permalink
Add rpi arm64 build and rewrite arm32 build to debian based.
Browse files Browse the repository at this point in the history
  • Loading branch information
veldenb committed Oct 29, 2023
1 parent 165203c commit 6156816
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 16 deletions.
13 changes: 10 additions & 3 deletions resources/bin/get-platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,25 @@ done
# Parse project var and convert to lower case
PLATFORM="$(echo "$LIBREELEC_PROJECT" | tr '[:upper:]' '[:lower:]')"

if [ "$LIBREELEC_ARCH" == "RPi4.arm" ]; then
# LibreELEC Pi4 runs a aarch64 kernel with arm32v7 libraries
PLATFORM_ARCH="armhf"
else
PLATFORM_ARCH=$(uname -m)
fi

# If platform is empty try uname
if [ "$PLATFORM" == "" ]; then
PLATFORM=$(uname -m)
PLATFORM="$PLATFORM_ARCH"
fi

# Figure out distro (libreelec, ubuntu)
PLATFORM_DISTRO="$ID"
PLATFORM_DISTRO_RELEASE="$VERSION_ID"

if [ -d "../build/$PLATFORM" ]; then
echo "Platform '$PLATFORM' running '$PLATFORM_DISTRO' '$PLATFORM_DISTRO_RELEASE' detected..."
echo "Platform $PLATFORM ($PLATFORM_ARCH) running $PLATFORM_DISTRO $PLATFORM_DISTRO_RELEASE detected..."
else
echo "Platform '$PLATFORM' running '$PLATFORM_DISTRO' '$PLATFORM_DISTRO_RELEASE' detected, using platform generic..."
echo "Platform $PLATFORM ($PLATFORM_ARCH) running $PLATFORM_DISTRO $PLATFORM_DISTRO_RELEASE detected, using platform generic..."
PLATFORM="generic"
fi
16 changes: 11 additions & 5 deletions resources/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ cd "$(dirname "$0")"

source ../bin/get-platform.sh

# If the distro is not LibreELEC assume local libraries are available and Docker is not needed
if [ "$PLATFORM" = "generic" ] && [ "$PLATFORM_DISTRO" != "libreelec" ]
if [ "$PLATFORM" = "generic" ]
then
ALTERNATIVE_BUILD="_local_libs"
elif [ "$PLATFORM_DISTRO" = "libreelec" ] && [ "$PLATFORM_DISTRO_RELEASE" = "10.0" ]
if [ "$PLATFORM_DISTRO" != "libreelec" ]
then
# If the distro is not LibreELEC assume local libraries are available and Docker is not needed
ALTERNATIVE_BUILD="_local_libs"
elif [ "$PLATFORM_DISTRO" = "libreelec" ] && [ "$PLATFORM_DISTRO_RELEASE" = "10.0" ]
then
ALTERNATIVE_BUILD="_libreelec_10"
fi
elif [ "$PLATFORM" = "rpi" ] && [ "$PLATFORM_ARCH" = "aarch64" ]
then
ALTERNATIVE_BUILD="_libreelec_10"
ALTERNATIVE_BUILD="_aarch64"
fi

# Uncomment to build moonlight from source. This is very experimental, cross your fingers and wait for a long time...
Expand Down
14 changes: 8 additions & 6 deletions resources/build/rpi/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

# Use latest compatible Debian version
FROM navikey/raspbian-buster
FROM arm32v7/debian:bullseye-slim

# See Installing Moonlight Qt on Raspberry Pi 4 (https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Raspberry-Pi-4)
RUN sudo apt-get update \
&& sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -y curl apt-transport-https \
&& curl -1sLf 'https://dl.cloudsmith.io/public/moonlight-game-streaming/moonlight-qt/setup.deb.sh' | sudo -E bash \
&& sudo apt-get update \
&& sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -y moonlight-qt libgl1 libxv1 \
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -y curl apt-transport-https ca-certificates gnupg \
&& echo "deb http://archive.raspberrypi.org/debian/ bullseye main" >> /etc/apt/sources.list \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 82B129927FA3303E \
&& curl -1sLf 'https://dl.cloudsmith.io/public/moonlight-game-streaming/moonlight-qt/setup.deb.sh' | distro=raspbian bash - \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -y moonlight-qt libgl1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
24 changes: 22 additions & 2 deletions resources/build/rpi/create_standalone_moonlight_qt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,51 @@ DEPENDENCIES="
libX11.so*
libXau.so*
libXdmcp.so*
libXext.so*
libXv.so*
libatomic.so*
libbsd.so*
libcrypto.so*
libdouble-conversion.so*
libffi.so*
libgssapi_krb5.so*
libgudev-1.0.so*
libicudata.so*
libicui18n.so*
libicuuc.so*
libjpeg.so*
libk5crypto.so*
libkrb5.so*
libkrb5support.so*
libmd.so*
libmd4c.so*
libmtdev.so*
libopus.so*
libpcre2-16.so*
libpcre2-8.so*
libpng16.so*
libssl.so*
libwayland-client.so*
libxcb.so*
libzstd.so*
qt5
"

LIB_DEPENDENCIES="
libcom_err.so*
libkeyutils.so*
libdbus-1.so*
liblzma.so*
"

# Dependencies from /usr/lib
for DEP in $DEPENDENCIES; do
cp --verbose --no-dereference --recursive /usr/lib/arm-linux-gnueabihf/$DEP /tmp/moonlight-qt/lib/
done

# Dependencies from /lib
for DEP in $LIB_DEPENDENCIES; do
cp --verbose --no-dereference --recursive /lib/arm-linux-gnueabihf/$DEP /tmp/moonlight-qt/lib/
done

mkdir /tmp/moonlight-qt/bin/
cp -v /usr/bin/moonlight-qt /tmp/moonlight-qt/bin/

Expand Down
18 changes: 18 additions & 0 deletions resources/build/rpi_aarch64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# Use latest compatible Debian version
FROM debian:bookworm-slim

# See Installing Moonlight Qt on Raspberry Pi 4 (https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Raspberry-Pi-4)
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -y curl apt-transport-https ca-certificates gnupg \
&& curl -1sLf 'https://dl.cloudsmith.io/public/moonlight-game-streaming/moonlight-qt/setup.deb.sh' | distro=raspbian bash - \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends install -y moonlight-qt \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Script to copy the needed libraries
COPY create_standalone_moonlight_qt.sh /tmp/
RUN chmod a+x /tmp/create_standalone_moonlight_qt.sh

ENTRYPOINT [ "/tmp/create_standalone_moonlight_qt.sh" ]
64 changes: 64 additions & 0 deletions resources/build/rpi_aarch64/create_standalone_moonlight_qt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

# Make sure al needed files end up in /tmp/moonlight-qt/

set -e

cd "$(dirname "$0")"

mkdir -p /tmp/moonlight-qt/lib/

# Include dependencies not present in LibreELEC
DEPENDENCIES="
libGL.so*
libGLX.so*
libGLdispatch.so*
libQt5*
libX11.so*
libXau.so*
libXdmcp.so*
libbsd.so*
libdouble-conversion.so*
libffi.so*
libgssapi_krb5.so*
libgudev-1.0.so*
libicudata.so*
libicui18n.so*
libicuuc.so*
libjpeg.so*
libk5crypto.so*
libkrb5.so*
libkrb5support.so*
libpcre2-16.so*
libpcre2-8.so*
libmd.so*
libmd4c.so*
libmtdev.so*
libopus.so*
libpng16.so*
libxcb.so*
libzstd.so*
libwayland-client.so*
qt5
"

LIB_DEPENDENCIES="
libcom_err.so*
libkeyutils.so*
libdbus-1.so*
liblzma.so*
"

for DEP in $DEPENDENCIES; do
cp --verbose --no-dereference --recursive /usr/lib/aarch64-linux-gnu/$DEP /tmp/moonlight-qt/lib/
done

# Dependencies from /lib
for DEP in $LIB_DEPENDENCIES; do
cp --verbose --no-dereference --recursive /lib/aarch64-linux-gnu/$DEP /tmp/moonlight-qt/lib/
done

mkdir /tmp/moonlight-qt/bin/
cp -v /usr/bin/moonlight-qt /tmp/moonlight-qt/bin/

chown -R --reference=/tmp/moonlight-qt /tmp/moonlight-qt/

0 comments on commit 6156816

Please sign in to comment.