From e3eea3901f1e7db0a62c4e9485ff458069f73e33 Mon Sep 17 00:00:00 2001 From: drlkf Date: Fri, 23 Feb 2024 17:40:47 +0100 Subject: [PATCH 1/3] build: add debian package files --- .gitignore | 10 +++++++++- CMakeLists.txt | 37 +++++++++++++++++++++++++++++++++++- DEBIAN.md | 27 ++++++++++++++++++++++++++ Makefile | 5 ----- autoupdater.cpp | 9 ++++++++- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 36 +++++++++++++++++++++++++++++++++++ debian/rules | 10 ++++++++++ debian/stremio.install | 1 + dist-utils/generate-icons.sh | 20 +++++++++++++++++++ main.qml | 9 ++++++++- release.makefile | 26 ++++++++++++++++--------- 13 files changed, 178 insertions(+), 18 deletions(-) delete mode 100644 Makefile create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100755 debian/rules create mode 100644 debian/stremio.install create mode 100755 dist-utils/generate-icons.sh diff --git a/.gitignore b/.gitignore index a8fc3e33..9f771f1b 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ debug/* release/* moc_predefs\.h +Makefile # binary on Linux stremio @@ -56,4 +57,11 @@ icons server.js Stremio*.exe -rcedit-x86.exe \ No newline at end of file +rcedit-x86.exe + +# debian build files +debian/*debhelper* +debian/files +debian/*.substvars +obj-*/ +stremio-build-deps_* diff --git a/CMakeLists.txt b/CMakeLists.txt index 047d5c03..09c82853 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,5 +125,40 @@ target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ) if(UNIX AND NOT APPLE) - install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION opt/stremio) + if(DEFINED ENV{DH_BUILD}) + set(BIN_INSTALL_TARGET ${CMAKE_INSTALL_BINDIR}) + else() + set(BIN_INSTALL_TARGET opt/stremio) + endif() + + install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${BIN_INSTALL_TARGET}) endif() + +# +# icons +# + +set(ICONS_DIR ${CMAKE_CURRENT_BINARY_DIR}/icons) + +add_custom_command(OUTPUT ${ICONS_DIR} + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dist-utils/generate-icons.sh + ARGS ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Generating icons" +) + +add_custom_target(icons ALL DEPENDS ${ICONS_DIR}) +install(DIRECTORY ${ICONS_DIR} DESTINATION share/icons/stremio) + +# +# server.js +# + +set(SERVER ${CMAKE_CURRENT_BINARY_DIR}/server.js) + +add_custom_command(OUTPUT ${SERVER} + COMMAND wget -O ${SERVER} -i ${CMAKE_CURRENT_SOURCE_DIR}/server-url.txt + COMMENT "Downloading server" +) + +add_custom_target(server ALL DEPENDS ${SERVER}) +install(FILES ${SERVER} DESTINATION share/stremio) diff --git a/DEBIAN.md b/DEBIAN.md index 5281f9a7..1b210637 100644 --- a/DEBIAN.md +++ b/DEBIAN.md @@ -2,6 +2,33 @@ These instructions have been tested in Debian Bookworm 12 (Stable) +# Debian package build +## 1. Install dependencies + +```bash +apt-get install -y devscripts equivs +mk-build-deps -i +``` + +## 2. Build the package + +```bash +dpkg-buildpackage -us -uc -b +``` + +## 3. Install the package + +```bash +apt install ../stremio_*.deb +``` + +## 4. Run Stremio + +```bash +stremio +``` + +# Manual build ## 1. Start by cloning the GIT repository: ``git clone --recurse-submodules -j8 https://github.com/Stremio/stremio-shell.git`` diff --git a/Makefile b/Makefile deleted file mode 100644 index 5534c397..00000000 --- a/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -all: - @echo "This is NOOP Makefile. Try make -f release.makefile" - -%: - @echo "This is NOOP Makefile. Try make -f release.makefile $@" \ No newline at end of file diff --git a/autoupdater.cpp b/autoupdater.cpp index ed79e455..8883ff40 100644 --- a/autoupdater.cpp +++ b/autoupdater.cpp @@ -106,7 +106,14 @@ int AutoUpdater::executeCmd(QString cmd, QStringList args, bool noWait = false) // CHECK FOR UPDATES void AutoUpdater::checkForUpdatesPerform(QString endpoint, QString userAgent) { - QByteArray serverHash = getFileChecksum(QCoreApplication::applicationDirPath() + QDir::separator() + SERVER_FNAME); + QString serverDir = QCoreApplication::applicationDirPath(); + + // debian package installation + if (serverDir == "/usr/bin") { + serverDir = "/usr/share/stremio"; + } + + QByteArray serverHash = getFileChecksum(serverDir + QDir::separator() + SERVER_FNAME); QByteArray asarHash = getFileChecksum(QCoreApplication::applicationDirPath() + QDir::separator() + ASAR_FNAME); QUrl url = QUrl(endpoint); diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..65f29d0d --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +stremio (4.4.168) stable; urgency=medium + + * init + + -- Stremio Team Thu, 22 Feb 2024 00:49:49 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..9d607966 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 \ No newline at end of file diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..9cd8fdaa --- /dev/null +++ b/debian/control @@ -0,0 +1,36 @@ +Source: stremio +Priority: extra +Section: video +Maintainer: Stremio Team +Build-Depends: + g++, + libkf5webengineviewer-dev, + libmpv-dev, + libqt5webview5-dev, + libssl-dev, + pkgconf, + qt5-qmake, + qtbase5-dev, + qtcreator, + qtwebengine5-dev, + wget + +Package: stremio +Architecture: any +Depends: + libmpv1 (>=0.30.0) | libmpv2, + nodejs, + qtdeclarative5-dev, + qml-module-qt-labs-platform (>=5.9.5), + qml-module-qt-labs-folderlistmodel (>=5.9.5), + qml-module-qt-labs-settings (>=5.9.5), + qml-module-qtquick-controls (>=5.9.5), + qml-module-qtquick-dialogs (>=5.9.5), + qml-module-qtwebchannel (>=5.9.5), + qml-module-qtwebengine (>=5.9.5), + librubberband2 (>=1.8.1), + libuchardet0 (>=0.0.6), + libfdk-aac2 (>=2.0.2), + librsvg2-bin +Provides: stremio +Description: The next generation media center diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..d01fc708 --- /dev/null +++ b/debian/rules @@ -0,0 +1,10 @@ +#!/usr/bin/make -f + +export DH_BUILD=1 + +override_dh_auto_configure: + qmake + dh_auto_configure + +%: + dh $@ --buildsystem=cmake diff --git a/debian/stremio.install b/debian/stremio.install new file mode 100644 index 00000000..c01ee9cc --- /dev/null +++ b/debian/stremio.install @@ -0,0 +1 @@ +smartcode-stremio.desktop usr/share/applications diff --git a/dist-utils/generate-icons.sh b/dist-utils/generate-icons.sh new file mode 100755 index 00000000..61070723 --- /dev/null +++ b/dist-utils/generate-icons.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +if test -n "$1"; then + source="$1"/images +else + source=images +fi + +target=icons + +mkdir -p "$target" + +for size in 16 22 24 32 64 128; do + rsvg-convert "$source"/stremio.svg -w "$size" \ + -o "$target"/smartcode-stremio_"$size".png + rsvg-convert "$source"/stremio_tray_white.svg -w "$size" \ + -o "$target"/smartcode-stremio-tray_"$size".png +done diff --git a/main.qml b/main.qml index 8954785d..32a54b7b 100644 --- a/main.qml +++ b/main.qml @@ -280,9 +280,16 @@ ApplicationWindow { } function launchServer() { var node_executable = applicationDirPath + "/node" + var server_dir = applicationDirPath + + // debian package installation + if (server_dir === "/usr/bin") { + server_dir = "/usr/share/stremio" + } + if (Qt.platform.os === "windows") node_executable = applicationDirPath + "/stremio-runtime.exe" streamingServer.start(node_executable, - [applicationDirPath +"/server.js"].concat(Qt.application.arguments.slice(1)), + [server_dir + "/server.js"].concat(Qt.application.arguments.slice(1)), "EngineFS server started at " ) } diff --git a/release.makefile b/release.makefile index 86ba4523..01746a99 100644 --- a/release.makefile +++ b/release.makefile @@ -1,19 +1,20 @@ -BUILD_DIR := build -INSTALL_DIR := ${PREFIX}/opt/stremio +BUILD_DIR := build +INSTALL_DIR := ${PREFIX}/opt/stremio -ICON_BIN := smartcode-stremio.svg +ICON_BIN := smartcode-stremio.svg -SERVER_JS := server.js +SERVER_JS := server.js -STREMIO_BIN := ${BUILD_DIR}/stremio +STREMIO_BIN := ${BUILD_DIR}/stremio ALL: ${STREMIO_BIN} ${SERVER_JS} icons install: make -C ${BUILD_DIR} install install -Dm 644 ${SERVER_JS} "${INSTALL_DIR}/server.js" - install -Dm 644 smartcode-stremio.desktop "${INSTALL_DIR}/smartcode-stremio.desktop" + install -Dm 644 smartcode-stremio.desktop \ + "${INSTALL_DIR}/smartcode-stremio.desktop" cp -r icons "${INSTALL_DIR}/" ln -s "${shell which node}" "${INSTALL_DIR}/node" ifneq ("$(wildcard ../mpv-build/mpv/build)","") @@ -26,14 +27,21 @@ uninstall: icons: mkdir -p "$@" - cd "$@" && printf 16,22,24,32,64,128 | xargs -I^ -d, sh -c 'rsvg-convert ../images/stremio.svg -w ^ -o smartcode-stremio_^.png && rsvg-convert ../images/stremio_tray_white.svg -w ^ -o smartcode-stremio-tray_^.png' + cd "$@" && \ + printf 16,22,24,32,64,128 | \ + xargs -I^ -d, sh -c \ + 'rsvg-convert ../images/stremio.svg -w ^ -o smartcode-stremio_^.png && \ + rsvg-convert ../images/stremio_tray_white.svg -w ^ -o smartcode-stremio-tray_^.png' -${SERVER_JS}: +${SERVER_JS}: wget "${shell cat server-url.txt}" -qO ${SERVER_JS} || rm ${SERVER_JS} ${STREMIO_BIN}: mkdir -p ${BUILD_DIR} - cd ${BUILD_DIR} && cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${PREFIX}" .. + cd ${BUILD_DIR} && \ + cmake -G"Unix Makefiles" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" .. make -j -C ${BUILD_DIR} clean: From 25d0f2585a8adfe662db7e8fb9f0af7340c4a32f Mon Sep 17 00:00:00 2001 From: drlkf Date: Wed, 1 Jan 2025 03:32:35 +0100 Subject: [PATCH 2/3] fix: fix desktop entry icon in debian packaging --- debian/stremio.install | 1 + smartcode-stremio.desktop | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/stremio.install b/debian/stremio.install index c01ee9cc..4502220e 100644 --- a/debian/stremio.install +++ b/debian/stremio.install @@ -1 +1,2 @@ smartcode-stremio.desktop usr/share/applications +images/stremio.ico usr/share/icons/stremio diff --git a/smartcode-stremio.desktop b/smartcode-stremio.desktop index 92762f6a..8bda299f 100644 --- a/smartcode-stremio.desktop +++ b/smartcode-stremio.desktop @@ -3,7 +3,7 @@ Version=1.0 Name=Stremio Comment=Video organizer for your Movies, TV Shows and TV Channels Exec=stremio %U -Icon=smartcode-stremio +Icon=/usr/share/icons/stremio/stremio.ico Terminal=false Type=Application Categories=AudioVideo;Video;Player;TV; From 9d271c3054b3518fe7fc2c4adb173c7b61888d2c Mon Sep 17 00:00:00 2001 From: drlkf Date: Wed, 1 Jan 2025 03:35:12 +0100 Subject: [PATCH 3/3] docs: add disclaimer about required non-free component --- DEBIAN.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DEBIAN.md b/DEBIAN.md index 1b210637..1f4b01dd 100644 --- a/DEBIAN.md +++ b/DEBIAN.md @@ -1,6 +1,8 @@ # Build Stremio for Debian GNU/Linux -These instructions have been tested in Debian Bookworm 12 (Stable) +These instructions have been tested in Debian Bookworm 12 (Stable). +In order to use this package, you will have to enable the `non-free` component +in your `sources.list(5)` to install `libfdk-aac2`. # Debian package build ## 1. Install dependencies