doc: adapt module doc to path used for install

Use same process than init scripts to translate module documentation
from configure-like pattern (@prefix@, @initdir@, etc) to the path name
chosen for installation.
This commit is contained in:
Xavier Delaruelle
2017-02-19 20:21:01 +01:00
parent e3d5dc5642
commit 1c9b4bdc2c
4 changed files with 31 additions and 18 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@ modules.sum
doc/diff_with_c-version.txt
doc/html/*.html
doc/man
doc/source/module.pod
www/tcl
www/docs
.makeinstallpath

View File

@@ -30,7 +30,8 @@ initdir:
initdir=$(initdir)
doc:
make -C doc all prefix=$(prefix) datarootdir=$(datarootdir) \
make -C doc all prefix=$(prefix) libexecdir=$(libexecdir) \
initdir=$(initdir) datarootdir=$(datarootdir) \
mandir=$(mandir) docdir=$(docdir)
www:

View File

@@ -16,6 +16,8 @@ SOURCE_DIR := source
# set default installation paths if not yet defined
prefix ?= /usr/local/modules-tcl
libexecdir ?= $(prefix)/libexec
initdir ?= $(prefix)/init
datarootdir ?= $(prefix)/share
mandir ?= $(datarootdir)/man
docdir ?= $(datarootdir)/doc
@@ -25,13 +27,24 @@ all: $(HTML_DIR)/module.html $(HTML_DIR)/modulefile.html \
$(HTML_DIR)/diff_with_c-version.html diff_with_c-version.txt \
.makeinstallpath
define translate-in-script
perl -pe 's|\@prefix\@|$(prefix)|g; \
s|\@libexecdir\@|$(libexecdir)|g; \
s|\@initdir\@|$(initdir)|g;' $< > $@
endef
# save defined install paths
.makeinstallpath:
@echo "prefix := $(prefix)" >$@
@echo "libexecdir := $(libexecdir)" >>$@
@echo "initdir := $(initdir)" >>$@
@echo "datarootdir := $(datarootdir)" >>$@
@echo "mandir := $(mandir)" >>$@
@echo "docdir := $(docdir)" >>$@
$(SOURCE_DIR)/%.pod: $(SOURCE_DIR)/%.pod.in
$(translate-in-script)
$(HTML_DIR)/%.html: $(SOURCE_DIR)/%.pod $(VERSION_FILE)
mkdir -p $(HTML_DIR)
pod2html --noindex --css=common.css --infile=$< --outfile=$@
@@ -59,6 +72,7 @@ install: all
clean:
rm -f $(HTML_DIR)/*.html
rm -f $(MAN1_DIR)/*.1 $(MAN4_DIR)/*.4
rm -f $(SOURCE_DIR)/module.pod
rmdir $(MAN1_DIR) $(MAN4_DIR) $(MAN_DIR)
rm -f diff_with_c-version.txt
rm -f pod*.tmp .makeinstallpath

View File

@@ -37,40 +37,37 @@ creates the B<module> command as either an alias or function and creates
Modules environment variables.
The B<module> alias or function executes the B<modulecmd.tcl> program
located in F<$MODULESHOME> and has the shell evaluate the command's
located in F<@libexecdir@> and has the shell evaluate the command's
output. The first argument to B<modulecmd.tcl> specifies the type of shell.
The initialization scripts are kept in F<$MODULESHOME/init/E<lt>shellE<gt>>
The initialization scripts are kept in F<@initdir@/E<lt>shellE<gt>>
where I<E<lt>shellE<gt>> is the name of the sourcing shell. For example,
a C Shell user sources the F<$MODULESHOME/init/csh> script. The sh, csh,
a C Shell user sources the F<@initdir@/csh> script. The sh, csh,
tcsh, bash, ksh, zsh and fish shells are supported by B<modulecmd.tcl>. In
addition, python, perl, tcl and lisp "shells" are supported which writes
the environment changes to stdout as python, perl, tcl or lisp code.
=head2 Examples of initialization
In the following examples, replace F<$MODULESHOME> with the actual
directory name.
C Shell initialization (and derivatives):
source $MODULESHOME/init/csh
source @initdir@/csh
module load modulefile modulefile ...
Bourne Shell (sh) (and derivatives):
. $MODULESHOME/init/sh
. @initdir@/sh
module load modulefile modulefile ...
Perl:
require "${MODULESHOME}/init/perl";
require "@initdir@/perl";
&module("load modulefile modulefile ...");
Python:
import os
exec(open(os.environ['MODULESHOME'] + '/init/python').read())
exec(open('@initdir@/python').read())
module('load modulefile modulefile ...')
=head2 Modulecmd startup
@@ -86,7 +83,7 @@ in the following order:
=item 1.
Global RC file as specified by F<$MODULERCFILE> or F<$MODULESHOME/etc/rc>.
Global RC file as specified by F<$MODULERCFILE> or F<@prefix@/etc/rc>.
If F<$MODULERCFILE> points to a directory, the F<modulerc> file in this
directory is used as global RC file.
@@ -408,7 +405,7 @@ and a directory containing a collection of master I<modulefiles>.
The path that the B<module> command searches when looking for
I<modulefiles>. Typically, it is set to the master I<modulefiles> directory,
I<$MODULESHOME/modulefiles>, by the initialization script. B<MODULEPATH>
I<@prefix@/modulefiles>, by the initialization script. B<MODULEPATH>
can be set using B<module use> or by the module initialization script to
search group or personal I<modulefile> directories before or after the
master I<modulefile> directory.
@@ -448,11 +445,11 @@ etc.
=over
=item B<$MODULESHOME>
=item B<@prefix@>
The B<MODULESHOME> directory.
=item B<$MODULESHOME/etc/rc>
=item B<@prefix@/etc/rc>
The system-wide modules rc file. The location of this file can be changed
using the B<MODULERCFILE> environment variable as described above.
@@ -465,18 +462,18 @@ The user specific modules rc file.
The user specific collection directory.
=item B<$MODULESHOME/modulefiles>
=item B<@prefix@/modulefiles>
The directory for system-wide I<modulefiles>. The location of the directory
can be changed using the B<MODULEPATH> environment variable as described
above.
=item B<$MODULESHOME/bin/modulecmd.tcl>
=item B<@libexecdir@/modulecmd.tcl>
The I<modulefile> interpreter that gets executed upon each invocation
of B<module>.
=item B<$MODULESHOME/init/<shell>>
=item B<@initdir@/<shell>>
The Modules package initialization file sourced into the user's environment.