Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: omit modules from compilation and installation process



This was easier than I'd expected.  Zefram, does this look right to you?
It seems to fit in quite naturally with the form of mkmodindex.sh.

Now you can give configure a comma-separated list of modules not to compile
nor install as --enable-omit-modules=zsh/example,zsh/zpty.  Having to use
the `enable' in front is a bit tacky, but as far as I can see there's no
way round it.  There's no restriction on what you can omit, so it requires
a bit of discretion on the part of the compiler.  I can foresee one of its
major uses will be to put instructions into Etc/MACHINES on the lines of
`the zsh/zpty module doesn't work on the Kray TWINNE, give configure the
argument --enable-omit-modules=zsh/zpty'.

I haven't allowed it to use patterns, which seems a bit dangerous, though
potentially if there are add-on modules from different `vendors' you might
want to do --enable-omit-modules="foo/*".

Index: INSTALL
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/INSTALL,v
retrieving revision 1.5
diff -u -r1.5 INSTALL
--- INSTALL	2000/01/20 19:47:34	1.5
+++ INSTALL	2000/02/13 18:30:55
@@ -59,8 +59,8 @@
 unless given explicitly, and PREFIX defaults to /usr/local.  See the end of
 this file for options to configure to change these.
 
-Adding more modules
--------------------
+Adding and removing modules
+---------------------------
 
 The zsh distribution contains several modules, in the Src/Builtins,
 Src/Modules and Src/Zle directories.  If you have any additional zsh
@@ -73,6 +73,18 @@
 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
 -----------------------------------------------------
 
@@ -365,6 +377,7 @@
      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
+     omit-modules=mod1,..# don't compile nor install the modules named mod1,...
      dynamic             # allow dynamically loaded binary modules
      lfs                 # allow configure check for large files
      locale              # allow use of locale library
Index: configure.in
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/configure.in,v
retrieving revision 1.15
diff -u -r1.15 configure.in
--- configure.in	2000/01/20 19:47:34	1.15
+++ configure.in	2000/02/13 18:12:36
@@ -186,6 +186,16 @@
 [  --disable-dynamic          turn off dynamically loaded binary modules],
 [dynamic="$enableval"], [dynamic=yes])
 
+dnl Do you want to disable a list of modules?
+dnl Unfortunately we can't give --disable-* a value, so we'll have
+dnl to do it as an `--enable-*', rather unnaturally.
+undefine([OMIT_MODULES])dnl
+AC_ARG_ENABLE(omit-modules,
+[  --enable-omit-modules      give comma-separated list of modules to ignore],
+[OMIT_MODULES="$enableval"], [OMIT_MODULES=])
+
+AC_SUBST(OMIT_MODULES)dnl
+
 dnl Do you want to compile as K&R C.
 AC_ARG_ENABLE(ansi2knr,
 [  --enable-ansi2knr          translate source to K&R C before compiling],
Index: Config/defs.mk.in
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/Config/defs.mk.in,v
retrieving revision 1.5
diff -u -r1.5 defs.mk.in
--- Config/defs.mk.in	2000/01/20 19:47:34	1.5
+++ Config/defs.mk.in	2000/02/13 18:10:41
@@ -62,6 +62,9 @@
 EXPOPT          = @EXPOPT@
 IMPOPT          = @IMPOPT@
 
+# choose modules not to compile and install
+OMIT_MODULES    = @OMIT_MODULES@
+
 # utilities
 AWK             = @AWK@
 YODL            = @YODL@
Index: Src/Makefile.in
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/Src/Makefile.in,v
retrieving revision 1.11
diff -u -r1.11 Makefile.in
--- Src/Makefile.in	2000/01/04 22:04:35	1.11
+++ Src/Makefile.in	2000/02/13 18:16:11
@@ -101,7 +101,8 @@
 @CONFIG_MK@
 
 Makemod modules.index prep: modules-bltin $(CONFIG_INCS)
-	( cd $(sdir_top) && $(SHELL) $(subdir)/mkmodindex.sh $(subdir) ) \
+	( 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; \
Index: Src/mkmodindex.sh
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/Src/mkmodindex.sh,v
retrieving revision 1.2
diff -u -r1.2 mkmodindex.sh
--- Src/mkmodindex.sh	1999/12/21 15:18:28	1.2
+++ Src/mkmodindex.sh	2000/02/13 18:22:47
@@ -8,6 +8,8 @@
 echo "# module index generated by mkmodindex.sh"
 echo
 
+omit_modules="`echo $OMIT_MODULES | sed 's/,/ /'`"
+
 module_list=' '
 while test $# -ne 0; do
     dir=$1
@@ -25,6 +27,11 @@
 	    eval "omodfile=\$modfile_$q_name"
 	    echo >&2 "WARNING: module \`$name' (in $omodfile) duplicated in $modfile"
 	    echo >&2 "         (ignoring duplicate)"
+	    continue
+	;; esac
+	case " $omit_modules " in *" $name "*)
+	    echo >&2 "Module \`$name' found in \$OMIT_MODULES"
+	    echo >&2 "         (omitting it)"
 	    continue
 	;; esac
 	module_list="$module_list$name "

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>



Messages sorted by: Reverse Date, Date, Thread, Author