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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
#!/bin/sh
# Shave and a Haircut
# (c) 2019 Epic Games
# US Patent 6720962
# This script sets environment and shell variables to values appropriate for
# building Shave for the version of Maya pointed to by the MAYA_LOCATION
# envariable.
#
# Environment and shell variable settings are inherited by child scripts
# (i.e. those called from the script in which they were defined) but are not
# inherited by the parent script (i.e. the script which called the one in which the
# variables were defined). For this reason you must *source* this script into a
# script high enough in your calling tree such the variables will be available to
# all those scripts which need it.
#
#
# Environment Variables Defined
# -----------------------------
#
# DEVELOPER_DIR - Points to the directory containing the version of Xcode tools
# required by this version of Maya.
# Ex: /Applications/Xcode5.0.2.app/Contents/Developer
#
# SDKROOT - Points to the OS X SDK for the version of OS X targetted by this
# version of Maya.
# Ex: /Applications/Xcode5.0.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOS10.8.sdk
#
# MACOSX_DEPLOYMENT_TARGET
# - The lowest version of OS X on which this build of Shave is
# intended to be used. For simplicity we always set this to the
# same version of OS X as in SDKROOT.
# Ex: 10.8
#
#
# Shell Variables Defined
# -----------------------
#
# mayaVersion - The full X.Y version number for Maya.
# Ex: 2016.5
#
# Note that most versions of Maya don't have minor number, in
# which case the dot and the minor number will be missing.
# Ex: 2016
#
# mayaMajor - The major version number for Maya (i.e. the part before the dot).
# Ex: 2016
#
# mayaMinor - The minor version number for Maya (i.e. the part after the dot).
# Ex: 5
#
# Note that most Maya versions do not have a minor number, in which
# case this variable will contain 0.
#
# mayaShared - Path to the directory containing those 3rd party Maya
# scripts and plugins which are to be shared among all users
# on the system.
# Ex: /Users/Shared/Autodesk/maya/2016
#
# fullShaveVersion
# - The full Shave version string, including release number.
# Ex: 9.0v16
# shaveVersion - The Shave version number, excluding release number.
# Ex: 9.0
#
# shaveMajor - The major version number from the Shave version string.
# Ex: 9
#
# shaveMinor - The minor version number from the Shave version string.
# Ex: 0
#
# release - The release number from the Shave version string.
# Ex: 16
#
# pkgname - The name of the Shave package before it is compressed.
# Ex: shaveHaircut_Maya2015_0-9.0v16.mpkg
#
# pmaker - Full path to the PackageMaker command.
#
# splitforks - Full path to the SplitForks command.
#
#
# This script may define some other variables in the course of its execution, but
# those should not be relied upon as they may be changed or removed in a future
# version.
#
if [ "${MAYA_LOCATION}" = "" ]; then
echo "MAYA_LOCATION is not defined"
exit 1
fi
# Maya and its scripts expect MAYA_LOCATION to point to the Maya.app/Contents
# folder while we expect it to point to the folder containing Maya.app.
# If the user has the version expected by Maya defined, let's redefine it to
# what our scripts expect.
#
mayaLocation=`echo ${MAYA_LOCATION} | sed 's?/Maya\.app.*$??'`
export MAYA_LOCATION=${mayaLocation}
# Get the Maya version number.
#
versionInfo=(`utils/getMayaAPIVersion.sh`)
mayaVersion=${versionInfo[1]}
mayaMajor=${versionInfo[2]}
mayaMinor=${versionInfo[3]}
if [ "${mayaMajor}" = "" ]; then
# getMayaAPIVersions.sh will have already reported the error.
exit 1
fi
if [ ${mayaMajor} -lt 2017 ]; then
echo "Shave does not support Maya ${mayaVersion} on OSX."
exit 1
fi
mayaShared=/Users/Shared/Autodesk/maya/${mayaVersion}
# Get the plugin version and release from the shaveVersion.mel file.
#
shaveVersion=`grep "return" scripts/shaveVersion.mel | sed 's/^[^"]*"\([^v"]*\)[v"].*$/\1/'`
shaveMajor=`echo $shaveVersion | sed 's/\..*$//'`
shaveMinor=`echo $shaveVersion | sed 's/^[^.]*\.\([^.]*\).*$/\1/'`
release=`grep "return" scripts/shaveVersion.mel | sed 's/^[^v]*v\([^"]*\)".*$/\1/'`
fullShaveVersion=${shaveVersion}v${release}
pkgName=shaveHaircut_Maya${mayaMajor}_${mayaMinor}-${fullShaveVersion}.mpkg
# Set DEVELOPER_DIR to the appropriate version of Xcode and SDKROOT to the
# appropriate SDK.
#
# 2018: El Capitan 10.11.6, Xcode 7.3.1, SDK 10.11
# 2017: Yosemite 10.10.5, Xcode 6.1.1, SDK 10.10?
#
# Old versions of Xcode are expected to be found in /Applications/XcodeA.B.app
# For example, on El Capitan /Applications/Xcode.app may contain the default
# 7.3.1 version of Xcode but version 6.1.1 should be in /Applications/Xcode6.1.1.app
#
# Upgrading to a new version of Xcode will normally delete the older version, so
# remember to copy the old version into its numbered directory before doing the
# upgrade.
#
if [ ${mayaMajor} -eq 2018 ]; then
xcodeVersion=7.3.1
sdk=10.11
elif [ ${mayaMajor} -eq 2017 ]; then
xcodeVersion=6.1
sdk=10.10
else
echo "getosxvars.sh: Maya version ${mayaMajor} not supported." >&2
echo ""
exit
fi
curXcodeVersion=0
# If there's a version of Xcode installed, see what it is.
if xcodebuild -version >/dev/null 2>&1; then
curXcodeVersion=`xcodebuild -version | grep '^Xcode' | sed 's/^[^0-9]*//'`
fi
if [ "${curXcodeVersion}" = "${xcodeVersion}" ]; then
xcodePath=`xcode-select -print-path`
else
# Look for an Xcode folder in /Applications with the right version number.
# This is not an Apple standard, just something we do for Shave.
xcodePath=/Applications/Xcode${xcodeVersion}.app/Contents/Developer
if [ ! -d ${xcodePath} ]; then
echo "getosxvars.sh: Could not find Xcode ${xcodeVersion} for Maya ${mayaMajor}." >& 2
echo ""
exit
fi
fi
export DEVELOPER_DIR=${xcodePath}
sdkPath=${xcodePath}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${sdk}.sdk
if [ ! -d ${sdkPath} ]; then
# Try the older path format.
sdkPath=${xcodePath}/SDKs/MacOSX${sdk}.sdk
if [ ! -d ${sdkPath} ]; then
echo "getosxvars.sh: Cannot find OS X SDK ${sdk} for Maya ${mayaMajor}." >& 2
echo ""
exit
fi
fi
export SDKROOT=${sdkPath}
# llvm is a bit stupid in that even if you specify an SDK version, such as 10.6, if
# you don't also specify a target OS X version then the compiler and linker will
# attempt to use features which may only be available in the currently running
# version of the operating system. So we must explicitly specify the target version
# as well.
#
export MACOSX_DEPLOYMENT_TARGET=${sdk}
# Figure out where PackageMaker is hiding.
#
if [ -d /Applications/PackageMaker.app ]; then
pmaker=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
elif [ -d /Applications/Utilities/PackageMaker.app ]; then
pmaker=/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
elif [ -d /Developer/Applications/Utilities/PackageMaker.app ]; then
pmaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
elif [ -d /Developer/Applications/PackageMaker.app ]; then
pmaker=/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker
else
echo "getosxvars.sh: Could not find PackageMaker command." >& 2
echo ""
exit
fi
# Figure out where SplitForks is hiding.
#
if [ -x /usr/bin/SplitForks ]; then
splitforks=/usr/bin/SplitForks
elif [ -x /Developer/Tools/SplitForks ]; then
splitforks=/Developer/Tools/SplitForks
else
echo "getosxvars.sh: Could not find SplitForks command." >& 2
echo ""
exit
fi
|