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