Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 7 additions & 85 deletions .build.linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,13 @@ configure_testing_environment() {
}

install_libuv() {(
if [[ "${OS_DISTRO}" = "ubuntu" ]] && [[ "${OS_DISTRO_RELEASE}" > "18.04" ]]; then
true
else
cd packaging
git clone --depth 1 https://github.com/datastax/libuv-packaging.git

(
cd libuv-packaging

# Ensure build directory is cleaned (static nodes are not cleaned)
[[ -d build ]] && rm -rf build
mkdir build

if [ "${OS_DISTRO}" = "ubuntu" ]; then
./build_deb.sh ${LIBUV_VERSION}
else
./build_rpm.sh ${LIBUV_VERSION}
fi
)

[[ -d packages ]] || mkdir packages
find libuv-packaging/build -type f \( -name "*.deb" -o -name "*.rpm" \) -exec mv {} packages \;

if [ "${OS_DISTRO}" = "ubuntu" ]; then
sudo dpkg -i packages/libuv*.deb
else
sudo rpm -U --force packages/libuv*.rpm
fi
fi
git clone https://github.com/libuv/libuv.git
cd libuv
git checkout v${LIBUV_VERSION}
sh autogen.sh
./configure --prefix=${HOME}/libuv-${LIBUV_VERSION}
make
make install
)}

install_openssl() {
Expand All @@ -61,59 +39,3 @@ install_openssl() {
install_zlib() {
true # Already installed on image
}

install_driver() {(
cd packaging

(
# Ensure build directory is cleaned (static nodes are not cleaned)
[[ -d build ]] && rm -rf build
mkdir build

if [ "${OS_DISTRO}" = "ubuntu" ]; then
./build_deb.sh
else
./build_rpm.sh
fi
)

[[ -d packages ]] || mkdir packages
find build -type f \( -name "*.deb" -o -name "*.rpm" \) -exec mv {} packages \;

if [ "${OS_DISTRO}" = "ubuntu" ]; then
sudo dpkg -i packages/*cpp-driver*.deb
else
sudo rpm -i packages/*cpp-driver*.rpm
fi
)}

test_installed_driver() {
local driver=$1

local test_program=$(mktemp)
gcc -x c -o ${test_program} - -Wno-implicit-function-declaration -l${driver} - <<EOF
#include <${driver}.h>

int main(int argc, char* argv[]) {
CassFuture* connect_future = NULL;
CassCluster* cluster = cass_cluster_new();
CassSession* session = cass_session_new();

cass_cluster_set_contact_points(cluster, "127.0.0.1");
connect_future = cass_session_connect(session, cluster);
cass_future_wait(connect_future);
printf("Success");
return 0;
}
EOF

if [ $? -ne 0 ] ; then
echo "Connection test compilation failed. Marking build as failure."
exit 1
fi
if [ "$($test_program)" != "Success" ] ; then
echo "Connection test did not return success. Marking build as failure."
exit 1
fi
}

14 changes: 4 additions & 10 deletions .build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,9 @@ set -e #Fail fast on non-zero exit status

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

if [ "${OS_DISTRO}" = "osx" ]; then
LIB_SUFFIX="dylib"
PROCS=$(sysctl -n hw.logicalcpu)
. ${SCRIPT_DIR}/.build.osx.sh
else
LIB_SUFFIX="so"
PROCS=$(grep -e '^processor' -c /proc/cpuinfo)
. ${SCRIPT_DIR}/.build.linux.sh
fi
LIB_SUFFIX="so"
PROCS=$(grep -e '^processor' -c /proc/cpuinfo)
. ${SCRIPT_DIR}/.build.linux.sh

get_driver_version() {
local header_file=${1}
Expand Down Expand Up @@ -75,7 +69,7 @@ build_driver() {
if [ "${CI_INTEGRATION_ENABLED}" == "true" ]; then
BUILD_INTEGRATION_TESTS=On
fi
cmake -DCMAKE_BUILD_TYPE=Release \
LIBUV_ROOT_DIR=${HOME}/libuv-${LIBUV_VERSION} cmake -DCMAKE_BUILD_TYPE=Release \
-D${driver_prefix}_BUILD_SHARED=On \
-D${driver_prefix}_BUILD_EXAMPLES=On \
-D${driver_prefix}_BUILD_UNIT_TESTS=On \
Expand Down
Loading