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

PATCH: Program transform name, again



I'm going to say right up front that I think this patch demonstrates that
we're doing the wrong thing to apply program name transforms to the doc at
all, and that I'd much prefer we back off to the -pws-10 behavior in all
subdirs except possibly Src/.

This implements the suggestion from Zefram that came out of the discussion
this weekend.  That is:

1.  It restores Doc/zsh.yo, in exactly it's -pws-10 form (and therefore
    that file isn't included in the patch).
2.  After this patch, Doc/zsh.yo.in should be removed.
3.  The yodl source is now used to create a zsh.texi.in, which is
    distributed in place of zsh.texi.
4.  Name transform is applied to the @setfilename line in zsh.texi.in to
    generate zsh.texi.  Note that if a --program-suffix is supplied, the
    resulting file name does not end in .info, which is almost certainly
    a bad thing and is the leading argument that --program-transform-name
    is intended to apply only to the name of the binary.
5.  Name transform is applied to manual page names as well.  Same caveat
    about --program-suffix.

I've also removed the "make -f - <<EOF" hack from configure.in, putting all
the references to @program_transform_name@ back into **/Makefile.in with
multiple repetitions of the backquote expansion factored out into shell
variables.  I couldn't come up with a good way to output the "binary/info
base name" at the end of configure.in because it was wrong with respect to
prefix/suffix and relied on the make hack, so I dropped it.

Index: Makefile.in
===================================================================
@@ -38,9 +38,6 @@
 
 @DEFS_MK@
 
-transform = @program_transform_name@
-tzsh = @tzsh@
-
 # ========== DEPENDENCIES FOR BUILDING ==========
 
 # default target
Index: configure.in
===================================================================
@@ -48,15 +48,6 @@
 dnl Handle --program-prefix, --program-suffix, etc.
 AC_ARG_PROGRAM
 
