aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBen Marsh <[email protected]>2019-10-22 09:07:59 -0400
committerBen Marsh <[email protected]>2019-10-22 09:07:59 -0400
commitbd0027e737c6512397f841c22786274ed74b927f (patch)
treef7ffbdb8f3741bb7f24635616cc189cba5cb865c /utils
downloadshave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.tar.xz
shave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.zip
Adding Shave-and-a-Haircut 9.6
Diffstat (limited to 'utils')
-rw-r--r--utils/absPath.sh11
-rw-r--r--utils/do-nmake.bat144
-rw-r--r--utils/getMayaAPIVersion.sh127
-rw-r--r--utils/getMayaLocation.bat30
-rw-r--r--utils/getMayaLocation.sh52
-rw-r--r--utils/getMayaVersions.sh24
-rw-r--r--utils/getNumJobs.sh12
-rw-r--r--utils/getShaveVersion.bat39
-rw-r--r--utils/getVSVersion.bat30
-rw-r--r--utils/getVrayVSVersion.bat30
-rw-r--r--utils/getarch.sh20
-rw-r--r--utils/getg++.sh92
-rw-r--r--utils/getg++vray.sh106
-rw-r--r--utils/getos.sh49
-rw-r--r--utils/splitMayaVersion.bat46
-rw-r--r--utils/vcbuild.bat154
-rw-r--r--utils/vcrebuild.bat68
-rw-r--r--utils/zeroPad.bat8
18 files changed, 1042 insertions, 0 deletions
diff --git a/utils/absPath.sh b/utils/absPath.sh
new file mode 100644
index 0000000..4b08cd7
--- /dev/null
+++ b/utils/absPath.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Shave and a Haircut
+# (c) 2019 Epic Games
+# US Patent 6720962
+
+# Returns the absolute path for a file path which may be relative to the current directory.
+
+cd -P -- `dirname -- "$1"`
+echo `pwd -P`/`basename -- "$1"`
+
diff --git a/utils/do-nmake.bat b/utils/do-nmake.bat
new file mode 100644
index 0000000..8423742
--- /dev/null
+++ b/utils/do-nmake.bat
@@ -0,0 +1,144 @@
+@if not "%verboseBuild%"=="y" echo off
+
+rem Shave and a Haircut
+rem (c) 2019 Epic Games
+rem US Patent 6720962
+
+rem Arg 1 is 'vs10', 'vs11', 'vs14', etc
+rem Arg 2 is 'release' or 'debug'
+rem Arg 3 is '32' or '64'
+rem Args 4 through 9 are passed directly to the nmake command.
+
+setlocal
+set scriptName=do-nmake
+set usage=n
+
+rem Get the Visual Studio version.
+rem
+rem Note that we cannot use the newer if / else statements here because we
+rem are dealing with pathnames which may have parentheses in them which
+rem make Miscrosoft's bug-ridden command parser barf.
+if /i not "%1"=="vs7" goto elseif1
+ set vsVersion=vs7
+ set varName=VS71COMNTOOLS
+ set commonToolsDir=%VS71COMNTOOLS%
+ set vcDir=%VS71COMNTOOLS:~0,-14%Vc7
+ set dllDir=%VS71COMNTOOLS:~0,-6%IDE
+ goto endif1
+:elseif1
+if /i not "%1"=="vs8" goto elseif2
+ set vsVersion=vs8
+ set varName=VS80COMNTOOLS
+ set commonToolsDir=%VS80COMNTOOLS%
+ set vcDir=%VS80COMNTOOLS:~0,-14%VC
+ set dllDir=%VS80COMNTOOLS:~0,-6%IDE
+ goto endif1
+:elseif2
+if /i not "%1"=="vs10" goto elseif3
+ set vsVersion=vs10
+ set varName=VS100COMNTOOLS
+ set commonToolsDir=%VS100COMNTOOLS%
+ set vcDir=%VS100COMNTOOLS:~0,-14%VC
+ set dllDir=%VS100COMNTOOLS:~0,-6%IDE
+ goto endif1
+:elseif3
+if /i not "%1"=="vs11" goto elseif4
+ set vsVersion=vs11
+ set varName=VS110COMNTOOLS
+ set commonToolsDir=%VS110COMNTOOLS%
+ set vcDir=%VS110COMNTOOLS:~0,-14%VC
+ set dllDir=%VS110COMNTOOLS:~0,-6%IDE
+ goto endif1
+:elseif4
+if /i not "%1"=="vs14" goto else1
+ set vsVersion=vs14
+ set varName=VS140COMNTOOLS
+ set commonToolsDir=%VS140COMNTOOLS%
+ set vcDir=%VS140COMNTOOLS:~0,-14%VC
+ set dllDir=%VS140COMNTOOLS:~0,-6%IDE
+ goto endif1
+:else1
+ if "%1"=="" (
+ set usage=y
+ ) else (
+ echo %scriptName%: Error: Visual Studio version '%1' not supported. Must be 'vs7', 'vs8', 'vs10', 'vs11' or 'vs14'.
+ goto error
+ )
+:endif1
+
+rem Get the build flavour.
+if /i "%2"=="release" (
+ set flavour=release
+) else if /i "%2"=="debug" (
+ set flavour=debug
+) else (
+ if "%2"=="" (
+ set usage=y
+ ) else (
+ echo %scriptName%: Error: Build flavour '%2' not recognized. Must be 'release' or 'debug'.
+ goto error
+ )
+)
+
+if "%3"=="32" (
+ set setupScript=vcvars32.bat
+) else if "%3"=="64" (
+ if "%vsVersion%"=="vs7" (
+ echo %scriptName%: Error: Visual Studio 7 does not support 64-bit builds
+ goto error
+ )
+ set setupScript=x86_amd64\vcvarsx86_amd64.bat
+) else if "%3"=="" (
+ set usage=y
+) else (
+ echo %scriptName%: Error: target platform bit size '%3' is invalid
+ goto error
+)
+
+if "%usage%"=="y" (
+ echo %scriptName%: Error: Usage is: %scriptName% vs11/vs14 release/debug 64 [nmake arguments]
+ goto error
+)
+
+set binDir=%vcDir%\Bin
+set incDir=%vcDir%\Include;%vcDir%\PlatformSDK\Include
+set libDir=%vcDir%\Lib;%vcDir%\PlatformSDK\Lib
+set buildDir=%flavour%-%vsVersion%
+
+if exist "%commonToolsDir%" goto endif2
+ echo %scriptName%: Error: %varName% does not point to the Visual Studio Common Tools directory
+ goto error
+:endif2
+
+if exist "%binDir%\nmake.exe" goto endif3
+ echo %scriptName%: Error: cannot find NMAKE.EXE in '%binDir%'.
+ goto error
+:endif3
+
+if exist "%binDir%\%setupScript%" goto endif4
+ echo %scriptName%: Error: could not find %vsVersion% setup script '%binDir%\%setupScript%'
+ goto error
+:endif4
+
+call "%binDir%\%setupScript%" >NUL 2>&1
+
+echo on
+nmake FLAVOUR=%flavour% VSVERSION=%vsVersion% %4 %5 %6 %7 %8 %9 >do-nmake.log 2>&1
+@if not "%verboseBuild%"=="y" echo off
+if errorlevel 1 (
+ type do-nmake.log
+ goto error
+)
+
+if "%verboseBuild%"=="y" type do-nmake.log
+
+endlocal
+set result=0
+goto done
+
+:error
+endlocal
+set result=1
+:done
+
+if exist do-nmake.log del do-nmake.log
diff --git a/utils/getMayaAPIVersion.sh b/utils/getMayaAPIVersion.sh
new file mode 100644
index 0000000..cf11136
--- /dev/null
+++ b/utils/getMayaAPIVersion.sh
@@ -0,0 +1,127 @@
+#!/bin/bash
+
+# Shave and a Haircut
+# (c) 2019 Epic Games
+# US Patent 6720962
+
+# Returns six words, separated by spaces: raw normal major minor release dir
+#
+# 'raw' is the compact version used in MAYA_API_VERSION (e.g. "201500" prior
+# to Maya 2018, "20180000" from Maya 2018 onward)
+#
+# 'normal' is the version number by which Maya is known. E.g. "2015"
+# Although there may be multiple releases of Maya within a year (e.g. Maya 2015
+# SP1, Maya 2015 Extension 1) they are normally all binary compatible and will
+# have the same 'normal' version number (e.g. "2015"). However, there are
+# occasional exceptions. For example two binary incompatible versions of Maya
+# 2016 were released: Maya 2016 ('normal' value "2016") and Maya 2016 Extension
+# 2 ('normal' value "2016.5").
+#
+# 'major' is the major version number
+#
+# 'minor' is the minor version number. Usually this is "0" except in those cases
+# where multiple versions of Maya were made in the same year. For example, for
+# Maya 2016.5 this will contain "5".
+#
+# 'release' is the incremental release number within a version of Maya. For
+# example, if the 'raw' version is "201507" then the 'release' will be "7".
+# From Maya 2018 onward, the release number is 4 digits long, so a 'raw'
+# version of "20180123" would give a 'release' of "123".
+#
+# 'dir' is the version number as it appears in Maya's install path. On MacOS
+# and Windows this will be the same as the 'normal' version number but on Linux
+# some versions of Maya include a '-x64' suffix in their path
+# (e.g. "2015-x64").
+#
+# From a Makefile these can easily be accessed as follows:
+#
+# versionInfo := $(shell getMayaAPIVersion.sh)
+# raw := $(word 1,$(versionInfo))
+# normal := $(word 2,$(versionInfo))
+# major := $(word 3,$(versionInfo))
+# minor := $(word 4,$(versionInfo))
+# release := $(word 5,$(versionInfo))
+# dir := $(word 6,$(versionInfo))
+#
+# From a csh or tcsh script:
+#
+# set versionInfo = `getMayaAPIVersion.sh`
+# set raw = ${versionInfo[1]}
+# set normal = ${versionInfo[2]}
+# set major = ${versionInfo[3]}
+# set minor = ${versionInfo[4]}
+# set release = ${versionInfo[5]}
+# set dir = ${versionInfo[6]}
+#
+# From a Bourne shell or bash script:
+#
+# versionInfo=(`getMayaAPIVersion.sh`)
+# raw=${versionInfo[0]}
+# normal=${versionInfo[1]}
+# major=${versionInfo[2]}
+# minor=${versionInfo[3]}
+# release=${versionInfo[4]}
+# dir=${versionInfo[5]}
+#
+if [ "${MAYA_LOCATION}" = "" ]; then
+ echo "getMayaVersion:error: MAYA_LOCATION not defined." >&2
+ exit 1
+fi
+
+if [ ! -d ${MAYA_LOCATION} ]; then
+ echo "getMayaVersion:error: MAYA_LOCATION contains '${MAYA_LOCATION}', which does not exist." >&2
+ exit 2;
+fi
+
+versionFile=${MAYA_LOCATION}/include/maya/MTypes.h
+
+# Prior to Maya 2016, the API 'includes' directory was inside the 'devkit'
+# directory. Now it's at the same level as 'devkit', like Linux.
+#
+if [ "`uname -s`" == "Darwin" ]; then
+ if [ ! -r ${versionFile} ]; then
+ versionFile=${MAYA_LOCATION}/devkit/include/maya/MTypes.h
+ fi
+fi
+
+if [ ! -r ${versionFile} ]; then
+ echo "getMayaVersion:error: File '${versionFile}' does not exist." >&2
+ exit 4
+fi
+
+compact=`grep '^[ \t]*\#define[ \t]*MAYA_API_VERSION' ${versionFile} | sed 's/^[^0-9]*//'`
+major=`echo ${compact} | sed 's/\(.*\)[0-9][0-9]$/\1/'`
+
+# From Maya 2018 onward the API version number is 8 digits long.
+
+if [ ${major} -gt 2017 ]; then
+ major=`echo ${compact} | sed 's/\(.*\)[0-9][0-9][0-9][0-9]$/\1/'`
+ release=`echo ${compact} | sed 's/.*\([0-9][0-9][0-9][0-9]\)$/\1/'`
+else
+ release=`echo ${compact} | sed 's/.*\([0-9][0-9]\)$/\1/'`
+fi
+
+# Strip leading zeroes from the release number.
+release=`echo ${release} | sed 's/^0*//'`
+
+# If the release string is empty, set it to zero.
+if [ "${release}" == "" ]; then
+ release=0
+fi
+
+combined=${major}
+minor=0
+
+# Special handling for Maya 2013.5 & 2016.5
+if [ \( ${major} -eq 2013 -o ${major} -eq 2016 \) -a ${release} -ge 50 ]; then
+ combined=${major}.5
+ minor=5
+fi
+
+if `echo ${MAYA_LOCATION} | grep -q '[-]x64'`; then
+ dir=${combined}-x64
+else
+ dir=${combined}
+fi
+
+echo ${compact} ${combined} ${major} ${minor} ${release} ${dir}
diff --git a/utils/getMayaLocation.bat b/utils/getMayaLocation.bat
new file mode 100644
index 0000000..cdc2657
--- /dev/null
+++ b/utils/getMayaLocation.bat
@@ -0,0 +1,30 @@
+@echo off
+
+rem Shave and a Haircut
+rem (c) 2019 Epic Games
+rem US Patent 6720962
+
+rem This script requires that the mayaVersionMajor, mayaVersionMinor and
+rem mayaVersionBits envariables all be properly set. That generally means
+rem that splitMayaVersion.bat should be called before this.
+
+set mayaLocation=.
+
+if "%mayaVersionBits%"=="" (
+ echo getMayaLocation: mayaVersionBits not defined. Call splitMayaVersion first.
+ goto done
+)
+
+if "%AUTODESK_LOCATION%"=="" (
+ echo getMayaLocation: AUTODESK_LOCATION not defined.
+ goto done
+)
+
+set mayaLocation=%AUTODESK_LOCATION%\Maya%mayaVersion%
+
+if not exist "%mayaLocation%" (
+ echo getMayaLocation: Maya %mayaVersion% not installed under %AUTODESK_LOCATION%.
+ set mayaLocation=.
+)
+
+:done
diff --git a/utils/getMayaLocation.sh b/utils/getMayaLocation.sh
new file mode 100644
index 0000000..2fad7d8
--- /dev/null
+++ b/utils/getMayaLocation.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# Shave and a Haircut
+# (c) 2019 Epic Games
+# US Patent 6720962
+
+mayaVer=$1
+
+if [ "$mayaVer" = "" ]; then
+ echo "Usage: $0 mayaVersion" >&2
+ exit
+fi
+
+utilsDir=`dirname $0`
+thisArch=`${utilsDir}/getarch.sh`
+targetArch=${thisArch}
+os=`${utilsDir}/getos.sh`
+
+case ${os} in
+ osx*)
+ case ${mayaVer} in
+ *i|*i386)
+ targetArch=i386
+ mayaVer=`echo ${mayaVer} | sed 's/i.*$//'`
+ ;;
+ *p|*ppc)
+ targetArch=ppc
+ mayaVer=`echo ${mayaVer} | sed 's/p.*$//'`
+ ;;
+ esac
+
+ mayaDir=maya${mayaVer}
+
+ if [ ${targetArch} != ${thisArch} ]; then
+ mayaDir=${mayaDir}-${targetArch}
+ fi
+
+ if [ -r /Applications/Autodesk/${mayaDir} ]; then
+ echo "/Applications/Autodesk/${mayaDir}"
+ else
+ if [ -r /Applications/Alias/${mayaDir} ]; then
+ echo "/Applications/Alias/${mayaDir}"
+ else
+ echo ""
+ fi
+ fi
+ ;;
+ *)
+ echo "$0: Operating system ${os} not currently supported." >&2
+ echo ""
+ ;;
+esac
diff --git a/utils/getMayaVersions.sh b/utils/getMayaVersions.sh
new file mode 100644
index 0000000..33afaeb
--- /dev/null
+++ b/utils/getMayaVersions.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Shave and a Haircut
+# (c) 2019 Epic Games
+# US Patent 6720962
+
+utilsDir=`dirname $0`
+arch=`${utilsDir}/getarch.sh`
+os=`${utilsDir}/getos.sh`
+versionsFile=${utilsDir}/../mayaVersions.linux
+
+auto=
+
+if [ "$1" = "auto" ]; then
+ auto=y
+fi
+
+if [ -r ${versionsFile} ]; then
+ # Note that we replace the spacing between fields with a single tab so
+ # callers can use the 'cut' cmd on the output without any fiddling.
+ grep -v "^[[:space:]]*#" ${versionsFile} |
+ sed 's/[[:space:]]\+/\t/g' |
+ grep "^[^[:space:]]\+[[:space:]]\+${arch}[[:space:]]\+[^[:space:]]\+[[:space:]]\+${os}[[:space:]]\+${auto}"
+fi
diff --git a/utils/getNumJobs.sh b/utils/getNumJobs.sh
new file mode 100644
index 0000000..7219301
--- /dev/null
+++ b/utils/getNumJobs.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Shave and a Haircut
+# (c) 2019 Epic Games
+# US Patent 6720962
+
+# How many processors do we have?
+numprocs=`grep '^processor' /proc/cpuinfo | wc -l`
+
+# We use two jobs per processor, so that one can be using the processor
+# while another is waiting for disk I/O.
+echo $((${numprocs} * 2))
diff --git a/utils/getShaveVersion.bat b/utils/getShaveVersion.bat
new file mode 100644
index 0000000..ec8faf2
--- /dev/null
+++ b/utils/getShaveVersion.bat
@@ -0,0 +1,39 @@
+@echo off
+
+rem Shave and a Haircut
+rem (c) 2019 Epic Games
+rem US Patent 6720962
+
+rem This script extracts the current Shave version string from the
+rem shaveVersion.mel script file and place it into the 'shaveVersion'
+rem environment variable.
+
+rem We need the shaveVersion.mel script so let's make sure it exists.
+
+if not exist scripts\shaveVersion.mel goto noFile
+ find "return" <scripts\shaveVersion.mel > version.dat
+ set /p shaveVersion=<version.dat
+ del version.dat
+
+ rem
+ rem Note that because of the recursive nature of these assignments
+ rem (i.e. shaveVersion is being defined in terms of shaveVersion)
+ rem they will not work inside an 'if cond (...) else (...)' construct
+ rem because Windows treats that as a single statement and does variable
+ rem substitution once, when the statement is read in, not as each
+ rem statement is executed. So we have to use the 'if cond goto' construct
+ rem instead.
+ rem
+ set shaveVersion=%shaveVersion:return=%
+ set shaveVersion=%shaveVersion:"=%
+ set shaveVersion=%shaveVersion:;=%
+ set shaveVersion=%shaveVersion: =%
+ set shaveVersion=%shaveVersion: =%
+
+ set result=0
+
+goto done
+:noFile
+ echo Error: cannot find scripts\shaveVersion.mel. Build terminated.
+ set result=1
+:done
diff --git a/utils/getVSVersion.bat b/utils/getVSVersion.bat
new file mode 100644
index 0000000..f86249a
--- /dev/null
+++ b/utils/getVSVersion.bat
@@ -0,0 +1,30 @@
+@echo off
+
+rem Shave and a Haircut
+rem (c) 2019 Epic Games
+rem US Patent 6720962
+
+if "%1"=="" (
+ if not "%splitMayaVersionCalled%"=="y" (
+ echo ERROR: getVSVersion: You must either supply a Maya version number or have already called utils/splitMayaVersion.bat.
+ goto :error
+ )
+ set versionToCheck=%mayaVersion%
+) else (
+ set versionToCheck=%1
+)
+
+set vsVersion=vs14
+
+if %versionToCheck% LSS 2015 (
+ set vsVersion=vs10
+) else if %versionToCheck% LSS 2018 (
+ set vsVersion=vs11
+)
+
+:success
+set result=0
+goto :eof
+
+:error
+set result=1
diff --git a/utils/getVrayVSVersion.bat b/utils/getVrayVSVersion.bat
new file mode 100644
index 0000000..d88a554
--- /dev/null
+++ b/utils/getVrayVSVersion.bat
@@ -0,0 +1,30 @@
+@echo off
+
+rem Shave and a Haircut
+rem (c) 2019 Epic Games
+rem US Patent 6720962
+
+if "%1"=="" (
+ if not "%splitMayaVersionCalled%"=="y" (
+ echo ERROR: getVrayVSVersion: You must either supply a Maya version number or have already called utils/splitMayaVersion.bat.
+ goto :error
+ )
+ set versionToCheck=%mayaVersion%
+) else (
+ set versionToCheck=%1
+)
+
+set vrayVSVersion=vs15
+
+if %versionToCheck% LSS 2015 (
+ set vrayVSVersion=vs10
+) else if %versionToCheck% LSS 2018 (
+ set vrayVSVersion=vs11
+)
+
+:success
+set result=0
+goto :eof
+
+:error
+set result=1
diff --git a/utils/getarch.sh b/utils/getarch.sh
new file mode 100644
index 0000000..19f7545
--- /dev/null
+++ b/utils/getarch.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Shave and a Haircut
+# (c) 2019 Epic Games
+# US Patent 6720962
+
+utilsDir=`dirname $0`
+
+case "`${utilsDir}/getos.sh`" in
+ rh7.3) echo i386
+ ;;
+ ce*|fc*|rh*) uname -i
+ ;;
+ deb*) uname -m
+ ;;
+ osx*) uname -p | sed 's/powerpc/ppc/'
+ ;;
+ *) echo unknown
+ ;;
+esac
diff --git a/utils/getg++.sh b/utils/getg++.sh
new file mode 100644
index 0000000..922b1a9
--- /dev/null
+++ b/utils/getg++.sh
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# Shave and a Haircut
+# (c) 2019 Epic Games
+# US Patent 6720962
+
+returnVersion=n
+returnDTS=n
+maya=
+
+while [ "$1" != "" ]; do
+ if [ "$1" = "-v" ]; then
+ returnVersion=y
+ elif [ "$1" == "-dts" ]; then
+ returnDTS=y
+ else
+ maya=$1
+ fi
+
+ shift
+done
+
+if [ "${maya}" = "" ]; then
+ echo "Usage: $0 mayaVersion" >&2
+ echo ""
+ exit
+fi
+
+gpp=
+utilsDir=`dirname $0`
+os=`${utilsDir}/getos.sh`
+
+case ${os} in
+ ce*|deb*|fc*|rh*)
+ gppVerNeeded=`${utilsDir}/getMayaVersions.sh |
+ grep "^${maya}[[:space:]]" | head -n 1 | cut -f 3`
+
+ if [ "${gppVerNeeded}" != "" ]; then
+ if [ "${returnVersion}" = "y" ]; then
+ echo ${gppVerNeeded}
+ exit
+ fi
+
+ # 4.8.2 builds on CentOS 6 require DTS.
+ if [ "${os/.*/}" = "ce6" -a "${gppVerNeeded}" = "4.8.2" ]; then
+ if [ "${returnDTS}" = "y" ]; then
+ echo y
+ exit
+ fi
+
+ source /opt/rh/devtoolset-2/enable
+ elif [ "${returnDTS}" = "y" ]; then
+ echo n
+ exit
+ fi
+
+ # Check to see if there is a directory in /opt containing the
+ # compiler we want.
+ compressedVer=`echo ${gppVerNeeded} | sed 's/\.//g'`
+ shortVer=`echo ${gppVerNeeded} | cut -d. -f-2`
+
+ if [ -x /opt/gcc${compressedVer}/bin/g++ ]; then
+ gpp="/opt/gcc${compressedVer}/bin/g++"
+ elif [ -x /opt/gcc${compressedVer}/bin/g++${compressedVer} ]; then
+ gpp="/opt/gcc${compressedVer}/bin/g++${compressedVer}"
+ elif [ -x /usr/bin/g++-${shortVer} ]; then
+ gpp="/usr/bin/g++-${shortVer}"
+ else
+ # Nothing in /opt, so see if the native g++ is the correct
+ # version.
+ nativeVer=`g++ -v 2>&1 | grep "gcc version" | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`
+
+ if [ "${nativeVer}" = "${gppVerNeeded}" ]; then
+ gpp=g++
+ fi
+ fi
+ fi
+ ;;
+
+ osx*)
+ if [ "${returnDTS}" = "y" ]; then
+ echo n
+ exit
+ fi
+
+ # getosxvars.sh sets environment variables which control where we find
+ # the compiler, so we can just use 'g++' in all cases.
+ gpp=g++
+ ;;
+esac
+
+echo ${gpp}
diff --git a/utils/getg++vray.sh b/utils/getg++vray.sh
new file mode 100644
index 0000000..ed226b7
--- /dev/null
+++ b/utils/getg++vray.sh
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+# Shave and a Haircut
+# (c) 2019 Epic Games
+# US Patent 6720962
+
+returnVersion=n
+returnDTS=n
+vray=
+
+while [ "$1" != "" ]; do
+ if [ "$1" = "-v" ]; then
+ returnVersion=y
+ elif [ "$1" == "-dts" ]; then
+ returnDTS=y
+ else
+ vray=$1
+ fi
+ shift
+done
+
+if [ "${vray}" = "" ]; then
+ echo "Usage: $0 vrayVersion" >&2
+ echo "Where vrayVersion is 31, 36, 40, etc"
+ echo ""
+ exit
+fi
+
+gpp=
+utilsDir=`dirname $0`
+os=`${utilsDir}/getos.sh`
+
+if [ "${os/.*/}" = "ce6" ]; then
+ isCentOS6=y
+else
+ isCentOS6=n
+fi
+
+case ${os} in
+ ce*|deb*|fc*|rh*)
+ gppVerNeeded=
+ case $vray in
+ 30|31|36)
+ if [ "${returnDTS}" = "y" ]; then
+ echo n
+ exit
+ fi
+
+ gppVerNeeded=4.4.7
+ ;;
+
+ 40) # On CentOS 6 we need to use DTS for gcc 4.8.2 builds.
+ if [ "${returnDTS}" = "y" ]; then
+ echo ${isCentOS6}
+ exit
+ fi
+
+ if [ ${isCentOS6} = y ]; then
+ source /opt/rh/devtoolset-2/enable
+ fi
+
+ gppVerNeeded=4.8.2
+ ;;
+ esac
+
+ if [ "${gppVerNeeded}" != "" ]; then
+ if [ "${returnVersion}" = "y" ]; then
+ echo ${gppVerNeeded}
+ exit
+ fi
+
+ # Does the native g++ command give us the correct version?
+ nativeVer=`g++ -v 2>&1 | grep "gcc version" | sed 's/^[^0-9]*\([0-9.]*\).*$/\1/'`
+
+ if [ "${nativeVer}" = "${gppVerNeeded}" ]; then
+ gpp=g++
+ else
+ # Check to see if there is a directory in /opt containing the
+ # compiler we want.
+ compressedVer=`echo ${gppVerNeeded} | sed 's/\.//g'`
+ shortVer=`echo ${gppVerNeeded} | cut -d. -f-2`
+
+ if [ -x /opt/gcc${compressedVer}/bin/g++ ]; then
+ gpp="/opt/gcc${compressedVer}/bin/g++"
+ elif [ -x /opt/gcc${compressedVer}/bin/g++${compressedVer} ]; then
+ gpp="/opt/gcc${compressedVer}/bin/g++${compressedVer}"
+ elif [ -x /usr/bin/g++-${shortVer} ]; then
+ gpp="/usr/bin/g++-${shortVer}"
+ fi
+ fi
+ fi
+ ;;
+
+ osx*)
+ if [ "${returnDTS}" = "y" ]; then
+ echo n
+ exit
+ fi
+
+ # getosxvars.sh sets environment variables which control where we find
+ # the compiler, so we can just use 'g++' in all cases.
+ gpp=g++
+ ;;
+esac
+
+echo ${gpp}
diff --git a/utils/getos.sh b/utils/getos.sh
new file mode 100644
index 0000000..edbeb73
--- /dev/null
+++ b/utils/getos.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# Shave and a Haircut
+# (c) 2019 Epic Games
+# US Patent 6720962
+
+case `uname -s` in
+ Linux)
+ sysInfoFile=""
+ osVersion=""
+ if [ -r /etc/issue ]; then
+ sysInfoFile=/etc/issue
+ osVersion=`grep "release" ${sysInfoFile} | sed 's/^.*release \([0-9][0-9]*[.]*[0-9]*\).*$/\1/'`
+ fi
+
+ if [ "${osVersion}" = "" -a -r /etc/system-release ]; then
+ sysInfoFile=/etc/system-release
+ osVersion=`grep "release" ${sysInfoFile} | sed 's/^.*release \([0-9][0-9]*[.]*[0-9]*\).*$/\1/'`
+ fi
+
+ if [ "${osVersion}" != "" ]; then
+ if grep "Fedora" ${sysInfoFile} >/dev/null; then
+ osType=fc
+ elif grep "CentOS" ${sysInfoFile} >/dev/null; then
+ osType=ce
+ elif grep "Debian" ${sysInfoFile} >/dev/null; then
+ osType=deb
+ osVersion=`grep "Debian" ${sysInfoFile} | sed 's/^[^0-9]*\([0-9.]\+\)[^0-9]*$/\1/'`
+ else
+ osType=rh
+ fi
+
+ echo ${osType}${osVersion}
+ else
+ echo "getos:error: cannot determine Linux version." >&2
+ echo ""
+ fi
+ ;;
+
+ Darwin)
+ osVersion=`sw_vers -productVersion`
+ echo "osx${osVersion}"
+ ;;
+
+ *)
+ echo "Unrecognized OS type '`uname -s`'." >&2
+ echo ""
+ ;;
+esac
diff --git a/utils/splitMayaVersion.bat b/utils/splitMayaVersion.bat
new file mode 100644
index 0000000..f18dc3b
--- /dev/null
+++ b/utils/splitMayaVersion.bat
@@ -0,0 +1,46 @@
+@echo off
+
+rem Shave and a Haircut
+rem (c) 2019 Epic Games
+rem US Patent 6720962
+
+set mayaFullVersion=%1
+set mayaVersion=%mayaFullVersion%
+set mayaVersionBits=32
+
+if "%mayaVersion:~-4%"=="-x64" (
+ set mayaVersion=%mayaVersion:~0,-4%
+ set mayaVersionBits=64
+) else if "%mayaVersion:~-3%"=="x64" (
+ set mayaVersion=%mayaVersion:~0,-3%
+ set mayaVersionBits=64
+)
+
+set mayaVersionMajor=0
+
+if "%mayaVersion:~1,1%"=="." (
+ set mayaVersionMajor=%mayaVersion:~0,1%
+ set mayaVersionMinor=%mayaVersion:~2%
+) else if "%mayaVersion:~2,1%"=="." (
+ set mayaVersionMajor=%mayaVersion:~0,2%
+ set mayaVersionMinor=%mayaVersion:~3%
+) else if "%mayaVersion:~4,1%"=="." (
+ set mayaVersionMajor=%mayaVersion:~0,4%
+ set mayaVersionMinor=%mayaVersion:~5%
+) else if "%mayaVersion:~4,1%"=="" (
+ rem From Maya 2008 onward it's possible for the minor version to be
+ rem dropped if it's zero.
+ set mayaVersionMajor=%mayaVersion%
+ set mayaVersionMinor=0
+) else (
+ echo '%1' is not a valid Maya version specification.
+ set mayaVersionMinor=0
+)
+
+rem From Maya 2016 onward the -x64 has been dropped from Maya's name since
+rem there is only 64-bit support these days.
+if "%mayaVersionMajor%" GEQ "2016" (
+ set mayaVersionBits=64
+)
+
+set splitMayaVersionCalled=y
diff --git a/utils/vcbuild.bat b/utils/vcbuild.bat
new file mode 100644
index 0000000..567166e
--- /dev/null
+++ b/utils/vcbuild.bat
@@ -0,0 +1,154 @@
+@if not "%verboseBuild%"=="y" echo off
+
+rem Shave and a Haircut
+rem (c) 2019 Epic Games
+rem US Patent 6720962
+
+rem
+rem Build a Visual Studio project
+rem
+
+set result=0
+
+setlocal
+
+if a%5b==ab (
+ echo Usage: vcbuild directory project config vsVersion solutionBaseName [bits]
+ goto error
+)
+
+set builddir=%1
+set project=%2
+set config=%3
+set vsVersion=%4
+set solution=%5
+
+set timeStr=%TIME: =%
+set timeStr=%timeStr::=_%
+set timeStr=%timeStr:.=_%
+set logfile=%TEMP%\vcbuild_%timeStr%_%RANDOM%.log
+
+set platform=x64
+
+rem For Visual Studio 7.* we used the normal solution and project file names,
+rem but from VS8 onward the solution and project files have Visual Studio major
+rem version number before the extension. E.g. "shaveHaircut-vs8.sln".
+rem Since the paths may contain parentheses, we cannot use the new style of
+rem 'if' statements here.
+if /i "%vsVersion%"=="vs10" goto useVS10
+if /i "%vsVersion%"=="vs11" goto useVS11
+if /i "%vsVersion%"=="vs14" goto useVS14
+if /i "%vsVersion%"=="vs15" goto useVS15
+if /i not "%vsVersion%"=="vs7" goto notVS7
+
+ set solution=%solution%.sln
+ set project=%project%.vcproj
+ set vsDotVersion=7.1
+ set vsPublicVersion=2003
+ set vsToolsVar=VS71COMNTOOLS
+ set vsToolsPath=%VS71COMNTOOLS%
+ goto doneVSVersion
+:notVS7
+ set solution=%solution%-%vsVersion%.sln
+ set project=%project%-%vsVersion%.vcproj
+ set vsDotVersion=8.0
+ set vsPublicVersion=2005
+ set vsToolsVar=VS80COMNTOOLS
+ set vsToolsPath=%VS80COMNTOOLS%
+ goto doneVSVersion
+:useVS10
+ set solution=%solution%-%vsVersion%.sln
+ set project=%project%-%vsVersion%.vcxproj
+ set vsDotVersion=10.0
+ set vsPublicVersion=2010
+ set vsToolsVar=VS100COMNTOOLS
+ set vsToolsPath=%VS100COMNTOOLS%
+ goto doneVSVersion
+:useVS11
+ set solution=%solution%-%vsVersion%.sln
+ set project=%project%-%vsVersion%.vcxproj
+ set vsDotVersion=11.0
+ set vsPublicVersion=2012
+ set vsToolsVar=VS110COMNTOOLS
+ set vsToolsPath=%VS110COMNTOOLS%
+ goto doneVSVersion
+:useVS14
+ set solution=%solution%-%vsVersion%.sln
+ set project=%project%-%vsVersion%.vcxproj
+ set vsDotVersion=14.0
+ set vsPublicVersion=2015
+ set vsToolsVar=VS140COMNTOOLS
+ set vsToolsPath=%VS140COMNTOOLS%
+ goto doneVSVersion
+:useVS15
+ set solution=%solution%-%vsVersion%.sln
+ set project=%project%-%vsVersion%.vcxproj
+ set vsDotVersion=15.0
+ set vsPublicVersion=2017
+ set vsToolsVar=VS150COMNTOOLS
+ set vsToolsPath=%VS150COMNTOOLS%
+ goto doneVSVersion
+
+:doneVSVersion
+
+if not exist "%solution%" (
+ echo vcbuild: Could not find solution file '%solution%'.
+ echo vcbuild: Note that you must be in the same directory as the solution file
+ goto error
+)
+
+set vsPath=%vsToolsPath%\..\IDE\devenv.exe
+
+if exist "%vsPath%" goto foundIt
+ set vsPath=c:\Program Files (x86)\Microsoft Visual Studio %vsDotVersion%\Common7\Tools\..\IDE\devenv.exe
+
+if exist "%vsPath%" goto foundIt
+ set vsPath=c:\Program Files (x86)\Microsoft Visual Studio\%vsPublicVersion%\Professional\Common7\Tools\..\IDE\devenv.exe
+
+if exist "%vsPath%" goto foundIt
+ echo vcbuild: Could not find %vsPath%. If you have installed Visual Studio
+ echo vcbuild: %vsDotVersion% in a non-standard location, please set the
+ echo vcbuild: %vsToolsVar% variable to point to its Tools folder.
+goto error
+
+:foundIt
+
+rem Remove the .exe from the devenv command so that the .com version will
+rem be used, if available.
+rem
+set vsPath=%vsPath:.exe=%
+
+rem
+rem Visual Studio has problems with .\dir notation. It's fine with
+rem dir1\dir2 it just seems to have trouble with using '.' for the current
+rem directory. So we only add the path to the project file if the build dir
+rem is not the current directory.
+rem
+if not "%builddir%"=="." set project=%builddir%\%project%
+
+@echo on
+"%vsPath%" %solution% /rebuild "%config%" /project %project% /projectconfig "%config%|%platform%" >%logfile% 2>&1
+@set errcode=%errorlevel%
+@if not "%verboseBuild%"=="y" echo off
+
+rem If there was an error, display the build log.
+if not %errcode%==0 type %logfile%
+
+rem For some reason Visual Studio 2017 keeps the log file open after its command
+rem has returned, which causes the deletion below to fail.
+rem
+if %vsPublicVersion% LSS 2017 (
+ if exist %logfile% del %logfile%
+)
+
+if not %errcode%==0 goto error
+
+endlocal
+set result=0
+goto done
+
+:error
+endlocal
+set result=1
+
+:done
diff --git a/utils/vcrebuild.bat b/utils/vcrebuild.bat
new file mode 100644
index 0000000..3d951f2
--- /dev/null
+++ b/utils/vcrebuild.bat
@@ -0,0 +1,68 @@
+@if not "%verboseBuild%"=="y" echo off
+
+rem Shave and a Haircut
+rem (c) 2019 Epic Games
+rem US Patent 6720962
+
+rem
+rem Rebuild a Visual Studio project
+rem
+rem Note that our usage of the terms 'build' and 'rebuild' are the reverse
+rem of Visual Studio's. For us 'build' means to clean out the old stuff
+rem and do a full build while 'rebuild' means to just rebuild those bits
+rem which have changed.
+rem
+
+setlocal
+
+if a%5b==ab (
+ echo Usage: vcrebuild directory project config vsVersion solutionBaseName [bits]
+ goto done
+)
+
+set builddir=%1
+set project=%2
+set config=%3
+set vsVersion=%4
+set solution=%5
+
+set platform=Win32
+if "%6"=="64" set platform=x64
+
+rem For Visual Studio 7.* we used the normal solution and project file names,
+rem but from VS8 onward the solution and project files have Visual Studio major
+rem version number before the extension. E.g. "shaveHaircut-vs8.sln".
+rem Since the paths may contain parentheses, we cannot use the new style of
+rem 'if' statements here.
+if /i not "%vsVersion%"=="vs7" goto notVS7
+ set solution=%solution%.sln
+ set project=%project%.vcproj
+ set vsPath=%VS71COMNTOOLS%\..\IDE\devenv
+ goto doneVSVersion
+:notVS7
+ set solution=%solution%-%vsVersion%.sln
+ set project=%project%-%vsVersion%.vcproj
+ set vsPath=%VS80COMNTOOLS%\..\IDE\devenv
+:doneVSVersion
+
+if not exist "%solution%" (
+ echo vcbuild: Could not find solution file '%solution%'.
+ echo vcbuild: Note that you must be in the same directory as the solution file
+ goto done
+)
+
+
+rem
+rem Visual Studio has problems with .\dir notation. It's fine with
+rem dir1\dir2 it just seems to have trouble with using '.' for the current
+rem directory. So we only add the path to the project file if the build dir
+rem is not the current directory.
+rem
+if not "%builddir%"=="." set project=%builddir%\%project%
+
+@echo on
+"%vsPath%" %solution% /build "%config%" /project %project% /projectconfig "%config%|%platform%"
+@if not "%verboseBuild%"=="y" echo off
+
+:done
+endlocal
diff --git a/utils/zeroPad.bat b/utils/zeroPad.bat
new file mode 100644
index 0000000..a0782eb
--- /dev/null
+++ b/utils/zeroPad.bat
@@ -0,0 +1,8 @@
+@echo off
+
+rem Shave and a Haircut
+rem (c) 2019 Epic Games
+rem US Patent 6720962
+
+set result=0000%1
+set result=%result:~-4%