summaryrefslogtreecommitdiff
path: root/scripts/context/stubs/setup
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2014-01-24 12:00:17 +0200
committerMarius <mariausol@gmail.com>2014-01-24 12:00:17 +0200
commitd45943afbc4a24ed10f87162b238af07cde73ac5 (patch)
tree5aa69c2b86f3cda7f13d9abca5b9f59421ae1301 /scripts/context/stubs/setup
parent3234906ac7cb4eac2077af3dff2b3db452514cd0 (diff)
downloadcontext-d45943afbc4a24ed10f87162b238af07cde73ac5.tar.gz
beta 2014.01.24 10:20
Diffstat (limited to 'scripts/context/stubs/setup')
-rw-r--r--scripts/context/stubs/setup/setuptex167
-rw-r--r--scripts/context/stubs/setup/setuptex.bat70
-rw-r--r--scripts/context/stubs/setup/setuptex.csh164
3 files changed, 401 insertions, 0 deletions
diff --git a/scripts/context/stubs/setup/setuptex b/scripts/context/stubs/setup/setuptex
new file mode 100644
index 000000000..d41e36707
--- /dev/null
+++ b/scripts/context/stubs/setup/setuptex
@@ -0,0 +1,167 @@
+# 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
+
+system=`uname -s`
+cpu=`uname -m`
+
+case "$system" in
+ # linux
+ Linux)
+ case "$cpu" in
+ i*86) platform="linux" ;;
+ x86_64|ia64) platform="linux-64" ;;
+ # a little bit of cheating with ppc64 (won't work on Gentoo)
+ ppc|ppc64) platform="linux-ppc" ;;
+ *) platform="unknown" ;;
+ esac ;;
+ # Mac OS X
+ Darwin)
+ case "$cpu" in
+ i*86) platform="osx-intel" ;;
+ x86_64) platform="osx-64" ;;
+ ppc*|powerpc|power*|Power*) platform="osx-ppc" ;;
+ *) platform="unknown" ;;
+ esac ;;
+ # FreeBSD
+ FreeBSD|freebsd)
+ case "$cpu" in
+ i*86) platform="freebsd" ;;
+ x86_64) platform="freebsd" ;;
+ amd64) platform="freebsd-amd64" ;;
+ *) platform="unknown" ;;
+ esac ;;
+ # kFreeBSD (Debian)
+ GNU/kFreeBSD)
+ case "$cpu" in
+ i*86) platform="kfreebsd-i386" ;;
+ x86_64|amd64) platform="kfreebsd-amd64" ;;
+ *) platform="unknown" ;;
+ esac ;;
+ # cygwin
+ CYGWIN)
+ case "$cpu" in
+ i*86) platform="cygwin" ;;
+ x86_64|ia64) platform="cygwin-64" ;;
+ *) platform="unknown" ;;
+ esac ;;
+ # SunOS/Solaris
+ SunOS)
+ case "$cpu" in
+ sparc) platform="solaris-sparc" ;;
+ i86pc) platform="solaris-intel" ;;
+ *) platform="unknown" ;;
+ esac ;;
+ *) platform="unknown"
+esac
+
+# temporary fix for Snow Leopard
+if test "$platform" = "osx-intel"; then
+ # running Snow Leopard or later
+ if test `uname -r|cut -f1 -d"."` -ge 10 ; then
+ # working on 64-bit hardware
+ if test `sysctl -n hw.cpu64bit_capable` = 1; then
+ platform="osx-64"
+ fi
+ fi
+fi
+
+if test "$platform" = "unknown" ; then
+ echo "Error: your system \"$system $cpu\" is not supported yet."
+ echo "Please report to the ConTeXt mailing-list (ntg-context@ntg.nl)"
+fi
+
+#
+# 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
+
diff --git a/scripts/context/stubs/setup/setuptex.bat b/scripts/context/stubs/setup/setuptex.bat
new file mode 100644
index 000000000..b61fd4494
--- /dev/null
+++ b/scripts/context/stubs/setup/setuptex.bat
@@ -0,0 +1,70 @@
+@ECHO OFF
+
+REM author: Hans Hagen - PRAGMA ADE - Hasselt NL - www.pragma-ade.com
+
+:userpath
+
+if "%SETUPTEX%"=="done" goto done
+
+if "%~s1"=="" goto selftest
+
+set TEXMFOS=%~s1texmf-mswin-64
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~s1\texmf-mswin-64
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~s1texmf-win64
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~s1\texmf-win64
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~s1texmf-mswin
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~s1\texmf-mswin
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~s1texmf-win32
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~s1\texmf-win32
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+:selftest
+
+set TEXMFOS=%~d0%~p0texmf-mswin-64
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~d0%~p0\texmf-mswin-64
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~d0%~p0texmf-win64
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~d0%~p0\texmf-win64
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~d0%~p0texmf-mswin
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~d0%~p0\texmf-mswin
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~d0%~p0texmf-win32
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+set TEXMFOS=%~d0%~p0\texmf-win32
+if exist %TEXMFOS%\bin\mtxrun.exe goto start
+
+:start
+
+set PATH=%TEXMFOS%\bin;%PATH%
+
+:register
+
+set SETUPTEX=done
+set CTXMINIMAL=yes
+
+:done
diff --git a/scripts/context/stubs/setup/setuptex.csh b/scripts/context/stubs/setup/setuptex.csh
new file mode 100644
index 000000000..c1160675f
--- /dev/null
+++ b/scripts/context/stubs/setup/setuptex.csh
@@ -0,0 +1,164 @@
+# Example setup file for ConTeXt distribution
+#
+# Author: Hans Hagen
+# Patches: Arthur R. & Mojca M.
+# (t)csh version: Alan B.
+#
+# Usage :
+# source setuptex.csh [texroot]
+#
+# On the first run also execute:
+# mktexlsr
+# texexec --make --alone
+
+echo "We are considering removing setuptex.csh in case that nobody uses it."
+echo "If you still use this file please drop us some mail at"
+echo " gardeners (at) contextgarden (dot) net"
+echo "If we don't get any response, we will delete it in near future."
+
+#
+# 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
+
+set system=`uname -s`
+set cpu=`uname -m`
+
+switch ( $system )
+ # linux
+ case Linux:
+ switch ( $cpu )
+ case i*86:
+ set platform="linux"
+ breaksw
+ case x86_64:
+ case ia64:
+ set platform="linux-64"
+ breaksw
+ case ppc:
+ case ppc64:
+ set platform="linux-ppc"
+ breaksw
+ default:
+ set platform="unknown"
+ endsw
+ breaksw
+ # Mac OS X
+ case Darwin:
+ switch ( $cpu )
+ case i*86:
+ set platform="osx-intel"
+ breaksw
+ case x86_64:
+ set platform="osx-64"
+ breaksw
+ case ppc*:
+ case powerpc:
+ case power*:
+ case Power*:
+ set platform="osx-ppc"
+ breaksw
+ default:
+ set platform="unknown"
+ endsw
+ breaksw
+ # FreeBSD
+ case FreeBSD:
+ case freebsd:
+ switch ( $cpu )
+ case i*86:
+ set platform="freebsd"
+ breaksw
+ case x86_64:
+ set platform="freebsd"
+ breaksw
+ case amd64:
+ set platform="freebsd-amd64"
+ breaksw
+ default:
+ set platform="unknown"
+ endsw
+ breaksw
+ # cygwin
+ case CYGWIN:
+ switch ( $cpu )
+ case i*86:
+ set platform="cygwin"
+ breaksw
+ case x86_64:
+ case ia64:
+ set platform="cygwin-64"
+ breaksw
+ default:
+ set platform="unknown"
+ endsw
+ breaksw
+ # SunOS/Solaris
+ case SunOS:
+ switch ( $cpu )
+ case sparc:
+ set platform="solaris-sparc"
+ breaksw
+ case i86pc:
+ set platform="solaris-intel"
+ default:
+ set platform="unknown"
+ endsw
+ breaksw
+ # Other
+ default:
+ set platform="unknown"
+endsw
+
+if ( $platform == "unknown" ) then
+ echo Error: your system \"$system $cpu\" is not supported yet.
+ echo Please report to the ConTeXt mailing-list (ntg-context@ntg.nl).
+endif
+
+#
+# PATH
+#
+
+# this resolves to path of the setuptex script
+# We use $0 for determine the path to the script, except for bash and (t)csh where $0
+# always is bash or (t)csh.
+
+# but one can also call
+# . setuptex path-to-tex-tree
+
+# first check if any path has been provided in the argument, and try to use that one
+if ( $# > 0 ) then
+ setenv TEXROOT $1
+else
+ # $_ should be `history -h 1` but doesn't seem to work...
+ set cmd=`history -h 1`
+ if ( $cmd[2]:h == $cmd[2]:t ) then
+ setenv TEXROOT $cwd
+ else
+ setenv TEXROOT $cmd[2]:h
+ endif
+ unset cmd
+endif
+cd $TEXROOT; setenv TEXROOT $cwd; cd -
+
+if ( -f "$TEXROOT/texmf/tex/plain/base/plain.tex" ) then
+ echo Setting \"$TEXROOT\" as TEXROOT.
+else
+ echo \"$TEXROOT\" is not a valid TEXROOT path.
+ echo There is no file \"$TEXROOT/texmf/tex/plain/base/plain.tex\".
+ echo Please provide a proper tex root (like \"source setuptex /path/tex\")
+ unsetenv TEXROOT
+ exit
+endif
+
+unsetenv TEXINPUTS MPINPUTS MFINPUTS
+
+# ConTeXt binaries have to be added to PATH
+setenv TEXMFOS $TEXROOT/texmf-$platform
+setenv PATH $TEXMFOS/bin:$PATH
+# TODO: we could set OSFONTDIR on Mac for example
+
+# setenv CTXMINIMAL yes