diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index fc4aeeb37e..76acb2da81 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -3,6 +3,25 @@ SUBDIRS = . overrides test AM_CFLAGS = -I${top_builddir} ${GLIB_CFLAGS} +bin_PROGRAMS = gnucash-bin +gnucash_bin_SOURCES = gnucash-bin.c +gnucash_bin_LDADD = ${GUILE_LIBS} ${GLIB_LIBS} + +gnucash: gnucash.in ${top_builddir}/config.status + rm -f $@.tmp + sed < $< > $@.tmp \ + -e 's:@-BIN_DIR-@:${bindir}:g' \ + -e 's:@-G_WRAP_MODULE_DIR-@:${G_WRAP_MODULE_DIR}:g' \ + -e 's:@-G_WRAP_LIB_DIR-@:${G_WRAP_LIB_DIR}:g' \ + -e 's:@-GNC_GUILE_MODULE_DIR-@:${GNC_SHAREDIR}/guile-modules:g' \ + -e 's:@-GNC_SCM_INSTALL_DIR-@:${GNC_SCM_INSTALL_DIR}:g' \ + -e 's:@-GNC_LIB_INSTALLDIR-@:${libdir}:' \ + -e 's:@-GNC_PKGLIB_INSTALLDIR-@:${pkglibdir}:g' \ + -e 's:@-GNC_MODULE_DIR-@:${GNC_MODULE_DIR}:g' + mv $@.tmp $@ + chmod u+x $@ +CLEANFILES = gnucash + # We handle gnucash scripts in a somewhat unexpected way, but we do # this so that a user who doesn't necessarily have the right # directories in their path can still invoke these commands via their @@ -18,9 +37,9 @@ AM_CFLAGS = -I${top_builddir} ${GLIB_CFLAGS} # For testing and other reasons, overrides/* scripts should not modify # the path to re-insert the overrides dir. This should only be done # by these top-level "common" scripts. -gnc_common_scripts = gnucash gnucash-env gnucash-run-script gnucash-make-guids +gnc_common_scripts = gnucash-env gnucash-run-script gnucash-make-guids -bin_SCRIPTS = ${gnc_common_scripts} update-gnucash-gconf +bin_SCRIPTS = ${gnc_common_scripts} update-gnucash-gconf gnucash # if you change gncoverridedir, make sure you change ./overrides/Makefile.am too. gncoverridesdir = ${GNC_LIBEXECDIR}/overrides @@ -31,7 +50,7 @@ EXTRA_DIST = generate-gnc-script update-gnucash-gconf.in ${gnc_common_scripts}: generate-gnc-script ${top_builddir}/config.status ${srcdir}/generate-gnc-script $@ "${gncoverridesdir}" -CLEANFILES = ${gnc_common_scripts} update-gnucash-gconf +CLEANFILES += ${gnc_common_scripts} update-gnucash-gconf ## We borrow guile's convention and use @-...-@ as the substitution ## brackets here, instead of the usual @...@. This prevents autoconf diff --git a/src/bin/gnucash-bin.c b/src/bin/gnucash-bin.c new file mode 100644 index 0000000000..96c4ac6ef1 --- /dev/null +++ b/src/bin/gnucash-bin.c @@ -0,0 +1,43 @@ +/* + * gnucash-bin.c -- The program entry point for GnuCash + * + * Copyright (C) 2006 Chris Shoemaker + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, contact: + * + * Free Software Foundation Voice: +1-617-542-5942 + * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 + * Boston, MA 02110-1301, USA gnu@gnu.org + */ + +#include +#include +#include +#include "glib.h" + +static void +inner_main (void *closure, int argc, char **argv) +{ + /* module initializations would go here */ + //scm_c_eval_string("(display %load-path)"); + scm_c_eval_string("(use-modules (gnucash main))"); + scm_c_eval_string("(gnc:main)"); + return; +} + +int main(int argc, char ** argv) +{ + scm_boot_guile(argc, argv, inner_main, 0); + exit(0); /* never reached */ +} diff --git a/src/bin/gnucash.in b/src/bin/gnucash.in new file mode 100644 index 0000000000..695f15f2f4 --- /dev/null +++ b/src/bin/gnucash.in @@ -0,0 +1,29 @@ +#!/bin/sh + +PATH="@-BIN_DIR-@:${PATH}" +export PATH + +GUILE_WARN_DEPRECATED="no" +export GUILE_WARN_DEPRECATED + +GNC_MODULE_PATH="@-GNC_PKGLIB_INSTALLDIR-@:${GNC_MODULE_PATH}" + +EXTRA_PATH="@-G_WRAP_MODULE_DIR-@" +EXTRA_PATH="${EXTRA_PATH}:@-GNC_GUILE_MODULE_DIR-@" +EXTRA_PATH="${EXTRA_PATH}:@-GNC_SCM_INSTALL_DIR-@" +GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}" + +EXTRA_LIBS="${GNC_MODULE_PATH}" +EXTRA_LIBS="${EXTRA_LIBS}:@-GNC_LIB_INSTALLDIR-@" +EXTRA_LIBS="${EXTRA_LIBS}:@-GNC_MODULE_DIR-@" +EXTRA_LIBS="${EXTRA_LIBS}:@-G_WRAP_LIB_DIR-@" + +LD_LIBRARY_PATH="${EXTRA_LIBS}:${LD_LIBRARY_PATH}" +LTDL_LIBRARY_PATH="${EXTRA_LIBS}:${LTDL_LIBRARY_PATH}" + +export GNC_MODULE_PATH +export GUILE_LOAD_PATH +export LD_LIBRARY_PATH +export LTDL_LIBRARY_PATH + +gnucash-bin "$@"