mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-01 21:51:40 +02:00
zsh-workers/9322
This commit is contained in:
parent
9fc3e9a8db
commit
e142bdeb17
9 changed files with 86 additions and 57 deletions
|
@ -41,6 +41,7 @@ infodir = @infodir@
|
|||
mandir = @mandir@
|
||||
datadir = @datadir@
|
||||
fndir = @fndir@
|
||||
sitefndir = @sitefndir@
|
||||
htmldir = $(datadir)/$(tzsh)/htmldoc
|
||||
|
||||
# compilation
|
||||
|
|
|
@ -33,7 +33,7 @@ install.fns:
|
|||
FUNCTIONS_INSTALL="$(FUNCTIONS_INSTALL)" \
|
||||
FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \
|
||||
INSTALL_DATA="$(INSTALL_DATA)" \
|
||||
DESTDIR="$(DESTDIR)" \
|
||||
DESTDIR="$(DESTDIR)" VERSION="$(VERSION)" \
|
||||
$(SHELL) $(sdir_top)/Config/installfns.sh || exit 1; \
|
||||
fi; \
|
||||
exit 0
|
||||
|
@ -43,7 +43,7 @@ uninstall.fns:
|
|||
fndir="$(fndir)" sdir="$(sdir)" \
|
||||
FUNCTIONS_INSTALL="$(FUNCTIONS_INSTALL)" \
|
||||
FUNCTIONS_SUBDIRS="$(FUNCTIONS_SUBDIRS)" \
|
||||
DESTDIR="$(DESTDIR)" \
|
||||
DESTDIR="$(DESTDIR)" VERSION="$(VERSION)" \
|
||||
$(SHELL) $(sdir_top)/Config/uninstallfns.sh || exit 1; \
|
||||
fi; \
|
||||
exit 0
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
fndir=$DESTDIR$fndir
|
||||
|
||||
if test -d $fndir.old; then
|
||||
add_old=1
|
||||
fi
|
||||
|
||||
$sdir_top/mkinstalldirs $fndir || exit 1;
|
||||
|
||||
# If the source directory is somewhere else, we need to force
|
||||
|
@ -24,27 +20,14 @@ for file in $install; do
|
|||
if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then
|
||||
subfile="$file"
|
||||
subdir="`echo $file | sed -e 's%/[^/]*$%%'`"
|
||||
olddir="$fndir.old/$subdir"
|
||||
instdir="$fndir/$subdir"
|
||||
else
|
||||
subfile="`echo $file | sed -e 's%^.*/%%'`"
|
||||
olddir="$fndir.old"
|
||||
instdir="$fndir"
|
||||
fi
|
||||
if test -f $fndir/$subfile; then
|
||||
if cmp $fndir/$subfile $sdir/$file >/dev/null; then :; else
|
||||
$sdir_top/mkinstalldirs $olddir
|
||||
mv $fndir/$subfile $olddir
|
||||
: ${add_old:=1}
|
||||
fi
|
||||
fi
|
||||
$sdir_top/mkinstalldirs $instdir || exit 1
|
||||
$INSTALL_DATA $sdir/$file $instdir || exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if test x$add_old != x1; then
|
||||
rm -rf $fndir.old
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -14,20 +14,26 @@ done
|
|||
fndir=$DESTDIR$fndir
|
||||
|
||||
for file in $install; do
|
||||
if test -f $sdir/$file; then
|
||||
if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then
|
||||
rm -f $fndir/$file;
|
||||
if test -f $fndir.old/$file; then
|
||||
mv $fndir.old/$file $fndir/$file
|
||||
fi
|
||||
else
|
||||
bfile="`echo $file | sed -e 's%^.*/%%'`"
|
||||
rm -f "$fndir/$bfile"; \
|
||||
if test -f $fndir.old/$bfile; then
|
||||
mv $fndir.old/$bfile $fndir/$bfile
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
case $fndir in
|
||||
*$VERSION*)
|
||||
# Version specific function directory, safe to remove completely.
|
||||
# However, we don't remove the top-level version directory since
|
||||
# it could have other things than functions in it. We could
|
||||
# do that instead in the top-level Makefile on a full uninstall,
|
||||
# if we wanted.
|
||||
rm -rf $fndir
|
||||
;;
|
||||
*)
|
||||
if test -f $sdir/$file; then
|
||||
if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then
|
||||
rm -f $fndir/$file;
|
||||
else
|
||||
bfile="`echo $file | sed -e 's%^.*/%%'`"
|
||||
rm -f "$fndir/$bfile"; \
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
18
INSTALL
18
INSTALL
|
@ -283,16 +283,13 @@ shell functions to be installed into subdirectories of the function
|
|||
directory, i.e. `Core/*' files will be installed into `FNDIR/Core', and so
|
||||
on. This also initialises $fpath/$FPATH appropriately.
|
||||
|
||||
On installation, any completion function which already exists but is
|
||||
different from the new version will be moved to a corresponding place in
|
||||
FNDIR.old; for example, if a different version of User/_rcs exists when
|
||||
installing into /usr/local/share/zsh/functions/User, the old one will be
|
||||
moved into /usr/local/share/zsh/functions.old/User. The installer is
|
||||
responsible for recovering or deleting old functions which have been moved
|
||||
in this way. On uninstallation, any newly installed functions (including
|
||||
those which existed before but were unchanged) will be deleted and the
|
||||
files in the FNDIR.old hierarchy moved back into FNDIR. To preserve the
|
||||
entire old hierarchy, you should move or copy it before installation.
|
||||
The option --enable-site-fndir controls whether to create and initialise
|
||||
$fpath to include a directory for site-specific functions. By default this
|
||||
is created in the location ${datadir}/zsh/site-functions, i.e. parallel to
|
||||
the version-specific functions directory, and inserted at the start of the
|
||||
$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.
|
||||
|
||||
Support for large files and integers
|
||||
------------------------------------
|
||||
|
@ -366,6 +363,7 @@ Features:
|
|||
zprofile=pathname # the full pathname of the global zprofile script
|
||||
zlogout=pathname # the full pathname of the global zlogout script
|
||||
fndir=directory # the directory where shell functions will go
|
||||
site-fndir=directory# the directory where site-specific functions can go
|
||||
function-subdirs # if functions will be installed into subdirectories
|
||||
dynamic # allow dynamically loaded binary modules
|
||||
lfs # allow configure check for large files
|
||||
|
|
|
@ -76,7 +76,13 @@ install.man uninstall.man:
|
|||
@cd Doc && $(MAKE) $(MAKEDEFS) $@
|
||||
|
||||
# install/uninstall just the shell functions
|
||||
install.fns uninstall.fns:
|
||||
install.fns:
|
||||
test x$(sitefndir) != xno && $(sdir_top)/mkinstalldirs $(sitefndir)
|
||||
@cd Completion && $(MAKE) $(MAKEDEFS) $@
|
||||
@cd Functions && $(MAKE) $(MAKEDEFS) $@
|
||||
|
||||
uninstall.fns:
|
||||
# never attempt to remove $(sitefndir)
|
||||
@cd Completion && $(MAKE) $(MAKEDEFS) $@
|
||||
@cd Functions && $(MAKE) $(MAKEDEFS) $@
|
||||
|
||||
|
|
46
Src/init.c
46
Src/init.c
|
@ -546,6 +546,18 @@ setupvals(void)
|
|||
char *ptr;
|
||||
#ifdef HAVE_GETRLIMIT
|
||||
int i;
|
||||
#endif
|
||||
#if defined(SITEFPATH_DIR) || defined(FPATH_DIR)
|
||||
char **fpathptr;
|
||||
# if defined(FPATH_DIR) && defined(FPATH_SUBDIRS)
|
||||
char *fpath_subdirs[] = FPATH_SUBDIRS;
|
||||
int j;
|
||||
# endif
|
||||
# ifdef SITEPATH_DIR
|
||||
int fpathlen = 1;
|
||||
# else
|
||||
int fpathlen = 0;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
getkeyptr = NULL;
|
||||
|
@ -581,23 +593,33 @@ setupvals(void)
|
|||
cdpath = mkarray(NULL);
|
||||
manpath = mkarray(NULL);
|
||||
fignore = mkarray(NULL);
|
||||
#ifdef FPATH_DIR
|
||||
# ifdef FPATH_SUBDIRS
|
||||
{
|
||||
char *fpath_subdirs[] = FPATH_SUBDIRS;
|
||||
int len = sizeof(fpath_subdirs)/sizeof(char *), j;
|
||||
|
||||
fpath = zalloc((len+1)*sizeof(char *));
|
||||
for (j = 0; j < len; j++)
|
||||
fpath[j] = tricat(FPATH_DIR, "/", fpath_subdirs[j]);
|
||||
fpath[len] = NULL;
|
||||
}
|
||||
# else
|
||||
fpath = mkarray(ztrdup(FPATH_DIR));
|
||||
#if defined(SITEFPATH_DIR) || defined(FPATH_DIR)
|
||||
# ifdef FPATH_DIR
|
||||
# ifdef FPATH_SUBDIRS
|
||||
fpathlen += sizeof(fpath_subdirs)/sizeof(char *);
|
||||
# else
|
||||
fpathlen++;
|
||||
# endif
|
||||
# endif
|
||||
fpath = fpathptr = (char **)zalloc((fpathlen+1)*sizeof(char *));
|
||||
# ifdef SITEFPATH_DIR
|
||||
*fpathptr++ = ztrdup(SITEFPATH_DIR);
|
||||
fpathlen--;
|
||||
# endif
|
||||
# ifdef FPATH_DIR
|
||||
# ifdef FPATH_SUBDIRS
|
||||
for (j = 0; j < fpathlen; j++)
|
||||
*fpathptr++ = tricat(FPATH_DIR, "/", fpath_subdirs[j]);
|
||||
# else
|
||||
*fpathptr++ = ztrdup(FPATH_DIR);
|
||||
# endif
|
||||
# endif
|
||||
*fpathptr = NULL;
|
||||
#else
|
||||
fpath = mkarray(NULL);
|
||||
#endif
|
||||
|
||||
mailpath = mkarray(NULL);
|
||||
watch = mkarray(NULL);
|
||||
psvar = mkarray(NULL);
|
||||
|
|
|
@ -34,6 +34,9 @@ version.h: $(sdir_top)/Config/version.mk
|
|||
|
||||
zshpaths.h: Makemod $(CONFIG_INCS)
|
||||
@echo '#define MODULE_DIR "'$(MODDIR)'"' > zshpaths.h.tmp
|
||||
@if test x$(sitefndir) != xno; then \
|
||||
echo '#define SITEFPATH_DIR "'$(sitefndir)'"' >> zshpaths.h.tmp; \
|
||||
fi
|
||||
@if test x$(fndir) != xno; then \
|
||||
echo '#define FPATH_DIR "'$(fndir)'"' >> zshpaths.h.tmp; \
|
||||
if test x$(FUNCTIONS_SUBDIRS) != x -a \
|
||||
|
|
12
configure.in
12
configure.in
|
@ -212,7 +212,7 @@ AC_DEFINE(CONFIG_LOCALE)
|
|||
|
||||
undefine([fndir])dnl
|
||||
AC_ARG_ENABLE(fndir,
|
||||
[ --enable-fndir=DIR where functions go (default DATADIR/zsh/functions)],
|
||||
[ --enable-fndir=DIR where functions go],
|
||||
dnl ${VERSION} to be determined at compile time.
|
||||
[if test $enableval = yes; then
|
||||
fndir=${datadir}/${tzsh_name}/'${VERSION}'/functions
|
||||
|
@ -220,6 +220,15 @@ else
|
|||
fndir="$enableval"
|
||||
fi], [fndir=${datadir}/${tzsh_name}/'${VERSION}'/functions])
|
||||
|
||||
undefine([sitefndir])dnl
|
||||
AC_ARG_ENABLE(sitefndir,
|
||||
[ --enable-site-fndir=DIR where site functions (not version specific) go],
|
||||
[if test $enableval = yes; then
|
||||
sitefndir=${datadir}/${tzsh_name}/site-functions
|
||||
else
|
||||
sitefndir="$enableval"
|
||||
fi], [sitefndir=${datadir}/${tzsh_name}/site-functions])
|
||||
|
||||
undefine([function_subdirs])
|
||||
AC_ARG_ENABLE(function-subdirs,
|
||||
[ --enable-function-subdirs install functions in subdirectories])
|
||||
|
@ -240,6 +249,7 @@ else
|
|||
fi
|
||||
|
||||
AC_SUBST(fndir)dnl
|
||||
AC_SUBST(sitefndir)dnl
|
||||
AC_SUBST(FUNCTIONS_INSTALL)dnl
|
||||
AC_SUBST(FUNCTIONS_SUBDIRS)dnl
|
||||
|
||||
|
|
Loading…
Reference in a new issue