zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Program transform name, again
@ 1999-12-06  2:39 Bart Schaefer
  1999-12-06  4:07 ` Bart Schaefer
  1999-12-06 10:14 ` Zefram
  0 siblings, 2 replies; 7+ messages in thread
From: Bart Schaefer @ 1999-12-06  2:39 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Program transform name, again
  1999-12-06  2:39 PATCH: Program transform name, again Bart Schaefer
@ 1999-12-06  4:07 ` Bart Schaefer
  1999-12-06  4:22   ` Bart Schaefer
  1999-12-06 10:14 ` Zefram
  1 sibling, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 1999-12-06  4:07 UTC (permalink / raw)
  To: zsh-workers

On Dec 6,  2:39am, Bart Schaefer wrote:
} Subject: PATCH: Program transform name, again
}
} 4.  Name transform is applied to the @setfilename line in zsh.texi.in to
}     generate zsh.texi.

Oops; two silly typos fixed below, and avoid making one of those mistakes
again by using $<.

Index: Doc/Makefile.in
===================================================================
@@ -78,9 +78,9 @@
 zsh.texi.in: $(sdir)/zsh.yo
 	$(YODL) -o $(sdir)/zsh.texi.in -I$(sdir) -w ztexi.yo version.yo zsh.yo
 
-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
+zsh.texi: $(sdir)/zsh.texi.in
+	@test -f $< -a -s $<
+	sed '/@setfilename/{; s/@setfilename //; $(transform) ; s/^/@setfilename /;}' < $< > zsh.texi
 
 .yo.1:
 	@case $@ in \

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Program transform name, again
  1999-12-06  4:07 ` Bart Schaefer
@ 1999-12-06  4:22   ` Bart Schaefer
  0 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 1999-12-06  4:22 UTC (permalink / raw)
  To: zsh-workers

On Dec 6,  4:07am, Bart Schaefer wrote:
} Subject: Re: PATCH: Program transform name, again
}
} Oops; two silly typos fixed below

Of course this is what I get for not starting the make from a completely
clean tree.  zsh.info should no longer be built until install time, as its
name may not even be zsh.info any more.

Index: Doc/Makefile.in
===================================================================
@@ -68,14 +68,14 @@
 
 transform = @program_transform_name@
 
-all: $(MAN) zsh.texi zsh.info ../META-FAQ
+all: $(MAN) zsh.texi ../META-FAQ
 
 everything: all zsh.dvi zsh_us.ps zsh_a4.ps zsh_toc.html
 
 zsh.dvi: zsh.texi
 	$(TEXI2DVI) zsh.texi
 
-zsh.texi.in: $(sdir)/zsh.yo
+$(sdir)/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.texi.in

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Program transform name, again
  1999-12-06  2:39 PATCH: Program transform name, again Bart Schaefer
  1999-12-06  4:07 ` Bart Schaefer
@ 1999-12-06 10:14 ` Zefram
  1999-12-06 16:32   ` Bart Schaefer
  1 sibling, 1 reply; 7+ messages in thread
From: Zefram @ 1999-12-06 10:14 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

Bart Schaefer wrote:
>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.

No, no, this is all wrong.  You should be doing

	tzsh=`echo zsh | sed '@program_transform_name@'`

and then in each installed filename replace the substring "zsh" with "$(tzsh)".  So you'd do

	$(INSTALL_DATA) zshzle.1 $(DESTDIR)$(mandir)/man1/$(tzsh)zle.1

and so on.  The transform applies to the *program* name -- `zsh' -- not to
the actual filenames.  Furthermore, no transformed-name files, except the
info files (but they're an exception), should appear in the build tree.

-zefram


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Program transform name, again
  1999-12-06 10:14 ` Zefram
@ 1999-12-06 16:32   ` Bart Schaefer
  1999-12-06 17:11     ` Zefram
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 1999-12-06 16:32 UTC (permalink / raw)
  To: zsh-workers

On Dec 6, 10:14am, Zefram wrote:
} Subject: Re: PATCH: Program transform name, again
}
} No, no, this is all wrong.  You should be doing
} 
} 	tzsh=`echo zsh | sed '@program_transform_name@'`
} 
} and then in each installed filename replace the substring "zsh" with
} "$(tzsh)".

Oh, of course.  How silly of me.

This should be installed INSTEAD OF Clint's 8915, which arrived just as
I pasted the patch below into my editor buffer.  They're almost identical,
but I've covered quoting of commas in the transformed name and avoided
using slashes as sed separators in case the name prefix has one.  Also,
this fixes the @setfilename line inside zsh.texi, which Clint missed.

