From 164f80c423605d3e00f1581b05616964e3bec45d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 14 Aug 2024 15:56:31 +0200 Subject: allow to build using libiodbc instead of unixODBC (--with iodbc) --- php-8.2.0-iodbc.patch | 41 +++++++++++++++++++++++++++++++++++++++++ php83.spec | 39 ++++++++++++++++++++++++++++++++------- 2 files changed, 73 insertions(+), 7 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/php83.spec b/php83.spec index 99c9285..0534362 100644 --- a/php83.spec +++ b/php83.spec @@ -94,6 +94,9 @@ %bcond_with tzdata %endif +# /usr/sbin/a# build with libiodbc instead of unixODBC +%bcond_with iodbc + # /usr/sbin/apsx with httpd < 2.4 and defined as /usr/bin/apxs with httpd >= 2.4 %{!?_httpd_apxs: %{expand: %%global _httpd_apxs %%{_sbindir}/apxs}} %{!?_httpd_mmn: %{expand: %%global _httpd_mmn %%(cat %{_includedir}/httpd/.mmn 2>/dev/null || echo 0-0)}} @@ -129,7 +132,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: php Version: %{upver}%{?rcver:~%{rcver}} -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 @@ -189,6 +192,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 @@ -702,8 +707,11 @@ License: PHP-3.01 Requires: php-pdo%{?_isa} = %{version}-%{release} Provides: php_database Provides: php-pdo_odbc, 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 %if 0%{?rhel} == 7 Obsoletes: php53-odbc, php53u-odbc, php54-odbc, php54w-odbc, php55u-odbc, php55w-odbc, php56u-odbc, php56w-odbc Obsoletes: php70u-odbc, php70w-odbc, php71u-odbc, php71w-odbc, php72u-odbc, php72w-odbc @@ -720,6 +728,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 @@ -1213,6 +1224,7 @@ in pure PHP. %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 @@ -1489,7 +1501,7 @@ build --libdir=%{_libdir}/php \ --with-tcadb=%{_prefix} \ --with-lmdb=%{_prefix} \ %if %{with qdbm} - --with-qdbm=%{_root_prefix} \ + --with-qdbm=%{_prefix} \ %endif --enable-exif=shared \ --enable-ftp=shared \ @@ -1517,7 +1529,13 @@ build --libdir=%{_libdir}/php \ --enable-xmlreader=shared --enable-xmlwriter=shared \ --with-curl=shared \ --enable-pdo=shared \ +%if %{with iodbc} + --with-iodbc=shared,%{_prefix} \ + --with-pdo-odbc=shared,iodbc,%{_prefix} \ +%else + --with-unixODBC=shared,%{_prefix} \ --with-pdo-odbc=shared,unixODBC,%{_prefix} \ +%endif --with-pdo-mysql=shared,mysqlnd \ --with-pdo-pgsql=shared,%{_prefix} \ --with-pdo-sqlite=shared \ @@ -1534,7 +1552,6 @@ build --libdir=%{_libdir}/php \ --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared \ --enable-shmop=shared \ --enable-posix=shared \ - --with-unixODBC=shared,%{_prefix} \ --enable-fileinfo=shared \ --with-ffi=shared \ --with-sodium=shared \ @@ -1627,7 +1644,7 @@ build --includedir=%{_includedir}/php-zts \ --with-tcadb=%{_prefix} \ --with-lmdb=%{_prefix} \ %if %{with qdbm} - --with-qdbm=%{_root_prefix} \ + --with-qdbm=%{_prefix} \ %endif --with-gettext=shared \ --with-iconv=shared \ @@ -1656,7 +1673,13 @@ build --includedir=%{_includedir}/php-zts \ --enable-xmlreader=shared --enable-xmlwriter=shared \ --with-curl=shared \ --enable-pdo=shared \ +%if %{with iodbc} + --with-iodbc=shared,%{_prefix} \ + --with-pdo-odbc=shared,iodbc,%{_prefix} \ +%else + --with-unixODBC=shared,%{_prefix} \ --with-pdo-odbc=shared,unixODBC,%{_prefix} \ +%endif --with-pdo-mysql=shared,mysqlnd \ --with-pdo-pgsql=shared,%{_prefix} \ --with-pdo-sqlite=shared \ @@ -1673,7 +1696,6 @@ build --includedir=%{_includedir}/php-zts \ --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared \ --enable-shmop=shared \ --enable-posix=shared \ - --with-unixODBC=shared,%{_prefix} \ --enable-fileinfo=shared \ --with-ffi=shared \ --with-sodium=shared \ @@ -2217,6 +2239,9 @@ fi %changelog +* Wed Aug 14 2024 Remi Collet - 8.3.11~RC1-2 +- allow to build using libiodbc instead of unixODBC (--with iodbc) + * Wed Aug 14 2024 Remi Collet - 8.3.11~RC1-1 - update to 8.3.11RC1 -- cgit