mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
29008, 29012: Add --enable-additional-fpath' option to add arbitrary directories to the default
$fpath'.
This commit is contained in:
parent
95b83f217d
commit
32974286d4
6 changed files with 53 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-04-18 Frank Terbeck <ft@bewatermyfriend.org>
|
||||
|
||||
* 29008, 29012: Config/defs.mk.in, Src/init.c, Src/zsh.mdd,
|
||||
configure.ac, INSTALL: Add `--enable-additional-fpath' option to
|
||||
add arbitrary directories to the default `$fpath'.
|
||||
|
||||
2011-04-18 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* Simon Ruderich: 29004: M Doc/Zsh/compsys.yo,
|
||||
|
@ -14471,5 +14477,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5251 $
|
||||
* $Revision: 1.5252 $
|
||||
*****************************************************
|
||||
|
|
|
@ -86,6 +86,9 @@ INSTALL_DATA = @INSTALL_DATA@
|
|||
# variables used in determining what to install
|
||||
FUNCTIONS_SUBDIRS = @FUNCTIONS_SUBDIRS@
|
||||
|
||||
# Additional fpath entries (eg. for vendor specific directories).
|
||||
additionalfpath = @additionalfpath@
|
||||
|
||||
# flags passed to recursive makes in subdirectories
|
||||
MAKEDEFS = \
|
||||
prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
|
||||
|
|
7
INSTALL
7
INSTALL
|
@ -472,6 +472,12 @@ $fpath array on shell startup. This directory will not be affected by
|
|||
`make uninstall' or `make uninstall.fns', although the version-specific
|
||||
directory and its contents will be deleted.
|
||||
|
||||
The --enable-additional-fpath option may be used to add arbitrary
|
||||
directories to the shell's default $fpath array. This may be useful to
|
||||
have vendor specific function directories available for vendor specific
|
||||
addons. You may add more than one directory this way by listing them with
|
||||
the option separated by commas.
|
||||
|
||||
Function depth
|
||||
--------------
|
||||
|
||||
|
@ -593,6 +599,7 @@ fndir=directory # the directory where shell functions will go
|
|||
# [DATADIR/zsh/VERSION/functions]
|
||||
site-fndir=directory # the directory where site-specific functions can go
|
||||
# [DATADIR/zsh/site-functions]
|
||||
additional-path # add directories to default function path [<none>]
|
||||
function-subdirs # if functions will be installed into subdirectories [no]
|
||||
dynamic # allow dynamically loaded binary modules [yes]
|
||||
largefile # allow configure check for large files [yes]
|
||||
|
|
21
Src/init.c
21
Src/init.c
|
@ -676,11 +676,15 @@ setupvals(void)
|
|||
struct timezone dummy_tz;
|
||||
char *ptr;
|
||||
int i, j;
|
||||
#if defined(SITEFPATH_DIR) || defined(FPATH_DIR)
|
||||
#if defined(SITEFPATH_DIR) || defined(FPATH_DIR) || defined (ADDITIONAL_FPATH)
|
||||
char **fpathptr;
|
||||
# if defined(FPATH_DIR) && defined(FPATH_SUBDIRS)
|
||||
char *fpath_subdirs[] = FPATH_SUBDIRS;
|
||||
# endif
|
||||
# if defined(ADDITIONAL_FPATH)
|
||||
char *more_fndirs[] = ADDITIONAL_FPATH;
|
||||
int more_fndirs_len;
|
||||
# endif
|
||||
# ifdef SITEFPATH_DIR
|
||||
int fpathlen = 1;
|
||||
# else
|
||||
|
@ -764,23 +768,36 @@ setupvals(void)
|
|||
manpath = mkarray(NULL);
|
||||
fignore = mkarray(NULL);
|
||||
|
||||
#if defined(SITEFPATH_DIR) || defined(FPATH_DIR)
|
||||
#if defined(SITEFPATH_DIR) || defined(FPATH_DIR) || defined(ADDITIONAL_FPATH)
|
||||
# ifdef FPATH_DIR
|
||||
# ifdef FPATH_SUBDIRS
|
||||
fpathlen += sizeof(fpath_subdirs)/sizeof(char *);
|
||||
# else
|
||||
fpathlen++;
|
||||
# endif
|
||||
# endif
|
||||
# if defined(ADDITIONAL_FPATH)
|
||||
more_fndirs_len = sizeof(more_fndirs)/sizeof(char *);
|
||||
fpathlen += more_fndirs_len;
|
||||
# endif
|
||||
fpath = fpathptr = (char **)zalloc((fpathlen+1)*sizeof(char *));
|
||||
# ifdef SITEFPATH_DIR
|
||||
*fpathptr++ = ztrdup(SITEFPATH_DIR);
|
||||
fpathlen--;
|
||||
# endif
|
||||
# if defined(ADDITIONAL_FPATH)
|
||||
for (j = 0; j < more_fndirs_len; j++)
|
||||
*fpathptr++ = ztrdup(more_fndirs[j]);
|
||||
# endif
|
||||
# ifdef FPATH_DIR
|
||||
# ifdef FPATH_SUBDIRS
|
||||
# ifdef ADDITIONAL_FPATH
|
||||
for (j = more_fndirs_len; j < fpathlen; j++)
|
||||
*fpathptr++ = tricat(FPATH_DIR, "/", fpath_subdirs[j - more_fndirs_len]);
|
||||
# else
|
||||
for (j = 0; j < fpathlen; j++)
|
||||
*fpathptr++ = tricat(FPATH_DIR, "/", fpath_subdirs[j]);
|
||||
#endif
|
||||
# else
|
||||
*fpathptr++ = ztrdup(FPATH_DIR);
|
||||
# endif
|
||||
|
|
|
@ -86,6 +86,10 @@ zshpaths.h: Makemod $(CONFIG_INCS)
|
|||
>>zshpaths.h.tmp; \
|
||||
fi; \
|
||||
fi
|
||||
@if test x$(additionalfpath) != x; then \
|
||||
fpath_tmp="`echo $(additionalfpath) | sed -e 's:,:\", \":g'`"; \
|
||||
echo "#define ADDITIONAL_FPATH { \"$$fpath_tmp\" }" >> zshpaths.h.tmp; \
|
||||
fi
|
||||
@if cmp -s zshpaths.h zshpaths.h.tmp; then \
|
||||
rm -f zshpaths.h.tmp; \
|
||||
echo "\`zshpaths.h' is up to date." ; \
|
||||
|
|
13
configure.ac
13
configure.ac
|
@ -276,6 +276,16 @@ else
|
|||
FUNCTIONS_SUBDIRS=no
|
||||
fi
|
||||
|
||||
ifdef([additionalfpath],[undefine([additionalfpath])])dnl
|
||||
AC_ARG_ENABLE(additional-fpath,
|
||||
AC_HELP_STRING([--enable-additional-fpath=DIR], [add directories to default function path]),
|
||||
[if test x$enableval = xyes; then
|
||||
additionalfpath=""
|
||||
else
|
||||
additionalfpath="${enableval}"
|
||||
fi], [additionalfpath=""])
|
||||
|
||||
AC_SUBST(additionalfpath)dnl
|
||||
AC_SUBST(fndir)dnl
|
||||
AC_SUBST(sitefndir)dnl
|
||||
AC_SUBST(FUNCTIONS_SUBDIRS)dnl
|
||||
|
@ -3088,6 +3098,9 @@ info install path : ${zshinfo}"
|
|||
if test "$zshfndir" != no; then
|
||||
echo "functions install path : ${zshfndir}"
|
||||
fi
|
||||
if test "x$additionalfpath" != x; then
|
||||
echo "additional fpath entries : ${additionalfpath}"
|
||||
fi
|
||||
echo "See config.modules for installed modules and functions.
|
||||
"
|
||||
|
||||
|
|
Loading…
Reference in a new issue