From 4b94979d986400d84567b3b11e277bbcc60ae7bf Mon Sep 17 00:00:00 2001 From: Gabriel Valcazar Date: Wed, 9 Dec 2020 16:58:16 +0100 Subject: [PATCH] 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 --- .../digi-webkit-examples/webglsamples_git.bb | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 meta-digi-dey/dynamic-layers/webkit/recipes-browser/digi-webkit-examples/webglsamples_git.bb diff --git a/meta-digi-dey/dynamic-layers/webkit/recipes-browser/digi-webkit-examples/webglsamples_git.bb b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/digi-webkit-examples/webglsamples_git.bb new file mode 100644 index 000000000..6ed09f180 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/webkit/recipes-browser/digi-webkit-examples/webglsamples_git.bb @@ -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}"