Skip to content

Commit

Permalink
13194: change in module configuration system
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Stephenson committed Nov 26, 2000
1 parent ad5f958 commit 49a1ad7
Show file tree
Hide file tree
Showing 34 changed files with 332 additions and 197 deletions.
17 changes: 17 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
2000-11-26 Peter Stephenson <pws@pwstephenson.fsnet.co.uk>

* 13194: INSTALL, configure.in, Config/defs.mk.in,
Etc/zsh-development-guide, Src/.distfiles, Src/Makefile.in,
Src/Makemod.in.in, Src/mkbltnmlst.sh, Src/mkmakemod.sh,
Src/zsh.mdd, Src/Builtins/rlimits.mdd, Src/Builtins/sched.mdd,
Src/Modules/cap.mdd, Src/Modules/clone.mdd,
Src/Modules/example.mdd, Src/Modules/files.mdd,
Src/Modules/mapfile.mdd, Src/Modules/mathfunc.mdd,
Src/Modules/parameter.mdd, Src/Modules/stat.mdd,
Src/Modules/zftp.mdd, Src/Modules/zprof.mdd, Src/Modules/zpty.mdd,
Src/Modules/zutil.mdd, Src/Zle/compctl.mdd, Src/Zle/complete.mdd,
Src/Zle/complist.mdd, Src/Zle/computil.mdd, Src/Zle/deltochar.mdd,
Src/Zle/zle.mdd, Src/Zle/zleparameter.mdd: New module
configuration system using file config.modules set up by
configure.

2000-11-25 Bart Schaefer <schaefer@zsh.org>

* 13192: Completion/Core/compinit, Src/params.c: Turn off
Expand Down
3 changes: 0 additions & 3 deletions Config/defs.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ DLLD = @DLLD@
EXPOPT = @EXPOPT@
IMPOPT = @IMPOPT@

# choose modules not to compile and install
OMIT_MODULES = @OMIT_MODULES@

# utilities
AWK = @AWK@
YODL = @YODL@
Expand Down
13 changes: 12 additions & 1 deletion Etc/zsh-development-guide
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This development takes place by mailing list. Check the META-FAQ for the
various zsh mailing lists and how to subscribe to them. The development
is very open and anyone is welcomed and encouraged to join and contribute.
Because zsh is a very large package whose development can sometimes
be very rapid, I kindly ask that people observe a few guidelines when
be very rapid, we kindly ask that people observe a few guidelines when
contributing patches and feedback to the mailing list. These guidelines
are very simple and hopefully should make for a more orderly development
of zsh.
Expand Down Expand Up @@ -181,6 +181,17 @@ sourced when zsh is built. To describe the module it can/should set the
following shell variables:

