This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: octave-forge dependency?

OK, let's back up a bit, and see why kpsexpand is needed in the first

Graphics in Octave use gnuplot.  The legend function from Octave Forge
sends a "save FILE" command to gnuplot so that it can extract some
information about gnuplot's current state.  If you do the following

  mv /usr/bin/kpsexpand. /usr/bin/kpsexpand-save
  gnuplot> save "foo"

you should see the errors

  sh: kpsexpand: command not found

So, why does gnuplot need kpsexpand to save state?  Looking at the
gnuplot sources, one finds

  /* Yet, no special font paths for these operating systems:
   * MSDOS, ATARI, AMIGA, MTOS, NeXT, ultrix, VMS, _IBMR2, alliant
   * Environmental variables are written as $(name).
   * Commands are written as $`command`.


  #if defined(_Windows) && !defined(FONTPATHSET)
  #  define FONTPATHSET
  static const struct path_table fontpath_tbl[] =
      { "$(windir)\\fonts" },
      /* Ghostscript */
      { "c:\\gs\\fonts" },
      /* X11 */
      { "$(CYGWIN_ROOT)\\usr\\X11R6\\lib\\X11\\fonts\\Type1" },
      /* fpTeX */
      { "$`kpsewhich -expand-path=$HOMETEXMF`\\fonts\\type1!" },
      { "$`kpsewhich -expand-path=$TEXMFLOCAL`\\fonts\\type1!" },
      { "$`kpsewhich -expand-path=$TEXMFMAIN`\\fonts\\type1!" },
      { "$`kpsewhich -expand-path=$TEXMFDIST`\\fonts\\type1!" },
      { NULL }


  /* Fallback: Should work for unix */
  static const struct path_table fontpath_tbl[] =
      /* teTeX or TeXLive */
      { "$`kpsexpand '$HOMETEXMF'`/fonts/type1!" },
      { "$`kpsexpand '$TEXMFLOCAL'`/fonts/type1!" },
      { "$`kpsexpand '$TEXMFMAIN'`/fonts/type1!" },
      { "$`kpsexpand '$TEXMFDIST'`/fonts/type1!" },
      /* Linux paths */
      { "/usr/X11R6/lib/X11/fonts/Type1" },
      { "/usr/X11R6/lib/X11/fonts/truetype" },
      /* HP-UX */
      { "/usr/lib/X11/fonts!"},
      /* Ghostscript */
      { "/usr/share/ghostscript/fonts" },
      { "/usr/local/share/ghostscript/fonts" },
      { NULL }


    switch (action) {
    case ACTION_CLEAR:
	/* Clear fontpath, fall through to init */
	FPRINTF((stderr, "Clear fontpath\n"));
	fontpath = p = last = NULL;
	/* HBB 20000726: 'limit' has to be initialized to NULL, too! */
	limit = NULL;
    case ACTION_INIT:
	/* Init fontpath from environment */
	FPRINTF((stderr, "Init fontpath from environment\n"));
	assert(fontpath == NULL);
	if (!fontpath)
	    char *envlib = getenv("GNUPLOT_FONTPATH");
	    if (envlib) {
		/* get paths from environment */
		int len = strlen(envlib);
		fontpath = gp_strdup(envlib);
		/* point to end of fontpath */
		last = fontpath + len;
		/* convert all PATHSEPs to \0 */
#if defined(HAVE_DIRENT_H) || defined(_Windows)
	    else {
		/* set hardcoded paths */
		const struct path_table *curr_fontpath = fontpath_tbl;


in src/variable.c.  The above is taken from a recent CVS checkout, but
the 4.0.0 sources for the current Cygwin package have similar lines.

So gnuplot is using kpsexpand to locate some font files.

It looks like there are a couple of options.

One is to set GNUPLOT_FONTPATH in the environment before calling

Another is to make a wrapper kpsexpand that looks for the real version
and does nothing if the real version is not present:

  #! /bin/sh
  if [ -x /usr/bin/kpsexpand ]; then
    exec /usr/bin/kspexpand "$@"

(though you might want to add some comments about why this is needed).

If the real kpsexpand is not present, then chances are the font files
are not -either, so it should not matter that the corresponding
directories named in the fontpath are bogus.  You could install the
wrapper script in one of the directories in Octave's DEFAULT_EXEC_PATH
(for example, /usr/lib/octave/2.1.72/exec/i686-pc-cygwin, where a
couple of other scripts are already installed), then it would only be
found by Octave and should not introduce any other conflicts.


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]