zsh-workers
 help / color / mirror / code / Atom feed
From: Martin Vaeth <vaeth@mathematik.uni-wuerzburg.de>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: zsh-workers@zsh.org
Subject: Re: Install run-help and *.zwc files system wide in build system
Date: Sun, 10 Nov 2013 23:44:41 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.02.1311102341430.29952@lounge.imp.fu-berlin.de> (raw)
In-Reply-To: <20131110181333.7682d38f@pws-pc.ntlworld.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 61 bytes --]

Sorry, I attached the wrong patch. The correct one is here...

[-- Attachment #2: Type: TEXT/PLAIN, Size: 6791 bytes --]

--- 1/Completion/Zsh/Command/_run-help
+++ 1/Completion/Zsh/Command/_run-help
@@ -0,0 +1,7 @@
+#compdef run-help
+local d expl
+local HELPDIR=${HELPDIR:-/usr/share/zsh/$ZSH_VERSION/help}
+[[ -d $HELPDIR ]] && {
+	d=($HELPDIR/*(:t))
+	(($#d)) && _wanted commands expl 'command' compadd -a d
+} || _man
--- 1/Doc/Makefile.in
+++ 1/Doc/Makefile.in
@@ -33,6 +33,7 @@
 VPATH           = @srcdir@
 sdir            = @srcdir@
 sdir_top        = @top_srcdir@
+runhelpdir      = @runhelpdir@
 INSTALL         = @INSTALL@
 
 @DEFS_MK@
@@ -82,7 +83,7 @@
 
 # ========== DEPENDENCIES FOR BUILDING ==========
 
-all: man texi ../META-FAQ
+all: man runhelp texi ../META-FAQ
 .PHONY: all
 
 everything: all dvi html pdf info
@@ -183,6 +184,11 @@
 man: $(MAN)
 .PHONY: man
 
+runhelp: man
+	test x"$(runhelpdir)" = x"" || \
+	  ${SHELL} $(sdir)/generate-help.sh $(sdir_top) $(sdir)/runhelp $(lc_ctype)
+.PHONY: runhelp
+
 $(MAN): zmacros.yo zman.yo
 
 zsh.1 zshall.1: Zsh/intro.yo Zsh/metafaq.yo Zsh/invoke.yo Zsh/files.yo \
@@ -285,12 +291,12 @@
 
 # ========== DEPENDENCIES FOR INSTALLING ==========
 
-# install just installs the manual pages
-install: install.man
+# install just installs the manual and runhelp pages
+install: install.man install.runhelp
 .PHONY: install
 
-# uninstall just unistalls the manual pages
-uninstall: uninstall.man
+# uninstall just uninstalls the manual and runhelp pages
+uninstall: uninstall.man uninstall.runhelp
 .PHONY: uninstall
 
 # install man pages, creating install directory if necessary
@@ -302,6 +308,17 @@
 	done
 .PHONY: install.man
 
+# install runhelp pages, creating install directory if necessary
+install.runhelp: runhelp
+	if test x"$(runhelpdir)" != x""; then \
+	    ${SHELL} $(sdir_top)/mkinstalldirs $(DESTDIR)$(runhelpdir); \
+	    for file in $(sdir)/runhelp/*; do \
+	        $(INSTALL_DATA) $$file $(DESTDIR)$(runhelpdir); \
+	        test -h $$file && cp -P $$file $(DESTDIR)$(runhelpdir) || :; \
+	  done; \
+	fi
+.PHONY: install.runhelp
+
 # install info pages, creating install directory if necessary
 install.info: texi
 	${SHELL} $(sdir_top)/mkinstalldirs $(DESTDIR)$(infodir)
@@ -334,6 +349,11 @@
 	done
 .PHONY: uninstall.man
 
+# uninstall runhelp pages
+uninstall.runhelp:
+	test x"$(runhelpdir)" = x"" || rm -rf -- $(DESTDIR)$(runhelpdir)
+.PHONY: uninstall.runhelp
+
 # uninstall info pages
 uninstall.info:
 	rm -f $(DESTDIR)$(infodir)/$(tzsh).info
--- 1/Doc/generate-help.sh
+++ 1/Doc/generate-help.sh
@@ -0,0 +1,83 @@
+#!/usr/bin/env sh
+
+Echo() {
+	printf '%s\n' "${*}"
+}
+
+[ ${#} -ge 2 ] && test -f "${1}/Doc/zshbuiltins.1" || { Echo \
+'Usage: generate-help.sh zsh-sources-directory destination-directory [LC_CTYPE]
+If you pass LC_CTYPE it must be utf8 aware.
+If you do not pass LC_CTYPE a heuristics is used to guess some for your system'
+	exit 1
+}
+
+case ${1} in
+/*) S=${1};;
+*) S=${PWD}/${1};;
+esac
+D=${2}
+
+Die() {
+	Echo "generate-help.sh: fatal: ${*}" >&2
+	exit 1
+}
+
+Info() {
+	Echo "generate-help.sh: ${*}"
+}
+
+test -d "${D}" || mkdir -- "${D}" || Die "failed to create ${D}"
+
+# We need GROFF_NO_SGR to produce "classical" formatting:
+export GROFF_NO_SGR=
+
+# This is self-explaining
+export MANWIDTH=80
+
+# In case the user has exported this, we restore the default:
+unset MANPL MANROFFSEQ
+
+# Now we must prepare locales:
+# Problem is LC_CTYPE since this must be utf8-aware for man to work properly.
+# Since there is no standard utf8-aware locale, we must use heuristics.
+unset LC_ALL LC_CTYPE
+export LANG=C
+if [ ${#} -eq 3 ]
+then	LC_CTYPE=${3}
+else	# Prefer en*utf8* (case ignored) over *utf8* over en*|*.* over rest
+	unset i j
+	for i in `locale -a 2>/dev/null`
+	do	case ${i} in
+		en*[uU][tT][fF]8*)
+			LC_CTYPE=${i}
+			break;;
+		*[uU][tT][fF]8*)
+			[ -n "${LC_CTYPE}" ] || LC_CTYPE=${i};;
+		en*|*.*)
+			j=${i};;
+		esac
+	done
+	[ -n "${LC_CTYPE}" ] || [ -z "${j}" ] || LC_CTYPE=${j}
+fi
+if [ -z "${LC_CTYPE}" ]
+then	Info "LC_CTYPE unset"
+else	Info "LC_CTYPE=${LC_CTYPE}"
+	export LC_CTYPE
+fi
+
+Info "generating files into ${D}"
+
+# It is necessary to be paranoid about the success of the following pipe,
+# since any change in locale or environment can break it completely.
+# In the lack of pipestatus, we better use temporary files
+rm -f -- "${D}/tmp1" "${D}/tmp2"
+man "${S}/Doc/zshbuiltins.1" >"${D}/tmp1" || Die 'man zshbuiltins.1 failed'
+colcrt "${D}/tmp1" >"${D}/tmp2" || Die 'colcrt failed'
+( cd -- "${D}" >/dev/null 2>&1 || Die "cannot cd to ${D}"
+perl "${S}/Util/helpfiles" <tmp2 || Die 'perl Util/helpfiles failed' )
+rm -f -- "${D}/tmp1" "${D}/tmp2"
+
+# Finally, we make a sanity check:
+
+test -r "${D}/zmodload" || Die 'did not produce all required files'
+Info 'success'
--- 1/Makefile.in
+++ 1/Makefile.in
@@ -63,8 +63,8 @@
 	$(MAKE) install STRIPFLAGS="-s"
 
 # install/uninstall most things
-install: install.bin install.modules install.fns install.man
-uninstall: uninstall.bin uninstall.modules uninstall.fns uninstall.man
+install: install.bin install.modules install.fns install.man install.runhelp
+uninstall: uninstall.bin uninstall.modules uninstall.fns uninstall.man uninstall.runhelp
 
 # install/uninstall just the binary
 install.bin uninstall.bin:
@@ -78,6 +78,10 @@
 install.man uninstall.man:
 	@cd Doc && $(MAKE) $(MAKEDEFS) $@
 
+# install/uninstall just the runhelp files
+install.runhelp uninstall.runhelp:
+	@cd Doc && $(MAKE) $(MAKEDEFS) $@
+
 # install/uninstall just the shell functions
 install.fns:
 	if test x$(fndir) != x && test x$(fndir) != xno; then \
--- 1/StartupFiles/zshrc
+++ 1/StartupFiles/zshrc
@@ -75,7 +75,7 @@
 # Some environment variables
 export MAIL=/var/spool/mail/$USERNAME
 export LESS=-cex3M
-export HELPDIR=/usr/local/lib/zsh/help  # directory for run-help function to find docs
+export HELPDIR=/usr/share/zsh/$ZSH_VERSION/help  # directory for run-help function to find docs
 
 MAILCHECK=300
 HISTSIZE=200
--- 1/configure.ac
+++ 1/configure.ac
@@ -216,11 +216,22 @@
   AC_DEFINE_UNQUOTED(GLOBAL_ZLOGOUT, "$zlogout")
 fi
 
+ifdef([runhelpdir],[undefine([runhelpdir])])dnl
+AC_ARG_ENABLE(runhelpdir,
+AC_HELP_STRING([--enable-runhelpdir=DIR], [the default directory for the run-help files]),
+[if test x"$enableval" = xno; then
+  runhelpdir=
+else
+  runhelpdir="$enableval"
+fi], [runhelpdir="/usr/share/zsh/$VERSION/help"])
+
+
 AC_SUBST(zshenv)dnl
 AC_SUBST(zshrc)dnl
 AC_SUBST(zprofile)dnl
 AC_SUBST(zlogin)dnl
 AC_SUBST(zlogout)dnl
+AC_SUBST(runhelpdir)dnl
 
 dnl Do you want dynamically loaded binary modules.
 ifdef([dynamic],[undefine([dynamic])])dnl

  parent reply	other threads:[~2013-11-10 22:44 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-10  8:57 Martin Vaeth
2013-11-10 18:13 ` Peter Stephenson
2013-11-10 22:28   ` Martin Vaeth
2013-11-11  2:30     ` Bart Schaefer
2013-11-11  9:09       ` Martin Vaeth
2013-11-11 16:42         ` Bart Schaefer
2013-11-11 22:59           ` Martin Vaeth
2013-11-12 10:11             ` Peter Stephenson
2013-11-12 17:41               ` Martin Vaeth
2013-11-12 17:48                 ` Peter Stephenson
2013-11-12 21:04                   ` Peter Stephenson
2013-11-12 21:42                     ` Martin Vaeth
2013-11-13  9:28                       ` Peter Stephenson
2013-11-13 10:10                         ` Martin Vaeth
2013-11-13 11:21                           ` Peter Stephenson
2013-11-13 16:06                             ` Bart Schaefer
2013-11-16 12:14                               ` modify functions hierarchy (was: Install run-help and *.zwc files system wide in build system) Martin Vaeth
2013-11-17 18:30                                 ` Bart Schaefer
2013-11-17 19:42                                   ` Martin Vaeth
2013-11-17 21:01                                     ` Bart Schaefer
2013-11-18  7:00                                       ` Martin Vaeth
2013-11-18 16:11                                         ` Doc/Doc/help (was: modify functions hierarchy (was: Install run-help and *.zwc files system wide in build system)) Bart Schaefer
2013-11-18 16:23                                           ` Peter Stephenson
2013-11-18 16:31                                             ` Bart Schaefer
2013-11-18 16:36                                               ` Peter Stephenson
2013-11-18 16:45                                                 ` Bart Schaefer
2013-11-18 16:58                                                   ` Peter Stephenson
2013-11-20 19:26                                       ` modify functions hierarchy (was: Install run-help and *.zwc files system wide in build system) Peter Stephenson
2013-11-21  6:01                                         ` Bart Schaefer
2013-11-23 17:48                                           ` Peter Stephenson
2013-11-23 19:47                                             ` Helpfiles again (was Re: modify functions hierarchy (was: etc.)) Bart Schaefer
2013-11-23 21:25                                               ` Martin Vaeth
2013-11-24  5:06                                                 ` Bart Schaefer
     [not found]                                                   ` <20131124175649.27c2559a@pws!>
2013-11-24 12:26                                                   ` Martin Vaeth
2013-11-24 12:31                                                     ` Martin Vaeth
2013-11-24 17:56                                                   ` Peter Stephenson
2013-11-25  8:18                                                     ` Bart Schaefer
2013-11-25 14:24                                                       ` Jun T.
2013-11-25 15:49                                                         ` Peter Stephenson
2013-11-25 16:56                                                           ` Bart Schaefer
2013-11-25 17:37                                                             ` Peter Stephenson
2013-11-25 20:14                                                             ` Phil Pennock
2013-11-26  9:24                                                               ` Peter Stephenson
2013-12-12 22:17                                                             ` PATCH: Util/helpfiles failing on old-fashioned unix pda
2013-12-13  9:08                                                               ` Martin Vaeth
2013-12-13 23:46                                                                 ` Martin Vaeth
2013-12-14  0:20                                                                 ` Wayne Davison
2013-12-14  9:23                                                                   ` Martin Vaeth
2013-12-14 18:49                                                                     ` Bart Schaefer
2013-12-15 23:37                                                                 ` pda
2013-12-18  8:39                                                                   ` Martin Vaeth
2013-11-17 20:13                                   ` modify functions hierarchy (was: Install run-help and *.zwc files system wide in build system) Peter Stephenson
2013-11-17 20:50                                     ` Bart Schaefer
2013-11-18  7:57                                       ` Martin Vaeth
2013-11-18 16:28                                         ` Bart Schaefer
2013-11-18 10:32                                       ` Peter Stephenson
2013-11-18 16:38                                         ` Bart Schaefer
2013-11-18 16:50                                           ` Peter Stephenson
2013-11-12 21:52                     ` Install run-help and *.zwc files system wide in build system Martin Vaeth
2013-11-13  1:13                       ` Bart Schaefer
2013-11-13  2:40                         ` Bart Schaefer
2013-11-13 13:30                 ` [PATCH] helpfiles: Also accept 'UTF-8' as an encoding name Jun T.
2013-11-13 15:37                   ` Jun T.
2013-11-13 16:56                     ` Martin Vaeth
2013-11-13 17:27                       ` Bart Schaefer
2013-11-13 18:28                         ` Martin Vaeth
2013-11-14  0:06                           ` Phil Pennock
2013-11-14  7:50                             ` Martin Vaeth
2013-11-14  8:18                               ` Phil Pennock
2013-11-14 11:11                                 ` Martin Vaeth
2013-11-15 14:58                                   ` Jun T.
2013-11-15 17:16                                     ` Bart Schaefer
2013-11-15 19:58                                     ` Martin Vaeth
2013-11-16  5:51                                       ` Bart Schaefer
2013-11-16 15:17                                         ` Jun T.
2013-11-16 18:05                                           ` Bart Schaefer
2013-11-18 18:43                                       ` Phil Pennock
2013-11-10 22:44   ` Martin Vaeth [this message]
2013-11-10 18:56 ` Install run-help and *.zwc files system wide in build system Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1311102341430.29952@lounge.imp.fu-berlin.de \
    --to=vaeth@mathematik.uni-wuerzburg.de \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).