- name name of the module
- link `static', `dynamic' or `no', as described in INSTALL.
May also be a command string, which will be run within
configure and whose output is used to set the value
of `link' in config.modules. This allows a
system-specific choice of modules. For example,
link='case $host in *-hpux*) echo dynamic; ;;
*) echo no; ;; esac'
- load `yes' or `no': whether the shell should include hooks
for loading the module automatically as necessary.
(This corresponds to an `L' in xmods.conf in the
old mechanism.)
- moddeps modules on which this module depends (default none)
- nozshdep non-empty indicates no dependence on the `zsh/main'
pseudo-module
Expand Down
67 changes: 29 additions & 38 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -66,53 +66,44 @@ The zsh distribution contains several modules, in the Src/Builtins,
Src/Modules and Src/Zle directories. If you have any additional zsh
modules that you wish to compile for this version of zsh, create another
subdirectory of the Src directory and put them there. You can create
as many extra subdirectory hierarchies as you need. The subdirectories
must be actual directories; symbolic links will not work.

If you wish to add or remove modules or module directories after you
have already run make, then after adding or removing the modules run:
make prep

You can also instruct the configuration process that a certain module
should neither be compiled nor installed without modifying any files. To
do this, give the argument `--enable-omit-modules=mod1,mod2,...' to
configure. The module arguments are the full names of the modules,
probably including the prefix `zsh/'. For example,
`configure --enable-omit-modules=zsh/zpty,zsh/example' says that the
modules zsh/zpty and zsh/example are not to be compiled nor installed.
Note that it is up to you to make sure the modules in question are not going
to be compiled into the main zsh binary, as described in the next section.
It is unlikely you would want to omit any of the modules liable to be
compiled in by default.

Controlling what is compiled into the main zsh binary
-----------------------------------------------------
as many extra subdirectories as you need, but currently configure will only
search in immediate subdirectories of Src. The subdirectories must be
actual directories; symbolic links will not work. You will then need to
rerun configure; the easiest way is to run `config.status --recheck' from
the top-level build directory which retains the existing configuration as
much as possible.

The key to the module system is the file config.modules, created in the
configuration process. Each module has a line in the file. It may be
edited to change the following values for each module; be careful to retain
the (strict) format for the file:
link - `dynamic', if the module is to be dynamically linked -- meaningless
if this is not available on your system.
`static' if the module is to be linked directly into the executable.
`no' if the module is not to be linked at all. In this case it will
not even be compiled.
load - `yes' if the module is to be visible to the user. This will make
builtins, parameters etc. visible to the user without any need
to use the zmodload builtin.
`no' if an explicit zmodload command is to be required to load the
utilities in the module. Note that this applies both to
statically and dynamically linked modules.
auto - `yes' if the entry is to be regenerated whenever configure is run.
`no' if you wish to retain your hand-edited version.
Do not edit the entry for the pseudo-module zsh/main, which is the main
shell. After you have edited this file, run `make prep' in the Src
subdirectory.

By default the complete, compctl, zle, computil, complist, sched, parameter,
zleparameter and rlimits modules are compiled into non-dynamic zsh and no
modules are compiled into the main binary if dynamic loading is available.
This can be overridden by creating the file mymods.conf in the compilation
directory (Src, unless you have told configure to use another directory)
with the list of modules which are to be compiled into the main binary, one
module name per line with no punctuation and no suffix. See the zshmodules
manual page for the list of available modules.

Note that mymods.conf replaces the standard list of linked-in modules from
Src/xmods.conf. If you wish to add to the standard list, copy the lines
that begin with "L " from xmods.conf into mymods.conf and remove the "L "
from each such line in mymods.conf. Then add the names of other modules
that you want to link. Module names typically must begin with "zsh/";
see the ".mdd" file for the module for the actual name. The modules must
be listed in dependency order, e.g., "zsh/zle" must precede "zsh/complete",
"zsh/complete" must precede "zsh/compctl", and similarly for any other
dependencies.

Note that the modules depending on zle or complete (e.g.: complist and
deltochar) cannot be loaded dynamically on systems which do not allow symbols
in one dynamically loaded library to be visible from another; this is true,
for example, of version 4 of SunOS. The most convenient workaround is to
compile zle and complete into the base executable by including them in
mymods.conf as described above.
compile zle and complete into the base executable by setting their `link'
entries in config.modules to `static' as described above.

Compiler Options or Using a Different Compiler
----------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions Src/.distfiles
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ DISTFILES_SRC='
ansi2knr.c modentry.c
builtin.c compat.c cond.c exec.c glob.c hashtable.c hashtable.h
hist.c init.c input.c jobs.c lex.c linklist.c loop.c main.c makepro.awk
math.c mem.c mkbltnmlst.sh mkmakemod.sh mkmodindex.sh
math.c mem.c mkbltnmlst.sh mkmakemod.sh
module.c options.c params.c parse.c pattern.c prompt.c prototypes.h
signals.c signals.h string.c subst.c system.h text.c utils.c
watch.c xmods.conf zsh.h zsh.mdd ztype.h
watch.c zsh.h zsh.mdd ztype.h
zsh.rc zsh.ico
'
2 changes: 2 additions & 0 deletions Src/Builtins/rlimits.mdd
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name=zsh/rlimits
link=either
load=yes

autobins="limit ulimit unlimit"

Expand Down
4 changes: 4 additions & 0 deletions Src/Builtins/sched.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
name=zsh/sched
link=either
load=yes

autobins="sched"

objects="sched.o"
34 changes: 4 additions & 30 deletions Src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,7 @@ rm-modobjs-tmp:

@CONFIG_MK@

Makemod modules.index prep: modules-bltin $(CONFIG_INCS)
( cd $(sdir_top) && OMIT_MODULES="$(OMIT_MODULES)" \
$(SHELL) $(subdir)/mkmodindex.sh $(subdir) ) \
> modules.index.tmp
@if cmp -s modules.index.tmp modules.index; then \
rm -f modules.index.tmp; \
echo "\`modules.index' is up to date."; \
else \
mv -f modules.index.tmp modules.index; \
echo "Updated \`modules.index'."; \
fi
Makemod prep: $(CONFIG_INCS) $(dir_top)/config.modules
@case $(sdir_top) in \
/*) top_srcdir=$(sdir_top) ;; \
*) top_srcdir=$(subdir)/$(sdir_top) ;; \
Expand All @@ -140,21 +130,6 @@ FORCE:
mymods.conf:
@echo Linking with the standard modules.

modules-bltin:: mymods.conf
@if test -f mymods.conf; then \
echo cat mymods.conf \> $@; \
cat mymods.conf > $@; \
fi

modules-bltin:: $(dir_top)/config.status $(sdir)/xmods.conf
if test -f mymods.conf; then \
cat mymods.conf > $@; \
elif test @D@ = N; then \
sed -n '/L.* /{s/^.* //;p;}' < $(sdir)/xmods.conf > $@; \
else \
echo > $@; \
fi

modules: $(@E@NTRYOBJ)

$(ENTRYOBJ): FORCE
Expand Down Expand Up @@ -228,14 +203,13 @@ mostlyclean-here:
.PHONY: mostlyclean-here

clean-here:
rm -f modules.index.tmp modules.stamp zsh$(EXEEXT) ansi2knr.o ansi2knr
rm -f modules.stamp zsh$(EXEEXT) ansi2knr.o ansi2knr
rm -f libzsh-*.$(DL_EXT)
.PHONY: clean-here

distclean-here:
rm -f TAGS tags
rm -f modules.index modules-bltin
rm -f Makefile mymods.conf
rm -f Makefile
.PHONY: distclean-here

mostlyclean: mostlyclean-modules
Expand All @@ -245,7 +219,7 @@ realclean: realclean-modules
.PHONY: mostlyclean clean distclean realclean

# Don't remake Makemod just to delete things, even if it doesn't exist.
mostlyclean-modules clean-modules distclean-modules realclean-modules: modules.index
mostlyclean-modules clean-modules distclean-modules realclean-modules:
if test -f Makemod; then \
$(MAKE) -f Makemod $(MAKEDEFS) `echo $@ | sed 's/-modules//'`; \
fi; \
Expand Down
5 changes: 2 additions & 3 deletions Src/Makemod.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ $(makefile): $(makefile).in $(dir_top)/config.status
cd $(dir_top) && \
$(SHELL) $$top_srcdir/Src/mkmakemod.sh -m $(subdir) $(makefile)

$(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) $(dir_src)/modules-bltin
$(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) \
$(dir_top)/config.modules
@case $(sdir_top) in \
/*) top_srcdir=$(sdir_top) ;; \
*) top_srcdir=$(subdir)/$(sdir_top) ;; \
Expand All @@ -188,5 +189,3 @@ $(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) $(dir
cd $(dir_top) && \
$(SHELL) $$top_srcdir/Src/mkmakemod.sh -i $(subdir) $(makefile)

$(dir_src)/modules-bltin:
@cd $(dir_src) && $(MAKE) $(MAKEDEFS) modules-bltin
4 changes: 4 additions & 0 deletions Src/Modules/cap.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
name=zsh/cap
link=dynamic
load=no

autobins="cap getcap setcap"

objects="cap.o"
4 changes: 4 additions & 0 deletions Src/Modules/clone.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
name=zsh/clone
link=dynamic
load=no

autobins="clone"

objects="clone.o"
9 changes: 9 additions & 0 deletions Src/Modules/example.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
name=zsh/example
link=dynamic
load=no

autobins="example"

autoinfixconds="ex"
autoprefixconds="len"
autoparams="exint exstr exarr"
automathfuncs="sum length"

objects="example.o"
6 changes: 5 additions & 1 deletion Src/Modules/files.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
autobins="ln mkdir mv rm rmdir sync"
name=zsh/files
link=dynamic
load=no

autobins="chgrp chown ln mkdir mv rm rmdir sync"

objects="files.o"
4 changes: 4 additions & 0 deletions Src/Modules/mapfile.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
name=zsh/mapfile
link=dynamic
load=no

autoparams="mapfile"

objects="mapfile.o"
4 changes: 4 additions & 0 deletions Src/Modules/mathfunc.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
name=zsh/mathfunc
link=dynamic
load=no

autobins="mathfunc"

objects="mathfunc.o"
6 changes: 5 additions & 1 deletion Src/Modules/parameter.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
autoparams="parameters commands functions options"
name=zsh/parameter
link=either
load=yes

autoparams="parameters commands functions dis_functions funcstack builtins dis_builtins reswords dis_reswords options modules dirstack history historywords jobtexts jobdirs jobstates nameddirs userdirs aliases dis_aliases galiases dis_galiases"

objects="parameter.o"
4 changes: 4 additions & 0 deletions Src/Modules/stat.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
name=zsh/stat
link=dynamic
load=no

autobins="stat"

objects="stat.o"
4 changes: 4 additions & 0 deletions Src/Modules/zftp.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
name=zsh/zftp
link=dynamic
load=no

autobins="zftp"

objects="zftp.o"
4 changes: 4 additions & 0 deletions Src/Modules/zprof.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
name=zsh/zprof
link=dynamic
load=no

autobins="zprof"

objects="zprof.o"
2 changes: 2 additions & 0 deletions Src/Modules/zpty.mdd
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name=zsh/zpty
link=dynamic
load=no

autobins="zpty"

Expand Down
8 changes: 7 additions & 1 deletion Src/Modules/zutil.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
name=zsh/zutil
link=either
load=yes

moddeps="zsh/complete"

objects="zutil.o"

autobins="zformat zstyle"
autobins="zformat zstyle zregexparse zparseopts"
2 changes: 2 additions & 0 deletions Src/Zle/compctl.mdd
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name=zsh/compctl
link=either
load=yes

moddeps="zsh/complete zsh/zle"

Expand Down
2 changes: 2 additions & 0 deletions Src/Zle/complete.mdd
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name=zsh/complete
link=either
load=yes

moddeps="zsh/zle"

Expand Down
6 changes: 5 additions & 1 deletion Src/Zle/complist.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
moddeps="comp1 zle"
name=zsh/complist
link=either
load=yes

moddeps="zsh/complete zsh/zle"

objects="complist.o"
2 changes: 2 additions & 0 deletions Src/Zle/computil.mdd
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name=zsh/computil
link=either
load=yes

moddeps="zsh/complete zsh/zle"

Expand Down
6 changes: 5 additions & 1 deletion Src/Zle/deltochar.mdd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
moddeps="zle"
name=zsh/deltochar
link=dynamic
load=no

moddeps="zsh/zle"

objects="deltochar.o"
Loading

0 comments on commit 49a1ad7

Please sign in to comment.