Index: Doc/Makefile.in
===================================================================
@@ -80,7 +80,8 @@
 
 zsh.texi: $(sdir)/zsh.texi.in
 	@test -f $< -a -s $<
-	sed '/@setfilename/{; s/@setfilename //; $(transform) ; s/^/@setfilename /;}' < $< > zsh.texi
+	tzsh=`echo zsh | sed '$(transform); s/,/\\\\,/g'`; \
+	sed "/@setfilename/{; s/@setfilename //; s,zsh,$$tzsh, ; s/^/@setfilename /;}" < $< > zsh.texi
 
 .yo.1:
 	@case $@ in \
@@ -169,23 +170,24 @@
 # install man pages, creating install directory if necessary
 install.man: $(MAN)
 	$(sdir_top)/mkinstalldirs $(DESTDIR)$(mandir)/man1
+	tzsh=`echo zsh | sed '$(transform); s/,/\\\\,/g'`; \
 	for file in $(MAN); do \
-	  tzsh=`echo $$file | sed '$(transform)'`; \
+	  tfile=`echo $$file | sed "s,zsh,$$tzsh,"`; \
 	  if test -f $$file; then \
-	    cp -f $$file $$tzsh; \
+	    cp -f $$file $$tfile; \
 	  elif test -f $(sdir)/$$file; then \
-	    cp -f $(sdir)/$$file $$tzsh; \
+	    cp -f $(sdir)/$$file $$tfile; \
 	  else :; \
 	  fi || exit 1; \
-	  $(INSTALL_DATA) $$tzsh $(DESTDIR)$(mandir)/man1 || exit 1; \
+	  $(INSTALL_DATA) $$tfile $(DESTDIR)$(mandir)/man1 || exit 1; \
 	done
 
 # install info pages, creating install directory if necessary
 install.info: zsh.texi
 	$(MAKEINFO) zsh.texi
 	$(sdir_top)/mkinstalldirs $(DESTDIR)$(infodir)
-	tzsh=`echo zsh.info | sed '$(transform)'`; \
-	for file in $$tzsh $$tzsh-[1-9]*; do \
+	tzsh=`echo zsh | sed '$(transform)'`; \
+	for file in $$tzsh.info $$tzsh.info-[1-9]*; do \
 	  if test -f $$file; then \
 	    $(INSTALL_DATA) $$file $(DESTDIR)$(infodir); \
 	  elif test -f $(sdir)/$$file; then \
@@ -204,8 +206,9 @@
 # uninstall man pages
 uninstall.man:
 	for file in $(MAN); do \
-	  tzsh=`echo zsh | sed '$(transform)'`; \
-	  rm -f $(DESTDIR)$(mandir)/man1/$$tzsh; \
+	  tzsh=`echo zsh | sed '$(transform); s/,/\\\\,/g'`; \
+	  tfile=`echo $$file | sed "s,zsh,$$tzsh,"`; \
+	  rm -f $(DESTDIR)$(mandir)/man1/$$tfile; \
 	done
 
 # uninstall info pages

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Program transform name, again
  1999-12-06 16:32   ` Bart Schaefer
@ 1999-12-06 17:11     ` Zefram
  1999-12-06 18:31       ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Zefram @ 1999-12-06 17:11 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

Bart Schaefer wrote:
>but I've covered quoting of commas in the transformed name and avoided
>using slashes as sed separators in case the name prefix has one.

Slashes in a prefix probably wouldn't work.  If you want a better safe
character, use "|" or ";"; leave "," alone.

-zefram


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Program transform name, again
  1999-12-06 17:11     ` Zefram
@ 1999-12-06 18:31       ` Bart Schaefer
  0 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 1999-12-06 18:31 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

On Dec 6,  5:11pm, Zefram wrote:
} Subject: Re: PATCH: Program transform name, again
}
} Bart Schaefer wrote:
} >but I've covered quoting of commas in the transformed name and avoided
} >using slashes as sed separators in case the name prefix has one.
} 
} Slashes in a prefix probably wouldn't work.  If you want a better safe
} character, use "|" or ";"; leave "," alone.

Too late; configure already uses comma as the sed separator character.
(And now that I look, it doesn't even bother to protect it in case it
appears in the transform.)  I chose comma *because* configure already
was using it.

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1999-12-06 18:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-06  2:39 PATCH: Program transform name, again Bart Schaefer
1999-12-06  4:07 ` Bart Schaefer
1999-12-06  4:22   ` Bart Schaefer
1999-12-06 10:14 ` Zefram
1999-12-06 16:32   ` Bart Schaefer
1999-12-06 17:11     ` Zefram
1999-12-06 18:31       ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).