commit:     a471f99343590c267a67ef6c973b5e3d51938921
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  4 18:18:18 2024 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Tue Jun  4 19:09:11 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a471f993

dev-lang/php: avoid the iodbc patch

The patch _is_ simpler, but with enough hacks, we can convince the build
system to use the right paths without patching.

Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 dev-lang/php/php-8.3.7.ebuild | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/dev-lang/php/php-8.3.7.ebuild b/dev-lang/php/php-8.3.7.ebuild
index 1ccb66ce8a52..8bb61d05fe7b 100644
--- a/dev-lang/php/php-8.3.7.ebuild
+++ b/dev-lang/php/php-8.3.7.ebuild
@@ -144,10 +144,6 @@ BDEPEND="virtual/pkgconfig"
 
 PHP_MV="$(ver_cut 1)"
 
-PATCHES=(
-       "${FILESDIR}/php-iodbc-header-location.patch"
-)
-
 # ARM/Windows functions (bug 923335)
 QA_CONFIG_IMPL_DECL_SKIP=(
        __crc32d
@@ -418,10 +414,22 @@ src_configure() {
 
        # ODBC support
        if use odbc && use iodbc ; then
+               # Obtain the correct -l and -I flags for the actual build from
+               # pkg-config. We use the "generic" library type to avoid the
+               # (wrong) hard-coded include dir for iodbc.
+               #
+               # We set the pdo_odbc_def_incdir variable because the
+               # ./configure script checks for the headers using "test -f" and
+               # ignores your CFLAGS... and pdo_odbc_def_libdir prevents the
+               # build system from appending a nonsense -L flag.
+               local iodbc_ldflags=$(pkg-config --libs libiodbc)
+               local iodbc_cflags=$(pkg-config --cflags libiodbc)
                our_conf+=(
+                       pdo_odbc_def_libdir="${EPREFIX}/usr/$(get_libdir)"
+                       pdo_odbc_def_incdir="${EPREFIX}/usr/include/iodbc"
                        --without-unixODBC
                        --with-iodbc
-                       $(use_with pdo pdo-odbc "iODBC,${EPREFIX}/usr")
+                       $(use_with pdo pdo-odbc 
"generic,,iodbc,${iodbc_ldlags},${iodbc_cflags}")
                )
        elif use odbc ; then
                our_conf+=(

Reply via email to