Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add debian packaging files #411

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ debug/*
release/*

moc_predefs\.h
Makefile

# binary on Linux
stremio
Expand All @@ -56,4 +57,11 @@ icons
server.js
Stremio*.exe

rcedit-x86.exe
rcedit-x86.exe

# debian build files
debian/*debhelper*
debian/files
debian/*.substvars
obj-*/
stremio-build-deps_*
37 changes: 36 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
31 changes: 30 additions & 1 deletion DEBIAN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
# 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

```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``
Expand Down
5 changes: 0 additions & 5 deletions Makefile

This file was deleted.

9 changes: 8 additions & 1 deletion autoupdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
stremio (4.4.168) stable; urgency=medium

* init

-- Stremio Team <[email protected]> Thu, 22 Feb 2024 00:49:49 +0100
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11
36 changes: 36 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Source: stremio
Priority: extra
Section: video
Maintainer: Stremio Team <[email protected]>
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
10 changes: 10 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/make -f

export DH_BUILD=1

override_dh_auto_configure:
qmake
dh_auto_configure

%:
dh $@ --buildsystem=cmake
2 changes: 2 additions & 0 deletions debian/stremio.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
smartcode-stremio.desktop usr/share/applications
images/stremio.ico usr/share/icons/stremio
20 changes: 20 additions & 0 deletions dist-utils/generate-icons.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 8 additions & 1 deletion main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
)
}
Expand Down
26 changes: 17 additions & 9 deletions release.makefile
Original file line number Diff line number Diff line change
@@ -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)","")
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion smartcode-stremio.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down