Skip to content

Commit

Permalink
Add HyperHDR addon
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed May 3, 2024
1 parent 4513878 commit 79437ae
Show file tree
Hide file tree
Showing 11 changed files with 239 additions and 0 deletions.
111 changes: 111 additions & 0 deletions packages/addons/addon-depends/qtbase_5_15/package.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Lukas Rusak (lrusak@libreelec.tv)
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)

PKG_NAME="qtbase_5_15"
PKG_VERSION="5.15.13"
PKG_SHA256="9550ec8fc758d3d8d9090e261329700ddcd712e2dda97e5fcfeabfac22bea2ca"
PKG_LICENSE="GPL"
PKG_SITE="http://qt-project.org"
PKG_URL="https://download.qt.io/archive/qt/${PKG_VERSION%.*}/${PKG_VERSION}/single/qt-everywhere-opensource-src-${PKG_VERSION}.tar.xz"
PKG_DEPENDS_TARGET="freetype libjpeg-turbo libpng openssl sqlite zlib"
PKG_LONGDESC="A cross-platform application and UI framework."
PKG_BUILD_FLAGS="-sysroot"

PKG_CONFIGURE_OPTS_TARGET="-prefix /usr
-sysroot "${SYSROOT_PREFIX}"
-hostprefix "${TOOLCHAIN}"
-device linux-libreelec-g++
-opensource -confirm-license
-release
-static
-make libs
-force-pkg-config
-openssl-linked
-no-accessibility
-qt-sqlite
-no-sql-mysql
-system-zlib
-no-mtdev
-qt-libjpeg
-qt-libpng
-no-harfbuzz
-no-libproxy
-system-pcre
-no-glib
-silent
-no-cups
-no-iconv
-no-evdev
-no-tslib
-no-icu
-no-strip
-no-fontconfig
-no-opengl
-no-libudev
-no-libinput
-no-eglfs
-no-egl
-skip qt3d
-skip qtactiveqt
-skip qtandroidextras
-skip qtcanvas3d
-skip qtconnectivity
-skip qtdeclarative
-skip qtdoc
-skip qtgraphicaleffects
-skip qtimageformats
-skip qtlocation
-skip qtmacextras
-skip qtmultimedia
-skip qtquickcontrols
-skip qtquickcontrols2
-skip qtscript
-skip qtsensors
-skip qtserialbus
-skip qtsvg
-skip qttranslations
-skip qtwayland
-skip qtwebchannel
-skip qtwebengine
-skip qtwebsockets
-skip qtwebview
-skip qtwinextras
-skip qtx11extras
-skip qtxmlpatterns"

configure_target() {
QMAKE_CONF_DIR="qtbase/mkspecs/devices/linux-libreelec-g++"

cd ..
mkdir -p ${QMAKE_CONF_DIR}

cat >"${QMAKE_CONF_DIR}/qmake.conf" <<EOF
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
load(device_config)
QMAKE_CC = ${CC}
QMAKE_CXX = ${CXX}
QMAKE_LINK = ${CXX}
QMAKE_LINK_SHLIB = ${CXX}
QMAKE_AR = ${AR} cqs
QMAKE_OBJCOPY = ${OBJCOPY}
QMAKE_NM = ${NM} -P
QMAKE_STRIP = ${STRIP}
QMAKE_CFLAGS = ${CFLAGS}
QMAKE_CXXFLAGS = ${CXXFLAGS}
QMAKE_LFLAGS = ${LDFLAGS}
load(qt_config)
EOF

cat >"${QMAKE_CONF_DIR}/qplatformdefs.h" <<EOF
#include "../../linux-g++/qplatformdefs.h"
EOF

unset CC CXX LD RANLIB AR AS CPPFLAGS CFLAGS LDFLAGS CXXFLAGS
./configure ${PKG_CONFIGURE_OPTS_TARGET}
}
11 changes: 11 additions & 0 deletions packages/addons/addon-depends/qtbase_5_15/patches/patch01.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/qtbase/src/corelib/text/qbytearraymatcher.h
+++ b/qtbase/src/corelib/text/qbytearraymatcher.h
@@ -39,7 +39,7 @@

#ifndef QBYTEARRAYMATCHER_H
#define QBYTEARRAYMATCHER_H
-
+#include <limits>
#include <QtCore/qbytearray.h>

QT_BEGIN_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- a/qtbase/src/corelib/tools/qoffsetstringarray_p.h
+++ b/qtbase/src/corelib/tools/qoffsetstringarray_p.h
@@ -53,6 +53,7 @@

#include "private/qglobal_p.h"

+#include <limits>
#include <tuple>
#include <array>
17 changes: 17 additions & 0 deletions packages/addons/addon-depends/qtbase_5_15/patches/patch03.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/qtbase/src/platformsupport/input/xkbcommon/qxkbcommon.cpp 2024-01-04 20:21:43.000000000 +0100
+++ b/qtbase/src/platformsupport/input/xkbcommon/qxkbcommon.cpp 2024-05-03 17:03:07.145043476 +0200
@@ -273,10 +273,10 @@
Xkb2Qt<XKB_KEY_dead_small_schwa, Qt::Key_Dead_Small_Schwa>,
Xkb2Qt<XKB_KEY_dead_capital_schwa, Qt::Key_Dead_Capital_Schwa>,
Xkb2Qt<XKB_KEY_dead_greek, Qt::Key_Dead_Greek>,
- Xkb2Qt<XKB_KEY_dead_lowline, Qt::Key_Dead_Lowline>,
- Xkb2Qt<XKB_KEY_dead_aboveverticalline, Qt::Key_Dead_Aboveverticalline>,
- Xkb2Qt<XKB_KEY_dead_belowverticalline, Qt::Key_Dead_Belowverticalline>,
- Xkb2Qt<XKB_KEY_dead_longsolidusoverlay, Qt::Key_Dead_Longsolidusoverlay>,
+ //Xkb2Qt<XKB_KEY_dead_lowline, Qt::Key_Dead_Lowline>,
+ //Xkb2Qt<XKB_KEY_dead_aboveverticalline, Qt::Key_Dead_Aboveverticalline>,
+ //Xkb2Qt<XKB_KEY_dead_belowverticalline, Qt::Key_Dead_Belowverticalline>,
+ //Xkb2Qt<XKB_KEY_dead_longsolidusoverlay, Qt::Key_Dead_Longsolidusoverlay>,

// Special keys from X.org - This include multimedia keys,
// wireless/bluetooth/uwb keys, special launcher keys, etc.
Binary file added packages/addons/service/hyperhdr/icon/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions packages/addons/service/hyperhdr/package.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)

PKG_NAME="hyperhdr"
PKG_VERSION="52f12b4ec9753f0b00ddeeb98d709b15b55a0444"
PKG_REV="204"
PKG_LICENSE="MiT"
PKG_SITE="https://github.com/awawa-dev/HyperHDR"
PKG_URL="https://github.com/awawa-dev/HyperHDR.git"
GET_HANDLER_SUPPORT="git"
PKG_DEPENDS_TARGET="toolchain qtbase_5_15 pkg-config libjpeg-turbo alsa"
PKG_TOOLCHAIN="cmake"
PKG_SECTION="service"
PKG_SHORTDESC="HyperHDR: an ambient lighting controller"
PKG_LONGDESC="HyperHDR is an opensource ambient lighting implementation."

PKG_IS_ADDON="yes"
PKG_ADDON_NAME="HyperHDR"
PKG_ADDON_TYPE="xbmc.service"
PKG_BUILD_FLAGS="-sysroot"

# Setting default values
PKG_PLATFORM="-DPLATFORM=linux"

if [ "$LINUX" = "raspberrypi" ]; then
PKG_PLATFORM="-DPLATFORM=rpi -DENABLE_WS281XPWM=ON"
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET rpi_ws281x"
fi

PKG_PLATFORM="$PKG_PLATFORM -DENABLE_FRAMEBUFFER=OFF -DENABLE_PIPEWIRE=OFF -DENABLE_X11=OFF -DENABLE_CEC=OFF"

PKG_CMAKE_OPTS_TARGET="-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_STATIC_QT_PLUGINS=ON \
$PKG_PLATFORM \
-Wno-dev"

addon() {
mkdir -p ${ADDON_BUILD}/${PKG_ADDON_ID}/{bin,lib,lut}
rm $(get_install_dir hyperhdr)/usr/share/hyperhdr/bin/hyperhdr-remote || true
cp -r -P -p $(get_install_dir hyperhdr)/usr/share/hyperhdr/bin/* ${ADDON_BUILD}/${PKG_ADDON_ID}/bin
cp $(get_install_dir hyperhdr)/usr/share/hyperhdr/lib/* ${ADDON_BUILD}/${PKG_ADDON_ID}/lib || true
tar -xf $(get_install_dir hyperhdr)/usr/share/hyperhdr/lut/lut_lin_tables.tar.xz -C ${ADDON_BUILD}/${PKG_ADDON_ID}/lut
}
11 changes: 11 additions & 0 deletions packages/addons/service/hyperhdr/source/bin/hyperhdr.start
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)

. /etc/profile

oe_setup_addon service.hyperhdr

exec hyperhdr --userdata $ADDON_HOME &
echo $! > /run/hyperhdr.pid
7 changes: 7 additions & 0 deletions packages/addons/service/hyperhdr/source/default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)

import xbmc

monitor = xbmc.Monitor()
monitor.waitForAbort()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=HyperHDR power management
Before=sleep.target
StopWhenUnneeded=yes

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/curl http://127.0.0.1:8090/json-rpc?request=%7B%22command%22:%22componentstate%22,%22componentstate%22:%7B%22component%22:%22ALL%22,%22state%22:false%7D%7D
ExecStop=-/usr/bin/curl http://127.0.0.1:8090/json-rpc?request=%7B%22command%22:%22componentstate%22,%22componentstate%22:%7B%22component%22:%22ALL%22,%22state%22:true%7D%7D

[Install]
WantedBy=sleep.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=HyperHDR service
After=graphical.target

[Service]
Type=forking
ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.hyperhdr/bin/hyperhdr.start"
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/run/hyperhdr.pid
TimeoutStopSec=2
Restart=always
RestartSec=10
StartLimitInterval=0

[Install]
WantedBy=default.target

0 comments on commit 79437ae

Please sign in to comment.