mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Invert the program entry point.
'gnucash' is now a shell script that calls the executable 'gnucash-bin' which uses libguile to load guile modules. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12252 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
157676f39b
commit
f301cae679
@ -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
|
||||
|
43
src/bin/gnucash-bin.c
Normal file
43
src/bin/gnucash-bin.c
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* gnucash-bin.c -- The program entry point for GnuCash
|
||||
*
|
||||
* Copyright (C) 2006 Chris Shoemaker <c.shoemaker@cox.net>
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <libguile.h>
|
||||
#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 */
|
||||
}
|
29
src/bin/gnucash.in
Normal file
29
src/bin/gnucash.in
Normal file
@ -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 "$@"
|
Loading…
Reference in New Issue
Block a user