commit 4a92aa724292775d4fbb57b6087c0db41c45c76d Author: Cameron Gutman Date: Tue Feb 4 19:48:42 2020 -0800 Initial drop of mostly-working containers diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..fee39b8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "userland"] + path = userland + url = https://github.com/raspberrypi/userland.git +[submodule "FFmpeg"] + path = FFmpeg + url = https://github.com/cgutman/FFmpeg.git +[submodule "nv-codec-headers"] + path = nv-codec-headers + url = https://git.videolan.org/git/ffmpeg/nv-codec-headers.git +[submodule "jetson-ffmpeg"] + path = jetson-ffmpeg + url = https://github.com/cgutman/jetson-ffmpeg.git diff --git a/Dockerfile.bionic.aarch64 b/Dockerfile.bionic.aarch64 new file mode 100644 index 0000000..865e5bb --- /dev/null +++ b/Dockerfile.bionic.aarch64 @@ -0,0 +1,23 @@ +FROM nvcr.io/nvidia/l4t-base:r32.3.1 + +RUN set -ex && \ + export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get install -y g++ make devscripts debhelper coreutils git wget nasm cmake libv4l-dev && \ + apt-get install -y libssl-dev qtbase5-dev qtquickcontrols2-5-dev qtdeclarative5-dev libqt5svg5-dev libgl1-mesa-dev libegl1-mesa-dev libxkbcommon-dev wayland-protocols libopus-dev libva-dev libvdpau-dev libsdl2-dev libsdl2-ttf-dev && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/* + +COPY userland /opt/userland +COPY FFmpeg /opt/FFmpeg +COPY jetson-ffmpeg /opt/jetson-ffmpeg +COPY nv-codec-headers /opt/nv-codec-headers + +COPY scripts/build-deps.sh /opt/scripts/ +RUN /bin/bash -c /opt/scripts/build-deps.sh + +COPY scripts/build-package.sh /opt/scripts/ +COPY debian /opt/debian + +VOLUME "/out" +ENTRYPOINT [ "/bin/bash", "-c", "/opt/scripts/build-package.sh" ] \ No newline at end of file diff --git a/Dockerfile.buster.amd64 b/Dockerfile.buster.amd64 new file mode 100644 index 0000000..6a6b4ca --- /dev/null +++ b/Dockerfile.buster.amd64 @@ -0,0 +1,23 @@ +FROM amd64/debian:buster + +RUN set -ex && \ + export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get install -y g++ make devscripts debhelper coreutils git wget nasm cmake libv4l-dev && \ + apt-get install -y libssl-dev qtbase5-dev qtquickcontrols2-5-dev qtdeclarative5-dev libqt5svg5-dev libgl1-mesa-dev libegl1-mesa-dev libxkbcommon-dev wayland-protocols libopus-dev libva-dev libvdpau-dev libsdl2-dev libsdl2-ttf-dev && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/* + +COPY userland /opt/userland +COPY FFmpeg /opt/FFmpeg +COPY jetson-ffmpeg /opt/jetson-ffmpeg +COPY nv-codec-headers /opt/nv-codec-headers + +COPY scripts/build-deps.sh /opt/scripts/ +RUN /bin/bash -c /opt/scripts/build-deps.sh + +COPY scripts/build-package.sh /opt/scripts/ +COPY debian /opt/debian + +VOLUME "/out" +ENTRYPOINT [ "/bin/bash", "-c", "/opt/scripts/build-package.sh" ] diff --git a/Dockerfile.buster.armhf b/Dockerfile.buster.armhf new file mode 100644 index 0000000..8d7984c --- /dev/null +++ b/Dockerfile.buster.armhf @@ -0,0 +1,23 @@ +FROM arm32v7/debian:buster + +RUN set -ex && \ + export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get install -y g++ make devscripts debhelper coreutils git wget nasm cmake libv4l-dev && \ + apt-get install -y libssl-dev qtbase5-dev qtquickcontrols2-5-dev qtdeclarative5-dev libqt5svg5-dev libgl1-mesa-dev libegl1-mesa-dev libxkbcommon-dev wayland-protocols libopus-dev libva-dev libvdpau-dev libsdl2-dev libsdl2-ttf-dev && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/* + +COPY userland /opt/userland +COPY FFmpeg /opt/FFmpeg +COPY jetson-ffmpeg /opt/jetson-ffmpeg +COPY nv-codec-headers /opt/nv-codec-headers + +COPY scripts/build-deps.sh /opt/scripts/ +RUN /bin/bash -c /opt/scripts/build-deps.sh + +COPY scripts/build-package.sh /opt/scripts/ +COPY debian /opt/debian + +VOLUME "/out" +ENTRYPOINT [ "/bin/bash", "-c", "/opt/scripts/build-package.sh" ] \ No newline at end of file diff --git a/FFmpeg b/FFmpeg new file mode 160000 index 0000000..747429e --- /dev/null +++ b/FFmpeg @@ -0,0 +1 @@ +Subproject commit 747429ea1cf561d5f375980eb1a731491d4fce87 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..915e438 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +moonlight (1.2.1-1) UNRELEASED; urgency=low + + * Initial release. + + -- Cameron Gutman Mon, 03 Feb 2020 15:08:49 -0800 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..17a0848 --- /dev/null +++ b/debian/control @@ -0,0 +1,11 @@ +Source: moonlight +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, libgl1-mesa-dev, libegl1-mesa-dev, libxkbcommon-dev, wayland-protocols, libopus-dev, libva-dev, libvdpau-dev, libsdl2-dev, libsdl2-ttf-dev + +Package: moonlight +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} +Description: NVIDIA GameStream client diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..2dc6c0c --- /dev/null +++ b/debian/copyright @@ -0,0 +1,22 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: moonlight-qt +Source: https://github.com/moonlight-stream/moonlight-qt + +Files: * +Copyright: 2018-2020 Cameron Gutman +License: GPL-3+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..0d34532 --- /dev/null +++ b/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f +export QT_SELECT := qt5 +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100755 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/jetson-ffmpeg b/jetson-ffmpeg new file mode 160000 index 0000000..caac989 --- /dev/null +++ b/jetson-ffmpeg @@ -0,0 +1 @@ +Subproject commit caac989993476b92c8a571e466a080167eba96dd diff --git a/nv-codec-headers b/nv-codec-headers new file mode 160000 index 0000000..0cd5c2b --- /dev/null +++ b/nv-codec-headers @@ -0,0 +1 @@ +Subproject commit 0cd5c2b7c30d580d09348c92d8facd7a39957f01 diff --git a/scripts/build-deps.sh b/scripts/build-deps.sh new file mode 100755 index 0000000..467f240 --- /dev/null +++ b/scripts/build-deps.sh @@ -0,0 +1,47 @@ +set -e + +BASE_FFMPEG_ARGS="--enable-pic --enable-static --disable-shared --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-hwaccel=h264_vaapi --enable-hwaccel=hevc_vaapi --enable-hwaccel=h264_vdpau --enable-hwaccel=hevc_vdpau" + +ARCH=`uname -m` +echo "Building dependencies for $ARCH" +if [ "$ARCH" == "armv7l" ]; then + # We need to link against some Raspberry Pi userland binaries + cd /opt/userland + mkdir build + cd build + cmake -DARM64=0 -DVMCS_INSTALL_PREFIX=/usr .. + make -j$(nproc) + make install + + # Enable MMAL decoders + EXTRA_FFMPEG_ARGS="--enable-mmal --enable-decoder=h264_mmal" +elif [ "$ARCH" == "aarch64" ]; then + # We need to build libnvmpi + cd /opt/jetson-ffmpeg + mkdir build + cd build + cmake .. + make -j$(nproc) + make install + + # We need to patch ffmpeg to add NVMPI support + cd /opt/FFmpeg + git apply /opt/jetson-ffmpeg/ffmpeg_nvmpi.patch + + # Enable NVMPI decoders + EXTRA_FFMPEG_ARGS="--enable-nvmpi --enable-decoder=h264_nvmpi --enable-decoder=hevc_nvmpi" +elif [ "$ARCH" == "x86_64" ]; then + # We need to install the NVDEC headers + cd /opt/nv-codec-headers + make install PREFIX=/usr + + EXTRA_FFMPEG_ARGS="--enable-nvdec --enable-hwaccel=h264_nvdec --enable-hwaccel=hevc_nvdec" +else + echo "Unrecognized architecture: $ARCH" + exit 1 +fi + +cd /opt/FFmpeg +./configure $BASE_FFMPEG_ARGS $EXTRA_FFMPEG_ARGS +make -j$(nproc) +make install \ No newline at end of file diff --git a/scripts/build-package.sh b/scripts/build-package.sh new file mode 100755 index 0000000..fd48e01 --- /dev/null +++ b/scripts/build-package.sh @@ -0,0 +1,42 @@ +set -e + +# Check out the source +[[ ! -z "$BRANCH" ]] || BRANCH="master" +echo "Checking out $BRANCH" +git clone --recursive --branch $BRANCH --depth 1 https://github.com/moonlight-stream/moonlight-qt.git +cd moonlight-qt +git show HEAD + +# Grab the verson metadata +VERSION=`cat app/version.txt` + +# Create a build directory +mkdir /opt/build + +# Nuke the libs folder - not needed for Linux +git rm -r libs +git commit -m "Remove pre-built libraries" + +# Generate source tarball +scripts/generate-src.sh + +# Move the tarball into the build directory +mv build/source/MoonlightSrc-$VERSION.tar.gz /opt/build/moonlight_$VERSION.orig.tar.gz + +# Extract the tarball into the appropriate directory +cd /opt/build +mkdir moonlight-$VERSION +cd moonlight-$VERSION +tar xvf ../moonlight_$VERSION.orig.tar.gz + +# Copy the debian directory into the build directory +cp -r /opt/debian . + +# Build the package +debuild -us -uc + +# Copy the output to the out directory +cp /opt/build/* /out + +# Done! +echo "Build successful!" \ No newline at end of file diff --git a/userland b/userland new file mode 160000 index 0000000..06bc6da --- /dev/null +++ b/userland @@ -0,0 +1 @@ +Subproject commit 06bc6daa02137ca72b7a2104afad81e82a44de17