digi-webkit-examples: add recipe for main landing page

This recipe installs the main page of the WebKit examples, from which all other
examples can be accessed. For now, only include the WebGL examples.

Since the landing page recipe needs to know which WebGL demos are being
installed and the webserver path where everything is installed, move some of
the variables used in the webglsamples recipe into an *.inc file to be able to
re-use said variables in different recipes.

Use the Digi embedded documentation CSS file for now, so the landing page looks
more on-brand.

https://jira.digi.com/browse/DEL-7314
https://jira.digi.com/browse/DEL-7339

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2020-12-09 17:06:49 +01:00
parent f7c86fb0a4
commit 04cd7aafe7
5 changed files with 1734 additions and 38 deletions

View File

@ -0,0 +1,44 @@
# Copyright (C) 2020 Digi International.
SUMMARY = "A webpage containing several examples for the WPE WebKit on Digi embedded devices"
DESCRIPTION = "This webpage provides examples that show how the WPE WebKit leverages the hardware capabilities of Digi embedded devices for improved performance"
LICENSE = "MPL-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad"
SRC_URI = " \
file://index.html \
file://digi.css \
"
S = "${WORKDIR}"
require digi-webkit-examples.inc
RDEPENDS_${PN} = " \
cog \
webglsamples \
${WEBSERVER_PACKAGE} \
"
# The package contains static webpages, no need to configure or compile
do_configure[noexec] = "1"
do_compile[noexec] = "1"
do_install() {
install -d ${D}/${WEBSERVER_ROOT}
install -m 644 ${S}/index.html ${D}/${WEBSERVER_ROOT}
install -m 644 ${S}/digi.css ${D}/${WEBSERVER_ROOT}
# Most entry points for the WebGL samples have the same format:
# <name>/<name>.html. Since we might define different sample lists per
# platform, we should generate the list of samples dynamically.
SAMPLE_LIST=""
ENTRY='<li><p><a href="_name_/_name_.html">_name_</a></p></li>'
for sample in ${WEBGL_SAMPLES}; do
SAMPLE_LIST="${SAMPLE_LIST}\n$(echo ${ENTRY} | sed s/_name_/${sample}/g)"
done
SAMPLE_LIST="${SAMPLE_LIST}\n"
sed -i s,##WEBGL_SAMPLE_LIST##,"${SAMPLE_LIST}",g ${D}/${WEBSERVER_ROOT}/index.html
}

View File

@ -0,0 +1,43 @@
# Copyright (C) 2020 Digi International.
# By default, use the Busybox HTTP daemon as the webserver for the examples.
WEBSERVER_PACKAGE ?= "busybox-httpd"
WEBSERVER_ROOT ?= "srv/www"
# List of samples we want accesible via the landing page
WEBGL_SAMPLES = " \
aquarium \
blob \
dynamic-cubemap \
electricflower \
field \
multiple-views \
spacerocks \
toon-shading \
"
# Folders containing elements required by the samples we've selected
WEBGL_SAMPLE_DEPS = " \
colorpicker \
css \
fishtank \
fonts \
gradient-editor \
images \
jquery-ui-1.8.2.custom \
js \
lots-o-objects \
shared \
tdl \
"
# List of all folders that need to be installed
WEBGL_REQUIRED = " \
${WEBGL_SAMPLES} \
${WEBGL_SAMPLE_DEPS} \
"
# All packages involved in the webkit examples install their files in the
# webserver directory
FILES_${PN} = "/${WEBSERVER_ROOT}/*"
# Don't generate dbg or dev packages
PACKAGES = "${PN}"

View File

@ -0,0 +1,29 @@
<html>
<head>
<title>Digi WebKit examples</title>
<link rel="stylesheet" href="digi.css">
</head>
<body>
<h1>Digi WebKit examples</h1>
<p>This page contains a series of examples that showcase some of the main
features of the <strong>WPE WebKit</strong>.</p>
<p>The main focus of this web engine is to leverage the hardware
capabilities of embedded systems to make browsing as efficient and as
lightweight as possible. You can find more information about the WPE WebKit at
<a href="https://wpewebkit.org/">https://wpewebkit.org/</a>.</p>
<p>When running an example, you can always come back to this page by executing
"<strong>cogctl previous</strong>" in the command line.</p>
<h2>WebGL examples</h2>
<p>WPE WebKit supports <strong>WebGL</strong>, a JavaScript library that allows
browsers to use the system's GPU to render 2D and 3D graphics. The following
examples have been obtained from
<a href="https://webglsamples.org/">https://webglsamples.org/</a>:</p>
<ul>##WEBGL_SAMPLE_LIST##</ul>
</body>
</html>

View File

@ -13,40 +13,7 @@ SRC_URI = "${WEBGL_SAMPLES_SRC};branch=${SRCBRANCH}"
SRCREV = "dc4428bdc6ef2177f71d9e7bab164c43f9e29302" SRCREV = "dc4428bdc6ef2177f71d9e7bab164c43f9e29302"
S = "${WORKDIR}/git" S = "${WORKDIR}/git"
# By default, use the Busybox HTTP daemon as the webserver for the examples. require digi-webkit-examples.inc
WEBSERVER_PACKAGE ?= "busybox-httpd"
WEBSERVER_ROOT ?= "srv/www"
# List of samples we want accesible via the landing page
WEBGL_SAMPLES = " \
aquarium \
blob \
dynamic-cubemap \
electricflower \
field \
multiple-views \
spacerocks \
toon-shading \
"
# Folders containing elements required by the samples we've selected
WEBGL_SAMPLE_DEPS = " \
colorpicker \
css \
fishtank \
fonts \
gradient-editor \
images \
jquery-ui-1.8.2.custom \
js \
lots-o-objects \
shared \
tdl \
"
WEBGL_REQUIRED = " \
${WEBGL_SAMPLES} \
${WEBGL_SAMPLE_DEPS} \
"
# The package contains static webpages, no need to configure or compile # The package contains static webpages, no need to configure or compile
do_configure[noexec] = "1" do_configure[noexec] = "1"
@ -65,7 +32,3 @@ do_install() {
-exec install -Dm 644 "{}" "${D}/${WEBSERVER_ROOT}/{}" \; -exec install -Dm 644 "{}" "${D}/${WEBSERVER_ROOT}/{}" \;
done done
} }
FILES_${PN} = "/${WEBSERVER_ROOT}/*"
PACKAGES = "${PN}"