Initial AD port

This commit is contained in:
2021-04-26 18:26:42 +01:00
parent 6911ce346b
commit 7e7773258a
408 changed files with 17799 additions and 172 deletions

View File

@@ -0,0 +1,23 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [2.0.0](https://git.habd.as/comfusion/fractal-forest/compare/v1.0.0...v2.0.0) (2019-05-10)
### Build System
* **npm:** add conventional commit script ([9e2074c](https://git.habd.as/comfusion/fractal-forest/commit/9e2074c))
* **npm:** add release script ([980b402](https://git.habd.as/comfusion/fractal-forest/commit/980b402))
* **npm:** make after-dark optional dependency ([44931c1](https://git.habd.as/comfusion/fractal-forest/commit/44931c1))
* **npm:** upgrade standard-version dev dep ([47ff232](https://git.habd.as/comfusion/fractal-forest/commit/47ff232))
### Features
* add after-dark gpg signed release tags ([5e82940](https://git.habd.as/comfusion/fractal-forest/commit/5e82940))
<a name="1.0.0"></a>
# 1.0.0 (2018-07-25)

View File

@@ -0,0 +1,12 @@
Copyright (C) 2018, 2019 by Josh Habdas <jhabdas@protonmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,44 @@
# DOCKER-VERSION 17.12.0-ce, build c97c6d6
# Pull alpine base image
FROM alpine:latest AS codecbuilder
# Configure build settings
ENV LIBBPG_VERSION=0.9.8 \
CPU_CORES=1
# Fetch and extract bpg library
RUN cd /tmp && \
wget https://bellard.org/bpg/libbpg-${LIBBPG_VERSION}.tar.gz && \
mkdir -p /opt/libbpg && \
tar --strip-components=1 -xzf libbpg-${LIBBPG_VERSION}.tar.gz -C /opt/libbpg && \
rm -f libbpg-${LIBBPG_VERSION}.tar.gz
# Set current working directory
WORKDIR /opt/libbpg
# Set bpg build options
ENV USE_EMCC=y \
USE_JCTVC=y \
USE_X265=
# Install packages required to build codecs
RUN apk add --update --no-cache \
build-base cmake libpng-dev libjpeg-turbo-dev \
sdl-dev sdl_image-dev yasm && \
echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk add --no-cache emscripten
# Compile codecs in intermediate container
RUN make -j ${CPU_CORES} && make install
# Generate js file integrity hashes
RUN apk add --update --no-cache openssl
COPY ./bin/generate-hashes.sh .
RUN chmod +x generate-hashes.sh && ./generate-hashes.sh
# Move codecs and hashes into busybox container
FROM busybox AS codecs
COPY --from=codecbuilder /usr/local/bin/bpg* /usr/local/bin/
COPY --from=codecbuilder /opt/libbpg/bpg*.js* /var/www/
WORKDIR /usr/local/bin

View File

@@ -0,0 +1,94 @@
# Fractal Forest
> Better Portable Graphics module for [After Dark]. Fractal Forest adds support for Fabrice Bellard's [BPG Image format](https://bellard.org/bpg/).
[![Latest NPM version](https://img.shields.io/npm/v/fractal-forest.svg?style=flat-square)](https://www.npmjs.com/package/fractal-forest)
[![NPM downloads per month](https://img.shields.io/npm/dm/fractal-forest.svg?style=flat-square)](https://www.npmjs.com/package/fractal-forest)
[![Minimum After Dark version](https://img.shields.io/badge/dynamic/json.svg?url=https://git.habd.as/comfusion/fractal-forest/raw/branch/master/package.json&label=after%20dark&query=$..['after-dark']&colorB=000000&style=flat-square&longCache=false&maxAge=86400)](https://git.habd.as/comfusion/after-dark/)
[![0BSD licensed](https://img.shields.io/npm/l/fractal-forest.svg?style=flat-square&longCache=true)](https://git.habd.as/comfusion/fractal-forest/src/branch/master/COPYING)
## Setup
None required.
## Installation
1. Copy the contents of this repository into a directory called `themes/fractal-forest` under the root of your After Dark site.
2. Add `fractal-forest` as a [theme component](https://gohugo.io/themes/theme-components/) to your After Dark site `config.toml`, e.g.
```toml
theme = [
"fractal-forest",
"after-dark"
]
```
3. Add and specify settings for the module in your After Dark site config, e.g.
```toml
[params.modules.fractal_forest]
enabled = true # Optional, set false to disable module
decoders = [
"bpgdec8", # 8-bit only javascript decoder without animation
"bpgdec", # > 8-bit javascript decoder without animation
"bpgdec8a" # 8-bit javascript decoder with animation
]
crossorigin = "anonymous" # Optional, sets CORS attribute
```
4. Build and deploy your After Dark site.
For additional information please see [BPG Image format](https://bellard.org/bpg/).
## Development
For development, install Docker on your machine:
- [Get started with Docker for Mac](https://docs.docker.com/docker-for-mac/)
- [Get started with Docker for Windows](https://docs.docker.com/docker-for-windows/)
Then build the codecs with [`docker build`](https://docs.docker.com/engine/reference/commandline/build/).
To adjust the version of bpg used simply modify `LIBBPG_VERSION` in the `Dockerfile` for desired version and rebuild. If you're on a multicore system adjust `CPU_CORES` to decrease compilation time.
Docker build produces an intermediate container image with libbpg source and result of compilation. It also copyies the codecs into a busybox image.
To access the full `libbpg` source run:
```sh
$ docker run -it 30c982469f98
```
Where `30c982469f98` is the image id of the intermediate step.
To access just the codecs run:
```sh
$ docker run -it 712e9ce47e86
```
Where `712e9ce47e86` is the image id of the final build step.
To update the javascript decoders in `static/js/bpg` run:
```
$ docker run --rm --entrypoint tar 712e9ce47e86 cC /var/www/ . | tar xvC static/js
```
Where `712e9ce47e86` is the image id of the final build step.
Reference the [`libbpg` mirror](https://git.habd.as/jhabdas/libbpg/) for additional compilation settings, `README` and `Makefile`. See the [Docker Documentation](https://docs.docker.com) for help with Docker.
## Contributing
Please squash commits and use [Convention Commit](https://www.conventionalcommits.org/) messages. Run `npm run commit` after installing NPM dev dependencies for help creating conventional commit messages.
## Rights
Copyright (C) 2018, 2019 by Josh Habdas <jhabdas@protonmail.com>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
The text of the above license is included in the file COPYING in the source.
[After Dark]: https://git.habd.as/comfusion/after-dark/

View File

@@ -0,0 +1,9 @@
{{ $crossorigin := .crossorigin }}
{{ if ne .enabled false }}
<meta title="mod:fractal-forest" content="status:enabled">
{{ range .decoders }}
<script async src={{ printf "/js/%s.js" . | relURL }} integrity={{ printf "sha384-%s" (readFile (printf "themes/fractal-forest/static/js/%s.js.sha384" .)) }}{{ with $crossorigin }} crossorigin={{ . }}{{ end }}></script>
{{ end }}
{{ else }}
<meta title="mod:fractal-forest" content="status:disabled">
{{ end }}

View File

@@ -0,0 +1,42 @@
{
"name": "fractal-forest",
"version": "2.0.0",
"description": "Better Portable Graphics module for After Dark.",
"author": "Josh Habdas <jhabdas@protonmail.com>",
"homepage": "https://after-dark.habd.as/module/fractal-forest/",
"standard-version": {
"scripts": {
"posttag": "git tag --sign $(git describe --tags $(git rev-list --tags --max-count=1)) $(git describe --tags $(git rev-list --tags --max-count=1))^{} -f -m \"$(git log -1 --pretty=%B)\" -m \"-----BEGIN DIST INTEGRITY-----\" -m \"$(npm pack --dry-run --json . | grep integrity | cut -d ',' -f1 | cut -d ':' -f2 | tr -d '\" ')\" -m \"-----END DIST INTEGRITY-----\""
}
},
"scripts": {
"test": "while true; do head -n 100 /dev/urandom; sleep 0.1; done | hexdump -C | grep 'ca fe'",
"release": "standard-version",
"commit": "npx git-cz"
},
"repository": {
"type": "git",
"url": "https://git.habd.as/comfusion/fractal-forest.git"
},
"keywords": [
"docker",
"hugo",
"wasm",
"bpg",
"asmjs"
],
"devDependencies": {
"commitizen": "^3.1.1",
"cz-conventional-changelog": "^2.1.0",
"standard-version": "^6.0.1"
},
"peerDependencies": {
"after-dark": ">= 5.1.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"license": "0BSD"
}

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
WjNxxN+t6/zyZRw8QQPGVYHSU1N3kcbNWWkGQRigK1zD12fGnNwIJpM7RmYEDOzK

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
3CqYbTw/dZv6ybsLOIogCZfTfFFvzYJQZfDBWUuXQyunCKxoE4rXbJLZSpjZa9gA

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
8PG0go3BW8hLm63KbTxk/hNcehaoSbrAhKzsmy2Jhs/KY8QdiKKkjhdeyHY/Q/0I