From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-request@euclid.skiles.gatech.edu Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.6/8.7.3) with ESMTP id CAA20457 for ; Sun, 24 Nov 1996 02:51:08 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id KAA20757; Sat, 23 Nov 1996 10:44:26 -0500 (EST) Resent-Date: Sat, 23 Nov 1996 10:44:26 -0500 (EST) From: Zefram Message-Id: <14767.199611231544@stone.dcs.warwick.ac.uk> Subject: module installation To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Sat, 23 Nov 1996 15:44:54 +0000 (GMT) X-Patch: 129 X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]8468.28 X-US-Congress: Moronic fuckers Content-Type: text Resent-Message-ID: <"bjI2c2.0.C45.Plnbo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2458 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----BEGIN PGP SIGNED MESSAGE----- This patch implements automatic installation of modules, by default in $(libdir)/zsh/$(VERSION). It also automatically initialises $module_path to point to this directory (previously it was initialised to be empty). The way I get the path from the Makefile into the source is by automatically generating an extra header, which is included in (and a dependency of) only one source file. I think it would be a good idea to handle the version number in the same way, so that changing the version number doesn't require rebuilding all the Makefiles or even all the objects. The Src/Makefile.in patch is textually very dependent on my recent patch 2455, but the changes are logically independent. -zefram Index: Makefile.in =================================================================== RCS file: /home/zefram/usr/cvsroot/zsh/Makefile.in,v retrieving revision 1.3 diff -c -r1.3 Makefile.in *** Makefile.in 1996/11/21 01:28:25 1.3 --- Makefile.in 1996/11/23 00:12:10 *************** *** 44,49 **** --- 44,50 ---- prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ + libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ manext = 1 *************** *** 67,73 **** MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \ CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \ prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \ ! infodir='$(infodir)' mandir='$(mandir)' manext='$(manext)' # subdirectories in distribution SUBDIRS = Src Doc Etc Functions StartupFiles Misc Util --- 68,74 ---- MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \ CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \ prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \ ! libdir='$(libdir)' infodir='$(infodir)' mandir='$(mandir)' manext='$(manext)' # subdirectories in distribution SUBDIRS = Src Doc Etc Functions StartupFiles Misc Util Index: Src/Makefile.in =================================================================== RCS file: /home/zefram/usr/cvsroot/zsh/Src/Makefile.in,v retrieving revision 1.8 diff -c -r1.8 Makefile.in *** Makefile.in 1996/11/22 02:20:05 1.8 --- Makefile.in 1996/11/23 00:12:32 *************** *** 38,43 **** --- 38,45 ---- prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ + libdir = @libdir@ + MODDIR = $(libdir)/zsh/$(VERSION) CC = @CC@ CPPFLAGS = @CPPFLAGS@ *************** *** 71,77 **** MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \ CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \ prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \ ! infodir='$(infodir)' mandir='$(mandir)' manext='$(manext)' MODBINS = $(srcdir)/modules-bltin --- 73,79 ---- MAKEDEFS = CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' \ CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \ prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \ ! libdir='$(libdir)' infodir='$(infodir)' mandir='$(mandir)' manext='$(manext)' MODBINS = $(srcdir)/modules-bltin *************** *** 211,223 **** $(OBJS): $(HDRS) ! init.o: bltinmods.list bltinmods.list: $(MODBINS) ( for mod in `cat $(MODBINS)`; do \ echo "DOMOD(mod_boot_$$mod, mod_cleanup_$$mod)"; \ done ) > $@ $(PROTO): makepro.sed $(NSTMP).force: --- 213,233 ---- $(OBJS): $(HDRS) ! init.o: bltinmods.list paths.h bltinmods.list: $(MODBINS) ( for mod in `cat $(MODBINS)`; do \ echo "DOMOD(mod_boot_$$mod, mod_cleanup_$$mod)"; \ done ) > $@ + paths.h.force: + echo '#define MODULE_DIR "'$(MODDIR)'"' > paths.h.tmp + if cmp -s paths.h paths.h.tmp; then \ + rm -f paths.h.tmp; \ + else \ + mv -f paths.h.tmp paths.h; \ + fi + $(PROTO): makepro.sed $(NSTMP).force: *************** *** 239,247 **** # ========== DEPENDENCIES FOR INSTALLING ========== ! install: install.bin ! uninstall: uninstall.bin # install binary, creating install directory if necessary install.bin: zsh --- 249,257 ---- # ========== DEPENDENCIES FOR INSTALLING ========== ! install: install.bin install.modules ! uninstall: uninstall.bin uninstall.modules # install binary, creating install directory if necessary install.bin: zsh *************** *** 256,261 **** --- 266,292 ---- -if [ -f $(bindir)/zsh ]; then rm -f $(bindir)/zsh; fi -if [ -f $(bindir)/zsh-$(VERSION) ]; then rm -f $(bindir)/zsh-$(VERSION); fi + # install modules + install.modules: + if test -n '$(MO@D@ULES)'; then \ + $(top_srcdir)/mkinstalldirs $(MODDIR); \ + for mod in .. $(MO@D@ULES); do \ + if test .$$mod = ...; then :; else \ + modname=`echo $$mod | $(SED) 's,.*/,,'`; \ + $(INSTALL_PROGRAM) $$mod $(MODDIR)/$$modname; \ + fi; \ + done; \ + fi + + # uninstall modules + uninstall.modules: + for mod in .. $(MO@D@ULES); do \ + if test .$$mod = ...; then :; else \ + modname=`echo $$mod | $(SED) 's,.*/,,'`; \ + test -f $(MODDIR)/$$modname && rm -f $(MODDIR)/$$modname; \ + fi; \ + done + # ========== DEPENDENCIES FOR CLEANUP ========== DLCLEAN = $(MODULE_DIR)/*.$(DL_EXT) $(MODULE_DIR)/*.*.[co] $(MODULE_DIR)/*.pro *************** *** 264,270 **** rm -f core stamp-modobjs* *.o $(MODULE_DIR)/*.o *~ clean: mostlyclean ! rm -f zsh ansi2knr $(@D@LCLEAN) signames.h bltinmods.list *.*.c *.pro distclean: clean rm -f Makefile --- 295,301 ---- rm -f core stamp-modobjs* *.o $(MODULE_DIR)/*.o *~ clean: mostlyclean ! rm -f zsh ansi2knr $(@D@LCLEAN) signames.h paths.h bltinmods.list *.*.c *.pro distclean: clean rm -f Makefile Index: Src/init.c =================================================================== RCS file: /home/zefram/usr/cvsroot/zsh/Src/init.c,v retrieving revision 1.24 diff -c -r1.24 init.c *** init.c 1996/11/22 02:20:06 1.24 --- init.c 1996/11/23 00:04:38 *************** *** 32,37 **** --- 32,39 ---- #define GLOBALS #include "zsh.h" + #include "paths.h" + int noexitct = 0; /* keep executing lists until EOF found */ *************** *** 456,462 **** watch = mkarray(NULL); psvar = mkarray(NULL); #ifdef DYNAMIC ! module_path = mkarray(NULL); #endif /* Set default prompts */ --- 458,464 ---- watch = mkarray(NULL); psvar = mkarray(NULL); #ifdef DYNAMIC ! module_path = mkarray(MODULE_DIR); #endif /* Set default prompts */ -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBMpZDg3D/+HJTpU/hAQFH9wQAg34BkNinUlDW+P5tY8LU7BWitA8EIrbk +bYHbmSmv32pNERjaTdjI3KPIlRTcqYpeDY+BjCcc3HnMI0HQlON/PkXIwYI+HPS JgDre/xHdwxEl2t+fL1ARly9kau+bg4qeDF7u3Lb1WSlwQSm5ggmliUY17faAwqt KXjYjH0wH60= =PvvF -----END PGP SIGNATURE-----