From 68a7ed1e4fbc8d148295fc42a61624a69afc44bd Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 15 Jan 2020 10:36:16 +0100 Subject: fix for cassandra-cpp-driver 2.15.0 with new headers location from https://github.com/datastax/php-driver/pull/141 --- 141.patch | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-cassandra.spec | 16 ++++++-- 2 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 141.patch diff --git a/141.patch b/141.patch new file mode 100644 index 0000000..e2aee7d --- /dev/null +++ b/141.patch @@ -0,0 +1,97 @@ +From f850bea77c036e59a220a976ce3564fb2dd08a1e Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 15 Jan 2020 10:17:42 +0100 +Subject: [PATCH] use pkg-config and allow build when cpp-driver use + CASS_INSTALL_HEADER_IN_SUBDIR + +--- + ext/config.m4 | 60 ++++++++++++++++++++++++++++++++++----------------- + 1 file changed, 40 insertions(+), 20 deletions(-) + +diff --git a/ext/config.m4 b/ext/config.m4 +index d479d904..3c9abdc5 100644 +--- a/ext/config.m4 ++++ b/ext/config.m4 +@@ -267,31 +267,51 @@ if test "$PHP_CASSANDRA" != "no"; then + PHP_ADD_LIBRARY(uv,, CASSANDRA_SHARED_LIBADD) + PHP_ADD_LIBRARY(m,, CASSANDRA_SHARED_LIBADD) + +- if test "$PHP_CASSANDRA" != "yes"; then +- if test -f $PHP_CASSANDRA/include/cassandra.h; then +- CPP_DRIVER_DIR=$PHP_CASSANDRA ++ AC_PATH_PROG(PKG_CONFIG, pkg-config, no) ++ ++ AC_MSG_CHECKING([for supported DataStax C/C++ driver version]) ++ if test "$PHP_CASSANDRA" = "yes" -a -x $PKG_CONFIG; then ++ CPP_DRIVER_VERSION=`$PKG_CONFIG cassandra --modversion` ++ if $PKG_CONFIG cassandra --atleast-version 2.7.0; then ++ CPP_DRIVER_INCDIR=`$PKG_CONFIG cassandra --variable=includedir` ++ CPP_DRIVER_LIBDIR=`$PKG_CONFIG cassandra --variable=libdir` ++ AC_MSG_RESULT([supported ($CPP_DRIVER_VERSION from pkg-config)]) ++ else ++ AC_MSG_ERROR([not supported. Driver version 2.7.0+ required (found $CPP_DRIVER_VERSION)]) + fi ++ + else +- for i in /usr/local /usr; do +- if test -f $i/include/cassandra.h; then +- CPP_DRIVER_DIR=$i ++ if test "$PHP_CASSANDRA" != "yes"; then ++ if test -f $PHP_CASSANDRA/include/cassandra.h; then ++ CPP_DRIVER_INCDIR=$PHP_CASSANDRA/include ++ CPP_DRIVER_LIBDIR=$PHP_CASSANDRA/$PHP_LIBDIR + fi +- done +- fi ++ if test -f $PHP_CASSANDRA/include/cassandra/cassandra.h; then ++ CPP_DRIVER_INCDIR=$PHP_CASSANDRA/include/cassandra ++ CPP_DRIVER_LIBDIR=$PHP_CASSANDRA/$PHP_LIBDIR ++ fi ++ else ++ for i in /usr/local /usr; do ++ if test -f $i/include/cassandra.h; then ++ CPP_DRIVER_INCDIR=$i/include ++ CPP_DRIVER_LIBDIR=$i/$PHP_LIBDIR ++ fi ++ done ++ fi + +- AC_MSG_CHECKING([for supported DataStax C/C++ driver version]) +- PHP_CASSANDRA_FOUND_CASSANDRA_VERSION=`$AWK '/CASS_VERSION_MAJOR/ {printf $3"."} /CASS_VERSION_MINOR/ {printf $3"."} /CASS_VERSION_PATCH/ {printf $3}' $CPP_DRIVER_DIR/include/cassandra.h` +- PHP_CASSANDRA_FOUND_CASSANDRA_VERSION_NUMBER=`echo "${PHP_CASSANDRA_FOUND_CASSANDRA_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'` +- if test "$PHP_CASSANDRA_FOUND_CASSANDRA_VERSION_NUMBER" -lt "20700"; then +- AC_MSG_ERROR([not supported. Driver version 2.7.0+ required (found $PHP_CASSANDRA_FOUND_CASSANDRA_VERSION)]) +- else +- AC_MSG_RESULT([supported ($PHP_CASSANDRA_FOUND_CASSANDRA_VERSION)]) ++ PHP_CASSANDRA_FOUND_CASSANDRA_VERSION=`$AWK '/CASS_VERSION_MAJOR/ {printf $3"."} /CASS_VERSION_MINOR/ {printf $3"."} /CASS_VERSION_PATCH/ {printf $3}' $CPP_DRIVER_INCDIR/cassandra.h` ++ PHP_CASSANDRA_FOUND_CASSANDRA_VERSION_NUMBER=`echo "${PHP_CASSANDRA_FOUND_CASSANDRA_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'` ++ if test "$PHP_CASSANDRA_FOUND_CASSANDRA_VERSION_NUMBER" -lt "20700"; then ++ AC_MSG_ERROR([not supported. Driver version 2.7.0+ required (found $PHP_CASSANDRA_FOUND_CASSANDRA_VERSION)]) ++ else ++ AC_MSG_RESULT([supported ($PHP_CASSANDRA_FOUND_CASSANDRA_VERSION)]) ++ fi + fi + +- if test -z "$CPP_DRIVER_DIR"; then ++ if test -z "$CPP_DRIVER_LIBDIR"; then + ac_extra= + else +- ac_extra=-L$CPP_DRIVER_DIR/$PHP_LIBDIR ++ ac_extra=-L$CPP_DRIVER_LIBDIR/$PHP_LIBDIR + fi + + PHP_CHECK_LIBRARY(cassandra, cass_cluster_new, +@@ -306,9 +326,9 @@ if test "$PHP_CASSANDRA" != "no"; then + ] + ) + +- if test -n "$CPP_DRIVER_DIR"; then +- PHP_ADD_LIBPATH($CPP_DRIVER_DIR/$PHP_LIBDIR, CASSANDRA_SHARED_LIBADD) +- PHP_ADD_INCLUDE($CPP_DRIVER_DIR/include) ++ if test -n "$CPP_DRIVER_INCDIR"; then ++ PHP_ADD_LIBPATH($CPP_DRIVER_LIBDIR, CASSANDRA_SHARED_LIBADD) ++ PHP_ADD_INCLUDE($CPP_DRIVER_INCDIR) + fi + + PHP_ADD_LIBRARY(cassandra,, CASSANDRA_SHARED_LIBADD) + diff --git a/php-pecl-cassandra.spec b/php-pecl-cassandra.spec index f71c80e..84fdabe 100644 --- a/php-pecl-cassandra.spec +++ b/php-pecl-cassandra.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-pecl-cassandra # -# Copyright (c) 2015-2019 Remi Collet +# Copyright (c) 2015-2020 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -32,20 +32,21 @@ Summary: DataStax PHP Driver for Apache Cassandra Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 1.3.2 -Release: 8%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 9%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: ASL 2.0 -URL: http://pecl.php.net/package/%{pecl_name} +URL: https://pecl.php.net/package/%{pecl_name} # Pull sources from github to get tests %if 0%{?gh_commit:1} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}.tar.gz %else -Source: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz +Source: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz %endif Patch0: https://patch-diff.githubusercontent.com/raw/datastax/php-driver/pull/126.patch Patch1: https://patch-diff.githubusercontent.com/raw/datastax/php-driver/pull/132.patch Patch2: https://patch-diff.githubusercontent.com/raw/datastax/php-driver/pull/135.patch +Patch3: https://patch-diff.githubusercontent.com/raw/datastax/php-driver/pull/141.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 5.6 @@ -127,6 +128,7 @@ cd NTS %patch0 -p2 -b .pr126 %patch1 -p2 -b .pr132 %patch2 -p2 -b .pr135 +%patch3 -p2 -b .pr141 # Sanity check, really often broken extver=$(sed -n '/#define PHP_DRIVER_VERSION /{s/.* "//;s/".*$//;p}' version.h) @@ -153,6 +155,8 @@ cp -pr NTS ZTS %build %{?dtsenable} +export PHP_RPATH=no + cd NTS %{_bindir}/phpize %configure \ @@ -261,6 +265,10 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Wed Jan 15 2020 Remi Collet - 1.3.2-9 +- fix for cassandra-cpp-driver 2.15.0 with new headers location + from https://github.com/datastax/php-driver/pull/141 + * Tue Sep 03 2019 Remi Collet - 1.3.2-8 - rebuild for 7.4.0RC1 -- cgit