-u_ptn=`make -s -f - <<EOF
-all:
-	@echo ${program_transform_name}
-EOF
-`
-tzsh=`echo zsh | sed -e "${u_ptn}"`
-
-AC_SUBST(tzsh)dnl
-
 dnl Do you want to debug zsh?
 undefine([zsh-debug])dnl
 AC_ARG_ENABLE(zsh-debug,
@@ -1610,6 +1601,5 @@
 if test "$zshfndir" != no; then
 echo "functions install path    : ${zshfndir}
 installed functions       : ${FUNCTIONS_INSTALL}
-binary/info base name     : ${tzsh}
 "
 fi
Index: Doc/.cvsignore
===================================================================
@@ -1,8 +1,7 @@
 Makefile
 version.yo
-zsh.yo
 zsh*.1
-zsh.texi
+zsh.texi*
 zsh.info*
 zsh_*.html
 zsh.aux zsh.toc
Index: Doc/.distfiles
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-3.1/Doc/.distfiles,v
retrieving revision 1.2
diff -u -r1.2 .distfiles
--- .distfiles	1999/12/02 16:42:02	1.2
+++ .distfiles	1999/12/06 01:29:05
@@ -2,10 +2,10 @@
     .cvsignore .distfiles Makefile.in
     META-FAQ.yo intro.ms
     version.yo zmacros.yo zman.yo ztexi.yo
-    zsh.yo.in zshbuiltins.yo zshcompctl.yo zshcompsys.yo zshcompwid.yo
+    zsh.yo zshbuiltins.yo zshcompctl.yo zshcompsys.yo zshcompwid.yo
     zshexpn.yo zshmisc.yo zshmodules.yo zshoptions.yo zshparam.yo
     zshzftpsys.yo zshzle.yo
-    zsh.texi
+    zsh.texi.in
     zsh.1 zshbuiltins.1 zshcompctl.1 zshcompsys.1 zshcompwid.1 zshexpn.1
     zshmisc.1 zshmodules.1 zshoptions.1 zshparam.1 zshzle.1 zshall.1
     zshzftpsys.1
Index: Doc/Makefile.in
===================================================================
@@ -35,8 +35,6 @@
 sdir_top        = @top_srcdir@
 INSTALL         = @INSTALL@
 
-tzsh = @tzsh@
-
 @DEFS_MK@
 
 MAKEINFO = makeinfo
@@ -52,7 +50,7 @@
 zshoptions.1 zshparam.1 zshzftpsys.1 zshzle.1 zshall.1
 
 # yodl documentation
-YODLDOC = $(MAN) zsh.texi
+YODLDOC = $(MAN) zsh.texi.in
 YODLSRC = zmacros.yo zman.yo ztexi.yo Zsh/arith.yo Zsh/builtins.yo \
 Zsh/compat.yo Zsh/compctl.yo Zsh/compsys.yo Zsh/compwid.yo Zsh/cond.yo \
 Zsh/exec.yo Zsh/expn.yo \
@@ -67,24 +65,23 @@
 Zsh/seealso.yo Zsh/zftpsys.yo Zsh/zle.yo
 
 # ========== DEPENDENCIES FOR BUILDING ==========
+
+transform = @program_transform_name@
 
-all: $(MAN) zsh.texi $(tzsh).info ../META-FAQ
+all: $(MAN) zsh.texi zsh.info ../META-FAQ
 
 everything: all zsh.dvi zsh_us.ps zsh_a4.ps zsh_toc.html
 
 zsh.dvi: zsh.texi
-	$(TEXI2DVI) $(sdir)/zsh.texi
+	$(TEXI2DVI) zsh.texi
 
-%.info: zsh.texi
-	$(MAKEINFO) $(sdir)/zsh.texi || exit 0
+zsh.texi.in: $(sdir)/zsh.yo
+	$(YODL) -o $(sdir)/zsh.texi.in -I$(sdir) -w ztexi.yo version.yo zsh.yo
 
-zsh.texi: $(sdir)/zsh.yo
-	$(YODL) -o $(sdir)/zsh.texi -I$(sdir) -w ztexi.yo version.yo zsh.yo
-	test -f $(sdir)/zsh.texi
+zsh.texi: zsh.texi.in
+	@test -f $(sdir)/zsh.texi.in -a -s $(sdir)/zsh.texi.in
+	sed '/@setfilename/{; s/@setfilename //; $(transform) ; s/^/@setfilename /;}' < $(sdir)/zsh.texi > zsh.texi
 
-$(sdir)/zsh.yo: $(sdir)/zsh.yo.in
-	sed 's,@@TEXINFO@@,texinfo\($(tzsh).info\)\($(tzsh)\),' $(sdir)/zsh.yo.in > $(sdir)/zsh.yo
-
 .yo.1:
 	@case $@ in \
 	  */*) target=$@ ;; \
@@ -173,27 +170,31 @@
 install.man: $(MAN)
 	$(sdir_top)/mkinstalldirs $(DESTDIR)$(mandir)/man1
 	for file in $(MAN); do \
+	  tzsh=`echo $$file | sed '$(transform)'`; \
 	  if test -f $$file; then \
-	    $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man1; \
+	    cp -f $$file $$tzsh; \
 	  elif test -f $(sdir)/$$file; then \
-	    $(INSTALL_DATA) $(sdir)/$$file $(DESTDIR)$(mandir)/man1; \
+	    cp -f $(sdir)/$$file $$tzsh; \
 	  else :; \
 	  fi || exit 1; \
+	  $(INSTALL_DATA) $$tzsh $(DESTDIR)$(mandir)/man1 || exit 1; \
 	done
 
 # install info pages, creating install directory if necessary
-install.info: $(tzsh).info
+install.info: zsh.texi
+	$(MAKEINFO) zsh.texi
 	$(sdir_top)/mkinstalldirs $(DESTDIR)$(infodir)
-	for file in $(tzsh).info $(tzsh).info-[1-9]*; do \
+	tzsh=`echo zsh.info | sed '$(transform)'`; \
+	for file in $$tzsh $$tzsh-[1-9]*; do \
 	  if test -f $$file; then \
 	    $(INSTALL_DATA) $$file $(DESTDIR)$(infodir); \
 	  elif test -f $(sdir)/$$file; then \
 	    $(INSTALL_DATA) $(sdir)/$$file $(DESTDIR)$(infodir); \
 	  else :; \
 	   fi || exit 1; \
-	done
+	done; \
 	if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
-	  install-info --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/$(tzsh).info; \
+	  install-info --dir-file=$(DESTDIR)$(infodir)/dir $(DESTDIR)$(infodir)/$$tzsh.info; \
 	else true; fi
 
 install.html: zsh_toc.html
@@ -203,12 +204,14 @@
 # uninstall man pages
 uninstall.man:
 	for file in $(MAN); do \
-	  rm -f $(DESTDIR)$(mandir)/man1/$$file; \
+	  tzsh=`echo zsh | sed '$(transform)'`; \
+	  rm -f $(DESTDIR)$(mandir)/man1/$$tzsh; \
 	done
 
 # uninstall info pages
 uninstall.info:
-	rm -f $(DESTDIR)$(infodir)/$(tzsh).info $(DESTDIR)$(infodir)/$(tzsh).info-[1-9]*
+	tzsh=`echo zsh | sed '$(transform)'`; \
+	rm -f $(DESTDIR)$(infodir)/$$tzsh.info $(DESTDIR)$(infodir)/$$tzsh.info-[1-9]*
 
 # ========== DEPENDENCIES FOR CLEANUP ==========
 
Index: Src/Makefile.in
===================================================================
@@ -42,8 +42,6 @@
 sdir_src      = $(sdir)
 dir_src       = .
 
-tzsh = @tzsh@
-
 # ========= DEPENDENCIES FOR BUILDING ==========
 
 LINK        = $(CC) $(LDFLAGS) $(EXELDFLAGS) $(EXTRA_LDFLAGS) -o $@
@@ -152,6 +150,8 @@
 
 # ========== DEPENDENCIES FOR INSTALLING ==========
 
+transform = @program_transform_name@
+
 install: install.bin install.modules
 uninstall: uninstall.bin uninstall.modules
 
@@ -161,14 +161,15 @@
 # install binary, creating install directory if necessary
 install.bin-here: zsh install.bin-@L@
 	$(sdir_top)/mkinstalldirs $(DESTDIR)$(bindir)
-	$(INSTALL_PROGRAM) $(STRIPFLAGS) zsh $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION)
-	if test -f $(DESTDIR)$(bindir)/$(tzsh); then \
-	   rm -f $(DESTDIR)$(bindir)/$(tzsh).old; \
-	   $(LN) $(DESTDIR)$(bindir)/$(tzsh) $(DESTDIR)$(bindir)/$(tzsh).old; \
-	else :; fi
-	rm -f $(DESTDIR)$(bindir)/$(tzsh).new
-	$(LN) $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION) $(DESTDIR)$(bindir)/$(tzsh).new
-	mv $(DESTDIR)$(bindir)/$(tzsh).new $(DESTDIR)$(bindir)/$(tzsh)
+	tzsh=`echo zsh | sed '$(transform)'`; \
+	$(INSTALL_PROGRAM) $(STRIPFLAGS) zsh $(DESTDIR)$(bindir)/$$tzsh-$(VERSION) && \
+	if test -f $(DESTDIR)$(bindir)/$$tzsh; then \
+	   rm -f $(DESTDIR)$(bindir)/$$tzsh.old; \
+	   $(LN) $(DESTDIR)$(bindir)/$$tzsh $(DESTDIR)$(bindir)/$$tzsh.old; \
+	else :; fi && \
+	rm -f $(DESTDIR)$(bindir)/$$tzsh.new && \
+	$(LN) $(DESTDIR)$(bindir)/$$tzsh-$(VERSION) $(DESTDIR)$(bindir)/$$tzsh.new && \
+	mv $(DESTDIR)$(bindir)/$$tzsh.new $(DESTDIR)$(bindir)/$$tzsh
 
 install.bin-N:
 install.bin-L: $(LIBZSH)
@@ -177,7 +178,8 @@
 
 # uninstall binary
 uninstall.bin-here: uninstall.bin-@L@
-	rm -f $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION) $(DESTDIR)$(bindir)/$(tzsh)
+	tzsh=`echo zsh | sed '$(transform)'`; \
+	rm -f $(DESTDIR)$(bindir)/$$tzsh-$(VERSION) $(DESTDIR)$(bindir)/$$tzsh
 
 uninstall.bin-N:
 uninstall.bin-L:

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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