aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-01-10 16:36:09 +0530
committerArun Isaac2022-01-10 23:32:22 +0530
commit670b0b68602288b44ad459230be4f701140bca66 (patch)
treef317e2b922da71e214109386d53d310d1a461414
parent51c12b7e58685b70e7cfd9612dac403cf9ee845c (diff)
downloadccwl-670b0b68602288b44ad459230be4f701140bca66.tar.gz
ccwl-670b0b68602288b44ad459230be4f701140bca66.tar.lz
ccwl-670b0b68602288b44ad459230be4f701140bca66.zip
Migrate to hand-written Makefiles.
The autotools are really overkill for a simple Guile project like ccwl. * .gitignore: Delete autotool generated files. Add Makefile.include. * Makefile.am, Makefile, build-aux/distcheck.scm, configure, configure.ac, configure.scm: New files. * NEWS: Rename to NEWS.org. Remove Emacs file-local variable to use org mode. * bootstrap.sh: Delete file. * build-aux/generate-cwl-output.sh.in: Rename to ... * build-aux/generate-cwl-output.sh: ... this. Replace autoconf variables for cwltool and sed. * build-aux/test-driver.scm.in: Rename to ... * build-aux/test-driver.scm: ... this. Do not import (ice-9 getopt-long). (%options): Delete variable. (my-gnu-runner): Do not write to log or trs ports. Accept test files as command-line arguments. Update invocation of my-gnu-runner. Print summary of results. * guix.scm (ccwl)[native-inputs]: Remove autoconf and automake. * pre-inst-env.in: Rename to ... * pre-inst-env: ... this. Replace autoconf variables for guile, abs_top_builddir and abs_top_srcdir. * scripts/ccwl.in: Rename to ... * scripts/ccwl: ... this. Replace autoconf variable for guile.
-rw-r--r--.gitignore19
-rw-r--r--Makefile165
-rw-r--r--Makefile.am234
-rw-r--r--NEWS.org (renamed from NEWS)1
-rw-r--r--build-aux/distcheck.scm76
-rwxr-xr-xbuild-aux/generate-cwl-output.sh (renamed from build-aux/generate-cwl-output.sh.in)8
-rw-r--r--build-aux/test-driver.scm (renamed from build-aux/test-driver.scm.in)66
-rwxr-xr-xconfigure (renamed from bootstrap.sh)13
-rw-r--r--configure.ac58
-rw-r--r--configure.scm159
-rw-r--r--guix.scm6
-rwxr-xr-x[-rw-r--r--]pre-inst-env (renamed from pre-inst-env.in)11
-rwxr-xr-xscripts/ccwl (renamed from scripts/ccwl.in)3
13 files changed, 448 insertions, 371 deletions
diff --git a/.gitignore b/.gitignore
index 6712254..3334a41 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,16 +1,6 @@
*.go
.depends
-Makefile
-Makefile.in
-aclocal.m4
-autom4te.cache
-build-aux/generate-cwl-output.sh
-build-aux/install-sh
-build-aux/missing
-build-aux/test-driver.scm
-config.log
-config.status
-configure
+Makefile.include
doc/*.cwl
!doc/echo.cwl
doc/*.dot
@@ -18,13 +8,6 @@ doc/*.html
doc/*.info
doc/*.out
doc/*.png
-doc/.dirstamp
doc/cwl-output
-doc/stamp-vti
-pre-inst-env
-scripts/ccwl
-test-suite.log
-tests/*.log
-tests/*.trs
website/index.html
website/manual \ No newline at end of file
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..02f9d26
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,165 @@
+# ccwl --- Concise Common Workflow Language
+# Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+#
+# This file is part of ccwl.
+#
+# ccwl is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ccwl is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ccwl. If not, see <https://www.gnu.org/licenses/>.
+
+include Makefile.include
+
+DOT = dot
+EMACS = emacs
+GIT = git
+GPG = gpg
+GUILD = guild
+GUILE = guile
+LZIP = lzip
+SKRIBILO = skribilo
+
+FIND_DEPENDENCIES = build-aux/find-dependencies.scm
+GENERATE_CWL_OUTPUT = build-aux/generate-cwl-output.sh
+TEST_DRIVER = build-aux/test-driver.scm
+
+top_level_module_dir = $(project)
+sources = $(wildcard $(top_level_module_dir)/*.scm)
+objects = $(sources:.scm=.go)
+scripts = $(wildcard scripts/*)
+tests = $(wildcard tests/*.scm)
+test_data = $(wildcard tests/*.cwl)
+doc_sources = doc/ccwl.skb
+doc_info = $(doc_sources:.skb=.info)
+doc_html = $(doc_sources:.skb=.html)
+doc_data = doc/hello.c.gz doc/hello.tar doc/hello.txt \
+ doc/spell-check-text.txt doc/dictionary
+distribute_files = $(sources) $(scripts) $(tests) $(test_data) \
+ $(doc_sources) doc/skribilo.scm $(doc_data) $(DOC_SCM) $(DOC_OTHER) \
+ pre-inst-env guix.scm Makefile configure configure.scm \
+ $(FIND_DEPENDENCIES) $(GENERATE_CWL_OUTPUT) $(TEST_DRIVER) \
+ COPYING NEWS.org README.org
+
+scmdir = $(datarootdir)/guile/site/$(guile_effective_version)/$(top_level_module_dir)
+godir = $(libdir)/guile/$(guile_effective_version)/site-ccache/$(top_level_module_dir)
+
+.PHONY: all check clean dist distcheck info install
+
+# Build
+
+all: $(objects)
+
+%.go: %.scm
+ $(GUILD) compile -L . -o $@ $<
+
+# Run tests
+
+check: $(tests) $(TEST_DRIVER)
+ $(GUILE) --no-auto-compile -L . $(TEST_DRIVER) $(tests)
+
+# Build documentation
+
+include .depends
+
+.depends: $(doc_sources) $(FIND_DEPENDENCIES)
+ $(GUILE) --no-auto-compile $(FIND_DEPENDENCIES) > $@
+
+info: $(doc_info)
+html: $(doc_html)
+
+doc:
+ mkdir -p $(dir $@)
+
+$(DOC_IMAGES:.png=.dot) $(DOC_OUT): | doc
+
+%.cwl: %.scm
+ ./pre-inst-env ccwl compile $< > $@
+
+doc/capture-output-file.out: doc/capture-output-file.cwl doc/hello.tar $(GENERATE_CWL_OUTPUT)
+ $(GENERATE_CWL_OUTPUT) $< --archive $(word 2, $^)
+
+doc/capture-output-file-with-parameter-reference.out: doc/capture-output-file-with-parameter-reference.cwl doc/hello.tar $(GENERATE_CWL_OUTPUT)
+ $(GENERATE_CWL_OUTPUT) $< --archive $(word 2, $^) --extractfile hello.txt
+
+doc/capture-stdout.out: doc/capture-stdout.cwl $(GENERATE_CWL_OUTPUT)
+ $(GENERATE_CWL_OUTPUT) $< --message '"Hello World!"'
+
+doc/checksum.out: doc/checksum.cwl doc/hello.txt $(GENERATE_CWL_OUTPUT)
+ $(GENERATE_CWL_OUTPUT) $< --file $(word 2, $^)
+
+doc/decompress-compile-run.out: doc/decompress-compile-run.cwl doc/hello.c.gz $(GENERATE_CWL_OUTPUT)
+ $(GENERATE_CWL_OUTPUT) $< --compressed-source $(word 2, $^)
+
+doc/hello-world.out: doc/hello-world.cwl $(GENERATE_CWL_OUTPUT)
+ $(GENERATE_CWL_OUTPUT) $< --message '"Hello World!"'
+
+doc/pass-stdin.out: doc/pass-stdin.cwl doc/hello.txt $(GENERATE_CWL_OUTPUT)
+ $(GENERATE_CWL_OUTPUT) $< --file $(word 2, $^)
+
+doc/spell-check.out: doc/spell-check.cwl doc/spell-check-text.txt doc/dictionary $(GENERATE_CWL_OUTPUT)
+ $(GENERATE_CWL_OUTPUT) $< --text-file $(word 2, $^) --dictionary $(word 3, $^)
+
+doc/hello.tar.out: doc/hello.tar
+ echo "$$ tar --list --file $(notdir $<)" > $@
+ tar --list --file $< >> $@
+
+%.dot: %.scm
+ ./pre-inst-env ccwl compile --to=dot $< > $@
+
+%.png: %.dot
+ $(DOT) -Tpng -o$@ $<
+
+$(doc_info): $(doc_sources) doc/skribilo.go $(DOC_IMAGES) $(DOC_SCM) $(DOC_OUT) $(DOC_OTHER)
+ ./pre-inst-env $(SKRIBILO) --target=info $< --output=$@
+
+$(doc_html): $(doc_sources) doc/skribilo.go $(DOC_IMAGES) $(DOC_SCM) $(DOC_OUT) $(DOC_OTHER)
+ rm -rf $@
+ mkdir -p $@
+ ./pre-inst-env $(SKRIBILO) --target=html $< --output=$@/index.html
+ cp -v $(DOC_IMAGES) $@
+
+# Install
+
+install: $(sources) $(objects) $(scripts) $(doc_info)
+ install -D $(sources) --target-directory $(scmdir)
+ install -D $(objects) --target-directory $(godir)
+ install -D $(scripts) --target-directory $(bindir)
+ install -D $(doc_info) --target-directory $(infodir)
+
+# Build distribution tarball
+
+dist_archive = $(project)-$(version).tar.lz
+
+dist: $(dist_archive) $(dist_archive).asc
+
+$(dist_archive): .git/refs/heads/main
+ $(GIT) archive --prefix $(basename $(basename $@))/ --format=tar main $(distribute_files) \
+ | $(LZIP) --force --output $@
+
+%.asc: %
+ $(GPG) --detach-sign --armor $<
+
+distcheck: $(dist_archive)
+ $(GUILE) build-aux/distcheck.scm $(version) $<
+
+# Build website
+
+website: website/index.html
+
+website/index.html: README.org build-aux/build-home-page.el
+ $(EMACS) -Q --batch --load build-aux/build-home-page.el --funcall build-website
+
+# Clean
+
+clean:
+ rm -f $(objects) $(dist_archive) $(dist_archive).asc Makefile.include website/index.html \
+ $(DOC_SCM:.scm=.cwl) $(DOC_IMAGES) $(DOC_IMAGES:.png=.dot) $(DOC_OUT) \
+ $(doc_html) $(doc_info) doc/skribilo.go
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 218ccc7..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,234 +0,0 @@
-# -*- indent-tabs-mode: t; -*-
-# ccwl --- Concise Common Workflow Language
-# Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
-#
-# This file is part of ccwl.
-#
-# ccwl is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# ccwl is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with ccwl. If not, see <https://www.gnu.org/licenses/>.
-
-# Prefix variables for silencing various commands. See "(automake)
-# Automake Silent Rules" for details.
-CCWL_GEN = $(CCWL_GEN_$(V))
-CCWL_GEN_ = $(CCWL_GEN_$(AM_DEFAULT_VERBOSITY))
-CCWL_GEN_0 = @echo " CCWL" $@;
-CCWL_GEN_1 =
-
-CWLTOOL_GEN = $(CWLTOOL_GEN_$(V))
-CWLTOOL_GEN_ = $(CWLTOOL_GEN_$(AM_DEFAULT_VERBOSITY))
-CWLTOOL_GEN_0 = @echo " CWLTOOL" $@;
-CWLTOOL_GEN_1 =
-
-DOT_GEN = $(DOT_GEN_$(V))
-DOT_GEN_ = $(DOT_GEN_$(AM_DEFAULT_VERBOSITY))
-DOT_GEN_0 = @echo " DOT" $@;
-DOT_GEN_1 =
-
-EMACS_GEN = $(EMACS_GEN_$(V))
-EMACS_GEN_ = $(EMACS_GEN_$(AM_DEFAULT_VERBOSITY))
-EMACS_GEN_0 = @echo " EMACS" $@;
-EMACS_GEN_1 =
-
-GUILD_GEN = $(GUILD_GEN_$(V))
-GUILD_GEN_ = $(GUILD_GEN_$(AM_DEFAULT_VERBOSITY))
-GUILD_GEN_0 = @echo " GUILD" $@;
-GUILD_GEN_1 =
-
-SKRIBILO_GEN = $(SKRIBILO_GEN_$(V))
-SKRIBILO_GEN_ = $(SKRIBILO_GEN_$(AM_DEFAULT_VERBOSITY))
-SKRIBILO_GEN_0 = @echo " SKRIBILO" $@;
-SKRIBILO_GEN_1 =
-
-GOBJECTS = $(SOURCES:%.scm=%.go)
-
-nobase_mod_DATA = $(SOURCES) $(NOCOMP_SOURCES)
-nobase_go_DATA = $(GOBJECTS)
-
-# 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.
-guile_install_go_files = install-nobase_goDATA
-$(guile_install_go_files): install-nobase_modDATA
-
-CLEANFILES = $(GOBJECTS)
-EXTRA_DIST = $(SOURCES) $(NOCOMP_SOURCES)
-GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat
-%.go: %.scm
- $(GUILD_GEN)$(builddir)/pre-inst-env $(GUILD) compile $(GUILE_WARNINGS) -o "$@" "$<"
-
-moddir = $(prefix)/share/guile/site/$(GUILE_EFFECTIVE_VERSION)
-godir = $(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache
-
-bin_SCRIPTS = scripts/ccwl
-
-SOURCES = ccwl/ccwl.scm ccwl/cwl.scm ccwl/graphviz.scm ccwl/yaml.scm ccwl/utils.scm
-TEST_EXTENSIONS = .scm
-SCM_TESTS = tests/ccwl.scm tests/graphviz.scm tests/utils.scm tests/yaml.scm
-TESTS = $(SCM_TESTS)
-
-SCM_LOG_DRIVER = \
- $(builddir)/pre-inst-env \
- $(GUILE) --no-auto-compile -s \
- $(builddir)/build-aux/test-driver.scm
-
-EXTRA_DIST += \
- $(TESTS) \
- tests/input-output-parameters.cwl \
- doc/skribilo.scm \
- doc/ccwl.skb \
- doc/hello.c.gz \
- doc/hello.tar \
- doc/hello.txt \
- doc/spell-check-text.txt \
- doc/dictionary \
- $(DOC_SCM) \
- $(DOC_OTHER) \
- COPYING \
- README.org
-
-.DELETE_ON_ERROR:
-
-# Build documentation
-
-include .depends
-
-CLEANFILES += doc/.dirstamp $(DOC_SCM:.scm=.cwl) $(DOC_IMAGES) $(DOC_IMAGES:.png=.dot) $(DOC_OUT)
-CLEAN_DIRECTORIES = doc/cwl-output
-
-doc/.dirstamp:
- @$(MKDIR_P) $(dir $@)
- @: > $@
-
-$(DOC_IMAGES:.png=.dot) $(DOC_OUT): doc/.dirstamp
-
-%.cwl: %.scm
- $(CCWL_GEN)$(builddir)/pre-inst-env ccwl compile $< > $@
-
-GENERATE_CWL_OUTPUT = ./build-aux/generate-cwl-output.sh
-
-doc/capture-output-file.out: doc/capture-output-file.cwl doc/hello.tar $(GENERATE_CWL_OUTPUT)
- $(CWLTOOL_GEN)$(GENERATE_CWL_OUTPUT) $< --archive $(word 2, $^)
-
-doc/capture-output-file-with-parameter-reference.out: doc/capture-output-file-with-parameter-reference.cwl doc/hello.tar $(GENERATE_CWL_OUTPUT)
- $(CWLTOOL_GEN)$(GENERATE_CWL_OUTPUT) $< --archive $(word 2, $^) --extractfile hello.txt
-
-doc/capture-stdout.out: doc/capture-stdout.cwl $(GENERATE_CWL_OUTPUT)
- $(CWLTOOL_GEN)$(GENERATE_CWL_OUTPUT) $< --message '"Hello World!"'
-
-doc/checksum.out: doc/checksum.cwl doc/hello.txt $(GENERATE_CWL_OUTPUT)
- $(CWLTOOL_GEN)$(GENERATE_CWL_OUTPUT) $< --file $(word 2, $^)
-
-doc/decompress-compile-run.out: doc/decompress-compile-run.cwl doc/hello.c.gz $(GENERATE_CWL_OUTPUT)
- $(CWLTOOL_GEN)$(GENERATE_CWL_OUTPUT) $< --compressed-source $(word 2, $^)
-
-doc/hello-world.out: doc/hello-world.cwl $(GENERATE_CWL_OUTPUT)
- $(CWLTOOL_GEN)$(GENERATE_CWL_OUTPUT) $< --message '"Hello World!"'
-
-doc/pass-stdin.out: doc/pass-stdin.cwl doc/hello.txt $(GENERATE_CWL_OUTPUT)
- $(CWLTOOL_GEN)$(GENERATE_CWL_OUTPUT) $< --file $(word 2, $^)
-
-doc/spell-check.out: doc/spell-check.cwl doc/spell-check-text.txt doc/dictionary $(GENERATE_CWL_OUTPUT)
- $(CWLTOOL_GEN)$(GENERATE_CWL_OUTPUT) $< --text-file $(word 2, $^) --dictionary $(word 3, $^)
-
-doc/hello.tar.out: doc/hello.tar
- echo "$$ tar --list --file $(notdir $<)" > $@
- tar --list --file $< >> $@
-
-# Print out graph for graphviz's dot.
-%.dot: %.scm
- $(CCWL_GEN)$(builddir)/pre-inst-env ccwl compile --to=dot $< > $@
-
-%.png: %.dot
- $(DOT_GEN)$(DOT) -Tpng -o$@ $<
-
-# The info and html targets depend on the info-local and html-local
-# targets respectively. So, we use them to extend the info and html
-# targets.
-info-local: doc/ccwl.info
-html-local: doc/ccwl.html
-
-SKRIBILO_FLAGS = --source-path=$(srcdir) --image-path=$(builddir)
-CLEANFILES += doc/ccwl.info doc/skribilo.go
-CLEAN_DIRECTORIES += doc/ccwl.html
-
-doc/ccwl.info: doc/ccwl.skb doc/skribilo.go $(DOC_IMAGES) $(DOC_SCM) $(DOC_OUT) $(DOC_OTHER)
- $(SKRIBILO_GEN)$(builddir)/pre-inst-env $(SKRIBILO) $(SKRIBILO_FLAGS) -t info $< -o $@
-
-doc/ccwl.html: doc/ccwl.skb doc/skribilo.go $(DOC_IMAGES) $(DOC_SCM) $(DOC_OUT) $(DOC_OTHER)
- rm -rf $@
- $(MKDIR_P) $@
- $(SKRIBILO_GEN)$(builddir)/pre-inst-env $(SKRIBILO) $(SKRIBILO_FLAGS) -t html $< -o $@/index.html
- cp -v $(DOC_IMAGES) $@
-
-# The install target depends on the install-data target, which in turn
-# depends on the install-data-local target. Use the install-data-local
-# target to install info documentation by default on `make install'.
-install-data-local: install-info-local
-
-# The install-info and install-html targets depend on the
-# install-info-local and install-html-local targets respectively. Use
-# them to install the skribilo generated info and html documentation.
-install-info-local: doc/ccwl.info
- $(MKDIR_P) $(DESTDIR)$(infodir)
- $(INSTALL_DATA) $< $(DESTDIR)$(infodir)
-
-install-html-local: doc/ccwl.html
- $(MKDIR_P) $(DESTDIR)$(htmldir)
- $(INSTALL_DATA) $< $(DESTDIR)$(htmldir)
-
-# The uninstall target depends on the uninstall-local target. Use it
-# to uninstall the installed info and html documentation.
-uninstall-local:
- rm -f $(DESTDIR)$(infodir)/ccwl.info $(DESTDIR)$(htmldir)/ccwl.html
-
-# Build website
-
-website: website/index.html website/manual/dev/en
-
-CLEANFILES += website/index.html
-CLEAN_DIRECTORIES += website/manual
-website/index.html: README.org build-aux/build-home-page.el
- $(EMACS_GEN)$(EMACS) -Q --batch --load build-aux/build-home-page.el --funcall build-website
-
-website/manual/dev/en: doc/ccwl.html
- rm -rf $@
- $(MKDIR_P) $(dir $@)
- cp -vr $< $@
-
-# Make release
-
-CURRENT_RELEASE = website/releases/$(firstword $(DIST_ARCHIVES))
-.PHONY: release
-release: $(CURRENT_RELEASE) $(CURRENT_RELEASE).asc
-
-$(CURRENT_RELEASE): dist distcheck
- cp $(notdir $@) $@
-
-%.asc: %
- gpg --detach-sign --armor $<
-
-# Build software bundles.
-
-.PHONY: docker pack
-docker:
- guix pack -RR --format=docker --entry-point=bin/ccwl --expression='(load "guix.scm")'
-
-pack:
- guix pack -RR --symlink=/opt/gnu/bin=bin --expression='(load "guix.scm")'
-
-# The clean target depends on clean-local. Use clean-local to clean up
-# several directories. Directories cannot be specified in CLEANFILES.
-clean-local:
- rm -rf $(CLEAN_DIRECTORIES)
diff --git a/NEWS b/NEWS.org
index 154074b..1c736cc 100644
--- a/NEWS
+++ b/NEWS.org
@@ -1,4 +1,3 @@
--*- org -*-
#+TITLE: ccwl NEWS – History of user-visible changes
Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
diff --git a/build-aux/distcheck.scm b/build-aux/distcheck.scm
new file mode 100644
index 0000000..4cca909
--- /dev/null
+++ b/build-aux/distcheck.scm
@@ -0,0 +1,76 @@
+;;; ccwl --- Concise Common Workflow Language
+;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;;
+;;; This file is part of ccwl.
+;;;
+;;; ccwl is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation, either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; ccwl is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with ccwl. If not, see <https://www.gnu.org/licenses/>.
+
+(import (rnrs io ports)
+ (srfi srfi-26)
+ (ice-9 eval-string)
+ (ice-9 match)
+ (ice-9 popen)
+ (guix gexp)
+ (guix packages)
+ (guix scripts)
+ (guix store))
+
+(define (call-with-input-pipe command proc)
+ "Call PROC with input pipe to COMMAND. COMMAND is a list of program
+arguments."
+ (match command
+ ((prog args ...)
+ (let ((port #f))
+ (dynamic-wind
+ (lambda ()
+ (set! port (apply open-pipe* OPEN_READ prog args)))
+ (cut proc port)
+ (cut close-pipe port))))))
+
+(define (call-with-archive-file archive file proc)
+ "Call PROC with port reading FILE in lzip compressed tar ARCHIVE."
+ (call-with-input-pipe (list "tar" "--extract" "--to-stdout"
+ "--file" archive
+ (string-append (basename archive ".tar.lz")
+ "/" file))
+ proc))
+
+(define (package-in-archive dist-archive)
+ "Return the package object in guix.scm of DIST-ARCHIVE."
+ (call-with-archive-file dist-archive "guix.scm"
+ (lambda (port)
+ (eval-string (get-string-all port)
+ #:file (string-append (getcwd) "/guix.scm")))))
+
+(define (check-build dist-archive)
+ "Check if package in DIST-ARCHIVE builds correctly."
+ (run-with-store (open-connection)
+ (build-package
+ (package
+ (inherit (package-in-archive dist-archive))
+ (source (local-file dist-archive))))))
+
+(define (check-news version dist-archive)
+ "Check if VERSION appears in the first 200 characters of the news
+file in DIST-ARCHIVE."
+ (call-with-archive-file dist-archive "NEWS.org"
+ (lambda (port)
+ (unless (string-contains (get-string-n port 200)
+ version)
+ (error "NEWS.org does not mention current version:" version)))))
+
+(match (program-arguments)
+ ((_ version dist-archive)
+ (check-build dist-archive)
+ (check-news version dist-archive)))
diff --git a/build-aux/generate-cwl-output.sh.in b/build-aux/generate-cwl-output.sh
index 4f92cc6..b5bed39 100755
--- a/build-aux/generate-cwl-output.sh.in
+++ b/build-aux/generate-cwl-output.sh
@@ -35,8 +35,8 @@ output_file=$(basename $cwl_file .cwl).out
# On Guix, workflows involving gcc need to preserve the
# LIBRARY_PATH environment variable.
- @CWLTOOL@ --preserve-environment LIBRARY_PATH --outdir doc/cwl-output $cwl_file "$@" 2>&1 \
- | @SED@ '1,2d' \
- | @SED@ 's|\[1;30mINFO\[0m ||g' \
- | @SED@ "s|$(pwd)/doc/cwl-output|/home/manimekalai|g"
+ cwltool --preserve-environment LIBRARY_PATH --outdir doc/cwl-output $cwl_file "$@" 2>&1 \
+ | sed '1,2d' \
+ | sed 's|\[1;30mINFO\[0m ||g' \
+ | sed "s|$(pwd)/doc/cwl-output|/home/manimekalai|g"
} > doc/$output_file
diff --git a/build-aux/test-driver.scm.in b/build-aux/test-driver.scm
index 1407fc8..8fc5236 100644
--- a/build-aux/test-driver.scm.in
+++ b/build-aux/test-driver.scm
@@ -1,5 +1,5 @@
;;; ccwl --- Concise Common Workflow Language
-;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2021, 2022 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of ccwl.
;;;
@@ -26,21 +26,10 @@
;;; Code:
(use-modules (ice-9 format)
- (ice-9 getopt-long)
(ice-9 match)
(srfi srfi-26)
(srfi srfi-64))
-;; Currently, only log-file and trs-file are understood. Everything
-;; else is ignored.
-(define %options
- '((test-name (value #t))
- (log-file (value #t))
- (trs-file (value #t))
- (color-tests (value #t))
- (expect-failure (value #t))
- (enable-hard-errors (value #t))))
-
(define (color code str color?)
(if color?
(format #f "~a[~am~a~a[0m" #\esc code str #\esc)
@@ -50,7 +39,7 @@
(define green (cut color 32 <> <>))
(define magenta (cut color 35 <> <>))
-(define (my-gnu-runner log-port trs-port color?)
+(define (my-gnu-runner color?)
(let ((runner (test-runner-null)))
(test-runner-on-group-begin! runner
(lambda (runner suite-name count)
@@ -64,36 +53,39 @@
(result (string-upcase
(symbol->string (test-result-kind runner))))
(result-alist (test-result-alist runner)))
- (format trs-port ":test-result: ~a ~a~%" result name)
(format #t "~a ~a~%"
(case (test-result-kind runner)
((pass) (green result color?))
(else (red result color?)))
name)
- (format log-port "~a ~a~%" result name)
;; If test did not pass, print details.
(unless (eq? (test-result-kind runner) 'pass)
- (let* ((expected-value (match (assq-ref result-alist 'source-form)
- (('test-assert _ ...) #t)
- (_ (assq-ref result-alist 'expected-value))))
- (log-output
- (format #f "~a:~a~%expected: ~s~%actual: ~s~%"
- (assq-ref result-alist 'source-file)
- (assq-ref result-alist 'source-line)
- expected-value
- (assq-ref result-alist 'actual-value))))
- (display log-output log-port)
- (display log-output (current-error-port)))))))
+ (format (current-error-port)
+ "~a:~a~%expected: ~s~%actual: ~s~%"
+ (assq-ref result-alist 'source-file)
+ (assq-ref result-alist 'source-line)
+ (match (assq-ref result-alist 'source-form)
+ (('test-assert _ ...) #t)
+ (_ (assq-ref result-alist 'expected-value)))
+ (assq-ref result-alist 'actual-value))))))
runner))
-(let ((opts (getopt-long (command-line) %options)))
- (call-with-output-file (string-append "@abs_top_builddir@/"
- (option-ref opts 'log-file #f))
- (lambda (log-port)
- (call-with-output-file (option-ref opts 'trs-file #f)
- (lambda (trs-port)
- (chdir "@abs_top_srcdir@")
- (test-with-runner (my-gnu-runner log-port trs-port
- (string=? (option-ref opts 'color-tests "yes")
- "yes"))
- (load-from-path (option-ref opts 'test-name #f))))))))
+(match (command-line)
+ ((_ test-files ...)
+ (let ((runner (my-gnu-runner #t)))
+ (test-with-runner runner
+ (for-each load-from-path test-files)
+ (display (magenta "SUMMARY" #t))
+ (newline)
+ (format #t "PASS: ~a
+FAIL: ~a
+XPASS: ~a
+XFAIL: ~a
+SKIP: ~a
+"
+ (test-runner-pass-count runner)
+ (test-runner-fail-count runner)
+ (test-runner-xpass-count runner)
+ (test-runner-xfail-count runner)
+ (test-runner-skip-count runner))
+ (exit (zero? (test-runner-fail-count runner)))))))
diff --git a/bootstrap.sh b/configure
index cc651f2..a8d8847 100755
--- a/bootstrap.sh
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# ccwl --- Concise Common Workflow Language
-# Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
+# Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
#
# This file is part of ccwl.
#
@@ -10,13 +10,12 @@
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
-# ccwl is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
+# ccwl is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ccwl. If not, see <https://www.gnu.org/licenses/>.
-guile --no-auto-compile build-aux/find-dependencies.scm > .depends
-autoreconf --verbose --install --force
+guile --no-auto-compile configure.scm ccwl "$@"
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 36d0868..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,58 +0,0 @@
-dnl ccwl --- Concise Common Workflow Language
-dnl Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
-dnl
-dnl This file is part of ccwl.
-dnl
-dnl ccwl is free software: you can redistribute it and/or modify it
-dnl under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation, either version 3 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl ccwl is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with ccwl. If not, see <https://www.gnu.org/licenses/>.
-
-AC_INIT([ccwl], [0.2.0])
-AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([color-tests -Wall -Wno-portability foreign check-news no-dist-gzip dist-lzip])
-AM_SILENT_RULES([yes])
-
-GUILE_PKG([3.0 2.2])
-GUILE_PROGS
-GUILE_MODULE_REQUIRED([yaml])
-
-# CHECK_FOR_PROGRAM(VARIABLE, PROGRAM-TO-CHECK-FOR, MESSAGE)
-# ----------------------------------------------------------
-AC_DEFUN([CHECK_FOR_PROGRAM], [
- AC_PATH_PROG([$1], [$2], [no])
- AS_IF([test x"$$1" = xno], [$3])
-])
-
-# REQUIRED_PROGRAM(VARIABLE, PROGRAM-TO-CHECK-FOR, PACKAGE-CONTAINING-PROGRAM)
-# ----------------------------------------------------------------------------
-AC_DEFUN([REQUIRED_PROGRAM], [
- CHECK_FOR_PROGRAM([$1], [$2], [AC_MSG_ERROR([cannot find $2 m4_ifnblank([$3], [from the $3 package])])])
-])
-
-# OPTIONAL_PROGRAM(VARIABLE, PROGRAM-TO-CHECK-FOR, WARNING)
-# ----------------------------------------------------------------------------
-AC_DEFUN([OPTIONAL_PROGRAM], [
- CHECK_FOR_PROGRAM([$1], [$2], [AC_MSG_WARN([$3])])
-])
-
-AC_PROG_SED
-REQUIRED_PROGRAM([DOT], [dot], [graphviz])
-REQUIRED_PROGRAM([CWLTOOL], [cwltool])
-REQUIRED_PROGRAM([SKRIBILO], [skribilo])
-OPTIONAL_PROGRAM([EMACS], [emacs], [cannot find emacs, and therefore cannot build the website])
-
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
-AC_CONFIG_FILES([build-aux/test-driver.scm])
-AC_CONFIG_FILES([build-aux/generate-cwl-output.sh], [chmod +x build-aux/generate-cwl-output.sh])
-AC_CONFIG_FILES([scripts/ccwl], [chmod +x scripts/ccwl])
-AC_OUTPUT
diff --git a/configure.scm b/configure.scm
new file mode 100644
index 0000000..a271879
--- /dev/null
+++ b/configure.scm
@@ -0,0 +1,159 @@
+;;; ccwl --- Concise Common Workflow Language
+;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;;
+;;; This file is part of ccwl.
+;;;
+;;; ccwl is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation, either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; ccwl is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;; General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with ccwl. If not, see <https://www.gnu.org/licenses/>.
+
+(use-modules (rnrs io ports)
+ (srfi srfi-1)
+ (srfi srfi-26)
+ (srfi srfi-28)
+ (srfi srfi-37)
+ (ice-9 match)
+ (ice-9 popen))
+
+(define (call-with-input-pipe command proc)
+ "Call PROC with input pipe to COMMAND. COMMAND is a list of program
+arguments."
+ (match command
+ ((prog args ...)
+ (let ((port #f))
+ (dynamic-wind
+ (lambda ()
+ (set! port (apply open-pipe* OPEN_READ prog args)))
+ (cut proc port)
+ (cut close-pipe port))))))
+
+(define (check-for-guile-3.0)
+ (display "checking for guile 3.0... ")
+ (if (string=? (effective-version) "3.0")
+ (display (format "yes~%"))
+ (begin
+ (display (format "no~%error: Guile 3.0 not found~%"))
+ (exit #f))))
+
+(define (check-for-module module)
+ (display (format "checking for module ~a... " module))
+ (if (resolve-module module #:ensure #f)
+ (display (format "yes~%"))
+ (begin
+ (display (format "no~%error: no ~a found~%" module))
+ (exit #f))))
+
+(define (find-program program)
+ (find file-exists?
+ (map (lambda (path)
+ (string-append path "/" program))
+ (string-split (getenv "PATH")
+ #\:))))
+
+(define* (check-for-program program #:optional package)
+ (display (format "checking for program ~a... " program))
+ (let ((found-program (find-program program)))
+ (cond
+ (found-program
+ (display (format "~a~%" found-program)))
+ (package
+ (display (format "no~%error: cannot find ~a from the ~a package~%"
+ program package))
+ (exit #f))
+ (else
+ (display (format "no~%error: cannot find ~a~%" program))
+ (exit #f)))))
+
+(define* (check-for-optional-program program msg)
+ (display (format "checking for program ~a... " program))
+ (let ((found-program (find-program program)))
+ (display (or found-program msg))
+ (newline)))
+
+(define (option-proc opt name arg result)
+ (cons (cons (string->symbol name) arg)
+ result))
+
+(define (unrecognized-option-proc opt name arg result)
+ (display (if arg
+ (format "Ignoring unrecognized option --~a=~a~%"
+ name arg)
+ (format "Ignoring unrecognized option --~a~%"
+ name)))
+ result)
+
+(define (unrecognized-argument-proc arg result)
+ (display (format "Ignoring unrecognized argument ~a~%"
+ arg))
+ result)
+
+(define processed-args
+ (match (program-arguments)
+ ((_ project args ...)
+ (let* ((args (args-fold args
+ (list (option '("prefix") #t #f
+ option-proc))
+ unrecognized-option-proc
+ unrecognized-argument-proc
+ '()))
+ (prefix (or (assq-ref args 'prefix)
+ "/usr/local"))
+ (exec-prefix (or (assq-ref args 'exec-prefix)
+ prefix))
+ (datarootdir (or (assq-ref args 'datarootdir)
+ (string-append prefix "/share"))))
+ `((project . ,project)
+ (bindir . ,(or (assq-ref args 'bindir)
+ (string-append exec-prefix "/bin")))
+ (libdir . ,(or (assq-ref args 'libdir)
+ (string-append exec-prefix "/lib")))
+ (datarootdir . ,datarootdir)
+ (infodir . ,(or (assq-ref args 'infodir)
+ (string-append datarootdir "/info"))))))))
+
+(define version
+ (call-with-input-pipe (list "git" "tag" "--sort=taggerdate"
+ "--list" "v*")
+ (lambda (port)
+ (let ((line (get-line port)))
+ (if (eof-object? line)
+ ;; If there are no tags, assume first version.
+ "0.1.0"
+ (substring line (string-length "v")))))))
+
+(check-for-guile-3.0)
+(check-for-module '(yaml))
+(check-for-program "dot" "graphviz")
+(check-for-program "cwltool")
+(check-for-program "skribilo")
+(check-for-optional-program "emacs" "cannot find emacs, and therefore cannot build the website")
+
+(call-with-output-file "Makefile.include"
+ (lambda (port)
+ (display (format "# This file was automatically generated by configure.
+
+project = ~a
+version = ~a
+bindir = ~a
+libdir = ~a
+datarootdir = ~a
+infodir = ~a
+guile_effective_version = ~a
+"
+ (assq-ref processed-args 'project)
+ version
+ (assq-ref processed-args 'bindir)
+ (assq-ref processed-args 'libdir)
+ (assq-ref processed-args 'datarootdir)
+ (assq-ref processed-args 'infodir)
+ (effective-version))
+ port)))
diff --git a/guix.scm b/guix.scm
index fbabdd7..0222810 100644
--- a/guix.scm
+++ b/guix.scm
@@ -40,10 +40,6 @@
(inherit guix:ccwl)
(source (local-file %source-dir
#:recursive? #t
- #:select? (git-predicate %source-dir)))
- (native-inputs
- `(("autoconf" ,autoconf)
- ("automake" ,automake)
- ,@(package-native-inputs guix:ccwl)))))
+ #:select? (git-predicate %source-dir)))))
ccwl
diff --git a/pre-inst-env.in b/pre-inst-env
index d0aa24c..c1ed5d7 100644..100755
--- a/pre-inst-env.in
+++ b/pre-inst-env
@@ -1,5 +1,4 @@
-#! @GUILE@ --no-auto-compile
--*- scheme -*-
+#! /usr/bin/env guile
!#
;;; ccwl --- Concise Common Workflow Language
;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
@@ -28,9 +27,11 @@
'()))
":")))
-(prepend-path-env! "GUILE_LOAD_PATH" "@abs_top_builddir@" "@abs_top_srcdir@")
-(prepend-path-env! "GUILE_LOAD_COMPILED_PATH" "@abs_top_builddir@")
-(prepend-path-env! "PATH" "@abs_top_builddir@/scripts")
+(define %source-dir (dirname (current-filename)))
+
+(prepend-path-env! "GUILE_LOAD_PATH" %source-dir)
+(prepend-path-env! "GUILE_LOAD_COMPILED_PATH" %source-dir)
+(prepend-path-env! "PATH" (string-append %source-dir "/scripts"))
(match (command-line)
((_ command args ...)
diff --git a/scripts/ccwl.in b/scripts/ccwl
index 5fb7877..1521803 100755
--- a/scripts/ccwl.in
+++ b/scripts/ccwl
@@ -1,5 +1,4 @@
-#! @GUILE@
--*- scheme -*-
+#! /usr/bin/env guile
!#
;;; ccwl --- Concise Common Workflow Language
;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>