aboutsummaryrefslogtreecommitdiff
path: root/mklinuxVersion
blob: 5b0046f0f225ba2c7204e5d214104cc913c73391 (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
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
#!/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