[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

pear.mk in dh-make-php



Well, it looks like the CDBS guys aren't going to include pear.mk (or
any other CDBS patches) for the time being, because they are working
hard to get CDBS version 2 released. Looking around a bit more, I
noticed that there are other packages which themselves ship files for
/usr/share/cdbs/1/class, and I recommend that dh-make-php do the same.

I have attached a patch which takes an initial step at integrating
pear.mk into dh-make-php. Basically, the file pear.mk is installed in
/usr/share/cdbs/1/class by dh-make-php, and the debian/rules of created
packages then include it. This has the distinct advantage of allowing us
to maintain a single, central copy of pear.mk that we can update to keep
inline with current policy and best practices.

For examples of packages that use the most recent version of pear.mk,
see php-cache-lite and php-pager. The current recommendation would
simply be to get pear.mk out of every package that wants to use it and
into dh-make-php.

If I can be of further assistance perfecting the integration of pear.mk
into dh-make-php, please don't hesitate to ask.

cheers,
Charles

-- 
These signs
Are not
For laughs alone
The face they save
May be your own
Burma-Shave
http://burma-shave.org/jingles/1953/these_signs
diff -Nur dh-make-php-0.0.13/debian/changelog dh-make-php-0.14/debian/changelog
--- dh-make-php-0.0.13/debian/changelog	2006-02-28 09:41:25.789124000 -0500
+++ dh-make-php-0.14/debian/changelog	2006-02-28 09:53:22.735433513 -0500
@@ -1,3 +1,9 @@
+dh-make-php (0.14) unstable; urgency=low
+
+  * Includes cdbs pear.mk
+
+ -- Charles Fry <debian@frogcircus.org>  Tue, 28 Feb 2006 09:52:42 -0500
+
 dh-make-php (0.0.13-1) unstable; urgency=low
 
   * New upstream release
diff -Nur dh-make-php-0.0.13/debian/control dh-make-php-0.14/debian/control
--- dh-make-php-0.0.13/debian/control	2006-02-28 09:41:25.790124000 -0500
+++ dh-make-php-0.14/debian/control	2006-02-28 09:51:52.216624619 -0500
@@ -3,12 +3,11 @@
 Priority: optional
 Maintainer: Uwe Steinmann <steinm@debian.org>
 Build-Depends-Indep: debhelper (>> 4.0.0), po-debconf, docbook-xsl, xsltproc
-Standards-Version: 3.6.1
+Standards-Version: 3.6.2
 
 Package: dh-make-php
 Architecture: all
-Depends: xsltproc
-Recommends: php-pear
-Description: Creating debian source packages for pear and pecl extensions
- It contains two programs to create a debian source package
- from a pear or pecl package.
+Depends:  php-pear, cdbs, xsltproc, xmlstarlet
+Description: Creates Debian source packages for PHP PEAR and PECL extensions
+ Contains two programs to create Debian source packages
+ from PHP PEAR or PECL packages.
diff -Nur dh-make-php-0.0.13/debian/dirs dh-make-php-0.14/debian/dirs
--- dh-make-php-0.0.13/debian/dirs	2006-02-28 09:41:25.788124000 -0500
+++ dh-make-php-0.14/debian/dirs	2006-02-28 09:50:49.425084332 -0500
@@ -1,2 +1,3 @@
 usr/share/
+usr/share/cdbs/1/rules
 usr/bin
diff -Nur dh-make-php-0.0.13/Makefile dh-make-php-0.14/Makefile
--- dh-make-php-0.0.13/Makefile	2006-02-13 05:38:46.000000000 -0500
+++ dh-make-php-0.14/Makefile	2006-02-28 09:50:18.896198278 -0500
@@ -32,6 +32,7 @@
 	cp -r licenses ${DESTDIR}/share/${PACKAGE}
 	cp -r xslt ${DESTDIR}/share/${PACKAGE}
 	cp dh-make-php.lib ${DESTDIR}/share/${PACKAGE}
+	cp pear.mk ${DESTDIR}/share/cdbs/1/class
 	rm -rf ${DESTDIR}/share/${PACKAGE}/pecl.template/CVS
 	rm -rf ${DESTDIR}/share/${PACKAGE}/pear.template/CVS
 	rm -rf ${DESTDIR}/share/${PACKAGE}/licenses/CVS
