[Gnucash-changes] r12252 - gnucash/trunk/src/bin - Invert the program entry point.

Chris Shoemaker chris at cvs.gnucash.org
Tue Jan 3 18:49:40 EST 2006


Author: chris
Date: 2006-01-03 18:49:39 -0500 (Tue, 03 Jan 2006)
New Revision: 12252
Trac: http://svn.gnucash.org/trac/changeset/12252

Added:
   gnucash/trunk/src/bin/gnucash-bin.c
   gnucash/trunk/src/bin/gnucash.in
Modified:
   gnucash/trunk/src/bin/Makefile.am
Log:
Invert the program entry point.

'gnucash' is now a shell script that calls the executable
'gnucash-bin' which uses libguile to load guile modules.


Modified: gnucash/trunk/src/bin/Makefile.am
===================================================================
--- gnucash/trunk/src/bin/Makefile.am	2006-01-03 22:22:08 UTC (rev 12251)
+++ gnucash/trunk/src/bin/Makefile.am	2006-01-03 23:49:39 UTC (rev 12252)
@@ -3,6 +3,25 @@
 
 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 @@
 # 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 @@
 ${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 @... at .  This prevents autoconf

Added: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c	2006-01-03 22:22:08 UTC (rev 12251)
+++ gnucash/trunk/src/bin/gnucash-bin.c	2006-01-03 23:49:39 UTC (rev 12252)
@@ -0,0 +1,43 @@
+/*
+ * gnucash-bin.c -- The program entry point for GnuCash
+ *
+ * Copyright (C) 2006 Chris Shoemaker <c.shoemaker at 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 at 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 */
+}

Added: gnucash/trunk/src/bin/gnucash.in
===================================================================
--- gnucash/trunk/src/bin/gnucash.in	2006-01-03 22:22:08 UTC (rev 12251)
+++ gnucash/trunk/src/bin/gnucash.in	2006-01-03 23:49:39 UTC (rev 12252)
@@ -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 "$@"



More information about the gnucash-changes mailing list