SPECS (DEVEL): test-php.spec - can't rely on greping sources, unab...

glen glen at pld-linux.org
Fri Sep 16 03:35:19 CEST 2005


Author: glen                         Date: Fri Sep 16 01:35:19 2005 GMT
Module: SPECS                         Tag: DEVEL
---- Log message:
- can't rely on greping sources, unable to make macro expand after source has been unpacked

---- Files affected:
SPECS:
   test-php.spec (1.1.2.4 -> 1.1.2.5) 

---- Diffs:

================================================================
Index: SPECS/test-php.spec
diff -u SPECS/test-php.spec:1.1.2.4 SPECS/test-php.spec:1.1.2.5
--- SPECS/test-php.spec:1.1.2.4	Fri Sep 16 03:20:36 2005
+++ SPECS/test-php.spec	Fri Sep 16 03:35:14 2005
@@ -1,6 +1,10 @@
 # $Revision$, $Date$
 %include	/usr/lib/rpm/macros.php
 
+# must be in sync with source. extra check ensuring that it is so is done in %%build
+%define		php_api_version		20031224
+%define		zend_module_api		20041030
+%define		zend_extension_api	220040412
 
 Summary:	The PHP HTML-embedded scripting language for use with Apache
 Name:		test-php
@@ -12,49 +16,38 @@
 Source0:	http://www.php.net/distributions/php-%{version}.tar.bz2
 # Source0-md5:	b5d4ca75bbb11ee5b830fa67213d9f7f
 #BuildRequires:	rpmbuild(macros) >= 1.238
-
-# redefine to use versions from current source
-%define		__php_includedir %{_builddir}/php-%{version}
-%{expand:%%define __old_php_provides %__php_provides}
-%define		__php_provides	%{_builddir}/php-%{version}/rpm-find-provides
-
-%define	_use_internal_dependency_generator 0
-
-# Note: Used iff _use_internal_dependency_generator is zero.
-#%__find_provides   /usr/lib/rpm/rpmdeps --provides
-#%__find_requires   /usr/lib/rpm/rpmdeps --requires
-%define		__find_provides    %{_builddir}/php-%{version}/rpm-find-provides
-%define		__find_requires %{nil}
-
-# these need to be updated manually when they change
-#define PHP_API_VERSION		20031224
-#define ZEND_MODULE_API		20041030
-#define ZEND_EXTENSION_API	220040412
-
+Provides:	php(modules_api) = %{php_api_version}
+Provides:	php(zend_module_api) = %{zend_module_api}
+Provides:	php(zend_extension_api) = %{zend_extension_api}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define		_sysconfdir	/etc/php
 %define		_phpsharedir	%{_datadir}/php
 %define		extensionsdir	%{_libdir}/php
 
+
 %description
 PHP is an HTML-embedded scripting language. PHP attempts to make it
 
 %prep
 # IMPORTANT: if you change '%setup', you should change %__php_includedir macro earlier in this file
-%setup -q -n php-%{version} -T -c
-
-cat <<'EOF' > ./rpm-find-provides
-#!/bin/sh
-echo "$0: $#: mina" >&2
-FILES="$(cat)"
-echo files: "$FILES" >&2
-echo "$FILES" | %__old_php_provides >&2
-EOF
-
-chmod +x ./rpm-find-provides
+%setup -q -n php-%{version}
 
 %build
+if API=$(awk '/#define PHP_API_VERSION/{print $3}' main/php.h) && [ $API != %{php_api_version} ]; then
+	echo "Set %%define php_api_version to $API and rerun."
+	exit 1
+fi
+
+if API=$(awk '/#define ZEND_MODULE_API_NO/{print $3}' Zend/zend_modules.h) && [ $API != %{zend_module_api} ]; then
+	echo "Set %%define zend_module_api to $API and rerun."
+	exit 1
+fi
+
+if API=$(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' Zend/zend_extensions.h) && [ $API != %{zend_extension_api} ]; then
+	echo "Set %%define zend_module_api to $API and rerun."
+	exit 1
+fi
 
 %install
 install -d $RPM_BUILD_ROOT/foo
@@ -73,6 +66,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.1.2.5  2005/09/16 01:35:14  glen
+- can't rely on greping sources, unable to make macro expand after source has been unpacked
+
 Revision 1.1.2.4  2005/09/16 01:20:36  glen
 - blah
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/test-php.spec?r1=1.1.2.4&r2=1.1.2.5&f=u




More information about the pld-cvs-commit mailing list