merge install path fix, module precompilation and org9 compat
7 files changed, 79 insertions(+), 44 deletions(-)

M AUTHORS => AUTHORS.in
M Makefile.am
M NEWS
M README.md
M configure.ac
M examples/downloadmesh.w
M ob-wisp.el
M AUTHORS => AUTHORS.in +2 -1
@@ 14,4 14,5 @@ NalaGinrut:
     "Mu Lei" known as "NalaGinrut" <NalaGinrut@gmail.com>: http://savannah.gnu.org/users/nalaginrut
 
 Mark Weaver:
-    Mark H. Weaver: http://savannah.gnu.org/users/mhw
  No newline at end of file
+    Mark H. Weaver: http://savannah.gnu.org/users/mhw
+

          
M Makefile.am +54 -38
@@ 1,36 1,50 @@ 
+# usage: make help
+
+# automake: explicitly set the supported suffixes
 SUFFIXES = .w .scm .sh
 
+# define the programs to install
 bin_SCRIPTS = wisp2lisp
 
-sitedir = $(datarootdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site
-site_DATA = wisp.scm
+# where to install guile modules to import
+# nobase_ as prefix prevents stripping leading directories
+# see https://www.gnu.org/software/automake/manual/html_node/Alternative.html#index-nobase_005f
+sitedir = $(datarootdir)/guile/site/$(GUILE_EFFECTIVE_VERSION)
+nobase_site_DATA = language/wisp.scm language/wisp/spec.scm
 
-langdir = $(datarootdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site/language
-lang_DATA = language/wisp.scm
-
-langwispdir = $(datarootdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site/language/wisp
-langwisp_DATA = language/wisp/spec.scm
+GOBJECTS = $(nobase_site_DATA:%.scm=%.go)
+nobase_go_DATA = $(GOBJECTS)
+godir=$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache
 
 WISP = wisp-guile.w wisp-reader.w wisp-scheme.w
 
-EXTRA_DIST = $(WISP) bootstrap.sh bootstrap-reader.sh language examples tests wisp-repl-guile.sh testrunner.w wisp.py wisp.scm m4 ob-wisp.el wisp-mode.el
-CLEANFILES = 1 2
-DISTCLEANFILES = $(bin_SCRIPTS) $(site_DATA) $(lang_DATA) $(langwisp_DATA)
+# Make sure source files are installed first, so that the mtime of
+# installed compiled files is greater than that of installed source
+# files.  See
+# <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
+# for details. The missing underscore before DATA is intentional.
+guile_install_go_files = install-nobase_goDATA
+$(guile_install_go_files): install-nobase_siteDATA
+
+EXTRA_DIST = $(WISP) bootstrap.sh bootstrap-reader.sh language examples tests wisp-repl-guile.sh testrunner.w wisp.py wisp.scm m4 ob-wisp.el wisp-mode.el AUTHORS.in
+CLEANFILES = 1 2 $(GOBJECTS)
+DISTCLEANFILES = $(bin_SCRIPTS) $(nobase_site_DATA)
 # don't spout out lots of stuff at each distcheck. Disable for debugging.
 AM_DISTCHECK_CONFIGURE_FLAGS="--quiet"
 
-ChangeLog :
-	hg log --style changelog > ChangeLog
+# precompile all scheme files
+.scm.go:
+	$(GUILE_TOOLS) compile $(GUILE_WARNINGS) -o "$@" "$<"
 
-$(bin_SCRIPTS): wisp.scm
+wisp2lisp: wisp.scm ## build only the wisp2lisp converter
 	cp $< $@
 
 .INTERMEDIATE: .mydatastuff
-$(lang_DATA) $(langwisp_DATA): .wispbootstrap
+$(nobase_site_DATA): .wispbootstrap
 .wispbootstrap : ${WISP} wisp.scm
 	@abs_top_srcdir@/bootstrap-reader.sh @abs_top_srcdir@ @abs_top_builddir@ @GUILE@ wisp.scm 2>&1 | sed "s/^;;;.*//" 2>&1 | grep . 1>&2 ; test ! $$? -eq 0 # it worked if grep does not find anything
 
-wisp.scm: wisp-guile.w wisp.py
+wisp.scm: wisp-guile.w wisp.py ## run the full bootstrap from Python (use make -B to rebuild)
 	@abs_top_srcdir@/bootstrap.sh @abs_top_srcdir@ @GUILE@ @python3@ 2>&1 | sed "s/^;;;.*//" 2>&1 | grep . 1>&2 ; test ! $$? -eq 0 # it worked if grep does not find anything
 	chmod +x $@
 

          
@@ 48,27 62,29 @@ syntaxtestsreader.sh : ${WISP} wisp.scm 
 
 TESTS=syntaxtests.sh syntaxtestsreader.sh
 
-# The installchecks won't work in a "make distcheck", because
-# they won't be installed in the final location used by the tools.
-# FIXME: automake should honor DESTDIR set by make distcheck
-if IS_MAKE_DISTCHECK
-install-binSCRIPTS:
-	echo "Running 'make distcheck'; local installchecks disabled."
-install-siteDATA:
-	echo "Running 'make distcheck'; local installchecks disabled."
-install-langDATA:
-	echo "Running 'make distcheck'; local installchecks disabled."
-install-langwispDATA:
-	echo "Running 'make distcheck'; local installchecks disabled."
-uninstall-binSCRIPTS:
-	echo "Running 'make distcheck'; local installchecks disabled."
-uninstall-siteDATA:
-	echo "Running 'make distcheck'; local installchecks disabled."
-uninstall-langDATA:
-	echo "Running 'make distcheck'; local installchecks disabled."
-uninstall-langwispDATA:
-	echo "Running 'make distcheck'; local installchecks disabled."
-else !IS_MAKE_DISTCHECK
-endif !IS_MAKE_DISTCHECK
+ACLOCAL_AMFLAGS = -I m4
 
-ACLOCAL_AMFLAGS = -I m4
+.PHONY: help
+help: ## Show this help message.
+	@echo 'Usage:'
+	@echo ':make [target] ...' | sed "s/\(target\)/\\x1b[36m\1\\x1b[m/" | column -c2 -t -s :
+	@echo
+	@echo 'make without target bootstraps and prepares wisp'
+	@echo
+	@echo 'Custom targets:'
+	@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/:\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
+	@echo
+	@echo '(see ./configure --help for setup options)'
+
+
+# create basic files for the tarballl
+.SECONDARY: ChangeLog AUTHORS
+ChangeLog: ## create the ChangeLog from the history
+	echo "For user-visible changes, see the NEWS file" > "$@"
+	echo >> "$@"
+	if test -d "@abs_top_srcdir@/.git"; then cd @abs_top_srcdir@; git log --date-order --date=short | sed -e '/^commit.*$/d' | awk '/^Author/ {sub(/\\$/,""); getline t; print $0 t; next}; 1' | sed -e 's/^Author: //g' | sed -e 's/\(.*\)>Date:   \([0-9]*-[0-9]*-[0-9]*\)/\2  \1>/g' | sed -e 's/^\(.*\) \(\)\t\(.*\)/\3    \1    \2/g' >> "$@"; cd -; fi
+	if test -d "@abs_top_srcdir@/.hg"; then hg -R "@abs_top_srcdir@" log --style changelog >> "$@"; fi
+AUTHORS: AUTHORS.in ## create the AUTHORS file from the history and AUTHORS.in
+	cp "$<" "$@"
+	if test -d "@abs_top_srcdir@/.git"; then cd "@abs_top_srcdir@"; git log --format='%aN' | sort -u >> "$@"; cd -; fi
+	if test -d "@abs_top_srcdir@/.hg"; then hg -R "@abs_top_srcdir@" --config extensions.churn= churn -t "{author}" >> "$@"; fi

          
M NEWS +7 -0
@@ 1,3 1,10 @@ 
+wisp 1.0.1
+- fix install directory, thanks to James-Adam Renquinha Henri and Ludovic Courtès who both
+  discovered a mistake in the paths: correct module path is /usr/share/guile/site/<version>/…,
+  but I used /usr/share/guile/<version>/site
+- simplify install logic and pre-compile installed modules.
+- add beautiful make help
+
 wisp 1.0:
 - add FOSDEM 2019 slides: docs/fosdem2019.org
 - As presented at FOSDEM, wisp the language is complete.

          
M README.md +11 -2
@@ 48,7 48,16 @@ From a release:
 * Get a release from [bitbucket.org/ArneBab/wisp/downloads/](https://bitbucket.org/ArneBab/wisp/downloads/)
 * Unpack and build: `tar xf [release].tar.gz; cd [release]; ./configure; make`
 
-Install systemwide with `./configure --datarootdir=/usr/share && sudo make install`, then you can run `guile --language=wisp` anywhere. Install in your home folder with `./configure --datarootdir=$HOME/.local; make install`. Use `guile -c '(import (language wisp spec))'` to get rid of auto-compile errors.
+### Install
+
+Install systemwide with `./configure --datarootdir=/usr/share && sudo make install`, then you can run `guile --language=wisp` anywhere. 
+
+Install in your home folder with `./configure --datarootdir=$HOME/.local; make install`. Use `guile -c '(import (language wisp spec))'` to get rid of auto-compile errors. You might need to set the module paths in ~/.bash_profile:
+
+    export GUILE_LOAD_COMPILED_PATH=${HOME}/.local/lib/guile/2.2/site-ccache{GUILE_LOAD_COMPILED_PATH:+:}${GUILE_LOAD_COMPILED_PATH}
+    export GUILE_LOAD_PATH=${HOME}/.local/share/guile/site/2.2/${GUILE_LOAD_PATH:+:}${GUILE_LOAD_PATH}
+
+### More
 
 Run tests with `make check`. Distribute your own version with `make distcheck`.
 

          
@@ 59,7 68,7 @@ The same might apply for Guile in /usr/l
 Usage
 -----
 
-* Preprocess files: `guile ./wisp.scm infile.wisp > outfile.scm`
+* Preprocess files: `./wisp2lisp infile.wisp > outfile.scm`
 * Wisp at the REPL: `guile -L . --language=wisp # in the wisp-folder`
 * The files in examples/ show how to make executable wisp programs.
 

          
M configure.ac +1 -1
@@ 1,7 1,7 @@ 
 dnl run `autoreconf -i` to generate a configure script. 
 dnl Then run ./configure to generate a Makefile.
 dnl Finally run make to generate the project.
-AC_INIT([wisp], [1.0],
+AC_INIT([wisp], [1.0.1],
         [arne_bab@web.de])
 # Add macros in m4/ to ensure that wisp builds without having Guile in the aclocal path
 AC_CONFIG_MACRO_DIR([m4])

          
M examples/downloadmesh.w +3 -1
@@ 21,7 21,7 @@ exec -a "$0" guile -L $(dirname $(dirnam
 ;; - Implement X-NAlt
 ;; - Add a parity block of 5% of the file (assuming 20 clients)
 
-;; [1] things you only know when you where there when they were built: 
+;; [1] things you only know when you where there when they were built:
 ;;     https://sourceforge.net/projects/bitcollider/
 
 ;; Download mesh specification:

          
@@ 31,6 31,7 @@ exec -a "$0" guile -L $(dirname $(dirnam
 ;; TigerTreeHash to allow for verifying individual chunks.
 ;; bitprint-urn: http://www.nuke24.net/docs/2015/HashURNs.html
 ;; https://web.archive.org/web/20091203212059/http://open-content.net/specs/draft-jchapweske-thex-02.html
+;; http://rfc-gnutella.sourceforge.net/src/Partial_File_Sharing_Protocol_1.0.txt
 
 define-module : examples downloadmesh
               . #:export : main serve download-file

          
@@ 156,6 157,7 @@ define : resolve-urn urn
 define : resolve-path path
     ;; URN: https://www.ietf.org/rfc/rfc2169.txt
     ;; extended to simplify my parsing: http://www.nuke24.net/docs/2015/HashURNs.html
+    ;; example: uri-res/urn:sha256:
     define uri-res-prefix "uri-res/raw/"
     pretty-print path
     vhash-fold (λ(key value result) (pretty-print key)(pretty-print value)) #f served-paths

          
M ob-wisp.el +1 -1
@@ 125,7 125,7 @@ VARS contains resolved variable referenc
      (format "define %s %s"
 	     (car pair)
 	     (org-babel-wisp-var-to-wisp (cdr pair))))
-   (mapcar #'cdr (org-babel-get-header params :var))))
+   (org-babel--get-vars params)))
 
 (defun org-babel-wisp-var-to-wisp (var)
   "Convert an elisp value to a wisp variable.