From 910732e02cebee65be3b59b7d50ac128ba04e8f6 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 19 Jun 2021 16:20:35 +0200 Subject: [PATCH] update build notes --- README.md | 41 +++++++++++++++++++++++++++++----- scripts/deps-docker/Dockerfile | 18 +++++++++------ 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 43423133..6da0721b 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,10 @@ turn your phone or raspi into a portable file server with resumable uploads/down * [sfx](#sfx) * [sfx repack](#sfx-repack) * [install on android](#install-on-android) -* [dev env setup](#dev-env-setup) -* [how to release](#how-to-release) +* [building](#building) + * [dev env setup](#dev-env-setup) + * [just the sfx](#just-the-sfx) + * [complete release](#complete-release) * [todo](#todo) @@ -532,18 +534,45 @@ echo $? after the initial setup, you can launch copyparty at any time by running `copyparty` anywhere in Termux -# dev env setup +# building + +## dev env setup + +mostly optional; if you need a working env for vscode or similar ```sh python3 -m venv .venv . .venv/bin/activate -pip install jinja2 # mandatory deps -pip install Pillow # thumbnail deps +pip install jinja2 # mandatory +pip install mutagen # audio metadata +pip install Pillow pyheif-pillow-opener pillow-avif-plugin # thumbnails pip install black bandit pylint flake8 # vscode tooling ``` -# how to release +## just the sfx + +unless you need to modify something in the web-dependencies, it's faster to grab those from a previous release: + +```sh +rm -rf copyparty/web/deps +curl -L https://github.com/9001/copyparty/releases/latest/download/copyparty-sfx.py >x.py +python3 x.py -h +rm x.py +mv /tmp/pe-copyparty/copyparty/web/deps/ copyparty/web/ +``` + +then build the sfx using any of the following examples: + +```sh +./scripts/make-sfx.sh # both python and sh editions +./scripts/make-sfx.sh no-sh gz # just python with gzip +``` + + +## complete release + +also builds the sfx so disregard the sfx section above in the `scripts` folder: diff --git a/scripts/deps-docker/Dockerfile b/scripts/deps-docker/Dockerfile index dbaeb715..29156555 100644 --- a/scripts/deps-docker/Dockerfile +++ b/scripts/deps-docker/Dockerfile @@ -1,6 +1,7 @@ FROM alpine:3.13 WORKDIR /z ENV ver_asmcrypto=5b994303a9d3e27e0915f72a10b6c2c51535a4dc \ + ver_hashwasm=4.7.0 \ ver_marked=1.1.0 \ ver_ogvjs=1.8.0 \ ver_mde=2.14.0 \ @@ -9,12 +10,6 @@ ENV ver_asmcrypto=5b994303a9d3e27e0915f72a10b6c2c51535a4dc \ ver_zopfli=1.0.3 -# TODO -# sha512.hw.js https://github.com/Daninet/hash-wasm -# sha512.kc.js https://github.com/chm-diederichs/sha3-wasm -# awk '/HMAC state/{o=1} /var HEAP/{o=0} /function hmac_reset/{o=1} /return \{/{o=0} /var __extends =/{o=1} /var Hash =/{o=0} /hmac_|pbkdf2_/{next} o{next} {gsub(/IllegalStateError/,"Exception")} {sub(/^ +/,"");sub(/^\/\/ .*/,"");sub(/;$/," ;")} 1' sha512.ac.js; for fn in sha512.ac.js.orig sha512.ac.js; do wc -c <$fn; wc -c <$fn.gz ; for n in {1..9}; do printf '%8d %d bz\n' $(bzip2 -c$n <$fn | wc -c) $n; done; done - - # download; # the scp url is latin from https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap RUN mkdir -p /z/dist/no-pk \ @@ -27,7 +22,11 @@ RUN mkdir -p /z/dist/no-pk \ && wget https://github.com/codemirror/CodeMirror/archive/$ver_codemirror.tar.gz -O codemirror.tgz \ && wget https://github.com/FortAwesome/Font-Awesome/releases/download/$ver_fontawesome/fontawesome-free-$ver_fontawesome-web.zip -O fontawesome.zip \ && wget https://github.com/google/zopfli/archive/zopfli-$ver_zopfli.tar.gz -O zopfli.tgz \ + && wget https://github.com/Daninet/hash-wasm/releases/download/v$ver_hashwasm/hash-wasm@$ver_hashwasm.zip -O hash-wasm.zip \ && unzip ogvjs.zip \ + && (mkdir hash-wasm \ + && cd hash-wasm \ + && unzip ../hash-wasm.zip) \ && (tar -xf asmcrypto.tgz \ && cd asmcrypto.js-$ver_asmcrypto \ && npm install ) \ @@ -64,7 +63,12 @@ RUN tar -xf zopfli.tgz \ RUN cd asmcrypto.js-$ver_asmcrypto \ && echo "export { Sha512 } from './hash/sha512/sha512';" > src/entry-export_all.ts \ && node -r esm build.js \ - && mv asmcrypto.all.es5.js /z/dist/sha512.js + && awk '/HMAC state/{o=1} /var HEAP/{o=0} /function hmac_reset/{o=1} /return \{/{o=0} /var __extends =/{o=1} /var Hash =/{o=0} /hmac_|pbkdf2_/{next} o{next} {gsub(/IllegalStateError/,"Exception")} {sub(/^ +/,"");sub(/^\/\/ .*/,"");sub(/;$/," ;")} 1' < asmcrypto.all.es5.js > /z/dist/sha512.ac.js + + +# build hash-wasm +RUN cd hash-wasm \ + && mv sha512.umd.min.js /z/dist/sha512.hw.js # build ogvjs