#!/bin/sh # Shave and a Haircut # (c) 2019 Epic Games # US Patent 6720962 echo "mklinuxVersion start $1" maya= debugOpt= while [ "$1" != "" ]; do if [ "$1" = "debug" ]; then debugOpt=debug=1 elif [ "${maya}" = "" ]; then maya=$1 fi shift done mayaMajorVersion=`echo $maya | sed 's/[^0-9].*$//'` log=$$.log checkFailure() { if [ $? -ne 0 ]; then cat $log rm -f $log echo "mklinux:error: Exiting due to errors building $1 for Maya $maya." exit 1 fi } export MAYA_LOCATION=/usr/autodesk/maya${maya} if [ ! -d $MAYA_LOCATION ]; then echo "mklinux:error: Maya version ${maya} does not appear to be installed." exit 2 fi numJobs=`utils/getNumJobs.sh` # V-Ray # # The V-Ray shaders, plugins and exporters use the same compiler as the # corresponding version of V-Ray, not that of Maya. So we need to build them # before we do the DTS setup for the rest of Shave. # rm -rf mayaPlug/vray mkdir -p mayaPlug/vray rm -f vrayPlug/bin/linux_x64/* grep "^${maya}:" vrayPlug/supportedVrayVersions.txt | \ while read key startVer endVer buildVer extra; do # Exporters # cd mayaPlug echo "mklinux:status: building V-Ray ${buildVer} exporters for Maya ${maya}" ./mkvrayexporter.sh ${buildVer} ${numJobs} ${debugOpt} checkFailure "V-Ray ${buildVer} exporter" # Shaders & plugins # cd ../vrayPlug echo "mklinux:status: Building V-Ray ${buildVer} plugins and shaders for Maya $maya" ./mklinux.sh ${buildVer} >$log 2>&1 checkFailure "V-Ray ${buildVer} plugin and shader" cd .. done # Set up DTS, if needed. if [ "`utils/getg++.sh -dts ${maya}`" = "y" ]; then source /opt/rh/devtoolset-2/enable fi # If we can't find a g++ for the specified version of Maya it means that we # cannot build it on this machine. gpp=`utils/getg++.sh $maya` if [ "$gpp" = "" ]; then echo "mklinux:error: Maya $maya cannot be built on this machine." exit 1 fi echo "mklinuxVersion cleaning up the old crap $debugOpt" cd mayaPlug make -f Makefile.linux Clean ${debugOpt} echo "mklinux:status: building libShave.so for Maya ${maya}" make -f Makefile.linux -j $numJobs libShave.so ${debugOpt} checkFailure "libShave.so" echo "mklinux:status: building shaveNode.so for Maya ${maya}" make -f Makefile.linux -j $numJobs shaveNode.so ${debugOpt} checkFailure "shaveNode.so" echo "mklinux:status: building libShaveAPI.so for Maya ${maya}" make -f Makefile.linux -j $numJobs libShaveAPI.so ${debugOpt} checkFailure "libShaveAPI.so" # Arnold shaders # cd ../arnold echo "mklinux:status: building Arnold plugin and shaders for Maya $maya" ./mklinux.sh ${maya} >$log 2>&1 checkFailure "Arnold plugin and shaders" cd .. # packing all stuff # echo "mklinux:status: creating RPM for Maya $maya" make -f Makefile.linux rpm ${debugOpt} >$log 2>&1 checkFailure "RPM" # Get the Maya version number into a form safe for use in package names. # # 2016.5 --> 2016_5 # 2017 --> 2017_0 # if [ "${maya}" = "${mayaMajorVersion}" ]; then safeMayaVersion=${mayaMajorVersion}_0 else safeMayaVersion=`echo ${maya} | sed 's/\./_/'` fi # Get the full Shave version number # shaveVersion=`grep SHAVE_VERSION libexe/version.h | sed 's/^.*"\([^"]*\)".*$/\1/'` shaveRelease=`grep SHAVE_RELEASE libexe/version.h | sed 's/^.*v\([^"]*\)".*$/\1/'` shaveFullVersion=${shaveVersion}-${shaveRelease} # Move the RPM to the Installers directory. # rpmName=shaveHaircut_Maya${safeMayaVersion}_64-${shaveFullVersion}.x86_64.rpm mkdir -p Installers mv ${rpmName} Installers rm -f $log echo "mklinux:done: RPM for Maya $maya" exit 0