Compare commits
3 Commits
3edc7c57da
...
62337dec07
Author | SHA1 | Date |
---|---|---|
Silas Vedder | 62337dec07 | 2 years ago |
Silas Vedder | 834bc25705 | 2 years ago |
Silas Vedder | 230a6a9432 | 2 years ago |
15 changed files with 173 additions and 438 deletions
@ -1,89 +0,0 @@ |
|||||||
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)
|
|
@ -1,36 +0,0 @@ |
|||||||
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,95 +1,85 @@ |
|||||||
(use-modules (guix packages) |
(use-modules |
||||||
((guix licenses) |
(guix packages) |
||||||
#:prefix license:) |
((guix licenses) #:prefix license:) |
||||||
(guix download) |
(guix download) |
||||||
(guix git-download) |
(guix build-system gnu) |
||||||
(guix build-system gnu) |
(guix gexp) |
||||||
(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)) |
||||||
|
|
||||||
(define-public bible-tools |
(package |
||||||
(package |
(name "bible-tools") |
||||||
(name "bible-tools") |
(version "1.0") |
||||||
(version "1.0") |
(source (local-file "./bible-tools-1.0.tar.gz")) |
||||||
(source |
(build-system gnu-build-system) |
||||||
(origin |
(arguments |
||||||
(method git-fetch) |
`(#:modules |
||||||
(uri (git-reference |
((ice-9 match) |
||||||
(url "https://git.silasvedder.xyz/silasfox/bible-tools.git") |
(ice-9 ftw) |
||||||
(commit "bc925d8"))) |
,@%gnu-build-system-modules) |
||||||
(file-name "bible-tools-1.0-checkout") |
#:phases |
||||||
(sha256 (base32 "07221jw4gl48cg45znwjkc7871in3pfq488ig4vnbjygqbg4wawh")))) |
(modify-phases |
||||||
(build-system gnu-build-system) |
%standard-phases |
||||||
(arguments |
(add-after |
||||||
`(#:modules |
'install |
||||||
((ice-9 match) |
'hall-wrap-binaries |
||||||
(ice-9 ftw) |
(lambda* (#:key inputs outputs #:allow-other-keys) |
||||||
,@%gnu-build-system-modules) |
(let* ((compiled-dir |
||||||
#:phases |
(lambda (out version) |
||||||
(modify-phases |
(string-append |
||||||
%standard-phases |
out |
||||||
(add-after |
"/lib/guile/" |
||||||
'install |
version |
||||||
'hall-wrap-binaries |
"/site-ccache"))) |
||||||
(lambda* (#:key inputs outputs #:allow-other-keys) |
(uncompiled-dir |
||||||
(let* ((compiled-dir |
(lambda (out version) |
||||||
(lambda (out version) |
(string-append |
||||||
(string-append |
out |
||||||
out |
"/share/guile/site" |
||||||
"/lib/guile/" |
(if (string-null? version) "" "/") |
||||||
version |
version))) |
||||||
"/site-ccache"))) |
(dep-path |
||||||
(uncompiled-dir |
(lambda (env modules path) |
||||||
(lambda (out version) |
(list env |
||||||
(string-append |
":" |
||||||
out |
'prefix |
||||||
"/share/guile/site" |
(cons modules |
||||||
(if (string-null? version) "" "/") |
(map (lambda (input) |
||||||
version))) |
(string-append |
||||||
(dep-path |
(assoc-ref inputs input) |
||||||
(lambda (env modules path) |
path)) |
||||||
(list env |
,''()))))) |
||||||
":" |
(out (assoc-ref outputs "out")) |
||||||
'prefix |
(bin (string-append out "/bin/")) |
||||||
(cons modules |
(site (uncompiled-dir out ""))) |
||||||
(map (lambda (input) |
(match (scandir site) |
||||||
(string-append |
(("." ".." version) |
||||||
(assoc-ref inputs input) |
(for-each |
||||||
path)) |
(lambda (file) |
||||||
,''()))))) |
(wrap-program |
||||||
(out (assoc-ref outputs "out")) |
(string-append bin file) |
||||||
(bin (string-append out "/bin/")) |
(dep-path |
||||||
(site (uncompiled-dir out ""))) |
"GUILE_LOAD_PATH" |
||||||
(match (scandir site) |
(uncompiled-dir out version) |
||||||
(("." ".." version) |
(uncompiled-dir "" version)) |
||||||
(for-each |
(dep-path |
||||||
(lambda (file) |
"GUILE_LOAD_COMPILED_PATH" |
||||||
(wrap-program |
(compiled-dir out version) |
||||||
(string-append bin file) |
(compiled-dir "" version)))) |
||||||
(dep-path |
,''("bible-app" "word-counter" "bible2latex")) |
||||||
"GUILE_LOAD_PATH" |
#t)))))))) |
||||||
(uncompiled-dir out version) |
(native-inputs |
||||||
(uncompiled-dir "" version)) |
`(("autoconf" ,autoconf) |
||||||
(dep-path |
("automake" ,automake) |
||||||
"GUILE_LOAD_COMPILED_PATH" |
("pkg-config" ,pkg-config) |
||||||
(compiled-dir out version) |
("texinfo" ,texinfo))) |
||||||
(compiled-dir "" version)))) |
(inputs `(("guile" ,guile-3.0))) |
||||||
,''("bible-app" "word-counter" "bible2latex")) |
(propagated-inputs `()) |
||||||
#t)))))))) |
(synopsis "") |
||||||
(native-inputs |
(description "") |
||||||
`(("autoconf" ,autoconf) |
(home-page "") |
||||||
("automake" ,automake) |
(license license:gpl3+)) |
||||||
("pkg-config" ,pkg-config) |
|
||||||
("texinfo" ,texinfo))) |
|
||||||
(inputs `(("guile" ,guile-3.0))) |
|
||||||
(propagated-inputs `()) |
|
||||||
(synopsis "") |
|
||||||
(description "") |
|
||||||
(home-page "") |
|
||||||
(license license:gpl3+))) |
|
||||||
|
|
||||||
bible-tools |
|
||||||
|
@ -1,13 +0,0 @@ |
|||||||
#!/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 "$@" |
|
@ -0,0 +1,41 @@ |
|||||||
|
#! /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