I am creating rpms of various PHP extensions to be manually installed after PHP7, which itself I have built an rpm for (in this case the version is 7.1.4).
In my spec file for a particular extension (in this case gd) I have specified that PHP is a required package. However, when rpmbuild is invoked it does not show this requirement in its output, and furthermore the rpm gd can be installed without PHP7 already being installed. Furthermore when I do this, I don't get any errors thrown out despite gd being told to write to a non-existent php.ini file.
Here is my gd.spec file:
%define ext_name gd
%define ext $RPM_BUILD_ROOT/usr/local/lib/php/extensions/no-debug-zts-20160303
%define sodir modules/%{ext_name}.so
%define head $RPM_BUILD_ROOT/usr/local/include/php/ext
%define phpini /usr/local/lib/php.ini
Name: php-gd
Summary: PHP gd extension
Group: Development/Languages
Version: 7.1.4
Release: 1
Source: php-gd-7.1.4.tar.gz
URL: http://www.php.net/
License: PHP
Packager: PHP Group
BuildRoot: /home/john/rpmbuild/BUILDROOT/php-gd-7.1.4
Requires: php
%description
PHP gd extension.
%prep
%setup -q
%build
phpize
./configure
make
%install
install -m 755 -d %{ext}
install -m 644 %{sodir} %{ext}
install -m 755 -d %{head}/%{ext_name}/libgd
install -m 644 *h %{head}/%{ext_name}
install -m 644 libgd/*h %{head}/%{ext_name}/libgd
%post
echo 'extension=%{ext_name}.so' >> %{phpini}
%postun
sed -i.bak '/extension=%{ext_name}.so/d' %{phpini}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
/usr/local/lib/php/extensions/no-debug-zts-20160303/%{ext_name}.so
/usr/local/include/php/ext
I tried variations for the 'Requires' directive, like specifying certain versions, and even tried a different package altogether, nano, just to see if that worked, but rpmbuild never picks it up.
This is the tail end of the rpmbuild output:
...
Processing files: php-gd-7.1.4-1.x86_64
Provides: php-gd = 7.1.4-1 php-gd(x86-64) = 7.1.4-1
Requires(interp): /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(post): /bin/sh
Requires(postun): /bin/sh
Processing files: php-gd-debuginfo-7.1.4-1.x86_64
Provides: php-gd-debuginfo = 7.1.4-1 php-gd-debuginfo(x86-64) = 7.1.4-1
Requires(rpmlib): rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/john/rpmbuild/BUILDROOT/php-gd-7.1.4-1.x86_64
...
which shows that rpmbuild is clearly doing something with 'Requires.' I also installed an rpm of Apache which was built with a spec file and in that instance the 'Requires' directives were noticed.