Topic: php_extdir macro not set

I'm trying to create php-pecl-couchbase for use with rh-php56 SCL.  I started from https://github.com/remicollet/remirepo/ … base2.spec and made a few changes to fix the igbinary dependencies:

--- php-pecl-couchbase2.spec    2017-03-15 11:27:38.665053269 -0700
+++ rh-php56-php-pecl-couchbase2.spec    2017-03-15 14:56:32.502260735 -0700
@@ -7,7 +7,11 @@
 # Please, preserve the changelog entries
 #
 %if 0%{?scl:1}
+%if "%{scl}" == "rh-php56"
+%global sub_prefix more-php56-
+%else
 %global sub_prefix %{scl_prefix}
+%endif
 %scl_package       php-pecl-couchbase2
 %endif
 
@@ -34,18 +38,19 @@
 
 BuildRequires: %{?scl_prefix}php-devel >= 5.4
 BuildRequires: %{?scl_prefix}php-pear
-BuildRequires: %{?scl_prefix}php-pecl-igbinary-devel
+BuildRequires: %{?sub_prefix}php-pecl-igbinary-devel
 BuildRequires: %{?scl_prefix}php-json
 BuildRequires: libcouchbase-devel >= 2.7.2
 BuildRequires: fastlz-devel
 BuildRequires: zlib-devel
+BuildRequires: gcc
 # to ensure compatibility with XDebug
 BuildRequires: %{?scl_prefix}php-pecl-xdebug
 
 Requires:      %{?scl_prefix}php(zend-abi) = %{php_zend_api}
 Requires:      %{?scl_prefix}php(api) = %{php_core_api}
 Requires:      %{?scl_prefix}php-json%{?_isa}
-Requires:      %{?scl_prefix}php-igbinary%{?_isa}
+Requires:      %{?sub_prefix}php-igbinary%{?_isa}
 %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
 
 Provides:      %{?scl_prefix}php-%{pecl_name}               = %{version}
@@ -196,6 +201,7 @@
 
 %check
 : minimal NTS load test
+echo %{php_extdir}
 %{__php} -n \
    -d extension=tokenizer.so \
    -d extension=igbinary.so \

I'm running into an issue where %php_extdir isn't being set:

+ echo '%{php_extdir}'
%{php_extdir}
+ grep couchbase
+ /opt/rh/rh-php56/root/usr/bin/php -n -d extension=tokenizer.so -d extension=igbinary.so -d extension=json.so -d 'extension=/root/rpmbuild/BUILDROOT/more-php56-php-pecl-couchbase2-2.3.0-1.el6.x86_64%{php_extdir}/couchbase.so' -m
PHP Warning:  PHP Startup: Unable to load dynamic library '/root/rpmbuild/BUILDROOT/more-php56-php-pecl-couchbase2-2.3.0-1.el6.x86_64%{php_extdir}/couchbase.so' - /root/rpmbuild/BUILDROOT/more-php56-php-pecl-couchbase2-2.3.0-1.el6.x86_64%{php_extdir}/couchbase.so: cannot open shared object file: No such file or directory in Unknown on line 0
error: Bad exit status from /var/tmp/rpm-tmp.xAbiCo (%check)

I see php_extdir in the rh-php56 macros:

[root@e5b825d61774 SPECS]# grep php_extdir /opt/rh/rh-php56/register.content/etc/rpm/macros.rh-php56-php
%php56_php_extdir   /opt/rh/rh-php56/root/usr/lib64/php/modules

Any ideas what I'm doing wrong?

Re: php_extdir macro not set

I'm building with

rpmbuild -ba php-pecl-couchbase2.spec --define 'scl rh-php56'

Re: php_extdir macro not set

I was missing the rh-php56-build package, works now

Re: php_extdir macro not set

FYI, only the 1st change (sub_prefix) is useful.

And, the more-php56 repostiory I was used to maintain in Copr is now deprecated, and packages for rh-php56 and rh-php70 are now maintained inside the CentOS SCLo SIG.

See https://blog.remirepo.net/post/2017/02/ … -for-RHSCL

BTW, couchbase is not there for now, but is also not in Fedora, so I don't plan to add it until it have been reviewed for Fedora.

Desktop: Fedora 25 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 26 x86_64 + remi (SCL only)
Hosting Server: CentOS 6.9 x86_64 + EPEL + remi + remi-php70