2121set -e # Fail fast on non-zero exit status
2222
2323WORKER_INFORMATION=($( echo ${OS_VERSION} | tr " /" " " ) )
24- DISTRO =${WORKER_INFORMATION[0]}
24+ OS_NAME =${WORKER_INFORMATION[0]}
2525RELEASE=${WORKER_INFORMATION[1]}
2626SHA=$( echo ${GIT_COMMIT} | cut -c1-7)
27- PROCS=$( grep -e ' ^processor' -c /proc/cpuinfo)
27+
28+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null && pwd ) "
29+ if [ " ${OS_NAME} " = " osx" ]; then
30+ PROCS=$( sysctl -n hw.logicalcpu)
31+ . ${SCRIPT_DIR} /.build.osx.sh
32+ else
33+ PROCS=$( grep -e ' ^processor' -c /proc/cpuinfo)
34+ . ${SCRIPT_DIR} /.build.linux.sh
35+ fi
2836
2937get_driver_version () {
3038 local header_file=$1
@@ -50,106 +58,25 @@ get_driver_version() {
5058 echo " ${driver_version} "
5159}
5260
53- configure_environment () {
54- if ! grep -lq " 127.254.254.254" /etc/hosts; then
55- printf " \n\n%s\n" " 127.254.254.254 cpp-driver.hostname." | sudo tee -a /etc/hosts
56- fi
57- sudo cat /etc/hosts
58- }
59-
60- install_libuv () {
61- (
62- cd packaging
63- git clone --depth 1 https://github.com/datastax/libuv-packaging.git
64-
65- (
66- cd libuv-packaging
67- if [ " ${DISTRO} " = " ubuntu" ]; then
68- ./build_deb.sh ${LIBUV_VERSION}
69- else
70- ./build_rpm.sh ${LIBUV_VERSION}
71- fi
72- )
73-
74- [[ -d packages ]] || mkdir packages
75- find libuv-packaging/build -type f \( -name " *.deb" -o -name " *.rpm" \) -exec mv {} packages \;
76-
77- if [ " ${DISTRO} " = " ubuntu" ]; then
78- sudo dpkg -i packages/libuv* .deb
79- else
80- sudo rpm -i packages/libuv* .rpm
81- fi
82- )
83- }
84-
8561install_dependencies () {
8662 install_libuv
63+ install_openssl
8764}
8865
8966build_driver () {
9067 local driver_prefix=$1
9168
69+ # Ensure build directory is cleaned (static nodes are not cleaned)
70+ [[ -d build ]] && rm -rf build
71+ mkdir build
72+
9273 (
93- [[ -d build ]] || mkdir build
9474 cd build
9575 cmake -DCMAKE_BUILD_TYPE=Release -D${driver_prefix} _BUILD_SHARED=On -D${driver_prefix} _BUILD_STATIC=On -D${driver_prefix} _BUILD_EXAMPLES=On -D${driver_prefix} _BUILD_UNIT_TESTS=On ..
9676 make -j${PROCS}
9777 )
9878}
9979
100- install_driver () {
101- (
102- cd packaging
103-
104- (
105- if [ " ${DISTRO} " = " ubuntu" ]; then
106- ./build_deb.sh
107- else
108- ./build_rpm.sh
109- fi
110- )
111-
112- [[ -d packages ]] || mkdir packages
113- find build -type f \( -name " *.deb" -o -name " *.rpm" \) -exec mv {} packages \;
114-
115- if [ " ${DISTRO} " = " ubuntu" ]; then
116- sudo dpkg -i packages/* cpp-driver* .deb
117- else
118- sudo rpm -i packages/* cpp-driver* .rpm
119- fi
120- )
121- }
122-
123- test_installed_driver () {
124- local driver=$1
125-
126- local test_program=$( mktemp)
127- gcc -x c -o ${test_program} - -Wno-implicit-function-declaration -l${driver} - << EOF
128- #include <${driver} .h>
129-
130- int main(int argc, char* argv[]) {
131- CassFuture* connect_future = NULL;
132- CassCluster* cluster = cass_cluster_new();
133- CassSession* session = cass_session_new();
134-
135- cass_cluster_set_contact_points(cluster, "127.0.0.1");
136- connect_future = cass_session_connect(session, cluster);
137- cass_future_wait(connect_future);
138- printf("Success");
139- return 0;
140- }
141- EOF
142-
143- if [ $? -ne 0 ] ; then
144- echo " Connection test compilation failed. Marking build as failure."
145- exit 1
146- fi
147- if [ " $( $test_program ) " != " Success" ] ; then
148- echo " Connection test did not return success. Marking build as failure."
149- exit 1
150- fi
151- }
152-
15380check_driver_exports () {(
15481 set +e # Disable fail fast for this subshell
15582 local driver_library=$1
0 commit comments