]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- removed duplicate php/zend macros
[packages/rpm-build-macros.git] / rpm.macros
index e5e133650b8da5d918eb6dcf6a5d1995ef340c7c..672bc82df6940f3e674816f4afadb41d076dc4c5 100644 (file)
@@ -2,27 +2,6 @@
 
 # other macros
 %epoch         0
-%_enable_debug_packages 1
-
-%__id          @__ID@
-%__id_u                %{__id} -u 
-%__chown_Rhf           @__CHOWN_RHF@
-%__chgrp_Rhf           @__CHGRP_RHF@
-
-%_fixowner       [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root:@ROOT_GROUP@
-%_fixgroup       true
-%_fixperms       %{__chmod} -Rf @FIXPERMS@
-%_topdir         %(echo $HOME)/rpm
-#-----------------------------------------------------------------
-# CFLAGS and LDFLAGS used to build
-
-%debuginfocflags       %{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1: -ggdb}%{expand:%%undefine __dic_%{?_enable_debug_packages}}
-
-%debugcflags   -O0 -g -Wall
-%rpmcflags     %{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}
-%rpmcxxflags   %{rpmcflags}
-%rpmldflags    %{nil}
-# %rpmldflags  -Wl,--as-needed
 
 # kernel compiler
 %kgcc          gcc
@@ -134,7 +113,10 @@ unset DISPLAY ||:\
 unset LINGUAS ||:\
 %{nil}
 
-%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
+%install \
+%if 0%{?_enable_debug_packages}\
+%{?buildsubdir:%{debug_package}}\
+%endif\
 %%install\
 LANG=C\
 export LANG\
@@ -142,49 +124,6 @@ unset DISPLAY ||:\
 unset LINGUAS ||:\
 %{nil}
 
-# ------------------------------------------------------------------------
-# Conditional build stuff.
-
-# Check if symbol is defined.
-# Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
-%defined()     %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
-%undefined()   %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
-
-# Shorthand for %{defined with_...}
-%with()                %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
-%without()     %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
-
-# Handle conditional builds. %bcond_with is for case when feature is
-# default off and needs to be activated with --with ... command line 
-# switch. %bcond_without is for the dual case.
-#
-# %bcond_with foo defines symbol with_foo if --with foo was specified on
-# command line.
-# %bcond_without foo defines symbol with_foo if --without foo was *not* 
-# specified on command line.
-#
-# For example:
-#
-# %bcond_with extra_fonts
-# %bcond_without static
-# %if %{with extra_fonts}
-# ...
-# %endif
-# %ifdef %{with static}
-# ...
-# %endif
-# %{?with_static: ... }
-# %{!?with_static: ... }
-# %{?with_extra_fonts: ... }
-# %{!?with_extra_fonts: ... }
-# 
-# The bottom line: never use without_foo, _with_foo nor _without_foo, only
-# with_foo. This way changing default set of bconds for given spec is just
-# a matter of changing single line in it and syntax is more readable.
-%bcond_with()          %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
-%bcond_without()       %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
-# ------------------------------------------------------------------------
-
 # Location of autoconf macros
 %_aclocaldir   %(aclocal --print-ac-dir)
 
@@ -298,7 +237,7 @@ unset LINGUAS ||:\
     %{?verbose:set -x;} \
     if [ -d "$RPM_BUILD_ROOT" ]; then \
        echo "Strip executable binaries, archives and shared object files."; \
-       filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
+       filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
        elfexelist=`echo $filelist | xargs -r file | \
                awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
        elfsharedlist=`echo $filelist | xargs -r file | \
@@ -472,26 +411,30 @@ fi \
 
 %php_pear_dir  %{_datadir}/pear
 
-# extract php/zend api versions
-%php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' /usr/include/php/main/php.h)
-%zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' /usr/include/php/Zend/zend_modules.h)
-%zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' /usr/include/php/Zend/zend_extensions.h)
-
 # directory where php includes are installed on system.
 %__php_includedir              /usr/include/php
+# extract php/zend api versions
+%php_major_version             %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR)
 %php_api_version               %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR)
+%php_debug                             %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR)
 %zend_module_api               %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR)
 %zend_extension_api            %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR)
+%zend_zts                              %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR})
 
 # helper macro
-%__php_api_requires() Requires: php(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
+%__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
 
 # macros for public use
 # for php extensions (php-pecl)
-%requires_php_extension %{__php_api_requires modules_api php_api_version}
+%requires_php_extension %{__php_api_requires modules_api php_api_version} \
+%{__php_api_requires -v %php_major_version debug php_debug} \
+%{__php_api_requires -v %php_major_version thread-safety zend_zts}
+
 # for zend extensions
 %requires_zend_extension %{__php_api_requires zend_module_api} \
-%{__php_api_requires zend_extension_api}
+%{__php_api_requires zend_extension_api} \
+%{__php_api_requires -v %php_major_version debug php_debug} \
+%{__php_api_requires -v %php_major_version thread-safety zend_zts}
 
 # Python specific macro definitions.
 # python main version
@@ -795,8 +738,7 @@ if [ -f /var/lock/subsys/%1 ]; then \
        else \
                echo 'Run "/etc/rc.d/init.d/%1 %2" to %2 %{!?3:%1 service}%{?3:%(set -- %{*}; echo "$3")}.'; \
        fi \
-else \
+%{!-q:else} \
        %{!-q:echo 'Run "/etc/rc.d/init.d/%1 start" to start %{!?3:%1 service}%{?3:%(set -- %{*}; echo "$3")}.';} \
-       %{-q::;} \
 fi }; }
 
This page took 0.337809 seconds and 4 git commands to generate.