%php_name php%{?php_suffix}
# use rpmbuild -D 'php_suffix 54' to build php extension for php 5.4
# NOTE: error output must be empty. otherwise can't build pecl packages if no php*-devel is installed
-%php_suffix %(c=$(php-config --sysconfdir 2>/dev/null) || echo '' && echo ${c#/etc/php})
+%php_suffix %{expand:%%global php_suffix %(c=$(php-config --sysconfdir 2>/dev/null) || echo '' && echo ${c#/etc/php})%%{nil}}%php_suffix
+
+# php cli. version that php headers are installed for
+%__php /usr/bin/%{php_name}
# helper macro
%__php_api_requires(v:) Requires: %{php_name}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
f = io.open("%{_docdir}/%{name}-%{version}/optional-packages.txt", "r") \
if f then \
for l in f:lines() do print(l); end \
+ f.close() \
end \
%{nil}
for _, l in pairs(t) do\
s=s..l.."\\n"\
end\
-io.open("/etc/shells", "w"):write(s)\
+f = io.open("/etc/shells", "w")\
+if f then\
+ write(s)\
+ f:close()\
+end\
%{nil}
# Backwards compat. Use of %lua_ prefixed macros is preferred as these are cleaner to read.