> > Just to keep you updated on this, I have completed the work that I plan
> > to do on pear.mk. Unless you have any comments on it, I plan to submit
> > it to cdbs. I'll keep you posted on how that goes.
> Thanks. If you send me a copy I could prepare dh-make-pear to make 
> use of it, though I'm currently a bit low on time.

Uwe,

I've attached the current pear.mk. It is very simple to use:

 - in debian/control add a Build-Depends on cdbs, xsltproc, libxml-xpath-perl
 - remove your current debian/prerm (no longer necessary without .registry)
 - replace your entire debian/rules with the following:

        #!/usr/bin/make -f

        include /usr/share/cdbs/1/class/pear.mk

Basically, your entire debian/rules got pushed into pear.mk! You can
still add more things if necessary.

Anyway, you can see some examples of packages that use it at:

   http://debian.frogcircus.org/packages/

Look at any of the php-* packages.

Please let me know if you see anything that you think should be changed
before I request that this be included in cdbs.

cheers,
Charles

-- 
That she
Could cook
He had his doubts
Until she creamed
His bristle sprouts with
Burma-Shave
http://burma-shave.org/jingles/1947/that_she
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2003 Charles Fry <[EMAIL PROTECTED]>
# 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 via email to