From 57ceef742182d6f0d1f7844256863a37c2d80d6a Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Tue, 24 Nov 2009 23:53:37 +0000 Subject: [PATCH] - Get VPATH build to work - Get test programs to run under VPATH build tree - Get 'make distcheck' to pass git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@183 ddfedd41-794f-dd11-ae45-00112f111e67 --- configure.ac | 2 +- docs/reference/Makefile.am | 43 +++++++++++++++++---------------- interpreters/git/Makefile.am | 2 +- interpreters/nitfol/Makefile.am | 17 ++++++------- interpreters/nitfol/nitfol.info | 33 +++++++++++++------------ libchimara/Makefile.am | 1 + libchimara/chimara-glk.c | 3 ++- libchimara/chimara-if.c | 7 +++++- libchimara/style.c | 43 ++++++++++++++++++--------------- po/POTFILES.in | 4 ++- po/POTFILES.skip | 2 +- tests/Makefile.am | 3 ++- tests/glulxercise.c | 7 ++++-- tests/main.c | 4 +-- 14 files changed, 94 insertions(+), 77 deletions(-) diff --git a/configure.ac b/configure.ac index 53db319..18f9d5f 100644 --- a/configure.ac +++ b/configure.ac @@ -44,7 +44,7 @@ AC_PROG_LIBTOOL # Old way of declaring Libtool AM_GNU_GETTEXT([external]) # Gettext, link to system libintl IT_PROG_INTLTOOL # Intltool PKG_PROG_PKG_CONFIG # pkg_config -GTK_DOC_CHECK(1.9) # Gtk-Doc +GTK_DOC_CHECK(1.11) # Gtk-Doc 1.11 required # Other utilities used in this package's various make scripts AC_PROG_AWK AC_PATH_PROG([PERL], [perl]) # Perl diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index f7f5ee5..c039fb8 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -33,7 +33,8 @@ MKDB_OPTIONS = --sgml-mode --output-format=xml MKTMPL_OPTIONS = # Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS = +# The --path is because Gtk-doc is broken on non-distcheck vpath builds! Sigh. +MKHTML_OPTIONS = --path="$(abs_builddir)" # Extra options to supply to gtkdoc-fixref. Not normally needed. FIXXREF_OPTIONS = @@ -51,26 +52,26 @@ IGNORE_HFILES = chimara-glk-private.h \ # Images to copy into HTML directory. HTML_IMAGES = \ - $(srcdir)/images/fig1.png \ - $(srcdir)/images/fig2.png \ - $(srcdir)/images/fig3a.png \ - $(srcdir)/images/fig3b.png \ - $(srcdir)/images/fig3c.png \ - $(srcdir)/images/fig4a.png \ - $(srcdir)/images/fig4b.png \ - $(srcdir)/images/fig4c.png \ - $(srcdir)/images/fig5-7a.png \ - $(srcdir)/images/fig6.png \ - $(srcdir)/images/fig7b.png \ - $(srcdir)/images/fig7c.png \ - $(srcdir)/images/fig7d.png \ - $(srcdir)/images/fig7e.png \ - $(srcdir)/images/fig8a.png \ - $(srcdir)/images/fig8b.png \ - $(srcdir)/images/fig8c.png \ - $(srcdir)/images/fig9.png \ - $(srcdir)/images/fig10.png \ - $(srcdir)/images/fig11.png + images/fig1.png \ + images/fig2.png \ + images/fig3a.png \ + images/fig3b.png \ + images/fig3c.png \ + images/fig4a.png \ + images/fig4b.png \ + images/fig4c.png \ + images/fig5-7a.png \ + images/fig6.png \ + images/fig7b.png \ + images/fig7c.png \ + images/fig7d.png \ + images/fig7e.png \ + images/fig8a.png \ + images/fig8b.png \ + images/fig8c.png \ + images/fig9.png \ + images/fig10.png \ + images/fig11.png # Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). content_files = version.xml \ diff --git a/interpreters/git/Makefile.am b/interpreters/git/Makefile.am index ac41315..a2825d4 100644 --- a/interpreters/git/Makefile.am +++ b/interpreters/git/Makefile.am @@ -21,7 +21,7 @@ git_la_LDFLAGS = -module $(PLUGIN_LIBTOOL_FLAGS) gitdocdir = $(datadir)/doc/$(PACKAGE)/git dist_gitdoc_DATA = README.txt -CLEANFILES = test/*.tmp +CLEANFILES = version.h test/*.tmp #TESTS = test/test.sh \ # test/Alabaster.gblorb test/Alabaster.walk test/Alabaster.golden diff --git a/interpreters/nitfol/Makefile.am b/interpreters/nitfol/Makefile.am index c1031b1..da18211 100644 --- a/interpreters/nitfol/Makefile.am +++ b/interpreters/nitfol/Makefile.am @@ -10,13 +10,12 @@ dist_noinst_SCRIPTS = copying.awk opt2glkc.pl y2help.pl pkglib_LTLIBRARIES = nitfol.la nitfol_la_SOURCES = automap.c automap.h binary.h copying.h debug.c debug.h \ decode.c decode.h errmesg.c errmesg.h globals.c globals.h hash.c hash.h \ - iff.c iff.h infix.c infix.h inform.y inform.h init.c init.h io.c \ - linkevil.h main.c main.h nio.h nitfol.h no_blorb.h objects.c objects.h \ - op_call.c op_call.h op_jmp.c op_jmp.h oplist.c oplist.h op_math.c \ - op_math.h op_save.c op_save.h op_table.c op_table.h op_v6.c op_v6.h \ - portfunc.c portfunc.h quetzal.c quetzal.h solve.c solve.h stack.c stack.h \ - struct.c struct.h tokenise.c tokenise.h undo.c undo.h z_io.c z_io.h \ - zscii.c zscii.h \ + iff.c iff.h infix.c infix.h inform.y inform.h init.c init.h io.c io.h \ + linkevil.h main.c main.h nitfol.h no_blorb.h objects.c objects.h op_call.c \ + op_call.h op_jmp.c op_jmp.h oplist.c oplist.h op_math.c op_math.h \ + op_save.c op_save.h op_table.c op_table.h op_v6.c op_v6.h portfunc.c \ + portfunc.h quetzal.c quetzal.h solve.c solve.h stack.c stack.h struct.c \ + struct.h tokenise.c tokenise.h undo.c undo.h z_io.c z_io.h zscii.c zscii.h \ $(GRAPHICS) \ $(BLORB) \ $(SOUND) @@ -29,8 +28,8 @@ info_TEXINFOS = nitfol.texi nitfol_TEXINFOS = dbg_help.texi options.texi # man_MANS = nitfol.6 -BUILT_SOURCES = copying.c dbg_help.h startunix.c -CLEANFILES = $(BUILT_SOURCES) dbg_help.texi nitfol.6 options.texi +BUILT_SOURCES = copying.c dbg_help.h startunix.c dbg_help.texi options.texi +CLEANFILES = $(BUILT_SOURCES) nitfol.6 dbg_help.h: inform.y y2help.pl $(PERL) $(srcdir)/y2help.pl $(srcdir)/inform.y diff --git a/interpreters/nitfol/nitfol.info b/interpreters/nitfol/nitfol.info index 2697079..fba02cc 100644 --- a/interpreters/nitfol/nitfol.info +++ b/interpreters/nitfol/nitfol.info @@ -1,4 +1,5 @@ -This is nitfol.info, produced by makeinfo version 4.13 from nitfol.texi. +This is ../../../interpreters/nitfol/nitfol.info, produced by makeinfo +version 4.13 from ../../../interpreters/nitfol/nitfol.texi. INFO-DIR-SECTION Games START-INFO-DIR-ENTRY @@ -1056,20 +1057,20 @@ File: nitfol.info, Node: Games Cited, Prev: Thanks, Up: Top  Tag Table: -Node: Top205 -Node: Invoking nitfol1544 -Node: Features8420 -Node: Preferences9069 -Node: Infinite undo/redo10425 -Node: Aliases11199 -Node: Abbreviation Expansion13723 -Node: Typo correction14840 -Node: Automapping16754 -Node: Quetzal22533 -Node: Blorb24254 -Node: Debugger24680 -Node: Bugs31655 -Node: Thanks34710 -Node: Games Cited35126 +Node: Top263 +Node: Invoking nitfol1602 +Node: Features8478 +Node: Preferences9127 +Node: Infinite undo/redo10483 +Node: Aliases11257 +Node: Abbreviation Expansion13781 +Node: Typo correction14898 +Node: Automapping16812 +Node: Quetzal22591 +Node: Blorb24312 +Node: Debugger24738 +Node: Bugs31713 +Node: Thanks34768 +Node: Games Cited35184  End Tag Table diff --git a/libchimara/Makefile.am b/libchimara/Makefile.am index ddc0438..69c5922 100644 --- a/libchimara/Makefile.am +++ b/libchimara/Makefile.am @@ -38,6 +38,7 @@ libchimara_la_CPPFLAGS = \ -DG_LOG_DOMAIN=\"Chimara\" \ -DLOCALEDIR=\""$(datadir)/locale"\" \ -DPLUGINDIR=\""$(pkglibdir)"\" \ + -DPLUGINSOURCEDIR=\""$(abs_builddir)/../interpreters"\" \ -I$(top_srcdir) libchimara_la_CFLAGS = @CHIMARA_CFLAGS@ $(AM_CFLAGS) libchimara_la_LIBADD = @CHIMARA_LIBS@ diff --git a/libchimara/chimara-glk.c b/libchimara/chimara-glk.c index 1d981a5..f62c1be 100644 --- a/libchimara/chimara-glk.c +++ b/libchimara/chimara-glk.c @@ -222,8 +222,9 @@ chimara_glk_finalize(GObject *object) /** * chimara_glk_reset: + * @self: The ChimaraGLK widget to reset + * * Resets the widget back to it's origional state. IE: it resets all the private data. - * @param self: The ChimaraGLK widget to reset */ void chimara_glk_reset(ChimaraGlk *self) diff --git a/libchimara/chimara-if.c b/libchimara/chimara-if.c index 3298c79..26e5b3a 100644 --- a/libchimara/chimara-if.c +++ b/libchimara/chimara-if.c @@ -533,11 +533,14 @@ chimara_if_run_game(ChimaraIF *self, gchar *gamefile, GError **error) ChimaraIFInterpreter interpreter = priv->preferred_interpreter[format]; gchar *pluginfile = g_strconcat(plugin_names[interpreter], "." G_MODULE_SUFFIX, NULL); + gchar *pluginpath; +#ifdef DEBUG /* If there is a plugin in the source tree, use that */ - gchar *pluginpath = g_build_filename("..", "interpreters", plugin_names[interpreter], LT_OBJDIR, pluginfile, NULL); + pluginpath = g_build_filename(PLUGINSOURCEDIR, plugin_names[interpreter], LT_OBJDIR, pluginfile, NULL); if( !g_file_test(pluginpath, G_FILE_TEST_EXISTS) ) { g_free(pluginpath); +#endif pluginpath = g_build_filename(PLUGINDIR, pluginfile, NULL); if( !g_file_test(pluginpath, G_FILE_TEST_EXISTS) ) { @@ -546,7 +549,9 @@ chimara_if_run_game(ChimaraIF *self, gchar *gamefile, GError **error) g_set_error(error, CHIMARA_ERROR, CHIMARA_PLUGIN_NOT_FOUND, _("No appropriate %s interpreter plugin was found"), interpreter_names[interpreter]); return FALSE; } +#ifdef DEBUG } +#endif g_free(pluginfile); /* Decide what arguments to pass to the interpreters; currently only the diff --git a/libchimara/style.c b/libchimara/style.c index 5c639cc..4a6b511 100644 --- a/libchimara/style.c +++ b/libchimara/style.c @@ -177,19 +177,6 @@ style_init() GHashTable *current_text_buffer_styles = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_object_unref); GtkTextTag *tag; - /* Create the CSS file scanner */ - GScanner *scanner = g_scanner_new(NULL); - - int f = open(glk_data->css_file, O_RDONLY); - g_return_if_fail(f != -1); - g_scanner_input_file(scanner, f); - scanner->input_name = glk_data->css_file; - scanner->config->cset_identifier_first = G_CSET_a_2_z G_CSET_A_2_Z "#"; - scanner->config->cset_identifier_nth = G_CSET_a_2_z G_CSET_A_2_Z "-_" G_CSET_DIGITS; - scanner->config->symbol_2_token = TRUE; - scanner->config->cpair_comment_single = NULL; - scanner->config->scan_float = FALSE; - /* Initialise the default styles for a text grid */ tag = gtk_text_tag_new("normal"); g_object_set(tag, "font-desc", glk_data->monospace_font_desc, NULL); @@ -272,15 +259,33 @@ style_init() g_object_set(tag, "foreground", "#0000ff", "underline", PANGO_UNDERLINE_SINGLE, "underline-set", TRUE, NULL); g_hash_table_insert(default_text_buffer_styles, "hyperlink", tag); - glk_data->default_styles->text_grid = default_text_grid_styles; glk_data->default_styles->text_buffer = default_text_buffer_styles; - /* Run the scanner over the CSS file, overriding defaults */ - while( g_scanner_peek_next_token(scanner) != G_TOKEN_EOF) { - if( !style_accept_style_selector(scanner) ) - break; + /* Create the CSS file scanner */ + GScanner *scanner = g_scanner_new(NULL); + + int f = open(glk_data->css_file, O_RDONLY); + if(f != -1) + { + g_scanner_input_file(scanner, f); + scanner->input_name = glk_data->css_file; + scanner->config->cset_identifier_first = G_CSET_a_2_z G_CSET_A_2_Z "#"; + scanner->config->cset_identifier_nth = G_CSET_a_2_z G_CSET_A_2_Z "-_" G_CSET_DIGITS; + scanner->config->symbol_2_token = TRUE; + scanner->config->cpair_comment_single = NULL; + scanner->config->scan_float = FALSE; + + /* Run the scanner over the CSS file, overriding defaults */ + while( g_scanner_peek_next_token(scanner) != G_TOKEN_EOF) { + if( !style_accept_style_selector(scanner) ) + break; + } + + g_scanner_destroy(scanner); } + else + g_warning("Could not find CSS file"); /* Set the current style to a copy of the default style */ g_hash_table_foreach(default_text_grid_styles, style_table_copy, current_text_grid_styles); @@ -288,8 +293,6 @@ style_init() glk_data->current_styles->text_grid = current_text_grid_styles; glk_data->current_styles->text_buffer = current_text_buffer_styles; - g_scanner_destroy(scanner); - glk_data->style_initialized = TRUE; } diff --git a/po/POTFILES.in b/po/POTFILES.in index e12a0d1..a3b956b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,5 +1,7 @@ # List of source files containing translatable strings. libchimara/chimara-glk.c -tests/chimara.glade +libchimara/chimara-if.c +libchimara/init.c +tests/chimara.ui diff --git a/po/POTFILES.skip b/po/POTFILES.skip index ce59acd..419e8ad 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -2,5 +2,5 @@ # but don't. interpreters/nitfol/inform.c -tests/chimara.ui +tests/glulxercise.ui diff --git a/tests/Makefile.am b/tests/Makefile.am index 45e0acf..1849437 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,7 +29,8 @@ test_multisession_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) test_multisession_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la glulxercise_SOURCES = glulxercise.c error.c error.h -glulxercise_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) +glulxercise_CPPFLAGS = $(AM_CPPFLAGS) -DPACKAGE_SRC_DIR=\""$(srcdir)"\" +glulxercise_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) glulxercise_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la plugin_loader_SOURCES = plugin-loader.c diff --git a/tests/glulxercise.c b/tests/glulxercise.c index 3c786a9..3db6bba 100644 --- a/tests/glulxercise.c +++ b/tests/glulxercise.c @@ -28,11 +28,14 @@ on_go_clicked(GtkButton *go, Widgets *w) gtk_tree_model_get(model, &iter, 1, &filename, -1); g_object_unref(model); - if( !chimara_if_run_game(CHIMARA_IF(w->interp), filename, &error) ) + gchar *fullpath = g_build_filename(PACKAGE_SRC_DIR, filename, NULL); + + if( !chimara_if_run_game(CHIMARA_IF(w->interp), fullpath, &error) ) { error_dialog(GTK_WINDOW(w->window), error, "Error starting Glk library: "); gtk_main_quit(); } + g_free(fullpath); gtk_widget_set_sensitive(w->go, FALSE); gtk_widget_set_sensitive(w->stop, TRUE); @@ -75,7 +78,7 @@ main(int argc, char *argv[]) gtk_init(&argc, &argv); GtkBuilder *builder = gtk_builder_new(); - if(!gtk_builder_add_from_file(builder, "glulxercise.ui", &error)) + if(!gtk_builder_add_from_file(builder, PACKAGE_SRC_DIR "/glulxercise.ui", &error)) { error_dialog(NULL, error, "Failed to build interface: "); return 1; diff --git a/tests/main.c b/tests/main.c index 5cadc22..82c92bf 100644 --- a/tests/main.c +++ b/tests/main.c @@ -88,7 +88,7 @@ create_window(void) GError *error = NULL; builder = gtk_builder_new(); - if( !gtk_builder_add_from_file(builder, "chimara.ui", &error) ) { + if( !gtk_builder_add_from_file(builder, PACKAGE_SRC_DIR "/chimara.ui", &error) ) { error_dialog(NULL, error, "Error while building interface: "); return; } @@ -114,7 +114,7 @@ create_window(void) gtk_action_group_add_action_with_accel(actiongroup, GTK_ACTION(load_object(ptr[0])), ptr[1]); uimanager = gtk_ui_manager_new(); - if( !gtk_ui_manager_add_ui_from_file(uimanager, "chimara.menus", &error) ) { + if( !gtk_ui_manager_add_ui_from_file(uimanager, PACKAGE_SRC_DIR "/chimara.menus", &error) ) { error_dialog(NULL, error, "Error while building interface: "); return; } -- 2.30.2