From 3e5569717328c373ec3e32350a24384923d0f715 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 11 Jan 2024 07:53:06 +0100 Subject: [PATCH 1/6] fix libcurl handling --- config.m4 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config.m4 b/config.m4 index dbaa3fd1..38286574 100644 --- a/config.m4 +++ b/config.m4 @@ -34,12 +34,11 @@ if test "$PHP_SOLR" != "no"; then ],[ AC_MSG_ERROR(There is something wrong. Please check config.log for more information.) ],[ - $CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR + $CURL_LIBS ]) - PHP_ADD_INCLUDE($CURL_DIR/include) + PHP_EVAL_INCLINE($CURL_CFLAGS) PHP_EVAL_LIBLINE($CURL_LIBS, SOLR_SHARED_LIBADD) - PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/lib, SOLR_SHARED_LIBADD) if test "$PHP_LIBXML" = "no"; then AC_MSG_ERROR([Solr extension requires LIBXML extension, add --enable-libxml]) From de05de343f23cf2fc0a0d6584d7afeecc33ef3b1 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 11 Jan 2024 10:42:00 +0100 Subject: [PATCH 2/6] use pkg-config instead of PKG_CHECK_MODULES --- config.m4 | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/config.m4 b/config.m4 index 38286574..08c564e0 100644 --- a/config.m4 +++ b/config.m4 @@ -1,11 +1,5 @@ dnl config.m4 for the solr extension -dnl Configuring the CURL external library -dnl This folder is the grand-parent folder of easy.h -PHP_ARG_WITH(curl, for cURL support, [ --with-curl[=DIR] SOLR : libcurl install prefix]) - -PKG_CHECK_MODULES([CURL], [libcurl >= 7.15.0]) - PHP_ARG_ENABLE(solr, whether to enable the Solr extension, [ --enable-solr Enable solr support]) @@ -24,8 +18,20 @@ PHP_ARG_ENABLE(coverage, whether to enable code coverage, dnl Setting up the apache Solr extension if test "$PHP_SOLR" != "no"; then - if test "$PHP_CURL" = "no"; then - AC_MSG_ERROR([Solr extension requires curl extension, add --with-curl]) + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + + AC_MSG_CHECKING(for libcurl) + if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libcurl; then + if $PKG_CONFIG libcurl --atleast-version 7.15.5; then + CURL_CFLAGS=`$PKG_CONFIG libcurl --cflags` + CURL_LIBS=`$PKG_CONFIG libcurl --libs` + CURL_VERSON=`$PKG_CONFIG libcurl --modversion` + AC_MSG_RESULT(from pkgconfig: version $CURL_VERSON found) + else + AC_MSG_ERROR(system libcurl must be upgraded to version >= 7.15.5) + fi + else + AC_MSG_ERROR(pkg-config or libcurl not found) fi PHP_CHECK_LIBRARY(curl,curl_easy_perform, From c2396e3a0beeafc0c6cb77a290c944e70e9fd1ae Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 11 Jan 2024 12:36:50 +0100 Subject: [PATCH 3/6] update installation instructions --- README.INSTALLATION | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.INSTALLATION b/README.INSTALLATION index 1a14eee1..6063ec55 100644 --- a/README.INSTALLATION +++ b/README.INSTALLATION @@ -2,7 +2,7 @@ PHP VERSION Dependencies ================================================================================ -PHP version 5.3 or later is needed +PHP version 7.0 or later is needed ================================================================================ Extension Dependencies @@ -16,10 +16,10 @@ Library Dependencies libxml2 2.6.26 or later is required -libcurl 7.15.0 or later is required +libcurl 7.15.5 or later is required ================================================================================ -On UNIX +On Linux/UNIX ================================================================================ As mentioned before, the libxml and curl extensions must be enabled for the Apache Solr extension to be functional. @@ -30,7 +30,7 @@ To install the Apache Solr extension directly from PECL, please enter the follow pecl install solr -To compile from source, please follow the following steps +4A. To compile from source, please follow the following steps $ phpize @@ -46,9 +46,7 @@ extension=solr.so Then restart your webserver. For CLI only, you do not have to restart your webserver. -Note : - -If your system does not have the minimum version of the libcurl or libxml libraries, you can download the libraries +4B. If your system does not have the minimum version of the libcurl or libxml libraries, you can download the libraries and compile them from source into a separate install prefix. @@ -94,7 +92,8 @@ Then you can pass libcurl prefix to the configure script for CURL and LIBXML res during the configuration phase as shown here : -4B ./configure --enable-solr --with-curl=/root/custom/software --with-libxml-dir=/root/custom/software +export PKG_CONFIG_PATH=/root/custom/software +./configure --enable-solr --with-libxml-dir=/root/custom/software If you already have the latest versions of the libraries then the step listed in 4A alone is sufficient. From 844decf83f47117d668b0fa367fe9bdd5405f409 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 11 Jan 2024 14:10:11 +0100 Subject: [PATCH 4/6] drop --with-libxml-dir --- README.INSTALLATION | 3 ++- config.m4 | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.INSTALLATION b/README.INSTALLATION index 6063ec55..d9330fad 100644 --- a/README.INSTALLATION +++ b/README.INSTALLATION @@ -93,7 +93,8 @@ Then you can pass libcurl prefix to the configure script for CURL and LIBXML res during the configuration phase as shown here : export PKG_CONFIG_PATH=/root/custom/software -./configure --enable-solr --with-libxml-dir=/root/custom/software +export PATH=$PATH:/root/custom/software/bin +./configure --enable-solr If you already have the latest versions of the libraries then the step listed in 4A alone is sufficient. diff --git a/config.m4 b/config.m4 index 08c564e0..11c7a193 100644 --- a/config.m4 +++ b/config.m4 @@ -6,12 +6,6 @@ PHP_ARG_ENABLE(solr, whether to enable the Solr extension, PHP_ARG_ENABLE(solr-debug, whether to compile with solr in verbose mode, [ --enable-solr-debug Compile with solr in verbose mode], no, no) -dnl Configuring the LibXML external Library -if test -z "$PHP_LIBXML_DIR"; then - PHP_ARG_WITH(libxml-dir, libxml2 install dir, - [ --with-libxml-dir=[DIR] SOLR : libxml2 install prefix], no, no) -fi - PHP_ARG_ENABLE(coverage, whether to enable code coverage, [ --enable-coverage Enable developer code coverage information],, no) @@ -58,6 +52,8 @@ if test "$PHP_SOLR" != "no"; then AC_MSG_ERROR([Solr extension requires json or jsonc support]) fi + dnl until PHP 7.3: xml2-config or pkg-config + dnl since PHP 7.4: pkg-config only PHP_SETUP_LIBXML(SOLR_SHARED_LIBADD, [ AC_DEFINE(HAVE_SOLR, 1,[Setting the value of HAVE_SOLR to 1 ]) From 2938df5da088640784c04488741fc553e98a7144 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 11 Jan 2024 14:11:30 +0100 Subject: [PATCH 5/6] cleanup package options --- package.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package.xml b/package.xml index d0065316..ccc3a097 100644 --- a/package.xml +++ b/package.xml @@ -428,10 +428,6 @@ https://github.com/php/pecl-search_engine-solr - - From 75380ea9ca658a4cf40345434ae0d7b062f9cb21 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 11 Jan 2024 14:16:37 +0100 Subject: [PATCH 6/6] fix path in README --- README.INSTALLATION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.INSTALLATION b/README.INSTALLATION index d9330fad..ac9c2daf 100644 --- a/README.INSTALLATION +++ b/README.INSTALLATION @@ -92,7 +92,7 @@ Then you can pass libcurl prefix to the configure script for CURL and LIBXML res during the configuration phase as shown here : -export PKG_CONFIG_PATH=/root/custom/software +export PKG_CONFIG_PATH=/root/custom/software/lib/pkgconfig export PATH=$PATH:/root/custom/software/bin ./configure --enable-solr