diff -Nur dh-make-php-0.0.13/pear.mk dh-make-php-0.14/pear.mk
--- dh-make-php-0.0.13/pear.mk	1969-12-31 19:00:00.000000000 -0500
+++ dh-make-php-0.14/pear.mk	2006-02-28 09:48:53.370726440 -0500
@@ -0,0 +1,100 @@
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2006 Charles Fry <debian@frogcircus.org>
+# Description: Installs and cleans PEAR packages
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+ifndef _cdbs_bootstrap
+_cdbs_scripts_path ?= /usr/lib/cdbs
+_cdbs_rules_path ?= /usr/share/cdbs/1/rules
+_cdbs_class_path ?= /usr/share/cdbs/1/class
+endif
+
+ifndef _cdbs_class_pear
+_cdbs_class_pear := 1
+
+include $(_cdbs_rules_path)/debhelper.mk$(_cdbs_makefile_suffix)
+
+# modify these variables as necessary
+PEAR_PKG := $(shell /usr/bin/xmlstarlet sel -t -v '/package/name/text()' package.xml)
+PEAR_PKG_VERSION := $(shell /usr/bin/xmlstarlet sel -t -v '/package/release/version/text()' package.xml)
+# some packages use test instead of tests
+PEAR_TEST_DIR := tests
+
+# these shouldn't need to be changed
+PEAR_SOURCE_DIR = $(PEAR_PKG)-$(PEAR_PKG_VERSION)
+PEAR_OLD_DOC_DIR = usr/share/php/docs/$(PEAR_PKG)
+PEAR_NEW_DOC_DIR = usr/share/doc/$(DEB_PACKAGES)
+PEAR_OLD_TEST_DIR = usr/share/php/tests/$(PEAR_PKG)/$(PEAR_TEST_DIR)
+PEAR_NEW_TEST_DIR = $(PEAR_NEW_DOC_DIR)/tests
+
+DEB_PHONY_RULES += pear-sanity-check
+
+pear-sanity-check:
+	if ! [ -x /usr/bin/pear -a -x /usr/bin/xmlstarlet ] ; then \
+		echo "pear.mk depends on php4-pear, xmlstarlet" ; \
+		exit 1 ; \
+	fi
+
+# check sanity as early as possible
+pre-build:: pear-sanity-check
+
+common-configure-indep::
+	ln -f -s ../package.xml $(PEAR_SOURCE_DIR)
+
+clean::
+	rm -f $(PEAR_PKG)-*/package.xml
+
+common-install-indep:: pear-sanity-check
+	# install everything in default locations
+	/usr/bin/pear \
+		-c debian/pearrc \
+		-d include_path=/usr/share/php \
+		-d php_bin=/usr/bin/php \
+		-d bin_dir=/usr/bin \
+		-d php_dir=/usr/share/php \
+		-d data_dir=/usr/share/php/data \
+		-d doc_dir=/usr/share/php/docs \
+		-d test_dir=/usr/share/php/tests \
+		install --nodeps -R $(DEB_DESTDIR) $(PEAR_SOURCE_DIR)/package.xml
+
+	# move documentation to correct location
+	mkdir -p $(DEB_DESTDIR)usr/share/doc
+	mv -i $(DEB_DESTDIR)$(PEAR_OLD_DOC_DIR) $(DEB_DESTDIR)$(PEAR_NEW_DOC_DIR)
+	ln -s ../../doc/$(DEB_PACKAGES) $(DEB_DESTDIR)$(PEAR_OLD_DOC_DIR)
+
+	# create upstream changelog
+	if [ -f debian/changelog.xsl ] ; then \
+		if [ -x /usr/bin/xsltproc ] ; then \
+			/usr/bin/xsltproc --nonet --novalid debian/changelog.xsl package.xml | gzip -9 > $(DEB_DESTDIR)$(PEAR_NEW_DOC_DIR)/changelog.gz ; \
+		else \
+			echo "pear.mk requires xsltproc to automatically install the upstream changelog" ; \
+			exit 1 ; \
+		fi ; \
+	fi
+
+	# move test to correct location
+	mkdir -p $(DEB_DESTDIR)$(PEAR_NEW_TEST_DIR)
+	# must move files instead of directory in case tests was part of docs above
+	mv -i $(DEB_DESTDIR)$(PEAR_OLD_TEST_DIR)/* $(DEB_DESTDIR)$(PEAR_NEW_TEST_DIR)
+	rmdir $(DEB_DESTDIR)$(PEAR_OLD_TEST_DIR)
+	ln -s ../../../doc/$(DEB_PACKAGES)/tests $(DEB_DESTDIR)$(PEAR_OLD_TEST_DIR)
+
+	# remove unwanted files
+	rm -rf $(DEB_DESTDIR)usr/share/php/.[a-z]* \
+		$(DEB_DESTDIR)$(PEAR_NEW_DOC_DIR)/LICENSE
+
+endif
diff -Nur dh-make-php-0.0.13/pear.template/control dh-make-php-0.14/pear.template/control
--- dh-make-php-0.0.13/pear.template/control	2005-07-22 16:35:01.000000000 -0400
+++ dh-make-php-0.14/pear.template/control	2006-02-28 10:02:42.314874142 -0500
@@ -2,7 +2,7 @@
 Section: web
 Priority: optional
 Maintainer: ##maintainer##
-Build-Depends-Indep: debhelper (>> 4.0.0), php4-pear, xsltproc
+Build-Depends-Indep: debhelper (>> 4.0.0), dh-make-php
 Standards-Version: 3.6.2
 
 Package: ##packagename##
diff -Nur dh-make-php-0.0.13/pear.template/rules dh-make-php-0.14/pear.template/rules
--- dh-make-php-0.0.13/pear.template/rules	2005-11-25 04:59:32.000000000 -0500
+++ dh-make-php-0.14/pear.template/rules	2006-02-28 09:58:10.331731862 -0500
@@ -1,102 +1,3 @@
 #!/usr/bin/make -f
-# template debian/rules provided by dh-make-php.
-# GNU copyright 2005 by Uwe Steinmann.
 
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-PEAR_PKG_NAME=##pearpkgname##
-PACKAGE_NAME=##packagename##
-PEAR="PHP_PEAR_PHP_BIN=/usr/bin/php /usr/bin/pear"
-PEAR_PHP_DIR=$(shell $(PEAR) config-get php_dir|sed -e 's/php_dir=//')
-PEAR_DOC_DIR=$(shell $(PEAR) config-get doc_dir|sed -e 's/doc_dir=//')
-SOURCE_DIR=$(shell ls -d $(PEAR_PKG_NAME)-*)
-
-configure: configure-stamp
-configure-stamp:
-	dh_testdir
-	# Add here commands to configure the package.
-
-	touch configure-stamp
-
-
-build: build-stamp
-
-build-stamp: configure-stamp 
-	dh_testdir
-
-	# Add here commands to compile the package.
-	ln -s ../package.xml $(SOURCE_DIR)
-	xsltproc --nonet --novalid debian/changelog.xsl package.xml > debian/Changelog
-
-	touch build-stamp
-
-clean:
-	dh_testdir
-	dh_testroot
-	rm -f build-stamp configure-stamp
-
-	# Add here commands to clean up after the build process.
-	#-$(MAKE) clean
-	rm -f debian/pearrc debian/Changelog $(SOURCE_DIR)/package.xml
-
-	dh_clean
-
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-	dh_installdirs
-
-	# Add here commands to install the package into debian/$(PACKAGE_NAME).
-	$(PEAR) install --nodeps -R debian/$(PACKAGE_NAME) $(SOURCE_DIR)/package.xml
-	rm -f debian/pearrc
-	rm -f debian/$(PACKAGE_NAME)$(PEAR_PHP_DIR)/.lock
-	rm -f debian/$(PACKAGE_NAME)$(PEAR_PHP_DIR)/.filemap
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_installchangelogs debian/Changelog
-	dh_installdocs
-	if [ -d debian/$(PACKAGE_NAME)$(PEAR_PHP_DIR)/docs/$(PEAR_PKG_NAME) ]; then \
-	  mv debian/$(PACKAGE_NAME)$(PEAR_PHP_DIR)/docs/$(PEAR_PKG_NAME) debian/$(PACKAGE_NAME)/usr/share/doc/$(PACKAGE_NAME); \
-		(cd debian/$(PACKAGE_NAME)$(PEAR_PHP_DIR)/docs/; ln -s /usr/share/doc/$(PACKAGE_NAME)/$(PEAR_PKG_NAME)) \
-	fi
-	if [ -d debian/$(PACKAGE_NAME)$(PEAR_PHP_DIR)/tests/$(PEAR_PKG_NAME)/tests ]; then \
-		mkdir -p debian/$(PACKAGE_NAME)/usr/share/doc/$(PACKAGE_NAME)/examples; \
-	  mv debian/$(PACKAGE_NAME)$(PEAR_PHP_DIR)/tests/$(PEAR_PKG_NAME)/tests debian/$(PACKAGE_NAME)/usr/share/doc/$(PACKAGE_NAME)/examples/; \
-		rm -rf debian/$(PACKAGE_NAME)$(PEAR_PHP_DIR)/tests; \
-	fi
-	dh_installexamples
-#	dh_install --sourcedir=debian/$(PACKAGE_NAME)
-#	dh_installmenu
-	dh_installdebconf	
-#	dh_installlogrotate
-#	dh_installemacsen
-#	dh_installpam
-#	dh_installmime
-#	dh_installinit
-#	dh_installcron
-#	dh_installinfo
-#	dh_installman
-#	dh_link
-#	dh_strip
-	dh_compress
-#	dh_fixperms
-#	dh_perl
-#	dh_python
-#	dh_makeshlibs
-	dh_installdeb
-#	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
+include /usr/share/cdbs/1/rules/pear.mk

Attachment: signature.asc
Description: Digital signature


Reply to: