From c4f9d501a6b14c0f2d7e662ed1d6cf54c390eca2 Mon Sep 17 00:00:00 2001 From: fewtarius Date: Fri, 25 Aug 2023 15:35:08 +0000 Subject: [PATCH] Add weston 11 for S922X, drop libmali-vulkan back to v40. --- packages/graphics/libmali-vulkan/package.mk | 2 +- packages/virtual/image/package.mk | 12 ++- packages/wayland/weston11/config/kiosk.ini | 22 ++++++ packages/wayland/weston11/config/weston.ini | 21 +++++ packages/wayland/weston11/package.mk | 79 +++++++++++++++++++ .../weston11/patches/001-terminal.patch | 79 +++++++++++++++++++ .../wayland/weston11/profile.d/04-weston.conf | 8 ++ .../wayland/weston11/scripts/weston-config | 15 ++++ .../wayland/weston11/system.d/weston.service | 19 +++++ 9 files changed, 255 insertions(+), 2 deletions(-) create mode 100644 packages/wayland/weston11/config/kiosk.ini create mode 100644 packages/wayland/weston11/config/weston.ini create mode 100644 packages/wayland/weston11/package.mk create mode 100644 packages/wayland/weston11/patches/001-terminal.patch create mode 100644 packages/wayland/weston11/profile.d/04-weston.conf create mode 100755 packages/wayland/weston11/scripts/weston-config create mode 100644 packages/wayland/weston11/system.d/weston.service diff --git a/packages/graphics/libmali-vulkan/package.mk b/packages/graphics/libmali-vulkan/package.mk index d35f11ccb..4ebc0a69d 100644 --- a/packages/graphics/libmali-vulkan/package.mk +++ b/packages/graphics/libmali-vulkan/package.mk @@ -2,7 +2,7 @@ # Copyright (C) 2022-present BrooksyTech (https://github.com/brooksytech) PKG_NAME="libmali-vulkan" -PKG_VERSION="r44p0-01eac0" +PKG_VERSION="r40p0-01eac0" PKG_LICENSE="mali_driver" PKG_ARCH="arm aarch64" PKG_SITE="https://developer.arm.com/downloads/-/mali-drivers/user-space" diff --git a/packages/virtual/image/package.mk b/packages/virtual/image/package.mk index 1eac738fb..81105dbb8 100644 --- a/packages/virtual/image/package.mk +++ b/packages/virtual/image/package.mk @@ -48,7 +48,17 @@ else [ "${PIPEWIRE_SUPPORT}" = "yes" ] && PKG_DEPENDS_TARGET+=" alsa pulseaudio pipewire wireplumber" fi -[ "${DISPLAYSERVER}" = "wl" ] && PKG_DEPENDS_TARGET+=" weston" +if [ "${DISPLAYSERVER}" = "wl" ] +then + case ${DEVICE} in + S922X) + PKG_DEPENDS_TARGET+=" weston11" + ;; + *) + PKG_DEPENDS_TARGET+=" weston" + ;; + esac +fi # Device is an emulation focused device [ "${EMULATION_DEVICE}" = "yes" ] && PKG_DEPENDS_TARGET+=" emulators gamesupport" diff --git a/packages/wayland/weston11/config/kiosk.ini b/packages/wayland/weston11/config/kiosk.ini new file mode 100644 index 000000000..167c36c69 --- /dev/null +++ b/packages/wayland/weston11/config/kiosk.ini @@ -0,0 +1,22 @@ +[core] +idle-time=0 +backend=/usr/lib/libweston-10/drm-backend.so +shell=kiosk-shell.so +xwayland=true + +[xwayland] +path=/usr/bin/Xwayland + +[terminal] +font-size=@WESTONFONTSIZE@ + +[shell] +background-image=/usr/config/splash/splash.png +background-type=scale-crop +background-color=0x00000000 +clock-format=minutes-24h +locking=false + +[autolaunch] +path=@STARTUP@ +watch=true diff --git a/packages/wayland/weston11/config/weston.ini b/packages/wayland/weston11/config/weston.ini new file mode 100644 index 000000000..1c6620f1a --- /dev/null +++ b/packages/wayland/weston11/config/weston.ini @@ -0,0 +1,21 @@ +[core] +idle-time=0 +backend=/usr/lib/libweston-10/drm-backend.so +xwayland=true + +[xwayland] +path=/usr/bin/Xwayland + +[terminal] +font-size=@WESTONFONTSIZE@ + +[shell] +background-image=/usr/config/splash/splash.png +background-type=scale-crop +background-color=0x00000000 +clock-format=minutes-24h +locking=false + +[launcher] +path=/usr/bin/weston-terminal +icon=/usr/share/weston/terminal.png diff --git a/packages/wayland/weston11/package.mk b/packages/wayland/weston11/package.mk new file mode 100644 index 000000000..ba7a39229 --- /dev/null +++ b/packages/wayland/weston11/package.mk @@ -0,0 +1,79 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="weston11" +PKG_VERSION="11.0.3" +PKG_LICENSE="MIT" +PKG_SITE="https://wayland.freedesktop.org/" +PKG_URL="https://gitlab.freedesktop.org/wayland/weston/-/archive/${PKG_VERSION}/${PKG_NAME}-${PKG_VERSION}.tar.gz" +PKG_DEPENDS_TARGET="toolchain wayland wayland-protocols libdrm libxkbcommon libinput cairo pango libjpeg-turbo dbus seatd glu ${OPENGL} libX11 xorg-server libXcursor xkbcomp setxkbmap cairo xterm splash" +PKG_LONGDESC="Reference implementation of a Wayland compositor" + +PKG_MESON_OPTS_TARGET="-Dbackend-drm=true \ + -Dbackend-drm-screencast-vaapi=false \ + -Dbackend-headless=false \ + -Dbackend-rdp=false \ + -Dscreenshare=false \ + -Dbackend-wayland=true \ + -Dbackend-x11=false \ + -Ddeprecated-backend-fbdev=false \ + -Dbackend-default=drm \ + -Drenderer-gl=true \ + -Ddeprecated-weston-launch=false \ + -Dxwayland=true \ + -Dsystemd=true \ + -Dremoting=false \ + -Dpipewire=false \ + -Dshell-desktop=true \ + -Dshell-fullscreen=true \ + -Dshell-ivi=false \ + -Dshell-kiosk=true \ + -Ddesktop-shell-client-default="weston-desktop-shell" \ + -Ddeprecated-wl-shell=false \ + -Dcolor-management-lcms=false \ + -Dcolor-management-colord=false \ + -Dlauncher-logind=false \ + -Dlauncher-libseat=true \ + -Dimage-jpeg=true \ + -Dimage-webp=false \ + -Dtools=['terminal'] + -Ddemo-clients=false \ + -Dsimple-clients=[] \ + -Dresize-pool=false \ + -Dwcap-decode=true \ + -Dtest-junit-xml=false \ + -Dtest-skip-is-failure=false \ + -Dtest-gl-renderer=false \ + -Ddoc=false" + +pre_configure_target() { + # weston does not build with NDEBUG (requires assert for tests) + export TARGET_CFLAGS=$(echo ${TARGET_CFLAGS} | sed -e "s|-DNDEBUG||g") +} + +post_makeinstall_target() { + mkdir -p ${INSTALL}/usr/lib/weston + cp ${PKG_DIR}/scripts/weston-config ${INSTALL}/usr/lib/weston + + mkdir -p ${INSTALL}/usr/share/weston + cp ${PKG_DIR}/config/*ini ${INSTALL}/usr/share/weston + + safe_remove ${INSTALL}/usr/share/wayland-sessions + + for configfile in weston.ini kiosk.ini + do + sed -i -e "s|@WESTONFONTSIZE@|${WESTONFONTSIZE}|g" ${INSTALL}/usr/share/weston/${configfile} + done + + if [ "${EMULATION_DEVICE}" = "yes" ] && \ + [ ! "${BASE_ONLY}" == true ] + then + cat <>${INSTALL}/usr/share/weston/weston.ini + +[launcher] +path=/usr/bin/start_es.sh +icon=/usr/config/emulationstation/resources/window_icon_24.png +EOF + fi + +} diff --git a/packages/wayland/weston11/patches/001-terminal.patch b/packages/wayland/weston11/patches/001-terminal.patch new file mode 100644 index 000000000..26dc25f69 --- /dev/null +++ b/packages/wayland/weston11/patches/001-terminal.patch @@ -0,0 +1,79 @@ +diff -rupN weston-10.0.3.orig/clients/terminal.c weston-10.0.3/clients/terminal.c +--- weston-10.0.3.orig/clients/terminal.c 2023-04-22 14:24:55.619280680 +0000 ++++ weston-10.0.3/clients/terminal.c 2023-04-22 16:10:53.929276891 +0000 +@@ -56,6 +56,8 @@ static char *option_font; + static int option_font_size; + static char *option_term; + static char *option_shell; ++static char *option_cwd; ++static char *option_command; + + static struct wl_list terminal_list; + +@@ -3089,7 +3091,13 @@ terminal_run(struct terminal *terminal, + close(pipes[0]); + setenv("TERM", option_term, 1); + setenv("COLORTERM", option_term, 1); +- if (execl(path, path, NULL)) { ++ if (option_command) { ++ if (execl(path, path, "-c", option_command, NULL)) { ++ fprintf(stderr, "command '%s' couldn't executed: %m", ++ option_command); ++ } ++ } ++ if (execl(path, path, "-l")) { + printf("exec failed: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } +@@ -3123,6 +3131,8 @@ static const struct weston_option termin + { WESTON_OPTION_STRING, "font", 0, &option_font }, + { WESTON_OPTION_INTEGER, "font-size", 0, &option_font_size }, + { WESTON_OPTION_STRING, "shell", 0, &option_shell }, ++ { WESTON_OPTION_STRING, "cwd", 0, &option_cwd }, ++ { WESTON_OPTION_STRING, "command", 0, &option_command }, + }; + + int main(int argc, char *argv[]) +@@ -3140,14 +3150,15 @@ int main(int argc, char *argv[]) + + option_shell = getenv("SHELL"); + if (!option_shell) +- option_shell = "/bin/sh"; ++ option_shell = "/bin/bash"; + + config_file = weston_config_get_name_from_env(); + config = weston_config_parse(config_file); + s = weston_config_get_section(config, "terminal", NULL, NULL); + weston_config_section_get_string(s, "font", &option_font, "monospace"); +- weston_config_section_get_int(s, "font-size", &option_font_size, 14); ++ weston_config_section_get_int(s, "font-size", &option_font_size, 16); + weston_config_section_get_string(s, "term", &option_term, "xterm"); ++ weston_config_section_get_string(s, "command", &option_command, NULL); + weston_config_destroy(config); + + if (parse_options(terminal_options, +@@ -3157,7 +3168,9 @@ int main(int argc, char *argv[]) + " --maximized or -m\n" + " --font=NAME\n" + " --font-size=SIZE\n" +- " --shell=NAME\n", argv[0]); ++ " --shell=NAME\n" ++ " --cwd=PATH\n" ++ " --command=CMDLINE\n", argv[0]); + return 1; + } + +@@ -3178,6 +3191,13 @@ int main(int argc, char *argv[]) + + wl_list_init(&terminal_list); + terminal = terminal_create(d); ++ ++ if (option_cwd) { ++ if(chdir(option_cwd) == -1) ++ fprintf(stderr, "failed to changing directory as %s: %m\n", ++ option_cwd); ++ } ++ + if (terminal_run(terminal, option_shell)) + exit(EXIT_FAILURE); + diff --git a/packages/wayland/weston11/profile.d/04-weston.conf b/packages/wayland/weston11/profile.d/04-weston.conf new file mode 100644 index 000000000..9d3df982c --- /dev/null +++ b/packages/wayland/weston11/profile.d/04-weston.conf @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +export SDL_AUDIODRIVER=alsa +export SDL_VIDEODRIVER=wayland +export WAYLAND_DISPLAY=wayland-1 +export XKB_CONFIG_ROOT=/usr/share/X11/xkb +export XDG_RUNTIME_DIR=/var/run/0-runtime-dir diff --git a/packages/wayland/weston11/scripts/weston-config b/packages/wayland/weston11/scripts/weston-config new file mode 100755 index 000000000..5c02b039d --- /dev/null +++ b/packages/wayland/weston11/scripts/weston-config @@ -0,0 +1,15 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) + +export XDG_RUNTIME_DIR=/var/run/0-runtime-dir + +if [ ! -d "$XDG_RUNTIME_DIR" ]; then + mkdir "$XDG_RUNTIME_DIR" + chmod 0700 "$XDG_RUNTIME_DIR" +fi + +if [ ! -f /storage/.config/weston.ini ]; then + cp /usr/share/weston/kiosk.ini /storage/.config/weston.ini +fi diff --git a/packages/wayland/weston11/system.d/weston.service b/packages/wayland/weston11/system.d/weston.service new file mode 100644 index 000000000..c850b5f38 --- /dev/null +++ b/packages/wayland/weston11/system.d/weston.service @@ -0,0 +1,19 @@ +[Unit] +Description=Weston Launcher +Before=graphical.target +After=multi-user.target +ConditionKernelCommandLine=!installer + +[Service] +Environment=HOME=/storage +Environment=LANG=C +Environment=XDG_RUNTIME_DIR=/var/run/0-runtime-dir +WorkingDirectory=/storage +ExecStartPre=-/usr/lib/weston/weston-config +ExecStart=/usr/bin/weston --tty=7 --log=/var/log/weston.log +Restart=always +RestartSec=2 + +[Install] +Alias=display-manager.service +WantedBy=graphical.target