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) |
||||
((guix licenses) |
||||
#:prefix license:) |
||||
(guix download) |
||||
(guix git-download) |
||||
(guix build-system gnu) |
||||
(gnu packages) |
||||
(gnu packages autotools) |
||||
(gnu packages guile) |
||||
(gnu packages guile-xyz) |
||||
(gnu packages pkg-config) |
||||
(gnu packages texinfo)) |
||||
(use-modules |
||||
(guix packages) |
||||
((guix licenses) #:prefix license:) |
||||
(guix download) |
||||
(guix build-system gnu) |
||||
(guix gexp) |
||||
(gnu packages) |
||||
(gnu packages autotools) |
||||
(gnu packages guile) |
||||
(gnu packages guile-xyz) |
||||
(gnu packages pkg-config) |
||||
(gnu packages texinfo)) |
||||
|
||||
(define-public bible-tools |
||||
(package |
||||
(name "bible-tools") |
||||
(version "1.0") |
||||
(source |
||||
(origin |
||||
(method git-fetch) |
||||
(uri (git-reference |
||||
(url "https://git.silasvedder.xyz/silasfox/bible-tools.git") |
||||
(commit "bc925d8"))) |
||||
(file-name "bible-tools-1.0-checkout") |
||||
(sha256 (base32 "07221jw4gl48cg45znwjkc7871in3pfq488ig4vnbjygqbg4wawh")))) |
||||
(build-system gnu-build-system) |
||||
(arguments |
||||
`(#:modules |
||||
((ice-9 match) |
||||
(ice-9 ftw) |
||||
,@%gnu-build-system-modules) |
||||
#:phases |
||||
(modify-phases |
||||
%standard-phases |
||||
(add-after |
||||
'install |
||||
'hall-wrap-binaries |
||||
(lambda* (#:key inputs outputs #:allow-other-keys) |
||||
(let* ((compiled-dir |
||||
(lambda (out version) |
||||
(string-append |
||||
out |
||||
"/lib/guile/" |
||||
version |
||||
"/site-ccache"))) |
||||
(uncompiled-dir |
||||
(lambda (out version) |
||||
(string-append |
||||
out |
||||
"/share/guile/site" |
||||
(if (string-null? version) "" "/") |
||||
version))) |
||||
(dep-path |
||||
(lambda (env modules path) |
||||
(list env |
||||
":" |
||||
'prefix |
||||
(cons modules |
||||
(map (lambda (input) |
||||
(string-append |
||||
(assoc-ref inputs input) |
||||
path)) |
||||
,''()))))) |
||||
(out (assoc-ref outputs "out")) |
||||
(bin (string-append out "/bin/")) |
||||
(site (uncompiled-dir out ""))) |
||||
(match (scandir site) |
||||
(("." ".." version) |
||||
(for-each |
||||
(lambda (file) |
||||
(wrap-program |
||||
(string-append bin file) |
||||
(dep-path |
||||
"GUILE_LOAD_PATH" |
||||
(uncompiled-dir out version) |
||||
(uncompiled-dir "" version)) |
||||
(dep-path |
||||
"GUILE_LOAD_COMPILED_PATH" |
||||
(compiled-dir out version) |
||||
(compiled-dir "" version)))) |
||||
,''("bible-app" "word-counter" "bible2latex")) |
||||
#t)))))))) |
||||
(native-inputs |
||||
`(("autoconf" ,autoconf) |
||||
("automake" ,automake) |
||||
("pkg-config" ,pkg-config) |
||||
("texinfo" ,texinfo))) |
||||
(inputs `(("guile" ,guile-3.0))) |
||||
(propagated-inputs `()) |
||||
(synopsis "") |
||||
(description "") |
||||
(home-page "") |
||||
(license license:gpl3+))) |
||||
|
||||
bible-tools |
||||
(package |
||||
(name "bible-tools") |
||||
(version "1.0") |
||||
(source (local-file "./bible-tools-1.0.tar.gz")) |
||||
(build-system gnu-build-system) |
||||
(arguments |
||||
`(#:modules |
||||
((ice-9 match) |
||||
(ice-9 ftw) |
||||
,@%gnu-build-system-modules) |
||||
#:phases |
||||
(modify-phases |
||||
%standard-phases |
||||
(add-after |
||||
'install |
||||
'hall-wrap-binaries |
||||
(lambda* (#:key inputs outputs #:allow-other-keys) |
||||
(let* ((compiled-dir |
||||
(lambda (out version) |
||||
(string-append |
||||
out |
||||
"/lib/guile/" |
||||
version |
||||
"/site-ccache"))) |
||||
(uncompiled-dir |
||||
(lambda (out version) |
||||
(string-append |
||||
out |
||||
"/share/guile/site" |
||||
(if (string-null? version) "" "/") |
||||
version))) |
||||
(dep-path |
||||
(lambda (env modules path) |
||||
(list env |
||||
":" |
||||
'prefix |
||||
(cons modules |
||||
(map (lambda (input) |
||||
(string-append |
||||
(assoc-ref inputs input) |
||||
path)) |
||||
,''()))))) |
||||
(out (assoc-ref outputs "out")) |
||||
(bin (string-append out "/bin/")) |
||||
(site (uncompiled-dir out ""))) |
||||
(match (scandir site) |
||||
(("." ".." version) |
||||
(for-each |
||||
(lambda (file) |
||||
(wrap-program |
||||
(string-append bin file) |
||||
(dep-path |
||||
"GUILE_LOAD_PATH" |
||||
(uncompiled-dir out version) |
||||
(uncompiled-dir "" version)) |
||||
(dep-path |
||||
"GUILE_LOAD_COMPILED_PATH" |
||||
(compiled-dir out version) |
||||
(compiled-dir "" version)))) |
||||
,''("bible-app" "word-counter" "bible2latex")) |
||||
#t)))))))) |
||||
(native-inputs |
||||
`(("autoconf" ,autoconf) |
||||
("automake" ,automake) |
||||
("pkg-config" ,pkg-config) |
||||
("texinfo" ,texinfo))) |
||||
(inputs `(("guile" ,guile-3.0))) |
||||
(propagated-inputs `()) |
||||
(synopsis "") |
||||
(description "") |
||||
(home-page "") |
||||
(license license:gpl3+)) |
||||
|
@ -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