From 8b728035f9cfe490ba109494eb8564d11552e374 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 23 Jan 2006 16:27:21 +0000 Subject: [PATCH] Make tests/examples do use generated pango.modules. (bug #328291) 2006-01-23 Behdad Esfahbod Make tests/examples do use generated pango.modules. (bug #328291) * examples/pangorc, tests/pangorc: Removed. Moved to modules/. * examples/pangox.aliases: Removed. Moved to pango/. * examples/Makefile.am, tests/Makefile.am: Remove pango.modules creation stuff, copy pangorc from $(srcdir)/../modules/pangorc insteadd. * examples/renderdemo.c: Add --pangorc option, default to ./pangorc. Setenv PANGO_RC_FILE to whatever pangorc file decided. * tests/*.c: Setenv PANGO_RC_FILE to ./pangorc. * pango/pangox.aliases: Added. * pango/Makefile.am: Install pangox.aliases. * modules/pangorc: Added. * modules/Makefile.am: Create pango.modules. Added pangorc. * modules/.cvsignore, examples/.cvsignore, tests/.cvsignore: Updated. --- ChangeLog | 27 ++++++++++++++++++++ examples/.cvsignore | 2 +- examples/Makefile.am | 50 +++++++++++--------------------------- examples/cairoview.c | 2 +- examples/pangorc | 10 -------- examples/renderdemo.c | 23 +++++++++++++----- examples/renderdemo.h | 7 +++--- examples/xftview.c | 2 +- modules/.cvsignore | 1 + modules/Makefile.am | 31 ++++++++++++++++------- modules/pangorc | 8 ++++++ pango/Makefile.am | 3 +++ {examples => pango}/pangox.aliases | 0 tests/.cvsignore | 2 +- tests/Makefile.am | 35 +++++++++----------------- tests/dump-boundaries.c | 2 ++ tests/pangorc | 7 ------ tests/testboundaries.c | 2 ++ tests/testcolor.c | 2 ++ tests/testiter.c | 2 ++ tests/testscript.c | 2 ++ 21 files changed, 122 insertions(+), 98 deletions(-) delete mode 100644 examples/pangorc create mode 100644 modules/pangorc rename {examples => pango}/pangox.aliases (100%) delete mode 100644 tests/pangorc diff --git a/ChangeLog b/ChangeLog index a9f88c8..4b9493f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,32 @@ 2006-01-23 Behdad Esfahbod + Make tests/examples do use generated pango.modules. (bug #328291) + + * examples/pangorc, tests/pangorc: Removed. Moved to modules/. + + * examples/pangox.aliases: Removed. Moved to pango/. + + * examples/Makefile.am, tests/Makefile.am: Remove pango.modules + creation stuff, copy pangorc from $(srcdir)/../modules/pangorc + insteadd. + + * examples/renderdemo.c: Add --pangorc option, default to ./pangorc. + Setenv PANGO_RC_FILE to whatever pangorc file decided. + + * tests/*.c: Setenv PANGO_RC_FILE to ./pangorc. + + * pango/pangox.aliases: Added. + + * pango/Makefile.am: Install pangox.aliases. + + * modules/pangorc: Added. + + * modules/Makefile.am: Create pango.modules. Added pangorc. + + * modules/.cvsignore, examples/.cvsignore, tests/.cvsignore: Updated. + +2006-01-23 Behdad Esfahbod + * modules/basic/basic-fc.c: Set cluster only on base chars, like the Arabic module does. diff --git a/examples/.cvsignore b/examples/.cvsignore index d08e01f..2e29227 100644 --- a/examples/.cvsignore +++ b/examples/.cvsignore @@ -1,7 +1,7 @@ Makefile.in Makefile makefile.mingw -pango.modules +pangorc cairosimple pango-cairoview pango-xftview diff --git a/examples/Makefile.am b/examples/Makefile.am index f41174f..d884f12 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,6 +1,16 @@ ## Process this file with automake to create Makefile.in. -aliasdir = $(sysconfdir)/pango +EXTRA_DIST= \ + viewer-win32.c \ + makefile.msc \ + HELLO.utf8 \ + GLASS.utf8 \ + dev-example.utf \ + muru.utf \ + syriac.utf \ + tibetan.utf + +CLEANFILES = pangorc INCLUDES = \ -DG_DISABLE_DEPRECATED \ @@ -13,11 +23,6 @@ INCLUDES = \ $(FREETYPE_CFLAGS) \ $(X_CFLAGS) -################################################### - -CLEANFILES = pango.modules -################################################### - noinst_PROGRAMS = ################################################### @@ -94,34 +99,7 @@ cairosimple_LDADD = \ $(CAIRO_LIBS) ################################################### -if CROSS_COMPILING -else -all-local: pango.modules -endif - -pango.modules: $(top_builddir)/pango/pango-querymodules - if find ../modules -name '*.so' | grep 'so' > /dev/null ; then \ - echo "Writing a pango.modules file to use when running examples before installing Pango."; \ - (cd ../modules && \ - $(top_builddir)/pango/pango-querymodules `find . -name '*.la' | grep -v \.libs | grep -v libpango` > ../examples/pango.modules ) ;\ - else \ - echo "No dynamic modules found; will use only static modules for not-installed example programs."; \ - touch pango.modules; \ - fi +pangorc: $(srcdir)/../modules/pangorc + cp $< $@ -EXTRA_DIST= \ - viewer-win32.c \ - pangoft2topgm.c \ - makefile.msc \ - HELLO.utf8 \ - GLASS.utf8 \ - dev-example.utf \ - muru.utf \ - syriac.utf \ - tibetan.utf \ - pangorc \ - pangox.aliases - -if HAVE_X -alias_DATA = pangox.aliases -endif +$(noinst_PROGRAMS): pangorc diff --git a/examples/cairoview.c b/examples/cairoview.c index 6a532da..b58a74e 100644 --- a/examples/cairoview.c +++ b/examples/cairoview.c @@ -181,7 +181,7 @@ update (void) update_region = NULL; } -void +static void expose (XExposeEvent *xev) { XRectangle r; diff --git a/examples/pangorc b/examples/pangorc deleted file mode 100644 index bfbecbd..0000000 --- a/examples/pangorc +++ /dev/null @@ -1,10 +0,0 @@ -# -# pangorc file for uninstalled operation. If pango-viewer is run with -# this file in the current directory it will set it as PANGO_RC_FILE -# - -[Pango] -ModuleFiles = ./pango.modules - -[PangoX] -AliasFiles = ./pangox.aliases \ No newline at end of file diff --git a/examples/renderdemo.c b/examples/renderdemo.c index a956e3c..e225fe7 100644 --- a/examples/renderdemo.c +++ b/examples/renderdemo.c @@ -38,28 +38,29 @@ #define _MAKE_FONT_NAME(family, size) family " " #size #define MAKE_FONT_NAME(family, size) _MAKE_FONT_NAME(family, size) -char *prog_name; +const char *prog_name; gboolean opt_display = FALSE; int opt_dpi = 96; const char *opt_font = MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE); gboolean opt_header = FALSE; -char *opt_output = NULL; +const char *opt_output = NULL; int opt_margin = 10; int opt_markup = FALSE; gboolean opt_rtl = FALSE; int opt_rotate = 0; gboolean opt_auto_dir = TRUE; -char *opt_text = NULL; +const char *opt_text = NULL; gboolean opt_waterfall = FALSE; int opt_width = -1; int opt_indent = 0; int opt_runs = 1; PangoEllipsizeMode opt_ellipsize = PANGO_ELLIPSIZE_NONE; HintMode opt_hinting = HINT_DEFAULT; +const char *opt_pangorc = NULL; /* Text (or markup) to render */ -char *text; +static char *text; void fail (const char *format, ...) @@ -343,7 +344,7 @@ fc_substitute_func (FcPattern *pattern, gpointer data) } } -void +static void parse_ellipsis (ArgContext *arg_context, const char *name, const char *arg, @@ -362,7 +363,7 @@ parse_ellipsis (ArgContext *arg_context, opt_ellipsize = value->value; } -void +static void parse_hinting (ArgContext *arg_context, const char *name, const char *arg, @@ -423,6 +424,8 @@ parse_options (int argc, char *argv[]) ARG_INT, &opt_indent, NULL }, { "runs", "Render text this many times", ARG_INT, &opt_runs, NULL }, + { "pangorc", "pangorc file to use (default is ./pangorc if available)", + ARG_STRING, &opt_pangorc, NULL }, { NULL, NULL, 0, NULL, NULL } }; @@ -488,6 +491,14 @@ parse_options (int argc, char *argv[]) if (opt_markup && !pango_parse_markup (text, -1, 0, NULL, NULL, NULL, &error)) fail ("Cannot parse input as markup: %s", error->message); + + /* Setup PANGO_RC_FILE + */ + if (!opt_pangorc) + if (g_file_test ("./pangorc", G_FILE_TEST_IS_REGULAR)) + opt_pangorc = "./pangorc"; + if (opt_pangorc) + g_setenv ("PANGO_RC_FILE", opt_pangorc, TRUE); } void diff --git a/examples/renderdemo.h b/examples/renderdemo.h index bd28334..d79df1a 100644 --- a/examples/renderdemo.h +++ b/examples/renderdemo.h @@ -53,22 +53,23 @@ void fc_substitute_func (FcPattern *pattern, gpointer data); gchar *get_options_string (void); -extern char *prog_name; +extern const char *prog_name; extern gboolean opt_display; extern int opt_dpi; extern const char *opt_font; extern gboolean opt_header; -extern char *opt_output; +extern const char *opt_output; extern int opt_margin; extern int opt_markup; extern gboolean opt_rtl; extern int opt_rotate; extern gboolean opt_auto_dir; -extern char *opt_text; +extern const char *opt_text; extern gboolean opt_waterfall; extern int opt_width; extern int opt_indent; extern int opt_runs; extern PangoEllipsizeMode opt_ellipsize; extern HintMode opt_hinting; +extern const char *opt_pangorc; diff --git a/examples/xftview.c b/examples/xftview.c index ba0a621..c050b6a 100644 --- a/examples/xftview.c +++ b/examples/xftview.c @@ -72,7 +72,7 @@ update (void) do_output (context, xft_render, NULL, draw, NULL, NULL); } -void +static void expose (XExposeEvent *xev) { XRectangle area; diff --git a/modules/.cvsignore b/modules/.cvsignore index 8019aae..e2ebcb0 100644 --- a/modules/.cvsignore +++ b/modules/.cvsignore @@ -1,6 +1,7 @@ Makefile Makefile.in makefile.mingw +pango.modules .deps .libs *.lo diff --git a/modules/Makefile.am b/modules/Makefile.am index 73b2cf4..89b9ccf 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -12,16 +12,21 @@ SUBDIRS = \ tibetan EXTRA_DIST = \ - module.def + module.def \ + pangorc + +CLEANFILES = \ + pango.modules if CROSS_COMPILING -RUN_QUERY_IMMODULES_TEST=false +RUN_QUERY_MODULES_TEST=false else -RUN_QUERY_IMMODULES_TEST=test -z "$(DESTDIR)" +RUN_QUERY_MODULES_TEST=test -z "$(DESTDIR)" +all-local: pango.modules endif -install-data-local: - @if $(RUN_QUERY_IMMODULES_TEST) ; then \ +install-data-local: $(top_builddir)/pango/pango-querymodules + @if $(RUN_QUERY_MODULES_TEST) ; then \ echo $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/pango \&\& \ $(top_builddir)/pango/pango-querymodules \ \> $(DESTDIR)$(sysconfdir)/pango/pango.modules ; \ @@ -30,13 +35,22 @@ install-data-local: > $(DESTDIR)$(sysconfdir)/pango/pango.modules ; \ else \ echo "***" ; \ - echo "*** Warning: pango.modules not created" ; \ - echo "***" ; \ + echo "*** Warning: $(sysconfdir)/pango/pango.modules" ; \ + echo "*** not created" ; \ echo "*** Generate this file on the target system" ; \ - echo "*** system using pango-querymodules" ; \ + echo "*** using pango-querymodules" ; \ echo "***" ; \ fi +pango.modules: $(top_builddir)/pango/pango-querymodules $(SUBDIRS) + @if find . -name '*.so' | grep 'so' > /dev/null ; then \ + echo "Writing a pango.modules file to use with tests/examples."; \ + $(top_builddir)/pango/pango-querymodules `find . -name '*.la' | grep -v '\.libs' | grep -v libpango` > $@ ;\ + else \ + echo "No dynamic modules found; will use only static modules for tests/examples."; \ + touch $@; \ + fi + included-modules: @for d in $(SUBDIRS) ; do \ ( cd $$d && $(MAKE) $(AM_MAKEFLAGS) included-modules ) ; \ @@ -48,4 +62,3 @@ dynamic-modules: done .PHONY: included-modules dynamic-modules - diff --git a/modules/pangorc b/modules/pangorc new file mode 100644 index 0000000..3b60ece --- /dev/null +++ b/modules/pangorc @@ -0,0 +1,8 @@ +# +# pangorc file for uninstalled operation. +# We set the path as ../modules, such that it works from any of +# top level build subdirs. +# + +[Pango] +ModuleFiles = ../modules/pango.modules diff --git a/pango/Makefile.am b/pango/Makefile.am index 9aac509..57b705b 100644 --- a/pango/Makefile.am +++ b/pango/Makefile.am @@ -150,6 +150,8 @@ s-enum-types-c: @REBUILD@ $(pango_headers) Makefile if HAVE_X pangoinclude_HEADERS += pangox.h lib_LTLIBRARIES += libpangox-1.0.la +aliasdir = $(sysconfdir)/pango +alias_DATA = pangox.aliases endif libpangox_1_0_la_LDFLAGS = $(LIBRARY_LIBTOOL_OPTIONS) @@ -416,6 +418,7 @@ EXTRA_DIST = \ makefile.msc \ pango.rc \ pango.rc.in \ + pangox.aliases \ pangoft2.rc \ pangoft2.rc.in \ pangowin32.rc \ diff --git a/examples/pangox.aliases b/pango/pangox.aliases similarity index 100% rename from examples/pangox.aliases rename to pango/pangox.aliases diff --git a/tests/.cvsignore b/tests/.cvsignore index 0202c46..c462db7 100644 --- a/tests/.cvsignore +++ b/tests/.cvsignore @@ -12,4 +12,4 @@ cxx-test testcolor Makefile.in Makefile -pango.modules +pangorc diff --git a/tests/Makefile.am b/tests/Makefile.am index e407b57..d46b846 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,13 @@ ## Process this file with automake to create Makefile.in. +EXTRA_DIST = \ + all-unicode.txt \ + boundaries.utf8 \ + runtests.sh + +CLEANFILES = pangorc +DISTCLEANFILES = all-unicode.txt runtests.log + INCLUDES = \ -DG_DISABLE_DEPRECATED \ -I$(top_srcdir) \ @@ -68,29 +76,10 @@ check_PROGRAMS += cxx-test endif cxx_test_SOURCES = cxx-test.C -if CROSS_COMPILING -all-local: -else -all-local: all-unicode.txt pango.modules -endif - -pango.modules: - if find ../modules -name '*.so' | grep 'so' > /dev/null ; then \ - echo "Writing a pango.modules file to use when running tests before installing Pango."; \ - (cd ../modules && \ - ../pango/pango-querymodules `find . -name '*.la' | grep -v \.libs` > ../tests/pango.modules ) ;\ - else \ - echo "No dynamic modules found; will use only static modules for uninstalled test programs."; \ - touch pango.modules; \ - fi - -EXTRA_DIST = \ - all-unicode.txt \ - boundaries.utf8 \ - runtests.sh - all-unicode.txt: gen-all-unicode ./gen-all-unicode > all-unicode.txt -CLEANFILES = pango.modules -DISTCLEANFILES = all-unicode.txt runtests.log +pangorc: $(srcdir)/../modules/pangorc + cp $< $@ + +$(noinst_PROGRAMS) $(check_PROGRAMS): pangorc diff --git a/tests/dump-boundaries.c b/tests/dump-boundaries.c index f566a54..29efc52 100644 --- a/tests/dump-boundaries.c +++ b/tests/dump-boundaries.c @@ -113,6 +113,8 @@ main (int argc, { gchar *text; + g_setenv ("PANGO_RC_FILE", "./pangorc", TRUE); + if (argc < 2) fail ("must give a filename on the command line"); diff --git a/tests/pangorc b/tests/pangorc deleted file mode 100644 index 2004c97..0000000 --- a/tests/pangorc +++ /dev/null @@ -1,7 +0,0 @@ -# -# pangorc file for uninstalled operation. -# - -[Pango] -ModuleFiles = ./pango.modules - diff --git a/tests/testboundaries.c b/tests/testboundaries.c index e003aad..edc5b18 100644 --- a/tests/testboundaries.c +++ b/tests/testboundaries.c @@ -340,6 +340,8 @@ main (int argc, char *argv[]) const gchar *srcdir; const gchar *filename; + g_setenv ("PANGO_RC_FILE", "./pangorc", TRUE); + srcdir = getenv ("srcdir"); if (!srcdir) srcdir = "."; diff --git a/tests/testcolor.c b/tests/testcolor.c index d64153d..068b0d9 100644 --- a/tests/testcolor.c +++ b/tests/testcolor.c @@ -84,6 +84,8 @@ main (int argc, char *argv[]) gboolean success; ColorSpec *spec; + g_setenv ("PANGO_RC_FILE", "./pangorc", TRUE); + success = TRUE; for (spec = specs; spec->spec; spec++) success &= test_color (spec); diff --git a/tests/testiter.c b/tests/testiter.c index 58cc228..76bb7f1 100644 --- a/tests/testiter.c +++ b/tests/testiter.c @@ -218,6 +218,8 @@ main (int argc, char *argv[]) PangoContext *context; PangoLayout *layout; + g_setenv ("PANGO_RC_FILE", "./pangorc", TRUE); + fontmap = pango_cairo_font_map_get_default (); context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap)); diff --git a/tests/testscript.c b/tests/testscript.c index 4594a9a..79c8471 100644 --- a/tests/testscript.c +++ b/tests/testscript.c @@ -248,6 +248,8 @@ test_script_iter (void) int main (int argc, char **argv) { + g_setenv ("PANGO_RC_FILE", "./pangorc", TRUE); + test_script_lookup (); test_script_iter (); -- 2.7.4