From 8bb78aa15416a0f19c9ea56b9fc20849034d0433 Mon Sep 17 00:00:00 2001 From: R. Mattes
Date: Wed, 11 May 2011 22:34:33 +0200 Subject: [PATCH 1/2] Extend guile's load path to honor a denemo specific load path. --- configure.in | 6 ++++++ src/Makefile.am | 13 +++++++++---- src/view.c | 22 ++++++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/configure.in b/configure.in index c63c53b..52b0dfe 100644 --- a/configure.in +++ b/configure.in @@ -198,6 +198,12 @@ packagesrcdir=`cd $srcdir && pwd` AC_DEFINE_UNQUOTED( PACKAGE_SOURCE_DIR, "${packagesrcdir}", [set package source dir]) +dnl path magic for denemo guile modules +denemo_load_path=${PACKAGE_DATA_DIR}/modules +denemo_bin_path=${libdir}/${PACKAGE}/modules +AC_SUBST(denemo_load_path) +AC_SUBST(denemo_bin_path) + dnl Gettext stuff AC_SUBST(CFLAGS) diff --git a/src/Makefile.am b/src/Makefile.am index 26a625a..7737e7c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -45,7 +45,8 @@ denemo_SOURCES = articulations.c calculatepositions.c changenotehead.c \ pitchentry.c pitchrecog.c audiocapture.c pitchentry.h audio.h \ drawlilydir.c lilydirectives.h lilydirectives.c keysigdialog.h \ callbacks.h entries.h \ - scheme_cb.h scheme.h register_commands.h + scheme_cb.h scheme.h register_commands.h \ + denemo-paths.h localedir = $(datadir)/locale INCLUDES = -I../intl -I$(top_srcdir)/intl -I$(top_srcdir)/include \ @@ -61,9 +62,13 @@ INCLUDES = -I../intl -I$(top_srcdir)/intl -I$(top_srcdir)/include \ denemo_LDADD = $(INTLLIBS) ../libsmf/libsmf.a AM_CPPFLAGS = $(BINRELOC_CFLAGS) +denemo-paths.h: $(top_builddir)/config.status + @echo "Generating denemo-path.h..." + @echo '#define DENEMO_LOAD_PATH "@denemo_load_path@"' >$@ + @echo '#define DENEMO_BIN_PATH "@denemo_bin_path@"' >>$@ + @mv denemo-path.tmp $@ - +noinst_HEADERS = parseinstruments.h keyboard.h denemo-paths.h - -noinst_HEADERS = parseinstruments.h keyboard.h +DISTCLEANFILES: denemo-path.h diff --git a/src/view.c b/src/view.c index 0f4ffbe..aff2b2c 100644 --- a/src/view.c +++ b/src/view.c @@ -47,6 +47,7 @@ #include "prefops.h" #define INIT_SCM "init.scm" +#include "denemo-paths.h" static GtkWidget *playbutton; static GtkWidget *recordbutton; @@ -4802,6 +4803,27 @@ void inner_main(void*closure, int argc, char **argv){ gint i; GError *error = NULL; + /* initialize guile core */ + { + SCM load_path; + char *user_path; + + /* we assume a normal guile with %load-path always be present */ + load_path = scm_c_lookup("%load-path"); + + scm_variable_set_x(load_path, + scm_cons(scm_from_locale_string(DENEMO_LOAD_PATH), + scm_variable_ref(load_path))); + + /* consider user-specified path extension */ + user_path = getenv("DENEMO_LOAD_PATH"); + if (user_path) { + scm_variable_set_x(load_path, + scm_cons(scm_from_locale_string(user_path), + scm_variable_ref(load_path))); + } + } + rsvg_init(); -- 1.7.2.3