digi-webkit-examples: create recipe for WebGL samples

This recipe installs a subset of the samples available at
https://webglsamples.org/ onto the target's web server, to be able to run said
examples locally without needing internet access. Make sure not to install any
source files to avoid making the package too large.

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 16:58:16 +01:00
parent cfa11005ee
commit 4b94979d98
1 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,71 @@
# Copyright (C) 2020 Digi International.
SUMMARY = "A collection of WebGL samples"
DESCRIPTION = "This repo contains several examples of the WebGL JavaScript API, which allows web browsers to render 2D and 3D graphics with direct access to the system's GPU."
HOMEPAGE = "https://webglsamples.org/"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE.md;md5=e20489d49c9f8517c8f8f3317844e7da"
WEBGL_SAMPLES_SRC ?= "git://github.com/WebGLSamples/WebGLSamples.github.io.git;protocol=https"
SRCBRANCH = "master"
SRC_URI = "${WEBGL_SAMPLES_SRC};branch=${SRCBRANCH}"
SRCREV = "dc4428bdc6ef2177f71d9e7bab164c43f9e29302"
S = "${WORKDIR}/git"
# 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 \
"
WEBGL_REQUIRED = " \
${WEBGL_SAMPLES} \
${WEBGL_SAMPLE_DEPS} \
"
# 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}
cd ${S}
# All we need to do is copy the folders we want to the webserver root
# path. Make sure not to copy any source assets, since they're quite
# heavy.
for sample in ${WEBGL_REQUIRED}; do
find ${sample} -path *source_assets* -prune -false -o -type f \
-exec install -Dm 644 "{}" "${D}/${WEBSERVER_ROOT}/{}" \;
done
}
FILES_${PN} = "/${WEBSERVER_ROOT}/*"
PACKAGES = "${PN}"