Compare commits
No commits in common. '62337dec07215e02b98603f73c65d6380a747b26' and '3edc7c57da2a4d14970d977f43a6dedc97d0d453' have entirely different histories.
62337dec07
...
3edc7c57da
15 changed files with 438 additions and 173 deletions
@ -0,0 +1,89 @@ |
|||||||
|
bin_SCRIPTS = scripts/bible-app \
|
||||||
|
scripts/word-counter \
|
||||||
|
scripts/bible2latex
|
||||||
|
|
||||||
|
# Handle substitution of fully-expanded Autoconf variables.
|
||||||
|
do_subst = $(SED) \
|
||||||
|
-e 's,[@]GUILE[@],$(GUILE),g' \
|
||||||
|
-e 's,[@]guilemoduledir[@],$(guilemoduledir),g' \
|
||||||
|
-e 's,[@]guileobjectdir[@],$(guileobjectdir),g' \
|
||||||
|
-e 's,[@]localedir[@],$(localedir),g'
|
||||||
|
|
||||||
|
nodist_noinst_SCRIPTS = pre-inst-env
|
||||||
|
|
||||||
|
GOBJECTS = $(SOURCES:%.scm=%.go)
|
||||||
|
|
||||||
|
moddir=$(prefix)/share/guile/site/$(GUILE_EFFECTIVE_VERSION)
|
||||||
|
godir=$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache
|
||||||
|
ccachedir=$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache
|
||||||
|
|
||||||
|
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 |
||||||
|
|
||||||
|
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 $(GUILE_TOOLS) compile $(GUILE_WARNINGS) -o "$@" "$<"
|
||||||
|
|
||||||
|
SOURCES = bible-tools/latex-export.scm \
|
||||||
|
bible-tools/count-words.scm \
|
||||||
|
bible-tools/bible-tools.scm
|
||||||
|
|
||||||
|
TESTS =
|
||||||
|
|
||||||
|
TEST_EXTENSIONS = .scm
|
||||||
|
SCM_LOG_DRIVER = \
|
||||||
|
$(top_builddir)/pre-inst-env \
|
||||||
|
$(GUILE) --no-auto-compile -e main \
|
||||||
|
$(top_srcdir)/build-aux/test-driver.scm
|
||||||
|
|
||||||
|
# Tell 'build-aux/test-driver.scm' to display only source file names,
|
||||||
|
# not indivdual test names.
|
||||||
|
AM_SCM_LOG_DRIVER_FLAGS = --brief=yes
|
||||||
|
|
||||||
|
AM_SCM_LOG_FLAGS = --no-auto-compile -L "$(top_srcdir)"
|
||||||
|
|
||||||
|
AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)"
|
||||||
|
|
||||||
|
info_TEXINFOS = doc/bible-tools.texi
|
||||||
|
dvi: # Don't build dvi docs
|
||||||
|
|
||||||
|
EXTRA_DIST += COPYING \
|
||||||
|
HACKING \
|
||||||
|
README \
|
||||||
|
README.org \
|
||||||
|
NEWS \
|
||||||
|
AUTHORS \
|
||||||
|
ChangeLog \
|
||||||
|
hall.scm \
|
||||||
|
.gitignore \
|
||||||
|
guix.scm \
|
||||||
|
build-aux/test-driver.scm \
|
||||||
|
build-aux/texinfo.tex \
|
||||||
|
build-aux/mdate-sh \
|
||||||
|
build-aux/missing \
|
||||||
|
build-aux/install-sh \
|
||||||
|
configure.ac \
|
||||||
|
Makefile.am \
|
||||||
|
pre-inst-env.in \
|
||||||
|
build-aux/test-driver.scm \
|
||||||
|
$(TESTS)
|
||||||
|
|
||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
|
clean-go: |
||||||
|
-$(RM) $(GOBJECTS)
|
||||||
|
.PHONY: clean-go |
||||||
|
|
||||||
|
CLEANFILES = \
|
||||||
|
$(GOBJECTS) \
|
||||||
|
$(TESTS:tests/%.scm=%.log)
|
@ -0,0 +1,36 @@ |
|||||||
|
dnl -*- Autoconf -*- |
||||||
|
|
||||||
|
AC_INIT(bible-tools, 1.0) |
||||||
|
AC_SUBST(HVERSION, "\"1.0\"") |
||||||
|
AC_SUBST(AUTHOR, "\"\"") |
||||||
|
AC_SUBST(COPYRIGHT, "'(2022)") |
||||||
|
AC_SUBST(LICENSE, gpl3+) |
||||||
|
AC_CONFIG_SRCDIR(bible-tools) |
||||||
|
AC_CONFIG_AUX_DIR([build-aux]) |
||||||
|
AM_INIT_AUTOMAKE([1.12 gnu silent-rules subdir-objects color-tests parallel-tests -Woverride -Wno-portability]) |
||||||
|
AM_SILENT_RULES([yes]) |
||||||
|
|
||||||
|
AC_CONFIG_FILES([Makefile]) |
||||||
|
AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env]) |
||||||
|
AC_CONFIG_FILES([scripts/bible-app],[chmod +x scripts/bible-app]) |
||||||
|
AC_CONFIG_FILES([scripts/word-counter],[chmod +x scripts/word-counter]) |
||||||
|
AC_CONFIG_FILES([scripts/bible2latex],[chmod +x scripts/bible2latex]) |
||||||
|
dnl Search for 'guile' and 'guild'. This macro defines |
||||||
|
dnl 'GUILE_EFFECTIVE_VERSION'. |
||||||
|
GUILE_PKG([3.0 2.2 2.0]) |
||||||
|
GUILE_PROGS |
||||||
|
GUILE_SITE_DIR |
||||||
|
if test "x$GUILD" = "x"; then |
||||||
|
AC_MSG_ERROR(['guild' binary not found; please check your guile-2.x installation.]) |
||||||
|
fi |
||||||
|
|
||||||
|
dnl Hall auto-generated guile-module dependencies |
||||||
|
|
||||||
|
|
||||||
|
dnl Installation directories for .scm and .go files. |
||||||
|
guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION" |
||||||
|
guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache" |
||||||
|
AC_SUBST([guilemoduledir]) |
||||||
|
AC_SUBST([guileobjectdir]) |
||||||
|
|
||||||
|
AC_OUTPUT |
@ -1,85 +1,95 @@ |
|||||||
(use-modules |
(use-modules (guix packages) |
||||||
(guix packages) |
((guix licenses) |
||||||
((guix licenses) #:prefix license:) |
#:prefix license:) |
||||||
(guix download) |
(guix download) |
||||||
(guix build-system gnu) |
(guix git-download) |
||||||
(guix gexp) |
(guix build-system gnu) |
||||||
(gnu packages) |
(gnu packages) |
||||||
(gnu packages autotools) |
(gnu packages autotools) |
||||||
(gnu packages guile) |
(gnu packages guile) |
||||||
(gnu packages guile-xyz) |
(gnu packages guile-xyz) |
||||||
(gnu packages pkg-config) |
(gnu packages pkg-config) |
||||||
(gnu packages texinfo)) |
(gnu packages texinfo)) |
||||||
|
|
||||||
(package |
(define-public bible-tools |
||||||
(name "bible-tools") |
(package |
||||||
(version "1.0") |
(name "bible-tools") |
||||||
(source (local-file "./bible-tools-1.0.tar.gz")) |
(version "1.0") |
||||||
(build-system gnu-build-system) |
(source |
||||||
(arguments |
(origin |
||||||
`(#:modules |
(method git-fetch) |
||||||
((ice-9 match) |
(uri (git-reference |
||||||
(ice-9 ftw) |
(url "https://git.silasvedder.xyz/silasfox/bible-tools.git") |
||||||
,@%gnu-build-system-modules) |
(commit "bc925d8"))) |
||||||
#:phases |
(file-name "bible-tools-1.0-checkout") |
||||||
(modify-phases |
(sha256 (base32 "07221jw4gl48cg45znwjkc7871in3pfq488ig4vnbjygqbg4wawh")))) |
||||||
%standard-phases |
(build-system gnu-build-system) |
||||||
(add-after |
(arguments |
||||||
'install |
`(#:modules |
||||||
'hall-wrap-binaries |
((ice-9 match) |
||||||
(lambda* (#:key inputs outputs #:allow-other-keys) |
(ice-9 ftw) |
||||||
(let* ((compiled-dir |
,@%gnu-build-system-modules) |
||||||
(lambda (out version) |
#:phases |
||||||
(string-append |
(modify-phases |
||||||
out |
%standard-phases |
||||||
"/lib/guile/" |
(add-after |
||||||
version |
'install |
||||||
"/site-ccache"))) |
'hall-wrap-binaries |
||||||
(uncompiled-dir |
(lambda* (#:key inputs outputs #:allow-other-keys) |
||||||
(lambda (out version) |
(let* ((compiled-dir |
||||||
(string-append |
(lambda (out version) |
||||||
out |
(string-append |
||||||
"/share/guile/site" |
out |
||||||
(if (string-null? version) "" "/") |
"/lib/guile/" |
||||||
version))) |
version |
||||||
(dep-path |
"/site-ccache"))) |
||||||
(lambda (env modules path) |
(uncompiled-dir |
||||||
(list env |
(lambda (out version) |
||||||
":" |
(string-append |
||||||
'prefix |
out |
||||||
(cons modules |
"/share/guile/site" |
||||||
(map (lambda (input) |
(if (string-null? version) "" "/") |
||||||
(string-append |
version))) |
||||||
(assoc-ref inputs input) |
(dep-path |
||||||
path)) |
(lambda (env modules path) |
||||||
,''()))))) |
(list env |
||||||
(out (assoc-ref outputs "out")) |
":" |
||||||
(bin (string-append out "/bin/")) |
'prefix |
||||||
(site (uncompiled-dir out ""))) |
(cons modules |
||||||
(match (scandir site) |
(map (lambda (input) |
||||||
(("." ".." version) |
(string-append |
||||||
(for-each |
(assoc-ref inputs input) |
||||||
(lambda (file) |
path)) |
||||||
(wrap-program |
,''()))))) |
||||||
(string-append bin file) |
(out (assoc-ref outputs "out")) |
||||||
(dep-path |
(bin (string-append out "/bin/")) |
||||||
"GUILE_LOAD_PATH" |
(site (uncompiled-dir out ""))) |
||||||
(uncompiled-dir out version) |
(match (scandir site) |
||||||
(uncompiled-dir "" version)) |
(("." ".." version) |
||||||
(dep-path |
(for-each |
||||||
"GUILE_LOAD_COMPILED_PATH" |
(lambda (file) |
||||||
(compiled-dir out version) |
(wrap-program |
||||||
(compiled-dir "" version)))) |
(string-append bin file) |
||||||
,''("bible-app" "word-counter" "bible2latex")) |
(dep-path |
||||||
#t)))))))) |
"GUILE_LOAD_PATH" |
||||||
(native-inputs |
(uncompiled-dir out version) |
||||||
`(("autoconf" ,autoconf) |
(uncompiled-dir "" version)) |
||||||
("automake" ,automake) |
(dep-path |
||||||
("pkg-config" ,pkg-config) |
"GUILE_LOAD_COMPILED_PATH" |
||||||
("texinfo" ,texinfo))) |
(compiled-dir out version) |
||||||
(inputs `(("guile" ,guile-3.0))) |
(compiled-dir "" version)))) |
||||||
(propagated-inputs `()) |
,''("bible-app" "word-counter" "bible2latex")) |
||||||
(synopsis "") |
#t)))))))) |
||||||
(description "") |
(native-inputs |
||||||
(home-page "") |
`(("autoconf" ,autoconf) |
||||||
(license license:gpl3+)) |
("automake" ,automake) |
||||||
|
("pkg-config" ,pkg-config) |
||||||
|
("texinfo" ,texinfo))) |
||||||
|
(inputs `(("guile" ,guile-3.0))) |
||||||
|
(propagated-inputs `()) |
||||||
|
(synopsis "") |
||||||
|
(description "") |
||||||
|
(home-page "") |
||||||
|
(license license:gpl3+))) |
||||||
|
|
||||||
|
bible-tools |
||||||
|
@ -0,0 +1,13 @@ |
|||||||
|
#!/bin/sh |
||||||
|
|
||||||
|
abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd`" |
||||||
|
abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd`" |
||||||
|
|
||||||
|
GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH" |
||||||
|
GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}:$GUILE_LOAD_PATH" |
||||||
|
export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH |
||||||
|
|
||||||
|
PATH="$abs_top_builddir/scripts:$PATH" |
||||||
|
export PATH |
||||||
|
|
||||||
|
exec "$@" |
@ -1,41 +0,0 @@ |
|||||||
#! /usr/bin/env sh |
|
||||||
exec guile -e '(@ (read-bible) main)' -s "$0" "$@" |
|
||||||
!# |
|
||||||
|
|
||||||
(define-module (read-bible) |
|
||||||
#:use-module (bible-tools) |
|
||||||
#:use-module (srfi srfi-1) |
|
||||||
#:use-module (srfi srfi-26) |
|
||||||
#:export (main)) |
|
||||||
|
|
||||||
(define (verse->string v) |
|
||||||
(string-append (book v) " " (chapter v) ":" (verse v) "\t" (text v))) |
|
||||||
|
|
||||||
(define (print-text txt) |
|
||||||
(for-each (lambda (str) (display str) (newline)) |
|
||||||
(map verse->string txt))) |
|
||||||
|
|
||||||
(define (help) |
|
||||||
(display "Usage: read-bible bible [-b book] [-c chapter] [-h] [-v]\n") |
|
||||||
(display "\t-b book\t\tthe book to read\n") |
|
||||||
(display "\t-c chapter\tthe chapter to read\n") |
|
||||||
(display "\t-h\t\tdisplay this help message\n") |
|
||||||
(display "\t-v\t\tdisplay the current version\n")) |
|
||||||
|
|
||||||
(define (version) |
|
||||||
(display "read-bible v1.0.0\n")) |
|
||||||
|
|
||||||
(define (main args) |
|
||||||
(define flag? (cut member <> args)) |
|
||||||
(define get (compose cadr flag?)) |
|
||||||
(define-syntax conf |
|
||||||
(syntax-rules (else) |
|
||||||
((_ (f e)... (else g)) (cond ((flag? f) e)... (else g))))) |
|
||||||
(with-bible (cadr args) |
|
||||||
(conf ("-h" (help)) |
|
||||||
("-v" (version)) |
|
||||||
("-b" (if (flag? "-c") |
|
||||||
(call-with-chapter (get "-b") (get "-c") |
|
||||||
print-text) |
|
||||||
(call-with-book (get "-b") print-text))) |
|
||||||
(else (help))))) |
|
Loading…
Reference in new issue