#!/bin/sh # Shave and a Haircut # (c) 2019 Epic Games # US Patent 6720962 process() { sed -e "s/%%shaveVersion%%/${shaveVersion}/g" \ -e "s/%%shaveMinor%%/${shaveMinor}/g" \ -e "s/%%shaveMajor%%/${shaveMajor}/g" \ -e "s/%%shaveRelease%%/${release}/g" \ -e "s/%%mayaMinor%%/${mayaMinor}/g" \ -e "s/%%mayaMajor%%/${mayaMajor}/g" \ -e "s/%%mayaVersion%%/${mayaVersion}/g" \ -e "s?%%rayrcLocation%%?${rayrcLocation}?g" \ -e "s?%%mayaShared%%?${mayaShared}?g" \ -e "s?%%mayaLocation%%?${mayaLocation}?g" \ -e "s?%%mtoaLocation%%?${mtoaLocation}?g" \ -e "s?%%vendorDir%%?${vendorDir}?g" \ $1 > $2 } source getosxvars.sh # The web-site and upload scripts are all expecting the package to end in # .pkg.zip not .mpkg.zip so let's oblige them. zipfile=`echo "${pkgName}.zip" | sed 's/\.mpkg\./.pkg./'` if [ -d osxpkg ]; then rm -rf osxpkg fi if [ -d $pkgName ]; then rm -rf $pkgName fi if [ -e $zipfile ]; then rm -rf $zipfile fi vendorDir="/Users/Shared/Epic Games/shaveHaircut/maya${mayaVersion}" binType=x86_64 # # Create directories for the main package. # mkdir -p "${pkgName}/Contents/Packages" mkdir -p "${pkgName}/Contents/Resources" echo "---------------------------------------------" echo ${mayaVersion} #------------------------------------------- # # Files which go into Maya's directories. # #------------------------------------------- # Define variables for all the directories we need, so that we only need to change # them in one place. # MacOSDir="osxpkg/mayaFiles/component/Maya.app/Contents/MacOS" shavePresetsDir="osxpkg/mayaFiles/component/Maya.app/Contents/presets/attrPresets/shaveHair" cgBinDir="osxpkg/mayaFiles/component/Maya.app/Contents/bin/Cg" vrayPluginsDir="osxpkg/mayaFiles/component/vray/vrayplugins" mayaIncludeDir="osxpkg/mayaFiles/component/include/maya" # # Create the directories # mkdir -p ${MacOSDir} mkdir -p ${shavePresetsDir} mkdir -p ${mayaIncludeDir} mkdir -p ${vrayPluginsDir} mkdir -p ${cgBinDir} # Copy the files. # cp mayaPlug/libShave.dylib ${MacOSDir}/libShave.dylib cp mayaPlug/libShaveAPI.dylib ${MacOSDir}/libShaveAPI.dylib cp presets/*.xpm presets/*.png presets/*.mel ${shavePresetsDir} # Maya viewport 2.0 shaders # cp CgFx/shaveHair.cgfx ${cgBinDir}/shaveHair.cgfx # V-Ray shaders # osTag=`vrayPlug/getMayaConfig.sh ${mayaVersion} osTag` supportedVersions=`vrayPlug/getMayaConfig.sh ${mayaVersion} versionTags` for vrayVersion in ${supportedVersions}; do cp vrayPlug/bin/${osTag}/libvray_Shave${vrayVersion}.so ${vrayPluginsDir} done # Shave API headers # cp mayaPlug/shaveAPI.h mayaPlug/shaveItHair.h ${mayaIncludeDir} # Make sure everything's world readable. # chmod -R o+r osxpkg/mayaFiles # # Set up the Packager configuration files. # mkdir -p "osxpkg/mayaFiles/other" mkdir -p "osxpkg/mayaFiles/Resources" process install/osx/Info.plist-mayaFiles osxpkg/mayaFiles/other/Info.plist process install/osx/Description.plist-mayaFiles osxpkg/mayaFiles/other/Description.plist # # Create the component package. # ${pmaker} -build -p ${PWD}/${pkgName}/Contents/Packages/shave_Maya${mayaVersion}-mayaFiles.pkg -f ${PWD}/osxpkg/mayaFiles/component -i ${PWD}/osxpkg/mayaFiles/other/Info.plist -d ${PWD}/osxpkg/mayaFiles/other/Description.plist -r ${PWD}/osxpkg/mayaFiles/Resources #------------------------------------------- # # Files which go into Maya's shared directories # #------------------------------------------- # # Create the directories # mkdir -p "osxpkg/pluginFiles/component/icons" mkdir -p "osxpkg/pluginFiles/component/scripts" mkdir -p "osxpkg/pluginFiles/component/plug-ins/prman/shaders/src" mkdir -p "osxpkg/pluginFiles/component/plug-ins/vray" for rmsDir in prman/plugins/RMS*; do mkdir -p "osxpkg/pluginFiles/component/plug-ins/prman/`basename ${rmsDir}`" done # # Copy the files. # cp mayaPlug/shaveNode.bundle "osxpkg/pluginFiles/component/plug-ins/shaveNode.bundle" cp mayaPlug/libShaveVray*Exporter.so "osxpkg/pluginFiles/component/plug-ins/vray" cp libexe/Shave.slo "osxpkg/pluginFiles/component/plug-ins/prman/shaders/Shave.slo" cp libexe/Shave.sl "osxpkg/pluginFiles/component/plug-ins/prman/shaders/src/Shave.sl" for rmsDir in prman/plugins/RMS*; do cp ${rmsDir}/maya${mayaVersion}/osx/*.so "osxpkg/pluginFiles/component/plug-ins/prman/`basename ${rmsDir}`" done cp scripts/*.mel "osxpkg/pluginFiles/component/scripts" cp libexe/icons/maya/selection/*.xpm "osxpkg/pluginFiles/component/icons" cp libexe/icons/maya/selectUtils/*.xpm "osxpkg/pluginFiles/component/icons" cp libexe/icons/maya/tools/*.xpm "osxpkg/pluginFiles/component/icons" cp libexe/icons/maya/transforms/*.xpm "osxpkg/pluginFiles/component/icons" cp libexe/icons/maya/utils/*.xpm "osxpkg/pluginFiles/component/icons" cp mayaPlug/icons/*.xpm "osxpkg/pluginFiles/component/icons" cp libexe/icons/maya/selection/*.png "osxpkg/pluginFiles/component/icons" cp libexe/icons/maya/selectUtils/*.png "osxpkg/pluginFiles/component/icons" cp libexe/icons/maya/tools/*.png "osxpkg/pluginFiles/component/icons" cp libexe/icons/maya/transforms/*.png "osxpkg/pluginFiles/component/icons" cp libexe/icons/maya/utils/*.png "osxpkg/pluginFiles/component/icons" cp mayaPlug/icons/*.png "osxpkg/pluginFiles/component/icons" # # Make sure everything's world readable since cvs will have removed that. # chmod -R o+r osxpkg/pluginFiles # # Set up the Packager configuration files. # mkdir -p "osxpkg/pluginFiles/other" mkdir -p "osxpkg/pluginFiles/Resources" process install/osx/Info.plist-pluginFiles osxpkg/pluginFiles/other/Info.plist process install/osx/Description.plist-pluginFiles osxpkg/pluginFiles/other/Description.plist process install/osx/postflight-pluginFiles osxpkg/pluginFiles/Resources/postflight chmod +x osxpkg/pluginFiles/Resources/postflight # # Create the component package. # ${pmaker} -build -p ${PWD}/${pkgName}/Contents/Packages/shave_Maya${mayaVersion}-pluginFiles.pkg -f ${PWD}/osxpkg/pluginFiles/component -i ${PWD}/osxpkg/pluginFiles/other/Info.plist -d ${PWD}/osxpkg/pluginFiles/other/Description.plist -r ${PWD}/osxpkg/pluginFiles/Resources #------------------------------------------- # # Files which go into the MtoA directories # #------------------------------------------- # MtoA uses a compact form of the Maya version which drops the period and # also drops the minor number if it is zero. # if [ "${mayaMinor}" = "0" ]; then mtoaLocation="/Applications/solidangle/mtoa/${mayaMajor}" else mtoaLocation="/Applications/solidangle/mtoa/${mayaMajor}${mayaMinor}" fi mtoaExtensionsDir="osxpkg/mtoaFiles/component/extensions" mtoaShadersDir="osxpkg/mtoaFiles/component/shaders" # Create the directories # mkdir -p ${mtoaExtensionsDir} mkdir -p ${mtoaShadersDir} # Copy the files. # grep "^${mayaVersion}:" arnold/supportedMtoAVersions.txt | while read mayaVer minVer maxVer buildVer garbage; do mtoaBuild=${buildVer/\/*/} arnoldBuild=${buildVer/*\//} safeMtoABuild=${mtoaBuild//./_} safeArnoldBuild=${arnoldBuild//./_} cp arnold/Release/${mayaVersion}/${mtoaBuild}/shave.dylib ${mtoaExtensionsDir}/shave-${safeMtoABuild}.dylib cp arnold/plugin/shave.py ${mtoaExtensionsDir}/shave-${safeMtoABuild}.py cp arnold/Release/${mayaVersion}/${mtoaBuild}/shave_shaders-${safeArnoldBuild}.dylib ${mtoaShadersDir} done # Make sure everything's world readable. # chmod -R o+r osxpkg/mtoaFiles # Set up the Packager configuration files. # mkdir -p "osxpkg/mtoaFiles/other" mkdir -p "osxpkg/mtoaFiles/Resources" process install/osx/Info.plist-mtoaFiles osxpkg/mtoaFiles/other/Info.plist process install/osx/Description.plist-mtoaFiles osxpkg/mtoaFiles/other/Description.plist # Create the component package. # ${pmaker} -build -p ${PWD}/${pkgName}/Contents/Packages/shave_Maya${mayaVersion}-mtoaFiles.pkg -f ${PWD}/osxpkg/mtoaFiles/component -i ${PWD}/osxpkg/mtoaFiles/other/Info.plist -d ${PWD}/osxpkg/mtoaFiles/other/Description.plist -r ${PWD}/osxpkg/mtoaFiles/Resources #------------------------------------------- # # Files which go into the vendor directories # #------------------------------------------- # # Create the directories # mkdir -p "osxpkg/sampleFiles/component/samples" # # Copy the files. # cp install/docs/Install.html "osxpkg/sampleFiles/component" cp arnold/supportedMtoAVersions.txt "osxpkg/sampleFiles/component" cp prman/supportedRManVersions.txt "osxpkg/sampleFiles/component" cp vrayPlug/supportedVrayVersions.txt "osxpkg/sampleFiles/component" cp libexe/shaveEngine.h "osxpkg/sampleFiles/component/samples" cp libexe/libShaveEngine-${binType}.dylib "osxpkg/sampleFiles/component/samples/libShaveEngine.dylib" cp libexe/shaveSDKTYPES.h "osxpkg/sampleFiles/component/samples" cp mayaPlug/shaveAPITestApp.cpp "osxpkg/sampleFiles/component/samples" cp mayaPlug/shaveAPITestCmd.cpp "osxpkg/sampleFiles/component/samples" cp mayaPlug/README-samples.osx "osxpkg/sampleFiles/component/samples/README" # # Make sure everything is world readable since cvs will have removed that. # chmod -R o+r osxpkg/sampleFiles # # Set up the Packager configuration files. # mkdir -p "osxpkg/sampleFiles/other" mkdir -p "osxpkg/sampleFiles/Resources" process install/osx/Info.plist-sampleFiles osxpkg/sampleFiles/other/Info.plist process install/osx/Description.plist-sampleFiles osxpkg/sampleFiles/other/Description.plist process install/osx/postflight-sampleFiles osxpkg/sampleFiles/Resources/postflight chmod +x osxpkg/sampleFiles/Resources/postflight # # Create the component package. # ${pmaker} -build -p ${PWD}/${pkgName}/Contents/Packages/shave_Maya${mayaVersion}-sampleFiles.pkg -f ${PWD}/osxpkg/sampleFiles/component -i ${PWD}/osxpkg/sampleFiles/other/Info.plist -d ${PWD}/osxpkg/sampleFiles/other/Description.plist -r ${PWD}/osxpkg/sampleFiles/Resources # # Add the distribution file to the main package. # distFile="distribution${mayaMajor}.dist" if [ -r install/osx/${distFile} ]; then process install/osx/${distFile} ${pkgName}/Contents/${distFile} else echo "Could not find distribution file install/osx/${distFile}" exit 1 fi # # Create a zip file of the main package for uploading. # mkdir -p Installers /usr/bin/zip -ry Installers/${zipfile} ${pkgName} # # Clean up. # rm -rf osxpkg