Skip to content

Commit

Permalink
wpe-demos: Add WPE Demos Recipe and Integrate with Core Image
Browse files Browse the repository at this point in the history
* Created a new recipe `wpe-demos.bb` to install multiple WPEWebKit
  demos, including SVG and video demos.
* Added scripts for demo execution: `demo-videos-wolvic`,
  `demo-wpe-svg-tiger`, and `demo-wpe-svg-toggler`.
* Included icons for each demo in the `wpe-demos` package.
* Updated `core-image-weston-wpe.bb` to include the new demo packages:
  `wpe-demos-videos-wolvic`, `wpe-demos-svg-tiger`, and
  `wpe-demos-svg-toggler`.
* Implemented a post-processing command to replace the default Apache2
  htdocs with the demo directory.
* Ensured proper ownership of the demo directory by the `weston` user.
  • Loading branch information
psaavedra committed Feb 14, 2025
1 parent 9cb0222 commit 0780efc
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 0 deletions.
79 changes: 79 additions & 0 deletions recipes-browser/wpe-demos/wpe-demos.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
SUMMARY = "Multiple WPE demo"
DESCRIPTION = "This recipe installs multiple WPEWebKit demos"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

DEPENDS += "python3"

HOSTTOOLS += "ffmpeg"

SRC_URI = " \
file://bin/ \
file://htdocs/ \
file://icons/ \
"

# demo-videos-wolvic
SRC_URI:append = " git://gitlab.igalia.com/teams/core/misc/demo-wolvic-videos.git;branch=main;protocol=https;name=demo-videos-wolvic;destsuffix=${S}/htdocs/demo-videos-wolvic"
SRCREV_demo-videos-wolvic = "${AUTOREV}"

S = "${WORKDIR}"

PACKAGES = "${PN}-svg-tiger ${PN}-svg-toggler ${PN}-videos-wolvic"

FILES:${PN}-svg-tiger = " \
/usr/bin/demo-wpe-svg-tiger \
/mnt/wpe-demos/demo-wpe-svg-tiger/ \
/mnt/install/icons/demo-wpe-svg-tiger.png \
"

FILES:${PN}-svg-toggler = " \
/usr/bin/demo-wpe-svg-toggler \
"

FILES:${PN}-videos-wolvic = " \
/usr/bin/demo-videos-wolvic \
/mnt/wpe-demos/demo-videos-wolvic/ \
/mnt/install/icons/demo-videos-wolvic.png \
"

RDEPENDS:${PN}-svg-toggler = "bash"
RDEPENDS:${PN}-videos-wolvic = "perl"

python do_fetch:append() {
import os
import subprocess

s_path = d.getVar('S')
demo_videos_dir = os.path.join(s_path, "demo-videos-wolvic")
download_script = os.path.join(s_path, "htdocs", "demo-videos-wolvic", "download.py")
os.makedirs(demo_videos_dir, exist_ok=True)

if os.path.isfile(download_script):
try:
subprocess.check_call(["python3", download_script],
cwd=os.path.dirname(download_script))
videos_dir = os.path.join(os.path.dirname(download_script),
"videos")
if os.path.isdir(videos_dir):
subprocess.check_call(["mv", videos_dir, demo_videos_dir])
except subprocess.CalledProcessError as e:
bb.fatal(f"Failed to execute {download_script}: {e}")
}

do_install() {
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/bin/demo-* ${D}${bindir}/

install -d ${D}/mnt/wpe-demos/
cp -r ${WORKDIR}/htdocs/demo-videos-wolvic ${D}/mnt/wpe-demos/
cp -r ${WORKDIR}/demo-videos-wolvic/videos ${D}/mnt/wpe-demos/demo-videos-wolvic/
cp -r ${WORKDIR}/htdocs/demo-wpe-svg-tiger ${D}/mnt/wpe-demos/

install -d ${D}/mnt/install/icons/
install -m 644 ${WORKDIR}/icons/demo-videos-wolvic.png ${D}/mnt/install/icons/
install -m 644 ${WORKDIR}/icons/demo-wpe-svg-tiger.png ${D}/mnt/install/icons/
}
12 changes: 12 additions & 0 deletions recipes-browser/wpe-demos/wpe-demos/bin/demo-videos-wolvic
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

/usr/bin/kill-demo

export WEBKIT_INSPECTOR_SERVER=0.0.0.0:12321
#export WAYLAND_DEBUG=1

export WEBKIT_SHOW_FPS=0
export GALLIUM_HUD_TOGGLE_SIGNAL=10 GALLIUM_HUD_VISIBLE=0 GALLIUM_HUD=cpu+fps
export LAYER_BASED_SVG_ENGINE_TOGGLER=/mnt/wpe-demos/LAYER_BASED_SVG_ENGINE_TOGGLER

/usr/bin/wpe-exported-wayland --maximize 'http://localhost/wpe-demos/demo-videos-wolvic/index.html'
12 changes: 12 additions & 0 deletions recipes-browser/wpe-demos/wpe-demos/bin/demo-wpe-svg-tiger
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

/usr/bin/kill-demo

export WEBKIT_INSPECTOR_SERVER=0.0.0.0:12321
#export WAYLAND_DEBUG=1

export WEBKIT_SHOW_FPS=0
export GALLIUM_HUD_TOGGLE_SIGNAL=10 GALLIUM_HUD_VISIBLE=0 GALLIUM_HUD=cpu+fps
export LAYER_BASED_SVG_ENGINE_TOGGLER=/mnt/wpe-demos/LAYER_BASED_SVG_ENGINE_TOGGLER

/usr/bin/wpe-exported-wayland --maximize http://localhost/wpe-demos/demo-wpe-svg-tiger/igalia.html
13 changes: 13 additions & 0 deletions recipes-browser/wpe-demos/wpe-demos/bin/demo-wpe-svg-toggler
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

TOGGLER=/mnt/wpe-demos/LAYER_BASED_SVG_ENGINE_TOGGLER

if [ -f "$TOGGLER" ]
then
rm $TOGGLER
else
touch $TOGGLER
fi

/usr/bin/wpe-ctl reload

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions recipes-core/images/core-image-weston-wpe.bb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,24 @@ IMAGE_INSTALL:append = " \
wpewebkit \
wpe-simple-launcher \
python3-uinput \
wpe-demos-videos-wolvic \
wpe-demos-svg-tiger \
wpe-demos-svg-toggler \
"

IMAGE_INSTALL:append:raspberrypi4 = " rpi-eeprom"
IMAGE_INSTALL:append:raspberrypi4-64 = " rpi-eeprom"
IMAGE_INSTALL:append:raspberrypi5 = " rpi-eeprom"

replace_default_apache2_htdocs () {
mkdir -p ${IMAGE_ROOTFS}/usr/share/apache2/default-site/
ln -sf /mnt/wpe-demos/ ${IMAGE_ROOTFS}/usr/share/apache2/default-site/htdocs/
}

ROOTFS_POSTPROCESS_COMMAND += "replace_default_apache2_htdocs; "

fakeroot do_populate_image () {
chown -R weston:weston ${IMAGE_ROOTFS}/mnt/wpe-demos
}

IMAGE_PREPROCESS_COMMAND += "do_populate_image"

0 comments on commit 0780efc

Please sign in to comment.