[Build-common-hackers] Bug#332632: cdbs: pear.mk for building PHP
Pear packages
Charles Fry
debian at frogcircus.org
Fri Oct 7 12:29:11 UTC 2005
Package: cdbs
Version: 0.4.32
Severity: wishlist
Tags: patch
Please find attached a new make file sloted for addition at:
/usr/share/cdbs/1/class/pear.mk
This file works for standard PHP Pear packages (the rough equivilant of
CPAN for PHP modules). This file itself was extracted from the
dh-make-php program which is currently the standard way to create Pear
packages. Once this is included in cdbs, dh-make-php can use it as well.
Note that I received direct feedback from the debian-webapps mailing
list regarding pear.mk, and have integrated all suggestions made there
by others.
cheers,
Charles
-- System Information:
Debian Release: testing/unstable
APT prefers testing
APT policy: (900, 'testing'), (800, 'stable'), (70, 'unstable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-2-386
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
cdbs depends on no packages.
Versions of packages cdbs recommends:
ii autotools-dev 20050803.1 Update infrastructure for config.{
ii debhelper 4.9.8 helper programs for debian/rules
-- no debconf information
-------------- next part --------------
# -*- mode: makefile; coding: utf-8 -*-
# Copyright ? 2003 Charles Fry <debian at 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)
# modify these variables as necessary
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)
# 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/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 $(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/.lock \
$(DEB_DESTDIR)usr/share/php/.filemap \
$(DEB_DESTDIR)usr/share/php/.registry \
$(DEB_DESTDIR)$(PEAR_NEW_DOC_DIR)/LICENSE
endif
More information about the Build-common-hackers
mailing list