diff options
author | Hiroki Sato <hrs@FreeBSD.org> | 2004-06-18 15:06:26 +0000 |
---|---|---|
committer | Hiroki Sato <hrs@FreeBSD.org> | 2004-06-18 15:06:26 +0000 |
commit | 425a597bb1eef7396884653c00b5232e1aab6a13 (patch) | |
tree | 7e690547e606eaf5a2f464bf87500a47ddae3350 /print/tex-texmflocal | |
parent | ad16e21811f7974e1cd508129cd60959f7a0174d (diff) | |
download | ports-425a597bb1eef7396884653c00b5232e1aab6a13.tar.gz ports-425a597bb1eef7396884653c00b5232e1aab6a13.zip |
Notes
Diffstat (limited to 'print/tex-texmflocal')
-rw-r--r-- | print/tex-texmflocal/Makefile | 72 | ||||
-rw-r--r-- | print/tex-texmflocal/files/pkg-install.in | 11 | ||||
-rw-r--r-- | print/tex-texmflocal/files/tetex-modesw.in | 142 |
3 files changed, 198 insertions, 27 deletions
diff --git a/print/tex-texmflocal/Makefile b/print/tex-texmflocal/Makefile index d65d25d31bcc..e3acf16ed8f4 100644 --- a/print/tex-texmflocal/Makefile +++ b/print/tex-texmflocal/Makefile @@ -5,7 +5,7 @@ # $FreeBSD$ PORTNAME= tex-texmflocal -PORTVERSION= 1.3 +PORTVERSION= 1.4 CATEGORIES= print MASTER_SITES= # empty DISTFILES= # empty @@ -13,47 +13,87 @@ DISTFILES= # empty MAINTAINER= hrs@FreeBSD.org COMMENT= Meta-port that creates a site-local $$TEXMF directory -BUILD_DEPENDS= mktexlsr:${PORTSDIR}/print/teTeX - NO_WRKSUBDIR= yes NO_BUILD= yes PKGINSTALL= ${WRKDIR}/pkg-install.sh PKGDEINSTALL= ${WRKDIR}/pkg-install.sh PLIST= ${WRKDIR}/pkg-plist +TEXMF= share/texmf TEXMFLOCAL= share/texmf-local TEXMFLOCAL_LSR= ${LOCALBASE}/${TEXMFLOCAL}/ls-R +TEXMFVAR= share/texmf-var +TEXMFVAR_LSR= ${LOCALBASE}/${TEXMFVAR}/ls-R MKTEXLSR= ${LOCALBASE}/bin/mktexlsr +DEFAULT_MODE= tetex +TEXMFCNF= web2c/texmf.cnf +DVIPSKCNF= dvips/config/config.ps +XDVIKCNF= xdvi/XDvi +DVIPDFMCNF= dvipdfm/config/config + +TETEX_MODESW_SUB= \ + DEFAULT_MODE=${DEFAULT_MODE} \ + TEXMFCNF=${TEXMFCNF} \ + DVIPSKCNF=${DVIPSKCNF} \ + XDVIKCNF=${XDVIKCNF} \ + DVIPDFMCNF=${DVIPDFMCNF} \ + PREFIX=${PREFIX} \ + TEXMF=${TEXMF} \ + TEXMFVAR=${TEXMFVAR} \ + TEXMFLOCAL=${TEXMFLOCAL} + DIRS= bibtex/bib bibtex/bst bibtex\ - dvipdfm dvips \ + context/config context \ + dvipdfm/config dvipdfm dvips/config dvips \ + etex/plain/config etex/plain etex \ fonts/afm fonts/ofm fonts/ovp fonts/ovf \ fonts/ocp fonts/pk fonts/tfm fonts/type1 \ fonts/source/public fonts/source fonts/vf fonts \ metafont metapost \ jbibtex/bib jbibtex/bst jbibtex\ - tex/generic tex/jadetex tex/latex tex/plain tex\ - pdftex/latex pdftex/platex pdftex\ + tex/generic/config tex/generic \ + tex/jadetex tex/latex tex/plain tex\ + pdftex/config pdftex/latex pdftex/platex pdftex\ ptex/plain ptex/platex ptex\ - web2c + web2c xdvi + +LSRMAGIC=${ECHO_CMD} "% ls-R -- filename database for kpathsea; do not change this line." pre-install: - (${ECHO_CMD} '${TEXMFLOCAL}/ls-R'; \ + ${SED} ${TETEX_MODESW_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + < ${FILESDIR}/tetex-modesw.in > ${WRKDIR}/tetex-modesw + (${ECHO_CMD} "bin/tetex-modesw"; \ for dir in ${DIRS}; do \ - ${ECHO_CMD} "@dirrm ${TEXMFLOCAL}/$${dir}"; \ + ${ECHO_CMD} "@unexec ${RMDIR} %D/${TEXMFLOCAL}/$${dir} > /dev/null 2>&1 || true"; \ + ${ECHO_CMD} "@unexec ${RMDIR} %D/${TEXMFVAR}/$${dir} > /dev/null 2>&1 || true"; \ ${ECHO_CMD} "@exec ${MKDIR} %D/${TEXMFLOCAL}/$${dir}"; \ + ${ECHO_CMD} "@exec ${MKDIR} %D/${TEXMFVAR}/$${dir}"; \ done; \ - ${ECHO_CMD} '@exec ${MKTEXLSR}'; \ - ${ECHO_CMD} '@unexec ${MKTEXLSR}' ) > ${PLIST} - ${SED} -e 's,%%TEXMFLOCAL_LSR%%,${TEXMFLOCAL_LSR},' \ - < ${FILESDIR}/pkg-install.in > ${PKGINSTALL} - ${CHMOD} 0555 ${PKGINSTALL} + ${ECHO_CMD} '@exec ${LSRMAGIC:S,%,%%,g} > ${TEXMFLOCAL_LSR} && ${CHMOD} 0644 ${TEXMFLOCAL_LSR}'; \ + ${ECHO_CMD} '@exec ${LSRMAGIC:S,%,%%,g} > ${TEXMFVAR_LSR} && ${CHMOD} 0644 ${TEXMFVAR_LSR}'; \ + ${ECHO_CMD} '@exec ${TOUCH} ${PREFIX}/etc/tetex-modesw.conf'; \ + ${ECHO_CMD} '@unexec ${RM} -f ${PREFIX}/etc/tetex-modesw.conf > /dev/null 2>&1 || true'; \ + ${ECHO_CMD} '@unexec ${RM} -f ${TEXMFLOCAL_LSR} > /dev/null 2>&1 || true'; \ + ${ECHO_CMD} '@unexec ${RM} -f ${TEXMFVAR_LSR} > /dev/null 2>&1 || true'; \ + ${ECHO_CMD} "@unexec ${RMDIR} %D/${TEXMFLOCAL} > /dev/null 2>&1 || true"; \ + ${ECHO_CMD} "@unexec ${RMDIR} %D/${TEXMFVAR} > /dev/null 2>&1 || true"; \ + ${ECHO_CMD} '@exec if [ -x ${MKTEXLSR} ]; then ${MKTEXLSR}; fi'; \ + ${ECHO_CMD} '@unexec if [ -x ${MKTEXLSR} ]; then ${MKTEXLSR}; fi'; \ + ) > ${PLIST} do-install: + ${INSTALL_SCRIPT} ${WRKDIR}/tetex-modesw ${PREFIX}/bin + ${TOUCH} ${PREFIX}/etc/tetex-modesw.conf + ${CHMOD} 644 ${PREFIX}/etc/tetex-modesw.conf ${MKDIR} ${DIRS:S,^,${PREFIX}/${TEXMFLOCAL}/,} + ${MKDIR} ${DIRS:S,^,${PREFIX}/${TEXMFVAR}/,} + ${LSRMAGIC} > ${TEXMFLOCAL_LSR} + ${CHMOD} 0644 ${TEXMFLOCAL_LSR} + ${LSRMAGIC} > ${TEXMFVAR_LSR} + ${CHMOD} 0644 ${TEXMFVAR_LSR} post-install: - @${MKTEXLSR} - @${PKGINSTALL} ${PKGNAME} POST-INSTALL + @if [ -x ${MKTEXLSR} ]; then ${MKTEXLSR}; fi .include <bsd.port.mk> diff --git a/print/tex-texmflocal/files/pkg-install.in b/print/tex-texmflocal/files/pkg-install.in deleted file mode 100644 index 9327d9d0867c..000000000000 --- a/print/tex-texmflocal/files/pkg-install.in +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ - -case $2 in -POST-INSTALL|DEINSTALL) - echo "fixup %%TEXMFLOCAL_LSR%%..." - T=/tmp/tex-texmflocal.$$ - cat %%TEXMFLOCAL_LSR%% | grep -v "./lsR[0-9]*.tmp": > ${T} - cp ${T} %%TEXMFLOCAL_LSR%% - rm -f ${T} -;; -esac diff --git a/print/tex-texmflocal/files/tetex-modesw.in b/print/tex-texmflocal/files/tetex-modesw.in new file mode 100644 index 000000000000..95e3d7cf4e72 --- /dev/null +++ b/print/tex-texmflocal/files/tetex-modesw.in @@ -0,0 +1,142 @@ +#!/bin/sh +# $FreeBSD$ + +if [ $# != 0 ]; then MODE=$1; shift; fi +if [ $# != 0 ]; then FILE=$1; shift; fi +if [ $# != 0 ]; then OPTIONS=$*; fi + +GREP=/usr/bin/grep +SED=/usr/bin/sed + +CONF=%%PREFIX%%/etc/tetex-modesw.conf + +DEFAULT_MODE=tetex + +PREFIX=%%PREFIX%% +TEXMF=%%TEXMF%% +TEXMFLOCAL=%%TEXMFLOCAL%% +TEXMFVAR=%%TEXMFVAR%% + +if [ ! -r ${CONF} ]; then + echo "ERROR: ${CONF} not found." +else + . ${CONF} +fi + +case ${FILE} in +texmf.cnf|tex) + CONFIG=%%TEXMFCNF%% + DEFAULT_MODE=tetex + ;; +config.ps|dvips) + CONFIG=%%DVIPSKCNF%% + ;; +XDvi|xdvi) + CONFIG=%%XDVIKCNF%% + ;; +config|dvipdfm) + CONFIG=%%DVIPDFMCNF%% + ;; +*) + CONFIG=${FILE} + ;; +esac + +FORCEINSTALL=FALSE +DESTMF=${TEXMFVAR} + +set -- ${OPTIONS} +while [ $# != 0 ]; do + case $1 in + force*) + FORCEINSTALL=TRUE ;; + main) + DESTMF=${TEXMF} ;; + var) + DESTMF=${TEXMFVAR} ;; + local) + DESTMF=${TEXMFLOCAL} ;; + esac + + shift; +done + +usage() +{ + echo "Usage: tetex-modesw modename {tex|dvips|dvipdfm|xdvi} [{forceinstall|var|main|local} ...]" + exit 1 +} + +install_file() +{ + _MODE=$1 + _SRC=$2 + _DST=$3 + + if [ ! -f ${_SRC} ]; then + echo "ERROR: invalid mode \"${_MODE}\" is specified." + usage + fi + if [ -f ${_DST} -a "${FORCEINSTALL}" != "TRUE" ]; then + echo "WARNING: ${_DST} is not modified because it already exists." + echo " If you want to install ${_SRC} -> ${_DST}," + echo " use \"forceinstall\" option." + exit 1 + fi + + if [ -f ${_DST} ] && cmp -s ${_SRC} ${_DST}; then + : + else + echo "Installing: ${_SRC} -> ${_DST}" + cp -p ${_SRC} ${_DST} + fi +} + +uninstall_file() +{ + for _F in $1; do + if [ -f ${_F} ]; then + echo "Uninstalling: ${_F}" + rm -f ${_F} + fi + done +} + +changedefault() +{ + _MODE=$1 + + case ${_MODE} in + tetex|tetex-letter) + echo "Default mode -> ${_MODE}" + echo "DEFAULT_MODE=${_MODE}" >> ${CONF} + ;; + *) + echo "ERROR: Unknown mode ${_MODE} is specified." + usage + exit 1 + ;; + esac +} + +case ${MODE} in +default) + MODE=${DEFAULT_MODE} + install_file \ + "${MODE}" \ + "${PREFIX}/${TEXMF}/${CONFIG}.${MODE}" \ + "${PREFIX}/${DESTMF}/${CONFIG}" + ;; +uninstall) + uninstall_file ${PREFIX}/${DESTMF}/${CONFIG} + ;; +changedefault) + changedefault ${CONFIG} + ;; +*) + install_file \ + "${MODE}" \ + "${PREFIX}/${TEXMF}/${CONFIG}.${MODE}" \ + "${PREFIX}/${DESTMF}/${CONFIG}" + ;; +esac |