diff options
-rw-r--r-- | .gitignore | 16 | ||||
-rw-r--r-- | Makefile | 80 | ||||
-rw-r--r-- | Makefile.am | 92 | ||||
-rwxr-xr-x | bootstrap.sh | 22 | ||||
-rw-r--r-- | build-aux/test-corpus.scm (renamed from build-aux/test-corpus.scm.in) | 3 | ||||
-rw-r--r-- | build-aux/test-driver.scm (renamed from build-aux/test-driver.scm.in) | 38 | ||||
-rw-r--r-- | configure.ac | 33 | ||||
-rw-r--r-- | guix.scm | 8 | ||||
-rw-r--r-- | pre-inst-env.in | 37 |
9 files changed, 97 insertions, 232 deletions
@@ -1,20 +1,4 @@ *.go -INSTALL -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -build-aux/install-sh -build-aux/missing -build-aux/test-corpus.scm -config.log -config.status -configure -doc/.dirstamp doc/guile-email.html doc/guile-email.info -pre-inst-env -test-suite.log -tests/*.log -tests/*.trs website
\ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..979c4f1 --- /dev/null +++ b/Makefile @@ -0,0 +1,80 @@ +# guile-email --- Guile email parser +# Copyright © 2023 Arun Isaac <arunisaac@systemreboot.net> +# +# This file is part of guile-email. +# +# guile-email is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# guile-email 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 +# Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License along with guile-email. If not, see +# <http://www.gnu.org/licenses/>. + +project = guile-email +# FIXME: Do not hardcode the effective version. +guile_effective_version = 3.0 + +EMACS ?= emacs +GUILD ?= guild +GUILE ?= guile +MAKEINFO ?= makeinfo + +prefix ?= /usr/local +exec_prefix ?= $(prefix) +libdir ?= $(exec_prefix)/lib +datarootdir ?= $(prefix)/share +infodir ?= $(datarootdir)/info + +top_level_module_dir = email +sources = $(wildcard $(top_level_module_dir)/*.scm) +objects = $(sources:.scm=.go) +tests = $(wildcard tests/*.scm) +doc_texi = doc/$(project).texi +doc_html = $(doc_texi:.texi=.html) +doc_info = $(doc_texi:.texi=.info) + +scmdir = $(datarootdir)/guile/site/$(guile_effective_version) +godir = $(libdir)/guile/$(guile_effective_version)/site-ccache + +.PHONY: all check install clean + +all: $(objects) + +%.go: %.scm + GUILE_AUTO_COMPILE=0 $(GUILD) compile -L . -o $@ $< + +$(doc_html): $(doc_texi) + $(MAKEINFO) --html --output=$@ --css-ref=/style.css $< + +$(doc_info): $(doc_texi) + $(MAKEINFO) --output=$@ $< + +website: website/index.html website/manual/dev/en + +website/index.html: README.org + mkdir -p $(dir $@) + $(EMACS) -Q --script build-aux/build-website.el + +website/manual/dev/en: $(doc_html) + rm -rf $@ + mkdir -p $(dir $@) + cp -vr $< $@ + +check: $(tests) + $(GUILE) --no-auto-compile -L . build-aux/test-driver.scm $^ + +install: $(doc_info) + mkdir -p $(scmdir) $(godir) + cp --parents -vr $(sources) $(scmdir) + cp --parents -vr $(objects) $(godir) + install -D $(doc_info) --target-directory $(infodir) + +clean: + rm -rf $(objects) $(doc_html) $(doc_info) website/index.tml website/manual/dev/en diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 6c29b96..0000000 --- a/Makefile.am +++ /dev/null @@ -1,92 +0,0 @@ -# guile-email --- Guile email parser -# Copyright © 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net> -# Copyright © 2018, 2019, 2021 Arun Isaac <arunisaac@systemreboot.net> -# -# This file was adapted from mumi and is part of guile-email. -# -# guile-email is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation; either version 3 of the -# License, or (at your option) any later version. -# -# guile-email 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 -# Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with guile-email. If not, see -# <http://www.gnu.org/licenses/>. - -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 -SUFFIXES = .scm .go -.scm.go: - $(AM_V_GEN)$(top_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 - -SOURCES = \ - email/base64.scm \ - email/email.scm \ - email/quoted-printable.scm \ - email/utils.scm - -TEST_EXTENSIONS = .scm - -SCM_TESTS = \ - tests/base64.scm \ - tests/email.scm \ - tests/quoted-printable.scm \ - tests/utils.scm - -TESTS = $(SCM_TESTS) - -SCM_LOG_DRIVER = \ - $(top_builddir)/pre-inst-env \ - $(GUILE) --no-auto-compile -s \ - $(top_builddir)/build-aux/test-driver.scm - -info_TEXINFOS = doc/guile-email.texi - -EXTRA_DIST += \ - $(TESTS) \ - tests/multipart-email-with-a-8bit-encoding-and-non-utf8-charset-part \ - tests/email-with-8bit-encoding-and-non-utf8-charset \ - build-aux/test-driver.scm.in \ - COPYING \ - README.org - -# Build website. -AM_MAKEINFOHTMLFLAGS = --css-ref=/style.css - -website: website/index.html website/manual/dev/en - -website/index.html: README.org - $(MKDIR_P) $(dir $@) - $(EMACS) -Q --script build-aux/build-website.el - -website/manual/dev/en: doc/guile-email.html - rm -rf $@ - $(MKDIR_P) $(dir $@) - cp -vr $< $@ - -# The clean target depends on clean-local. We use clean-local to clean -# up the website. -clean-local: - rm -rf website/index.html website/manual/dev/en diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index fa24661..0000000 --- a/bootstrap.sh +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/sh - -# guile-email --- Guile email parser -# Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net> -# -# This file is part of guile-email. -# -# guile-email is free software; you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation; either version 3 of the -# License, or (at your option) any later version. -# -# guile-email 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 -# Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public -# License along with guile-email. If not, see -# <http://www.gnu.org/licenses/>. - -autoreconf --verbose --install --force diff --git a/build-aux/test-corpus.scm.in b/build-aux/test-corpus.scm index b069186..83a359f 100644 --- a/build-aux/test-corpus.scm.in +++ b/build-aux/test-corpus.scm @@ -1,6 +1,3 @@ -#! @GUILE@ --*- scheme -*- -!# ;;; guile-email --- Guile email parser ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> ;;; diff --git a/build-aux/test-driver.scm.in b/build-aux/test-driver.scm index 96d84e0..8d60cd4 100644 --- a/build-aux/test-driver.scm.in +++ b/build-aux/test-driver.scm @@ -18,49 +18,29 @@ ;;; <http://www.gnu.org/licenses/>. (use-modules (ice-9 format) - (ice-9 getopt-long) - (srfi srfi-26) + (ice-9 match) (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 (my-gnu-runner log-port trs-port) +(define %my-gnu-runner (let ((runner (test-runner-simple))) (test-runner-on-group-begin! runner (lambda (runner suite-name count) - (format #t "%%%% Starting test ~a~%" suite-name) - (format log-port "%%%% Starting test ~a~%" suite-name) - ;; Set log-port in the aux-value field for use by other parts - ;; of test-runner-simple - (test-runner-aux-value! runner log-port) - (format #t " (Writing full log to \"~a\")~%" (port-filename log-port)))) + (format (current-error-port) + "%%%% Starting test ~a~%" suite-name))) (test-runner-on-group-end! runner (const #f)) (test-runner-on-test-end! runner (lambda (runner) (let ((name (test-runner-test-name runner)) (result (string-upcase (symbol->string (test-result-kind runner))))) - (format trs-port ":test-result: ~a ~a~%" result name) (format (current-error-port) "\x1b[~:[31~;32~]m~a\x1b[0m ~a~%" (eq? (test-result-kind runner) 'pass) result name)))) 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) - (load-from-path (option-ref opts 'test-name #f)))))))) +(match (command-line) + ((_ test-files ...) + (test-with-runner %my-gnu-runner + (for-each load test-files)) + (exit (zero? (test-runner-fail-count %my-gnu-runner))))) diff --git a/configure.ac b/configure.ac deleted file mode 100644 index c418e88..0000000 --- a/configure.ac +++ /dev/null @@ -1,33 +0,0 @@ -dnl guile-email --- Guile email parser -dnl Copyright © 2018, 2019, 2021 Arun Isaac <arunisaac@systemreboot.net> -dnl -dnl This file is part of guile-email. -dnl -dnl guile-email is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU Affero General Public License as -dnl published by the Free Software Foundation; either version 3 of the -dnl License, or (at your option) any later version. -dnl -dnl guile-email 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 Affero General Public License for more details. -dnl -dnl You should have received a copy of the GNU Affero General Public -dnl License along with guile-email. If not, see -dnl <http://www.gnu.org/licenses/>. - -AC_INIT([guile-email], [0.2.2]) -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 -AC_PATH_PROG([EMACS], [emacs]) - -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/test-corpus.scm], [chmod +x build-aux/test-corpus.scm]) -AC_OUTPUT @@ -25,6 +25,7 @@ (use-modules (guix gexp) (guix git-download) (guix packages) + (guix utils) (gnu packages autotools) (gnu packages guile-xyz) (gnu packages texinfo)) @@ -36,6 +37,13 @@ (source (local-file %source-dir #:recursive? #t #:select? (git-predicate %source-dir))) + (arguments + (substitute-keyword-arguments (package-arguments guile-email) + ((#:make-flags make-flags #~(list)) + #~(list (string-append "prefix=" #$output))) + ((#:phases phases #~%standard-phases) + #~(modify-phases #$phases + (delete 'configure))))) (native-inputs (modify-inputs (package-native-inputs guile-email) (prepend autoconf) diff --git a/pre-inst-env.in b/pre-inst-env.in deleted file mode 100644 index e6b281f..0000000 --- a/pre-inst-env.in +++ /dev/null @@ -1,37 +0,0 @@ -#! @GUILE@ --no-auto-compile --*- scheme -*- -!# -;;; guile-email --- Guile email parser -;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> -;;; -;;; This file is part of guile-email. -;;; -;;; guile-email is free software; you can redistribute it and/or modify -;;; it under the terms of the GNU Affero General Public License as -;;; published by the Free Software Foundation; either version 3 of the -;;; License, or (at your option) any later version. -;;; -;;; guile-email 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 -;;; Affero General Public License for more details. -;;; -;;; You should have received a copy of the GNU Affero General Public -;;; License along with guile-email. If not, see -;;; <http://www.gnu.org/licenses/>. - -(import (ice-9 match)) - -(define (prepend-path-environment-variable name . values) - (setenv name (string-join (append values - (if (getenv name) - (string-split (getenv name) #\:) - '())) - ":"))) - -(prepend-path-environment-variable "GUILE_LOAD_PATH" "@abs_top_builddir@" "@abs_top_srcdir@") -(prepend-path-environment-variable "GUILE_LOAD_COMPILED_PATH" "@abs_top_builddir@") - -(match (command-line) - ((_ command args ...) - (apply execlp command command args))) |