This repository has been archived by the owner on Oct 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildscript
executable file
·198 lines (180 loc) · 7.46 KB
/
buildscript
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/bin/bash -ex
##############################################################################
# Script for doing a ParaView source build on Linux/OSX
#
# BUILD_THREADS is set in the Jenkins node configuration
# NODE_LABELS should be set to indicate the OS
#
# It should be invoked as
# - buildscript [<build-dir>]
# where <build-dir> is an optional build directory (default=$HOME/build)
#
# This will create a directory for the PARAVIEW_DIR configuration
# variable like:
#
# OSX: /Users/builder/<build-dir>/ParaView-X.Y.Z
# Linux: /home/builder/<build-dir>/ParaView-X.Y.Z
##############################################################################
#get script directory
SCRIPT_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
# Set the ParaView version to build
PV_VERSION=v5.4.1
PV_VERSION2=${PV_VERSION%.*}
PV_VERSION3=${PV_VERSION/v/}
# Set the source and build directories
if [[ ${NODE_LABELS} == *osx* ]]; then
ON_OSX=true
OSX_VERSION=$(sw_vers -productVersion)
echo "Using OS X version ${OSX_VERSION}"
OSX_MAJOR_VERSION=$(echo $OSX_VERSION | cut -d. -f1)
OSX_MINOR_VERSION=$(echo $OSX_VERSION | cut -d. -f2)
OSX_PATCH_VERSION=$(echo $OSX_VERSION | cut -d. -f3)
export PATH=/usr/local/Cellar/qt@4/4.8.7_5/bin/qmake:$PATH
fi
if [[ ${NODE_LABELS} == *rhel7* ]] || [[ ${NODE_LABELS} == *centos7* ]] || [[ ${NODE_LABELS} == *scilin7* ]]; then
ON_RHEL7=true
fi
SRC_DIR=${HOME}/src
if [ $# -eq "1" ]; then
BUILD_DIR=$1
else
BUILD_DIR=${HOME}/build
fi
# Parse cmake version - we use cmake3 on rhel because cmake is too old
if [ $(command -v cmake3) ]; then
CMAKE_EXE=cmake3
else
CMAKE_EXE=cmake
fi
CMAKE_VERSION=$(${CMAKE_EXE} --version | head -n1 | awk '{print $3}')
echo "Using cmake version ${CMAKE_VERSION}"
CMAKE_MAJOR_VERSION=$(echo $CMAKE_VERSION | cut -d. -f1)
CMAKE_MINOR_VERSION=$(echo $CMAKE_VERSION | cut -d. -f2)
CMAKE_PATCH_VERSION=$(echo $CMAKE_VERSION | cut -d. -f3)
# Setup directories if they don't exist.
[[ -d ${SRC_DIR} ]] || mkdir -p ${SRC_DIR}
[[ -d ${BUILD_DIR} ]] || mkdir -p ${BUILD_DIR}
# Grab source package and unpack
cd ${SRC_DIR}
PARAVIEW_SRC=ParaView-${PV_VERSION}-source
if [[ ! -d ${PARAVIEW_SRC} ]]; then
git clone --branch ${PV_VERSION} https://gitlab.kitware.com/paraview/paraview.git ${PARAVIEW_SRC}
cd ${PARAVIEW_SRC}
else
cd ${PARAVIEW_SRC}
# Update paraview branches && tags
# Tags need to be separate as git < 1.9 fetches only tags with -t
git fetch -p
git fetch -t
# RHEL6 has git 1.7 that doesn't know about submodule recursion
git submodule foreach git fetch -p
git submodule foreach git fetch -t
fi
# Determine the version of JsonCpp we have
JSONCPP_VERSION_H=`find -L /usr/include/ /usr/local/include/ -path "*/json*" -name "version.h"`
if [ -e ${JSONCPP_VERSION_H} ]; then
JSONCPP_VERSION_MAJOR=`cat ${JSONCPP_VERSION_H} | sed -n "s/.*JSONCPP_VERSION_MAJOR[ tab]*\([0-9]\)/\1/p"`
JSONCPP_VERSION_MINOR=`cat ${JSONCPP_VERSION_H} | sed -n "s/.*JSONCPP_VERSION_MINOR[ tab]*\([0-9]\)/\1/p"`
JSONCPP_VERSION_PATCH=`cat ${JSONCPP_VERSION_H} | sed -n "s/.*JSONCPP_VERSION_PATCH[ tab]*\([0-9]\)/\1/p"`
JSONCPP_VERSION_MAJOR=`printf "%03d" ${JSONCPP_VERSION_MAJOR}`
JSONCPP_VERSION_MINOR=`printf "%03d" ${JSONCPP_VERSION_MINOR}`
JSONCPP_VERSION_PATCH=`printf "%03d" ${JSONCPP_VERSION_PATCH}`
JSONCPP_VERSION=${JSONCPP_VERSION_MAJOR}${JSONCPP_VERSION_MINOR}${JSONCPP_VERSION_PATCH}
echo "Found JsonCpp version ${JSONCPP_VERSION} from ${JSONCPP_VERSION_H}"
fi
#remove any changes from previous patches
git reset --hard ${PV_VERSION}
git submodule foreach git reset --hard
git clean -xf
git submodule foreach git clean -xf
git checkout ${PV_VERSION}
git submodule update --init --recursive
git config user.name "Bob T. Builder"
git config user.email "[email protected]"
git apply ${SCRIPT_DIR}/patches/1565.diff
git apply ${SCRIPT_DIR}/patches/1850.diff
git apply ${SCRIPT_DIR}/patches/1866.diff
git apply ${SCRIPT_DIR}/patches/1882.diff
git apply ${SCRIPT_DIR}/patches/remove-vtkguisupportqt-dep.diff
git apply ${SCRIPT_DIR}/patches/pqPythonSyntaxHighlighter-py3.diff
if [ -e ${JSONCPP_VERSION_H} ] && (( ${JSONCPP_VERSION} < 001007004 )); then
git revert --no-edit a99ea990a1bc34f072b50f794778e93595bcda8f
fi
git apply ${SCRIPT_DIR}/patches/2147.diff
cd VTK
git config user.name "Bob T. Builder"
git config user.email "[email protected]"
git apply ${SCRIPT_DIR}/patches/2527.diff
git apply ${SCRIPT_DIR}/patches/2632.diff
git apply ${SCRIPT_DIR}/patches/2693.diff
git apply ${SCRIPT_DIR}/patches/3134.diff
git apply ${SCRIPT_DIR}/patches/cast-around-py3-error.diff
if [[ "$ON_OSX" == true ]]; then
git apply ${SCRIPT_DIR}/patches/homebrew-find-qt4.diff
git apply ${SCRIPT_DIR}/patches/update-netcdf.diff
fi
# Go to build area, setup and run
cd ${BUILD_DIR}
PARAVIEW_BUILD=ParaView-${PV_VERSION3}
###############################################################################
# Check if this is a Python 3 build
###############################################################################
if [[ ${JOB_NAME} == *python3* ]]; then
PY3=true
PARAVIEW_BUILD="${PARAVIEW_BUILD}-python3"
fi
if [[ "$CLEAN" == true ]]; then
echo "Clean build requested. Removing '$PARAVIEW_BUILD'"
rm -rf $PARAVIEW_BUILD
fi
[[ -d ${PARAVIEW_BUILD} ]] || mkdir ${PARAVIEW_BUILD}
cd ${PARAVIEW_BUILD}
COMMON_CACHE_FILE=${SCRIPT_DIR}/common.cmake
OSX_CACHE_FILE=${SCRIPT_DIR}/osx.cmake
if [[ "${PY3}" == true ]]; then
OSX_PYTHON_CACHE_FILE=${SCRIPT_DIR}/osxpython3.cmake
else
OSX_PYTHON_CACHE_FILE=${SCRIPT_DIR}/osxpython.cmake
fi
LINUX_CACHE_FILE=${SCRIPT_DIR}/linux.cmake
PYTHON3_CACHE_FILE=${SCRIPT_DIR}/python3.cmake
[[ -d vtkMDHWSignalArray ]] || mkdir vtkMDHWSignalArray
cp ${SCRIPT_DIR}/vtkMDHWSignalArray/vtkMDHWSignalArray.h vtkMDHWSignalArray
# from the command line use SIGNAL_NAME=vtkArrayDispatch_extra_arrays=vtkMDHWSignalArray\<double\>
SIGNAL_NAME=vtkArrayDispatch_extra_arrays=vtkMDHWSignalArray\\\<double\\\>
SIGNAL_HEADER=vtkArrayDispatch_extra_headers=${BUILD_DIR}/${PARAVIEW_BUILD}/vtkMDHWSignalArray/vtkMDHWSignalArray.h
# wrap cmake call with appropriate devtoolset
if [[ ${NODE_LABELS} == *rhel6* ]]; then
SCL_ON_RHEL="scl enable mantidlibs34 devtoolset-2"
else
SCL_ON_RHEL="eval"
fi
# determine the cmake generator
if [ "$(command -v ninja)" ]; then
CMAKE_GENERATOR="-G Ninja"
elif [ "$(command -v ninja-build)" ]; then
CMAKE_GENERATOR="-G Ninja"
fi
if [ -e $BUILD_DIR/CMakeCache.txt ]; then
CMAKE_GENERATOR=""
fi
# configure
if [[ "$ON_OSX" == true ]]; then
if [[ "$PY3" == true ]]; then
$SCL_ON_RHEL "${CMAKE_EXE} ${CMAKE_GENERATOR} -D${SIGNAL_NAME} -D${SIGNAL_HEADER} -C${COMMON_CACHE_FILE} -C${OSX_CACHE_FILE} -C${OSX_PYTHON_CACHE_FILE} -C${PYTHON3_CACHE_FILE} ${SRC_DIR}/${PARAVIEW_SRC}"
else
if [[ "$OSX_MINOR_VERSION" -gt "10" ]]; then
$SCL_ON_RHEL "${CMAKE_EXE} ${CMAKE_GENERATOR} -D${SIGNAL_NAME} -D${SIGNAL_HEADER} -C${COMMON_CACHE_FILE} -C${OSX_CACHE_FILE} -C${OSX_PYTHON_CACHE_FILE} ${SRC_DIR}/${PARAVIEW_SRC}"
else
$SCL_ON_RHEL "${CMAKE_EXE} ${CMAKE_GENERATOR} -D${SIGNAL_NAME} -D${SIGNAL_HEADER} -C${COMMON_CACHE_FILE} -C${OSX_CACHE_FILE} ${SRC_DIR}/${PARAVIEW_SRC}"
fi
fi
else # on linux
if [[ "${PY3}" == true ]]; then
$SCL_ON_RHEL "${CMAKE_EXE} ${CMAKE_GENERATOR} -D${SIGNAL_NAME} -D${SIGNAL_HEADER} -C${COMMON_CACHE_FILE} -C${LINUX_CACHE_FILE} -C${PYTHON3_CACHE_FILE} ${SRC_DIR}/${PARAVIEW_SRC}"
else
$SCL_ON_RHEL "${CMAKE_EXE} ${CMAKE_GENERATOR} -D${SIGNAL_NAME} -D${SIGNAL_HEADER} -C${COMMON_CACHE_FILE} -C${LINUX_CACHE_FILE} ${SRC_DIR}/${PARAVIEW_SRC}"
fi
fi
# build
${CMAKE_EXE} --build . -- -j ${BUILD_THREADS:?}