aboutsummaryrefslogtreecommitdiff
path: root/mkwinpkg.bat
blob: 329cc582e1a1469c1e73d7573b2105a52343a559 (plain) (blame)
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
echo off
rem  Shave and a Haircut
rem  (c) 2019 Epic Games
rem  US Patent 6720962

rem  Build a Ghost Installer installation package of Shave for the specified
rem  Maya version and release type.

if a%2b==ab (
  echo Usage: mkwinpkg mayaVersion Release/Trial
  goto :eof
)

if /i %2==release (
  set relType=Release
) else if /i %2==trial (
  set relType=Trial
) else if /i %2==debug (
  set relType=Debug
) else (
  echo %2 is not a valid release type. Please specify Debug, Trial or Release.
  goto :eof
)

call utils\splitMayaVersion %1
call utils\getShaveVersion

if not %result%==0 goto :eof

set mayaCompactVersion=%mayaVersionMajor%%mayaVersionMinor%

rem
rem  The file selection logic for the arnold/mtoa files cannot be handled
rem  by the installer script so we do the logic here and copy the required
rem  files to a temp directory.
rem
if exist tempFiles rmdir /s /q tempFiles

mkdir tempFiles
mkdir tempFiles\mtoa
mkdir tempFiles\arnold

for /f "tokens=4" %%i in ('findstr "^%mayaVersion%:" arnold\supportedMtoAVersions.txt') do call :copyArnoldFiles %%i


setlocal

rem  Our shave version number is of the form 9.6v11. When setting the file
rem  version we need a standard Windows 4-part version of the form 9.6.11.0

set shaveStdVersion=%shaveVersion:v=.%.0

if not exist Installers mkdir Installers

"C:\Program Files (x86)\NSIS\makensis" /NOCD /DMayaVersion=%mayaVersion% /DMayaVersionMajor=%mayaVersionMajor% /DMayaVersionMinor=%mayaVersionMinor% /DReleaseType=%relType% /DShaveVersion=%shaveVersion% /DShaveStdVersion=%shaveStdVersion% install\win\shaveHaircut-maya.nsi

rem rmdir /s /q tempFiles

endlocal
goto :eof

rem --------------------------------------------------------------------------

:copyArnoldFiles

if "%1"=="" exit /b

rem  The version numbers are of the form:
rem
rem      mtoaVersion/arnoldVersion
rem
for /f "tokens=1,2 delims=/" %%i in ("%1") do call :copyArnoldFilesForVersion %%i %%j
shift
goto :copyArnoldFiles

exit /b

rem --------------------------------------------------------------------------

:copyArnoldFilesForVersion

setlocal

set MTOA_VERSION=%1
set ARNOLD_VERSION=%2
set srcDir=arnold\Release\%mayaVersion%\%MTOA_VERSION%

rem  MtoA doesn't work well when there are periods in the file name. Let's
rem  convert them to underscores.
rem
set SAFE_MTOA_VERSION=%MTOA_VERSION:.=_%
set SAFE_ARNOLD_VERSION=%ARNOLD_VERSION:.=_%

copy %srcDir%\shave.dll tempFiles\mtoa\shave-%SAFE_MTOA_VERSION%.dll
copy arnold\plugin\shave.py tempFiles\mtoa\shave-%SAFE_MTOA_VERSION%.py

copy %srcDir%\shave_shaders-%SAFE_ARNOLD_VERSION%.dll tempFiles\arnold

endlocal
exit /b