summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/stubs/setup/setuptex.csh
blob: c1160675fb4ec55af7e3e4659bc3e494ae11e72b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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