diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/splitindex/install.sh')
-rwxr-xr-x | Master/texmf-dist/source/latex/splitindex/install.sh | 346 |
1 files changed, 129 insertions, 217 deletions
diff --git a/Master/texmf-dist/source/latex/splitindex/install.sh b/Master/texmf-dist/source/latex/splitindex/install.sh index b66b343f0bf..d5ddad4a9f3 100755 --- a/Master/texmf-dist/source/latex/splitindex/install.sh +++ b/Master/texmf-dist/source/latex/splitindex/install.sh @@ -1,229 +1,141 @@ #!/bin/sh +# +# splitindex installation script +# Copyright (c) Markus Kohm 2013 +# +# $Id: install.sh,v 1.10 2013-04-04 13:12:18 mjk Exp $ +# +# This file is part of the SplitIndex bundle. +# +# This work may be distributed and/or modified under the conditions of +# the LaTeX Project Public License, version 1.3c of the license. +# The latest version of this license is in +# http://www.latex-project.org/lppl.txt +# and version 1.3c or later is part of all distributions of LaTeX +# version 2005/12/01 or later and of this work. +# +# This work has the LPPL maintenance status "maintained". +# +# The Current Maintainer and author of this work is Markus Kohm. +# +# The list of all files belongig to the SplitIndex bundle is given in +# in the file `manifest.txt'. Files generated by means of unpacking the +# distribution (using, for example, the docstrip program) or by means +# of compiling them from a source file, for example, from splitindex.c +# or splitindex.java may be distributed at the distributor's discretion. +# However if they are distributed then a copy of the SplitIndex bundle +# must be distributed together with them. +# +# The list of derived (unpacked or compiled) files belongig to the +# distribution and covered by LPPL is defined by the unpacking scripts +# (with extension .ins) and the installation script (with name +# install.sh) which are part of the distribution. +# +# Two often ignorred clauses from LPPL 1.3c you should not ignore: +# ---------------------------------------------------------------- +# 2. You may distribute a complete, unmodified copy of the Work as you +# received it. Distribution of only part of the Work is considered +# modification of the Work, and no right to distribute such a Derived +# Work may be assumed under the terms of this clause. +# 3. You may distribute a Compiled Work that has been generated from a +# complete, unmodified copy of the Work as distributed under Clause 2 +# above, as long as that Compiled Work is distributed in such a way that +# the recipients may install the Compiled Work on their system exactly +# as it would have been installed if they generated a Compiled Work +# directly from the Work. -archbin=false -tdsarchive=false - -while [ $# -gt 0 ]; do - case $1 in - --prefix) - if [ $# -lt 2 ]; then - echo "$0: argument expected after --prefix" >&2 - exit 1 - else - prefix=$2 - shift 2 - fi - ;; - --prefix=*) - prefix=${1#--prefix=} - shift 1 - ;; - --archbin) - archbin=true - shift 1 - ;; - --tdsarchive) - tdsarchive=true - shift 1 - ;; - --bindir) - if [ $# -lt 2 ]; then - echo "$0: argument expected after --bindir" >&2 - exit 1 - else - bindir=$2 - shift 2 - fi - ;; - --bindir=*) - bindir=${1#--bindir=} - shift 1 - ;; - --mandir) - if [ $# -lt 2 ]; then - echo "$0: argument expected after --mandir" >&2 - exit 1 - else - mandir=$2 - shift 2 - fi - ;; - --mandir=*) - mandir=${1#--mandir=} - shift 1 - ;; - --texmf) - if [ $# -lt 2 ]; then - echo "$0: argument expected after --texmf" >&2 - exit 1 - else - texmf=$2 - shift 2 - fi - ;; - --texmf=*) - texmf=${1#--texmf=} - shift 1 - ;; - --version|-v) - echo "install.sh v0.1" - echo "Copyright (c) Markus Kohm 2002" - exit 0 - ;; - --help|-h) - echo "Usage: install.sh [OPTIONS]" - echo - echo "Installs SplitIndex for all unix like environments." - echo - echo "OPTIONS:" - echo "--prefix=<DIR> install binaries at <DIR>/bin and manuals at <DIR>/man" - echo " (default: /usr/local)" - echo "--bindir=<DIR> install binaries at <DIR>" - echo "--archbin install binaries at arch depending directories at bindir" - echo "--mandir=<DIR> install manuals at <DIR>" - echo "--texmf=<DIR> install packages and TeX programs at <DIR>/tex/latex/splitindex," - echo " documentation (dvi and pdf) at <DIR>/doc/latex/splitindex and" - echo " sources at <DIR>/source/latex/splitindex" - echo " (default: \$TEXMFLOCAL if you are root and \$HOMETEXMF if" - echo " you are not root)" - exit 0 - ;; - --dist) - mkdir -p splitidx - cp -L splitindex splitindex-Linux-i386 - cp -L splitindex.tex splitindex.pl splitindex.c splitindex.java \ - splitindex.class splitindex.exe splitidx.dtx splitidx.ins \ - splitindex-Linux-i386 splitindex-OpenBSD-i386 \ - splitindex.1 install.txt manifest.txt install.sh \ - README splitidx - tar jcvf splitidx-`date +%F`.tar.bz2 splitidx - cd splitidx - rm -r chroot - ./install.sh --texmf ../chroot/texmf --tdsarchive - cd .. - rm -r splitidx - cd chroot/texmf - zip -r ../../splitindex-`date +%F`.tds.zip * - cd ../.. - find chroot/texmf/ | \ - sed 's/chroot\//+-/g;s/[a-z0-9-]*\//-/g' - mkdir chroot/splitindex - cp -R -p -L chroot/texmf/source/latex/splitindex/* chroot/splitindex - cp -R -p -L chroot/texmf/doc/latex/splitindex/* chroot/splitindex - cd chroot - zip -r ../splitindex-`date +%F`.CTAN.zip splitindex - cd .. - rm -r chroot - exit 0 - ;; - *) - echo "unkown option \`$1'" >&2 - echo "Try \`./install.sh --help' for more information." >&2 - exit 1; - ;; - esac -done - -case `uname -s -m` in - OpenBSD*i?86*) - cp -pf splitindex-OpenBSD-i386 splitindex - splitindex=splitindex - ;; - Linux*i?86*) - cp -pf splitindex-Linux-i386 splitindex - splitindex=splitindex - ;; - CYGWIN*i?86*) - splitindex=splitindex.exe - ;; - *) - if ! ./splitindex -V; then - echo 'Os '`uname -s -m`' not supported!' - echo 'Trying to compile the source:' - gcc -O3 -Wall -o splitindex splitindex.c || \ - gcc -O3 -Wall -DNO_LONGOPT -o splitindex splitindex.c || \ - echo 'You have to compile splitindex.c by your own!' - fi - if ./splitindex -V; then - splitindex=splitindex - cp -p splitindex splitindex-`uname -s`-`uname -m` - fi - ;; -esac - -if [ -z "$prefix" ]; then - prefix=/usr/local -fi -if [ -z "$bindir" ]; then - bindir=$prefix/bin -fi -if [ -z "$mandir" ]; then - mandir=$prefix/man +if [ -z "$DESTDIR" ] +then + TEXMFINSTALL=`kpsewhich -var-value=TEXMFLOCAL` + if ! mkdir -p $TEXMFINSTALL/tex/latex/splitidx + then + TEXMFINSTALL=`kpsewhich -var-value=TEXMFHOME` + fi +else + [ -z "$TEXMFINSTALL" ] && TEXMFINSTALL="/texmf" + [ -z "$BINDIR" ] && BINDIR="/bin" fi -if [ -z "$texmf" ]; then - if [ "r$USER" = "rroot" ]; then - texmf=`kpsexpand '$TEXMFLOCAL'` + +if [ "$1" == "-h" -o "$1" == "--help" ] +then + cat <<EOF +install.sh +Copyright (c) Markus Kohm 2013 + +This bash script installs splitidx and splitindex. +The files will be installed into TEXMF tree +$DESTDIR$TEXMFINSTALL/. +EOF + echo -n 'Binaries will be installed to ' + if [ -z "$BINDIR" ] + then + find `kpsewhich -var-value=SELFAUTODIR` -mindepth 1 -type d -print else - texmf=`kpsexpand '$HOMETEXMF'` - fi - if [ -z "$texmf" ]; then - echo "kpsexpand '$TEXMFLOCAL' or kpsexpand '$HOMETEXMF' failed!" >&2 - echo "You have to use option --texmf=<DIR>." >&2 - echo "This error is fatal!" >&2 - exit 1 + echo "$DESTDIR$BINDIR/" fi + cat <<EOF +You may change installation paths by setting environment variables DESTDIR, +TEXMFINSTALL and BINDIR. +EOF + exit 0 fi -latex splitidx.ins - -latex splitidx.dtx -latex splitidx.dtx -mkindex splitidx -latex splitidx.dtx - -pdflatex splitidx.dtx -pdflatex splitidx.dtx -mkindex splitidx -pdflatex splitidx.dtx - -install -v -m 755 -d $texmf/doc/latex/splitindex -install -v -m 755 -d $texmf/tex/latex/splitindex -install -v -m 755 -d $texmf/source/latex/splitindex - -if $tdsarchive; then - install -v -m 755 -d $texmf/scripts/splitindex/perl - install -v -m 755 splitindex.pl $texmf/scripts/splitindex/perl - install -v -m 644 splitindex.1 $texmf/doc/latex/splitindex -elif $archbin; then - install -v -m 755 -d $bindir - install -v -m 755 -d $bindir/i386-linux - install -v -m 755 -d $bindir/i386-openbsd - install -v -m 755 -d $bindir/i386-cygwin - install -v -m 755 -d $bindir/any - install -v -m 755 splitindex-Linux-i386 $bindir/i386-linux/splitindex - install -v -m 755 splitindex-OpenBSD-i386 $bindir/i386-openbsd/splitindex - install -v -m 755 splitindex.exe $bindir/i386-cygwin/splitindex.exe - install -v -m 755 splitindex.pl $bindir/any - install -v -m 644 splitindex.class $bindir/any - install -v -m 755 -d $mandir/man1 - install -v -m 644 splitindex.1 $mandir/man1 +perlavailable=false +if type perl +then + perlavailable=true +fi + +set -e + +sourcedir=`find ./ -name splitidx.dtx` +sourcedir=${sourcedir%/*}/ + +pushd $sourcedir + +tex splitidx.ins + +pdflatex -draftmode -interaction=batchmode splitidx.dtx +pdflatex -draftmode -interaction=batchmode splitidx.dtx +mkindex splitidx.dtx +pdflatex -interaction=batchmode splitidx.dtx + +mkdir -p "$DESTDIR$TEXMFINSTALL/tex/latex/splitidx" +mkdir -p "$DESTDIR$TEXMFINSTALL/tex/generic/splitindex" +mkdir -p "$DESTDIR$TEXMFINSTALL/scripts/splitindex" +mkdir -p "$DESTDIR$TEXMFINSTALL/doc/latex/splitidx" +mkdir -p "$DESTDIR$TEXMFINSTALL/doc/man/man1" +mkdir -p "$DESTDIR$TEXMFINSTALL/source/latex/splitindex" + +install -v -m 644 splitidx.sty "$DESTDIR$TEXMFINSTALL/tex/latex/splitidx/" +install -v -m 644 splitindex.tex "$DESTDIR$TEXMFINSTALL/tex/generic/splitindex/" +install -v -m 755 splitindex.pl splitindex.tlu splitindex_main.tlu \ + "$DESTDIR$TEXMFINSTALL/scripts/splitindex" +install -v -m 644 README splitidx.pdf \ + "$DESTDIR$TEXMFINSTALL/source/latex/splitindex/" +install -v -m 644 splitindex.1 "$DESTDIR$TEXMFINSTALL/doc/man/man1/" + +install -v -m 644 README install.txt manifest.txt \ + splitidx.dtx splitidx.ins \ + splitindex.1 splitindex.c splitindex.java splitindex.pl splitindex.tex \ + splitindex.tlu splitindex_main.tlu \ + "$DESTDIR$TEXMFINSTALL/source/latex/splitindex/" + +if $perlavailable +then + cp splitindex.pl splitindex else - install -v -m 755 -d $bindir - install -v -m 755 $splitindex splitindex.pl $bindir - install -v -m 644 splitindex.class $bindir + cp splitindex.tlu splitindex fi -install -v -m 644 splitindex.tex splitidx.sty $texmf/tex/latex/splitindex +if [ -z "$BINDIR" ] +then + find `kpsewhich -var-value=SELFAUTODIR` -mindepth 1 -type d -print0 | \ + xargs -0 install -v -m 755 splitindex +else + install -v -m 755 splitindex "$DESTDIR$BINDIR/" +fi -install -v -m 644 README install.txt splitidx.pdf $texmf/doc/latex/splitindex +rm splitindex -install -v -m 644 \ - splitindex.1 splitindex.c splitindex.java splitindex.class \ - splitindex.tex\ - README splitidx.dtx splitidx.ins manifest.txt install.txt \ - $texmf/source/latex/splitindex -install -v -m 755 \ - install.sh \ - splitindex.pl splitindex.exe \ - splitindex-Linux-i386 splitindex-OpenBSD-i386 \ - $texmf/source/latex/splitindex +popd |