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

beta version of pear.mk



Attached is the most recent version of pear.mk. It works fine for all of
the Pear packages that I maintain. Does anyone have any comments or
suggestions before I request that this be included in cdbs?

thanks,
Charles

-- 
The tube's
A whopper
35 cents
Easy shaving
Low expense
Burma-Shave
http://burma-shave.org/jingles/1932/the_tubes
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2003 Charles Fry <debian@frogcircus.org>
# Description: Installs and cleans PEAR packages
# Depends: php4-pear, libxml-xpath-perl, xsltproc
#
# 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)

PEAR_PKG := $(shell /usr/bin/xpath -q -e '/package/name/text()' package.xml)
PEAR_PKG_VERSION := $(shell /usr/bin/xpath -q -e '/package/release/version/text()' package.xml)

SOURCE_DIR := $(PEAR_PKG)-$(PEAR_PKG_VERSION)
OLD_DOC_DIR := $(DEB_DESTDIR)usr/share/php/docs/$(PEAR_PKG)
NEW_DOC_DIR := $(DEB_DESTDIR)usr/share/doc/$(DEB_PACKAGES)
OLD_TEST_DIR := $(DEB_DESTDIR)usr/share/php/tests/$(PEAR_PKG)/tests
NEW_TEST_DIR := $(NEW_DOC_DIR)/tests

DEB_PHONY_RULES += pear-sanity-check

pear-sanity-check:
	if ! [ -x /usr/bin/pear -a -x /usr/bin/xpath ] ; then \
		echo "pear.mk depends on php4-pear, libxml-xpath-perl" ; \
		exit 1 ; \
	fi

# check sanity as early as possible
pre-build:: pear-sanity-check

common-configure-indep::
	ln -f -s ../package.xml $(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) $(SOURCE_DIR)/package.xml

	# move documentation to correct location
	mkdir -p $(DEB_DESTDIR)usr/share/doc
	mv -i $(OLD_DOC_DIR) $(NEW_DOC_DIR)
	ln -s ../../doc/$(DEB_PACKAGES) $(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 > $(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 $(NEW_TEST_DIR)
	# must move files instead of directory in case tests was part of docs above
	mv -i $(OLD_TEST_DIR)/* $(NEW_TEST_DIR)
	rmdir $(OLD_TEST_DIR)
	ln -s ../../../doc/$(DEB_PACKAGES)/tests $(OLD_TEST_DIR)

	# remove unwanted files
	rm -rf $(DEB_DESTDIR)usr/share/php/.lock \
		$(DEB_DESTDIR)usr/share/php/.filemap \
		$(DEB_DESTDIR)usr/share/php/.registry \
		$(NEW_DOC_DIR)/LICENSE

endif

Attachment: signature.asc
Description: Digital signature


Reply to: