summaryrefslogtreecommitdiff
path: root/confninja.sh
diff options
context:
space:
mode:
Diffstat (limited to 'confninja.sh')
-rw-r--r--confninja.sh109
1 files changed, 109 insertions, 0 deletions
diff --git a/confninja.sh b/confninja.sh
new file mode 100644
index 0000000..f1507a0
--- /dev/null
+++ b/confninja.sh
@@ -0,0 +1,109 @@
+set -eu
+
+cat <<'END'
+# File generated by confninja.sh; DO NOT EDIT!
+
+ninja_required_version = 1.11
+
+rule cargo
+ command = cd $extractrs_dir && cargo build $rust_mode && cp $rs_bin ../bin
+ description = CARGO $out
+
+rule scss
+ command = sass --load-path=node_modules/ $scss_mode $in $out
+ description = SCSS $out
+
+rule bundle
+ command = esbuild --bundle $bundle_mode --outfile=$out $in
+ description = BUNDLE $out
+
+rule dist
+ command = tar --posix --zstd -cf $out $in
+ description = DIST $out
+
+rule cpy
+ command = cp $in $out
+ description = CPY $out
+
+rule perltest
+ command = prove -l t/
+ description = PERLTEST
+
+rule configure
+ command = ./configure $confargs
+ description = CONFIGURE
+ generator = 1
+
+build test: perltest
+END
+
+echo "confargs = $CONFARGS"
+echo "build build.ninja lib/JWebmail/Config.pm: configure configure confninja.sh lib/JWebmail/Config.pm.in MANIFEST"
+
+case "$JWM_MODE" in
+ (development)
+ echo 'bundle_mode = --sourcemap'
+ echo 'rs_bin = target/debug/jwebmail-extract'
+ ;;
+ (production)
+ echo 'bundle_mode = --minify'
+ echo 'sass_mode = --style=compress --no-source-maps'
+ echo 'rust_mode = --release --target x86_64-unknown-linux-musl'
+ echo 'rs_bin = target/x86_64-unknown-linux-musl/release/jwebmail-extract'
+ ;;
+esac
+
+case "$MAILDIR_EXTRACTOR_NAME" in
+ (extractrs)
+ echo "extractrs_dir = $JWM_EXTRACTRS_DIR"
+ printf '%s' 'build bin/jwebmail-extract: cargo'
+ FILES_RS='arguments.rs cmd.rs error.rs main.rs rfc822.rs cmd/count.rs cmd/folders.rs cmd/list.rs cmd/raw.rs'
+ for f in $FILES_RS
+ do
+ printf '%s' " \$extractrs_dir/src/$f"
+ done
+ echo
+ ;;
+esac
+
+FILES_JS='src/displayheaders.js src/login_cram.js src/rendermail.js'
+for f in $FILES_JS
+do case "$JWM_MODE" in
+ (development) echo "build public/$f | public/$f.map: bundle $f";;
+ (production) echo "build public/$f: bundle $f";;
+esac
+done
+
+FILES_CSS='my_bulma'
+for f in $FILES_CSS
+do case "$JWM_MODE" in
+ (development) echo "build public/css/$f.css | public/css/$f.css.map: scss scss/$f.scss";;
+ (production) echo "build public/css/$f.css: scss scss/$f.scss";;
+esac
+done
+
+while read f
+do [ -n "$f" ] && echo "build JWebmail-srcdist/$f: cpy $f"
+done <MANIFEST
+
+printf '%s' "build JWebmail-srcdist.tar.zstd: dist"
+while read f
+do [ -n "$f" ] && printf '%s' " JWebmail-srcdist/$f"
+done <MANIFEST
+echo
+
+#if [ "$JWM_MODE" = production ]
+#then for f in
+#do echo "build JWebmail-bindist/$f: cp $f"
+#done
+#fi
+
+while read f
+do [ -n "$f" ] && echo "build JWebmail-bindist/$f: cpy $f"
+done <MANIFEST.BIN
+
+printf '%s' "build JWebmail-bindist.tar.zstd: dist"
+while read f
+do [ -n "$f" ] && printf '%s' " JWebmail-bindist/$f"
+done <MANIFEST.BIN
+echo