-
-
Save gatesphere/0afaf5c2c647430ff653 to your computer and use it in GitHub Desktop.
setuptex that works in cygwin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### PLACE THIS FILE AS .setuptex in ~ | |
### Add the following line to the end of ~/.bashrc: | |
### | |
### source /home/PeckJ/.setuptex /cygdrive/c/context/tex | |
### | |
# Example setup file for ConTeXt distribution | |
# | |
# Author: Hans Hagen | |
# Patches: Arthur R. & Mojca M. | |
# | |
# Usage: | |
# . setuptex [texroot] | |
# | |
# On the first run also execute: | |
# mktexlsr | |
# texexec --make --alone | |
# | |
# PLATFORM | |
# | |
# we will try to guess the platform first | |
# (needs to be kept in sync with first-setup.sh and mtxrun) | |
# if yours is missing, let us know | |
platform="mswin" | |
# | |
# PATH | |
# | |
# this resolves to path of the setuptex script | |
# We use $0 for determine the path to the script, except for: | |
# * bash where $0 always is bash; here we use BASH_SOURCE | |
# * ksh93 where we use ${.sh.file} | |
# Thanks to Vasile Gaburici and Alessandro Perucchi for reporting this | |
# * http://www.ntg.nl/pipermail/ntg-context/2008/033953.html | |
# * http://www.ntg.nl/pipermail/ntg-context/2012/068658.html | |
if [ z"$BASH_SOURCE" != z ]; then | |
SCRIPTPATH="$BASH_SOURCE" | |
elif [ z"$KSH_VERSION" != z ]; then | |
SCRIPTPATH="${.sh.file}" | |
else | |
SCRIPTPATH="$0" | |
fi | |
OWNPATH=$(cd -P -- "$(dirname -- "$SCRIPTPATH")" && pwd -P) | |
# but one can also call | |
# . setuptex path-to-tree | |
TEXROOT="" | |
# first check if any path has been provided in the argument, and try to use that one | |
if [ $# -ne 0 ] ; then | |
# TODO: resolve any errors | |
ARGPATH=$(cd -P -- "$(dirname -- "$1")" && pwd -P) && ARGPATH=$ARGPATH/$(basename -- "$1") | |
if test -f "$ARGPATH/texmf/tex/plain/base/plain.tex" ; then | |
if [ -d "$ARGPATH/texmf-$platform/bin" ]; then | |
TEXROOT="$ARGPATH" | |
else | |
echo "Binaries for platform '$platform' are missing." | |
echo "(There is no folder \"$ARGPATH/texmf-$platform/bin\")" | |
fi | |
else | |
echo "The argument \"$ARGPATH\" is not a valid TEXROOT path." | |
echo "(There is no file \"$ARGPATH/texmf/tex/plain/base/plain.tex\")" | |
if [ -f "$OWNPATH/texmf/tex/plain/base/plain.tex" ]; then | |
TEXROOT="$OWNPATH" | |
fi | |
fi | |
else | |
if [ -f "$OWNPATH/texmf/tex/plain/base/plain.tex" ]; then | |
if [ -d "$OWNPATH/texmf-$platform/bin" ]; then | |
TEXROOT="$OWNPATH" | |
else | |
echo "Binaries for platform '$platform' are missing." | |
echo "(There is no folder \"$OWNPATH/texmf-$platform/bin\")" | |
fi | |
else | |
echo "\"$OWNPATH\" is not a valid TEXROOT path." | |
echo "(There is no file \"$OWNPATH/texmf/tex/plain/base/plain.tex\")" | |
fi | |
fi | |
if [ "$TEXROOT" != "" ]; then | |
# for Alan Braslau's server :) | |
#if [ "x$PS1" != "x" ] ; then | |
# echo "Setting \"$TEXROOT\" as ConTeXt root." | |
#fi | |
# ConTeXt binaries have to be added to PATH | |
TEXMFOS=$TEXROOT/texmf-$platform | |
export PATH=$TEXMFOS/bin:$PATH | |
# unset variables that won't be used lately | |
unset platform cpu system OWNPATH SCRIPTPATH ARGPATH TEXMFOS | |
# not sure why this would be needed | |
# export CTXMINIMAL=yes | |
else | |
echo "provide a proper tex root (like '. setuptex /something/tex')" ; | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment