forked from alexpearce/travis-ci-root-builds
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build
executable file
·114 lines (98 loc) · 2.83 KB
/
build
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
#!/bin/bash
debug=false
tmva=true
while [[ $# > 0 ]]
do
key="$1"
case $key in
--debug)
debug=true
shift
;;
--no-tmva)
tmva=false
shift
;;
*)
echo "unknown option: ${key}"
exit 1
;;
esac
shift
done
set -e
PYTHON_VERSIONS="2.7 3.4"
BUILD=/vagrant/builds
TAGS=/vagrant/tags.lst
ARCH=`uname -m`
GCC_VERSION=`gcc -dumpversion`
NPROC=`nproc`
if [ ! -e builds ]; then
mkdir -p builds
fi
if [ ! -e ${TAGS} ]; then
echo "list the tags, one per line in ${TAGS}"
exit 1
fi
if [ ! -e root ]; then
git clone http://root.cern.ch/git/root.git || exit 1
fi
function build-root {
ROOT=$1
ROOT_NICE_VERSION=${ROOT/v/}
ROOT_NICE_VERSION=${ROOT_NICE_VERSION//-/.}
PYTHON_MAJOR_VERSION=`python -c "from __future__ import print_function; import distutils.sysconfig; print(distutils.sysconfig.get_python_version())"`
BUNDLE=ROOT-${ROOT_NICE_VERSION}_Python-${PYTHON_MAJOR_VERSION}_GCC-${GCC_VERSION}_${ARCH}
options=""
if [ "$tmva" = true ]; then
options+=" --enable-tmva"
else
BUNDLE+="_notmva"
fi
if [ "$debug" = true ]; then
options+=" --build=debug"
BUNDLE+="_debug"
fi
if [ -e ${BUILD}/${BUNDLE}.tar.gz ]; then
echo "${BUILD}/${BUNDLE}.tar.gz already exists"
continue
fi
PYTHON_LIB=`python -c "from __future__ import print_function; import distutils.sysconfig; import os; print(os.path.dirname(distutils.sysconfig.get_python_lib(standard_lib=True)))"`
PYTHON_INCLUDE=`python -c "from __future__ import print_function; import distutils.sysconfig; import os; print(os.path.dirname(distutils.sysconfig.get_python_inc()))"`/python${PYTHON_MAJOR_VERSION}
export LD_LIBRARY_PATH=${PYTHON_LIB}
echo "Python lib: ${PYTHON_LIB}"
echo "Python inc: ${PYTHON_INCLUDE}"
echo "Building $ROOT ..."
cd root
git reset --hard HEAD
git clean -fdx || true
git checkout $ROOT
git apply ../root.patch || true
./configure $options --gminimal --enable-asimage --enable-x11 \
--enable-python --enable-roofit --enable-xml --enable-minuit2 \
--disable-xrootd --fail-on-missing \
--with-python-libdir=${PYTHON_LIB} --with-python-incdir=${PYTHON_INCLUDE} || exit 1
make -j ${NPROC} || exit 1
export ROOTSYS=${BUNDLE}
make DESTDIR=../builds/ install || exit 1
cd ../builds
tar zcvf ${BUNDLE}.tar.gz ${BUNDLE}
cp ${BUNDLE}.tar.gz ${BUILD}
cd ..
}
# build ROOTs
while read ROOT;
do
if [[ $ROOT == \#* ]]; then
continue
fi
for PYTHON in $PYTHON_VERSIONS; do
echo "Setting up Python-${PYTHON}"
# Create a virtualenv and work within it
virtualenv -p /usr/bin/python${PYTHON} .env
. .env/bin/activate
build-root $ROOT
# Deactivate the virtualenv
deactivate
done
done < ${TAGS}