summaryrefslogtreecommitdiff
path: root/confninja.sh
diff options
context:
space:
mode:
Diffstat (limited to 'confninja.sh')
-rw-r--r--confninja.sh147
1 files changed, 129 insertions, 18 deletions
diff --git a/confninja.sh b/confninja.sh
index fc5fbcf..c5f8c1a 100644
--- a/confninja.sh
+++ b/confninja.sh
@@ -14,17 +14,25 @@ rule scss
description = SCSS $out
rule bundle
- command = esbuild --bundle $bundle_mode --outfile=$out $in
+ command = esbuild --log-level=warning --bundle $bundle_mode --outfile=$out $in
description = BUNDLE $out
rule dist
- command = tar --posix --zstd -cf $out $in
+ command = tar -a -cf $out $in
description = DIST $out
rule cpy
command = cp $in $out
description = CPY $out
+rule instexec
+ command = install -T $in $out
+ description = INSTEXEC $out
+
+rule instdata
+ command = install -m0644 -T $in $out
+ description = INSTDATA $out
+
rule perltest
command = prove -l t/
description = PERLTEST
@@ -37,8 +45,10 @@ rule configure
build test: perltest
END
+# CONFIGURE
+
echo "confargs = $CONFARGS"
-echo "build build.ninja lib/JWebmail/Config.pm MANIFEST.BIN: configure configure confninja.sh lib/JWebmail/Config.pm.in MANIFEST MANIFEST.BIN.m4"
+echo "build build.ninja lib/JWebmail/Config.pm: configure configure confninja.sh lib/JWebmail/Config.pm.in"
case "$JWM_MODE" in
(development)
@@ -53,10 +63,12 @@ case "$JWM_MODE" in
;;
esac
+# EXTRACTRS
+
case "$MAILDIR_EXTRACTOR_NAME" in
(extractrs)
echo "extractrs_dir = $JWM_EXTRACTRS_DIR"
- echo -n 'build bin/jwebmail-extract: cargo'
+ echo -n 'build bin/jwebmail-extract: cargo $extractrs_dir/Cargo.toml'
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
@@ -66,6 +78,8 @@ case "$MAILDIR_EXTRACTOR_NAME" in
;;
esac
+# PUBLIC
+
FILES_JS='src/displayheaders.js src/rendermail.js'
if [ "$LOGIN_SCHEME" = cram_md5 ]
then FILES_JS="$FILES_JS src/login_cram.js"
@@ -85,22 +99,119 @@ do case "$JWM_MODE" in
esac
done
-while read f
-do [ -n "$f" ] && echo "build JWebmail-srcdist/$f: cpy $f"
-done <MANIFEST
+# BINDIST
+
+#while read f
+#do [ -n "$f" ] && echo "build JWebmail-bindist/$f: cpy $f"
+#done <MANIFEST.BIN
+#
+#if command -v zstd >/dev/null
+#then echo -n "build JWebmail-bindist.tar.zstd: dist"
+#else echo -n "build JWebmail-bindist.tar.gz: dist"
+#fi
+#while read f
+#do [ -n "$f" ] && echo -n " JWebmail-bindist/$f"
+#done <MANIFEST.BIN
+#echo
+
+# INSTALL
+
+install_file () { echo "build \$destdir/\$$2/$4: $1 $3/$4"; ALL_INST="$ALL_INST \$destdir/\$$2/$4"; }
+
+echo "destdir = $DESTDIR"
+
+echo "prefix = $PREFIX"
+echo "bindir = \$prefix/bin"
+echo "scriptdir = \$prefix/bin"
+echo "perldir = \$prefix/lib/perl5"
+if [ "$PREFIX" = usr ]
+then echo "confdir = \$prefix/../etc"
+else echo "confdir = \$prefix/etc"
+fi
+echo "datadir = \$prefix/share/jwebmail"
+echo "docdir = \$prefix/share/doc/jwebmail"
-echo -n "build JWebmail-srcdist.tar.zstd: dist"
-while read f
-do [ -n "$f" ] && echo -n " JWebmail-srcdist/$f"
-done <MANIFEST
-echo
+ALL_INST=
+
+case "$MAILDIR_EXTRACTOR_NAME" in
+ (extractrs) install_file instexec bindir bin jwebmail-extract;;
+ (extractpy) install_file instexec scriptdir script qmauth.py;;
+ (extractpl) install_file instexec scriptdir script qmauth.pl;;
+esac
+
+install_file instexec scriptdir script jwebmail
+install_file instexec scriptdir script testauthenticator.pl
while read f
-do [ -n "$f" ] && echo "build JWebmail-bindist/$f: cpy $f"
-done <MANIFEST.BIN
+do
+ install_file instdata perldir lib "$f"
+done <<'END'
+JWebmail/Controller/Webmail.pm
+JWebmail/I18N/de.pm
+JWebmail/I18N/en.pm
+JWebmail/Model/ReadMails/QMailAuthuser.pm
+JWebmail/Model/ReadMails/Role.pm
+JWebmail/Model/WriteMails.pm
+JWebmail/Plugin/I18N2/INI.pm
+JWebmail/Plugin/I18N2/Maketext.pm
+JWebmail/Plugin/I18N2/Role.pm
+JWebmail/Plugin/I18N2.pm
+JWebmail/Plugin/INIConfig.pm
+JWebmail/Plugin/Paginate.pm
+JWebmail/Plugin/ServerSideSessionData.pm
+JWebmail/Plugin/TOMLConfig.pm
+JWebmail/View/RenderMail.pm
+JWebmail/View/Webmail.pm
+JWebmail/Config.pm
+JWebmail/I18N.pm
+JWebmail.pm
+END
+
+install_file instdata datadir . public/css/my_bulma.css
+[ "$JWM_MODE" = development ] && install_file instdata datadir . public/css/my_bulma.css.map
+install_file instdata datadir . public/src/displayheaders.js
+[ "$JWM_MODE" = development ] && install_file instdata datadir . public/src/displayheaders.js.map
+install_file instdata datadir . public/src/rendermail.js
+[ "$JWM_MODE" = development ] && install_file instdata datadir . public/src/rendermail.js.map
+
+if [ "$LOGIN_SCHEME" = cram_md5 ]
+then
+ install_file instdata datadir . public/src/login_cram.js
+ [ "$JWM_MODE" = development ] && install_file instdata datadir . public/src/login_cram.js.map
+fi
-echo -n "build JWebmail-bindist.tar.zstd: dist"
while read f
-do [ -n "$f" ] && echo -n " JWebmail-bindist/$f"
-done <MANIFEST.BIN
-echo
+do
+ install_file instdata datadir . "$f"
+done <<'END'
+templates/displayheaders/_bot_nav.html.ep
+templates/displayheaders/_folders.html.ep
+templates/displayheaders/_main_table.html.ep
+templates/displayheaders/_pagination1.html.ep
+templates/displayheaders/_pagination2.html.ep
+templates/displayheaders/_pagination3.html.ep
+templates/displayheaders/_top_nav.html.ep
+templates/layouts/mainlayout.html.ep
+templates/webmail/about.html.ep
+templates/webmail/displayheaders.html.ep
+templates/webmail/login.html.ep
+templates/webmail/readmail.html.ep
+templates/webmail/writemail.html.ep
+templates/exception_.html.ep
+templates/not_found.html.ep
+END
+
+install_file instdata confdir . jwebmail.development.toml
+install_file instdata confdir . jwebmail.production.toml
+
+for f in CHANGES.md LICENSE README.md
+do install_file instdata docdir . "$f"
+done
+
+if [ "$JWM_INIT" = systemd ]
+then
+ echo "build \$destdir/\$confdir/systemd/system/jwebmail.service: instdata jwebmail.service"
+ ALL_INST="$ALL_INST \$destdir/\$confdir/systemd/system/jwebmail.service"
+fi
+
+echo "build install: phony $ALL_INST"