From f9449af87a4f5420aa7683d3f15110bfa2f1bf17 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 29 Oct 2022 18:22:35 +0100 Subject: kaios: Major parts of a build for KaiOS KaiOS (which is based on Firefox OS, formerly Boot to Gecko) runs its "native" apps in a Web browser, so this is essentially a rather specialised version of the JavaScript front-end. Indeed, the JavaScript and C parts are the same as the Web version. There are three major parts that are specific to the KaiOS build. First, there's manifest.pl, which generates a KaiOS-specific JSON manifest describing each puzzle. Second, there's a new HTML page generator, apppage.pl, that generates an HTML page that is much less like a Web page, and much more like an application, than the one generated by jspage.pl. It expects to build a single HTML page at a time and gets all its limited knowledge of the environment from its command line. This makes it gratuitously different from jspage.pl and javapage.pl, but makes it easier to run from the build system. And finally, there's the CMake glue that assembles the necessary parts for each application in a directory. This includes the manifest, the HTML, the JavaScript, the KaiOS-specific icons (generated as part of the GTK build) and a copy of the HTML documentation. The directory is assembled using CMake's install() function, and can be installed on a KaiOS device using the developer tools. --- kaios/apppage.pl | 337 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ kaios/manifest.pl | 36 ++++++ 2 files changed, 373 insertions(+) create mode 100755 kaios/apppage.pl create mode 100755 kaios/manifest.pl (limited to 'kaios') diff --git a/kaios/apppage.pl b/kaios/apppage.pl new file mode 100755 index 0000000..ecdffbc --- /dev/null +++ b/kaios/apppage.pl @@ -0,0 +1,337 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +@ARGV == 2 or die "usage: apppage.pl "; +my ($name, $displayname) = @ARGV; + +print < + + + + +${displayname} + + + + + + +
+
+ + +
+
+
+
Menu
+
+
+
    +
  • Game
      +
    • +
    • +
    • +
    • +
  • +
  • Type
    • +
    • +
    • +
    • +
    • +
    • +
    • +
    • + Instructions +
    • +
    • + Full manual +
    • +
    +
    +
    Select
    +
    Dismiss
    +
    +
    + + +EOF diff --git a/kaios/manifest.pl b/kaios/manifest.pl new file mode 100755 index 0000000..36fc195 --- /dev/null +++ b/kaios/manifest.pl @@ -0,0 +1,36 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use JSON::PP; + +@ARGV == 4 or + die "usage: manifest.pl "; +my ($name, $displayname, $description, $objective) = @ARGV; + +# Limits from +# https://developer.kaiostech.com/docs/getting-started/main-concepts/manifest +length($displayname) <= 20 or die "Name too long: $displayname"; +length($description) <= 40 or die "Subtitle too long: $description"; +$objective .= " Part of Simon Tatham's Portable Puzzle Collection."; +# https://developer.kaiostech.com/docs/distribution/submission-guideline +length($objective) <= 220 or die "Description too long: $objective"; + +print encode_json({ + name => $displayname, + subtitle => $description, + description => $objective, + launch_path => "/${name}.html", + icons => { + "56" => "/${name}-56kai.png", + "112" => "/${name}-112kai.png", + }, + developer => { + name => "Ben Harris", + url => "https://bjh21.me.uk", + }, + default_locale => "en-GB", + categories => ["games"], + cursor => JSON::PP::false, +}) -- cgit v1.1