From 06439860ec2c927b59a2a857fe119e33f76d9912 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 14 Aug 2024 15:48:41 +0200 Subject: allow to build using libiodbc instead of unixODBC (--with idobc) --- php-8.2.0-iodbc.patch | 41 +++++++++++++++++++++++++++++++++++++++++ php.spec | 27 +++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 php-8.2.0-iodbc.patch diff --git a/php-8.2.0-iodbc.patch b/php-8.2.0-iodbc.patch new file mode 100644 index 0000000..ba480aa --- /dev/null +++ b/php-8.2.0-iodbc.patch @@ -0,0 +1,41 @@ +From fbdf54c9efefaaa78277bbd951532cd9b6f0a16e Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 14 Aug 2024 14:32:47 +0200 +Subject: [PATCH] fix libodbc detection for headers in sub directory + +--- + ext/pdo_odbc/config.m4 | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/ext/pdo_odbc/config.m4 b/ext/pdo_odbc/config.m4 +index 72b604199bf72..b4478254ee0cb 100644 +--- a/ext/pdo_odbc/config.m4 ++++ b/ext/pdo_odbc/config.m4 +@@ -40,6 +40,7 @@ if test "$PHP_PDO_ODBC" != "no"; then + pdo_odbc_dir= + fi + ++ dnl TODO use PKG_CHECK_MODULES when possible + case $pdo_odbc_flavour in + ibm-db2) + pdo_odbc_def_libdir=/home/db2inst1/sqllib/lib +@@ -51,6 +52,7 @@ if test "$PHP_PDO_ODBC" != "no"; then + pdo_odbc_def_libdir=/usr/local/$PHP_LIBDIR + pdo_odbc_def_incdir=/usr/local/include + pdo_odbc_def_lib=iodbc ++ pdo_odbc_subdir=libiodbc + ;; + + unixODBC|unixodbc) +@@ -85,6 +87,11 @@ if test "$PHP_PDO_ODBC" != "no"; then + PDO_ODBC_LIBDIR="$pdo_odbc_def_libdir" + fi + ++ dnl handle installation in /usr/include/libiodbc ++ if test -n "$pdo_odbc_subdir" -a -d $PDO_ODBC_INCDIR/$pdo_odbc_subdir ; then ++ PDO_ODBC_INCDIR=$PDO_ODBC_INCDIR/$pdo_odbc_subdir ++ fi ++ + AC_MSG_RESULT([$pdo_odbc_flavour + libs $PDO_ODBC_LIBDIR, + headers $PDO_ODBC_INCDIR]) diff --git a/php.spec b/php.spec index 2ee6e8a..7ca691f 100644 --- a/php.spec +++ b/php.spec @@ -118,6 +118,8 @@ %bcond_with tzdata %endif +# build with libiodbc instead of unixODBC +%bcond_with iodbc # httpd 2.4.10 with httpd-filesystem and sethandler support %if 0%{?fedora} >= 21 || 0%{?rhel} >= 8 @@ -138,7 +140,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: %{?scl_prefix}php Version: %{upver}%{?rcver:~%{rcver}}%{?gh_date:.%{gh_date}} -Release: 1%{?dist} +Release: 2%{?dist} # All files licensed under PHP version 3.01, except # Zend is licensed under Zend # TSRM is licensed under BSD @@ -200,6 +202,8 @@ Patch47: php-8.1.0-phpinfo.patch # Always warn about missing curve_name # Both Fedora and RHEL do not support arbitrary EC parameters Patch48: php-8.3.0-openssl-ec-param.patch +# Fix libidobc headers path +Patch49: php-8.2.0-iodbc.patch # RC Patch Patch91: php-7.2.0-oci8conf.patch @@ -596,8 +600,11 @@ License: PHP-3.01 Requires: %{?scl_prefix}php-pdo%{?_isa} = %{version}-%{release} Provides: %{?scl_prefix}php_database Provides: %{?scl_prefix}php-pdo_odbc, %{?scl_prefix}php-pdo_odbc%{?_isa} -# EL-7 version don't have pkgconfig -BuildRequires: unixODBC-devel +%if %{with iodbc} +BuildRequires: pkgconfig(libiodbc) +%else +BuildRequires: pkgconfig(odbc) +%endif %description odbc The %{?scl_prefix}php-odbc package contains a dynamic shared object that will add @@ -607,6 +614,9 @@ data sources (which are often, but not always, databases). PHP is an HTML-embeddable scripting language. If you need ODBC support for PHP applications, you will need to install this package and the php package. +%if %{with iodbc} +Package build using libiodbc (instead of unixODBC). +%endif %package soap Summary: A module for PHP applications that use the SOAP protocol @@ -990,6 +1000,7 @@ sed -e 's/php-devel/%{?scl_prefix}php-devel/' -i scripts/phpize.in %patch -P46 -p1 -b .argon2 %patch -P47 -p1 -b .phpinfo %patch -P48 -p1 -b .ec-param +%patch -P49 -p1 -b .iodbc %patch -P91 -p1 -b .remi-oci8 @@ -1291,7 +1302,13 @@ build --libdir=%{_libdir}/php \ --enable-xmlreader=shared --enable-xmlwriter=shared \ --with-curl=shared \ --enable-pdo=shared \ +%if %{with iodbc} + --with-iodbc=shared,%{_root_prefix} \ + --with-pdo-odbc=shared,iodbc,%{_root_prefix} \ +%else + --with-unixODBC=shared,%{_root_prefix} \ --with-pdo-odbc=shared,unixODBC,%{_root_prefix} \ +%endif --with-pdo-mysql=shared,mysqlnd \ --with-pdo-pgsql=shared,%{_root_prefix} \ --with-pdo-sqlite=shared \ @@ -1316,7 +1333,6 @@ build --libdir=%{_libdir}/php \ --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared \ --enable-shmop=shared \ --enable-posix=shared \ - --with-unixODBC=shared,%{_root_prefix} \ --enable-intl=shared \ %if %{with enchant} --with-enchant=shared \ @@ -1879,6 +1895,9 @@ fi %changelog +* Wed Aug 14 2024 Remi Collet - 8.3.11~RC1-2 +- allow to build using libiodbc instead of unixODBC (--with idobc) + * Wed Aug 14 2024 Remi Collet - 8.3.11~RC1-1 - update to 8.3.11RC1 -- cgit