diff --git a/macros/ltoptions.m4 b/macros/ltoptions.m4 index b0b5e9c..94b0829 100644 --- a/macros/ltoptions.m4 +++ b/macros/ltoptions.m4 @@ -1,7 +1,7 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free -# Software Foundation, Inc. +# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software +# Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives diff --git a/macros/ltsugar.m4 b/macros/ltsugar.m4 index 902508b..48bc934 100644 --- a/macros/ltsugar.m4 +++ b/macros/ltsugar.m4 @@ -1,6 +1,6 @@ # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007-2008, 2011-2019, 2021-2022 Free Software +# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # diff --git a/macros/ltversion.m4 b/macros/ltversion.m4 index 0026c21..fa04b52 100644 --- a/macros/ltversion.m4 +++ b/macros/ltversion.m4 @@ -1,7 +1,6 @@ # ltversion.m4 -- version numbers -*- Autoconf -*- # -# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation, -# Inc. +# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives @@ -10,15 +9,15 @@ # @configure_input@ -# serial 4249 ltversion.m4 +# serial 4179 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.4.7.4-1ec8f-dirty]) -m4_define([LT_PACKAGE_REVISION], [2.4.7.4]) +m4_define([LT_PACKAGE_VERSION], [2.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.7.4-1ec8f-dirty' -macro_revision='2.4.7.4' +[macro_version='2.4.6' +macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/macros/lt~obsolete.m4 b/macros/lt~obsolete.m4 index 0f7a875..c6b26f8 100644 --- a/macros/lt~obsolete.m4 +++ b/macros/lt~obsolete.m4 @@ -1,7 +1,7 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free -# Software Foundation, Inc. +# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software +# Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives diff --git a/scheme/scribbu.scm b/scheme/scribbu.scm index 760c897..0505b82 100644 --- a/scheme/scribbu.scm +++ b/scheme/scribbu.scm @@ -34,6 +34,10 @@ unknown-frame album-frame artist-frame has-frame? get-frames)) +;; Load the Scheme extension in `libscribbu.so` & invoke `init_scribbu()` therein to define types & +;; functions. Nb. These definitions will be in module `(scribbu)`. +(load-extension "libscribbu" "init_scribbu") + (use-modules (ice-9 ftw)) (use-modules (ice-9 match)) (use-modules (rnrs bytevectors)) diff --git a/scribbu/scheme.cc b/scribbu/scheme.cc index 2fc4947..944e265 100644 --- a/scribbu/scheme.cc +++ b/scribbu/scheme.cc @@ -758,6 +758,30 @@ extern "C" { } + /// Define our types & functions at the top level of the current module + void + init_scribbu() + { + + scribbu::init_symbols(); + +# ifndef SCM_MAGIC_SNARFER +# include "scheme.x" +# endif + + scm_c_export(READ_ID3V1_TAG, READ_TAGSET, WITH_TRACK_IN, WRITE_ID3V1_TAG, + WRITE_TAGSET, nullptr); + + } + + /// Define our types & functions in the current module-- this function is + /// just a shim to allow us to initialize this from either the Guile REPL or + /// when loading the extension from Scheme. + void + init_scribbu_shim(void*) { + init_scribbu(); + } + SCM get_version_variable(void*) { @@ -854,16 +878,11 @@ extern "C" { { const init_guile *pig = reinterpret_cast(praw); - scribbu::init_symbols(); - -# ifndef SCM_MAGIC_SNARFER -# include "scheme.x" -# endif - + // scm_c_define_module("scribbu-int", init_scribbu_shim, nullptr); customize_welcome(); customize_load_path(pig->datadir_); - return 0; + return nullptr; } } // End extern "C". diff --git a/test/Makefile.am b/test/Makefile.am index 78a7776..332370c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,3 +1,5 @@ +AM_TESTS_ENVIRONMENT = \ + abs_top_builddir=$(abs_top_builddir) check_PROGRAMS = unit SUBDIRS = data EXTRA_DIST = test-util test-split test-rename test-report test-report-tdf \ @@ -7,7 +9,7 @@ EXTRA_DIST = test-util test-split test-rename test-report test-report-tdf \ test-tagsets-from-scheme.scm test-tagsets-from-scheme \ test-frames-from-scheme.scm test-frames-from-scheme \ test-scripting test-options test-popm test-xtag test-text test-genre \ - test-m3u + test-m3u test-snarfed-in-scribbu CLEANFILES = id3v20B id3v21B report.last.csv report-tdf.last.tdf \ report.csv report-last.csv report-tdf.tdf \ id3v20A trackB id3v1A trackA \ @@ -34,7 +36,8 @@ TESTS = $(check_PROGRAMS) test-split test-rename test-report test-report-tdf \ test-dump test-with-track-in test-fs-generator \ test-cleanup-encoded-by test-cleanup-from-audacity \ test-tagsets-from-scheme test-frames-from-scheme test-scripting \ - test-options test-popm test-xtag test-text test-genre test-m3u + test-options test-popm test-xtag test-text test-genre test-m3u \ + test-snarfed-in-scribbu unit_SOURCES = unit.cc unit.hh charsets.cc ostream.cc id3v1.cc framesv2.cc \ framesv22.cc framesv23.cc framesv24.cc id3v2.cc id3v22.cc id3v23.cc \ id3v24.cc id3v2-utils.cc pprinter.cc csv-pprinter.cc mp3.cc tdf-pprinter.cc \ diff --git a/test/id3v2.cc b/test/id3v2.cc index fabeed2..f5d11d7 100644 --- a/test/id3v2.cc +++ b/test/id3v2.cc @@ -21,6 +21,7 @@ * */ +#include #include #include "unit.hh" diff --git a/test/test-fs-generator b/test/test-fs-generator index 4150d8e..258b9a1 100755 --- a/test/test-fs-generator +++ b/test/test-fs-generator @@ -2,4 +2,4 @@ testdir=/tmp/scribbu-test/scheme mkdir -p $testdir/a/b touch $testdir/foo $testdir/a/bar $testdir/a/b/splat -guile -L ${srcdir}/../scheme -s ${srcdir}/test-fs-generator.scm +LD_LIBRARY_PATH=${abs_top_builddir}/scribbu/.libs guile -L ${srcdir}/../scheme -s ${srcdir}/test-fs-generator.scm diff --git a/test/test-fs-generator.scm b/test/test-fs-generator.scm index 8c19c27..9ee84af 100644 --- a/test/test-fs-generator.scm +++ b/test/test-fs-generator.scm @@ -20,7 +20,6 @@ ;;;; ;;;; - (use-modules (scribbu)) (define test-dir "/tmp/scribbu-test/scheme") (define G (fs-tree-generator test-dir)) diff --git a/test/test-snarfed-in-scribbu b/test/test-snarfed-in-scribbu new file mode 100755 index 0000000..c4561ae --- /dev/null +++ b/test/test-snarfed-in-scribbu @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +tmpfile=/tmp/test-scripting.scm +scribbu_dir=`cd ../src; pwd` +lib_dir=`cd ../scribbu; pwd` +case `uname` in + Linux) + echo "#!${scribbu_dir}/scribbu \\" > $tmpfile;; + Darwin) + # Workaround for MacOS-- should be; for some reason I don't + # understand (and don't care to debug), the `src/scribbu' + # libtool script doesn't work well with the extended #! line + # I use below. So, I call the MacOS binary directly, being careful + # to set DYLD_LIBRARY_PATH (like the libtool script would) + # so that we load the .so under test and not any previously installed + # version. + echo "#!${scribbu_dir}/.libs/scribbu \\" > $tmpfile; + export DYLD_LIBRARY_PATH=$lib_dir/.libs:$DYLD_LIBRARY_PATH;; + *) + echo "Unknown system" 2>&1; + exit 1;; +esac + +cat >> $tmpfile< >(t_err=$(cat); typeset -p t_err) \ + > >(t_std=$(cat); typeset -p t_std) )" +t_stat=$? +t_err=$(echo "$t_err" | grep -vE ';;; note: source file /tmp/test-scripting.scm' | grep -v 'newer than compiled') +if [ $t_stat -ne 0 ]; then + >&2 echo "Non-zero exit code ($t_stat)." + echo "stdout:" + echo "$t_std" + echo "stderr:" + echo "$t_err" + exit 1 +fi + +if [ "${t_err}" !~ "Unbound variable: read-id3v1-tag" ]; then + >&2 echo "Unexpected stderr" + echo "stdout:" + echo "$t_std" + echo "stderr:" + echo "$t_err" + exit 1 +fi