From 54f02f27f00c53edf4f9760047c136a31f2fa196 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 15 Aug 2021 20:51:57 +0000 Subject: [PATCH] Stop assuming the build target based on architecture --- Dockerfile.amd64.buster | 2 ++ Dockerfile.l4t.bionic | 2 ++ Dockerfile.rpi.buster | 2 ++ build-amd64.sh | 2 +- build-rpi.sh | 2 +- debian/control | 4 ++-- scripts/build-deps.sh | 11 +++++------ scripts/build-package.sh | 18 ++++++++++++++++++ 8 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Dockerfile.amd64.buster b/Dockerfile.amd64.buster index 5aa8b45..618369b 100644 --- a/Dockerfile.amd64.buster +++ b/Dockerfile.amd64.buster @@ -1,5 +1,7 @@ FROM amd64/debian:buster +ENV TARGET=desktop + COPY scripts/install-base-deps.sh /opt/scripts/ RUN /bin/bash -c /opt/scripts/install-base-deps.sh && \ apt-get install -y --no-install-recommends libwayland-dev wayland-protocols libva-dev libvdpau-dev && \ diff --git a/Dockerfile.l4t.bionic b/Dockerfile.l4t.bionic index 45de2a6..c69ff6d 100644 --- a/Dockerfile.l4t.bionic +++ b/Dockerfile.l4t.bionic @@ -1,5 +1,7 @@ FROM nvcr.io/nvidia/l4t-base:r32.3.1 +ENV TARGET=l4t + COPY scripts/install-base-deps.sh /opt/scripts/ RUN /bin/bash -c /opt/scripts/install-base-deps.sh && \ curl -1sLf 'https://dl.cloudsmith.io/public/moonlight-game-streaming/moonlight-l4t/setup.deb.sh' | bash && \ diff --git a/Dockerfile.rpi.buster b/Dockerfile.rpi.buster index 6741d62..01ccb81 100644 --- a/Dockerfile.rpi.buster +++ b/Dockerfile.rpi.buster @@ -1,5 +1,7 @@ FROM arm32v7/debian:buster +ENV TARGET=rpi + COPY scripts/install-base-deps.sh /opt/scripts/ RUN /bin/bash -c /opt/scripts/install-base-deps.sh && \ apt-get install -y --no-install-recommends gnupg && \ diff --git a/build-amd64.sh b/build-amd64.sh index bee90c1..3be7740 100755 --- a/build-amd64.sh +++ b/build-amd64.sh @@ -21,4 +21,4 @@ else echo Built Docker image - cgutman/moonlight-packaging:$TAG_NAME fi -docker run --rm --mount type=bind,source="$(pwd)"/$OUT_DIR,target=/out --mount type=bind,source="$(pwd)"/debian,target=/opt/debian -e COMMIT="$1" cgutman/moonlight-packaging:$TAG_NAME \ No newline at end of file +docker run --rm --mount type=bind,source="$(pwd)"/$OUT_DIR,target=/out --mount type=bind,source="$(pwd)"/debian,target=/opt/debian -e COMMIT="$1" cgutman/moonlight-packaging:$TAG_NAME diff --git a/build-rpi.sh b/build-rpi.sh index 0a35aad..2c9affc 100755 --- a/build-rpi.sh +++ b/build-rpi.sh @@ -21,4 +21,4 @@ else echo Built Docker image - cgutman/moonlight-packaging:$TAG_NAME fi -docker run --rm --mount type=bind,source="$(pwd)"/$OUT_DIR,target=/out --mount type=bind,source="$(pwd)"/debian,target=/opt/debian -e COMMIT="$1" cgutman/moonlight-packaging:$TAG_NAME \ No newline at end of file +docker run --rm --mount type=bind,source="$(pwd)"/$OUT_DIR,target=/out --mount type=bind,source="$(pwd)"/debian,target=/opt/debian -e COMMIT="$1" cgutman/moonlight-packaging:$TAG_NAME diff --git a/debian/control b/debian/control index a531fea..5d68cf8 100644 --- a/debian/control +++ b/debian/control @@ -3,9 +3,9 @@ Maintainer: Cameron Gutman Section: misc Priority: optional Standards-Version: 4.3.0 -Build-Depends: debhelper (>= 10), libssl-dev, qtbase5-dev, qtquickcontrols2-5-dev, qtdeclarative5-dev, libqt5svg5-dev, libxkbcommon-dev, libopus-dev, libgbm-dev, libdrm-dev, libfreetype6-dev, libasound2-dev, libdbus-1-dev, libegl1-mesa-dev, libgl1-mesa-dev, libgles2-mesa-dev, libglu1-mesa-dev, libibus-1.0-dev, libpulse-dev, libudev-dev, libx11-dev, libxcursor-dev, libxext-dev, libxi-dev, libxinerama-dev, libxrandr-dev, libxss-dev, libxt-dev, libxv-dev, libxxf86vm-dev, libwayland-dev [amd64], wayland-protocols [amd64], libva-dev [amd64], libvdpau-dev [amd64], libraspberrypi-dev [armhf] | rbp-userland-dev-osmc [armhf], libnvmpi1.0.0 [arm64] +Build-Depends: debhelper (>= 10), libssl-dev, qtbase5-dev, qtquickcontrols2-5-dev, qtdeclarative5-dev, libqt5svg5-dev, libxkbcommon-dev, libopus-dev, libgbm-dev, libdrm-dev, libfreetype6-dev, libasound2-dev, libdbus-1-dev, libegl1-mesa-dev, libgl1-mesa-dev, libgles2-mesa-dev, libglu1-mesa-dev, libibus-1.0-dev, libpulse-dev, libudev-dev, libx11-dev, libxcursor-dev, libxext-dev, libxi-dev, libxinerama-dev, libxrandr-dev, libxss-dev, libxt-dev, libxv-dev, libxxf86vm-dev, EXTRA_BUILD_DEPS Package: moonlight-qt Architecture: any -Depends: libraspberrypi0 [armhf] | rbp-userland-osmc [armhf], qml-module-qtquick2, qml-module-qtquick-controls2, qml-module-qtquick-layouts, qml-module-qtquick-window2, ${shlibs:Depends}, ${misc:Depends} +Depends: qml-module-qtquick2, qml-module-qtquick-controls2, qml-module-qtquick-layouts, qml-module-qtquick-window2, ${shlibs:Depends}, ${misc:Depends}, EXTRA_DEPS Description: NVIDIA GameStream client diff --git a/scripts/build-deps.sh b/scripts/build-deps.sh index 6e35141..2f3f766 100755 --- a/scripts/build-deps.sh +++ b/scripts/build-deps.sh @@ -2,18 +2,17 @@ set -e BASE_FFMPEG_ARGS="--enable-pic --enable-static --disable-shared --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-libdrm --enable-decoder=h264_v4l2m2m --enable-decoder=hevc_v4l2m2m --extra-cflags=-I/usr/include/libdrm" -ARCH=`uname -m` -echo "Building dependencies for $ARCH" -if [ "$ARCH" == "armv7l" ]; then +echo "Building dependencies for $TARGET" +if [ "$TARGET" == "rpi" ]; then # Copy libraspberrypi-dev pkgconfig files into the default location mkdir -p /usr/local/lib/pkgconfig cp /opt/vc/lib/pkgconfig/* /usr/local/lib/pkgconfig/ # Enable MMAL decoders EXTRA_FFMPEG_ARGS="--enable-mmal --enable-decoder=h264_mmal --disable-rpi --enable-sand --enable-libudev --enable-v4l2-request --enable-hwaccel=h264_v4l2request --enable-hwaccel=hevc_v4l2request" -elif [ "$ARCH" == "aarch64" ]; then +elif [ "$TARGET" == "l4t" ]; then # Enable NVMPI decoders EXTRA_FFMPEG_ARGS="--enable-nvmpi --enable-decoder=h264_nvmpi --enable-decoder=hevc_nvmpi" -elif [ "$ARCH" == "x86_64" ]; then +elif [ "$TARGET" == "desktop" ]; then # We need to install the NVDEC headers cd /opt/nv-codec-headers make install @@ -21,7 +20,7 @@ elif [ "$ARCH" == "x86_64" ]; then # Enable VAAPI, VDPAU, and NVDEC decoders EXTRA_FFMPEG_ARGS="--enable-nvdec --enable-hwaccel=h264_nvdec --enable-hwaccel=hevc_nvdec --enable-hwaccel=h264_vaapi --enable-hwaccel=hevc_vaapi --enable-hwaccel=h264_vdpau --enable-hwaccel=hevc_vdpau" else - echo "Unrecognized architecture: $ARCH" + echo "Unrecognized target: $TARGET" exit 1 fi diff --git a/scripts/build-package.sh b/scripts/build-package.sh index 192a966..ba26cbf 100755 --- a/scripts/build-package.sh +++ b/scripts/build-package.sh @@ -12,6 +12,19 @@ git -c submodule.libs.update=none submodule update --init --recursive # Grab the verson metadata VERSION=`cat app/version.txt` +# Determine extra target-specific dependencies +if [ "$TARGET" == "rpi" ]; then + EXTRA_BUILD_DEPS="libraspberrypi-dev | rbp-userland-dev-osmc" + EXTRA_DEPS="libraspberrypi0 | rbp-userland-osmc" +elif [ "$TARGET" == "l4t" ]; then + EXTRA_BUILD_DEPS="libnvmpi1.0.0" +elif [ "$TARGET" == "desktop" ]; then + EXTRA_BUILD_DEPS="libwayland-dev, wayland-protocols, libva-dev, libvdpau-dev" +else + echo "Unrecognized target: $TARGET" + exit 1 +fi + # Create a build directory mkdir /opt/build @@ -30,6 +43,11 @@ tar xvf ../moonlight-qt_$VERSION.orig.tar.gz # Copy the debian directory into the build directory cp -r /opt/debian . +# Patch the control file with target-specific dependencies +sed -i "s/EXTRA_BUILD_DEPS/$EXTRA_BUILD_DEPS/g" debian/control +sed -i "s/EXTRA_DEPS/$EXTRA_DEPS/g" debian/control +cat debian/control + # Build the package debuild -us -uc