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

Re: packaging perl modules



Hi,

	The following is an excerpt from my unfinished make-ppkg
 package (which creates a .deb file using a control file and CPAN.pm)
 This excerpt should help with individual packages as well.

	This correctly handles the MAN pages.

	manoj

______________________________________________________________________
thisdir=$(shell pwd)

install_file= install -p -o root -g root -m 644
install_program= install -p -o root -g root -m 755
make_directory= install -p -d -o root -g root -m 755
deb_rule = $(MAKE) -f $(thisdir)/debian/rules

package = $(shell grep Source debian/control | sed 's/^Source: //')
version= $(shell head -1 debian/changelog | \
                 perl -nle 'm/\S+\s+\((\S+)\)/ && print $$1')

PRIVLIB := $(shell perl -e 'use Config; print "$$Config{'privlibexp'}\n";')
ARCHLIB := $(shell perl -e 'use Config; print "$$Config{'archlibexp'}\n";')
DOCDIR  := debian/tmp/usr/doc/$(package)
FILES_TO_COMPRESS= $(DOCDIR)/README.* $(DOCDIR)/changelog.debian

all build: configure stamp-build
stamp-build:
# Builds the binary package.
        $(checkdir)
        -test ! -f stamp-configure && $(MAKE) -f debian/rules configure
        $(MAKE)
        dpkg -l perl 'libc*' make dpkg-dev | \
          awk '$$1 == "ii" { printf("%s-%s\n", $$2, $$3) }' > \
           debian/buildinfo
        touch stamp-build

configure: stamp-configure Makefile
stamp-configure Makefile:
        $(checkdir)
        -test ! -f stamp-configure && \
            perl Makefile.PL && touch stamp-configure

clean:
# Undoes the effect of `make -f debian/rules build'.
        $(checkdir)
        rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
        rm -rf $(DIRS_TO_CLEAN)
        -test -f Makefile && $(MAKE) realclean
        rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
          -name '*~' -o -name '*.bak' -o -name '#*#' -o \
          -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
          -size 0 \) -print` TAGS

binary: binary-arch binary-indep
binary-arch: build

binary-indep: build stamp-binary
stamp-binary:
# Makes a binary package.
        test root = "`whoami`" || (echo need root priviledges; exit 1)
        $(checkdir)
        test -f stamp-build || $(deb_rule) build
        rm -rf debian/tmp
        $(make_directory) debian/tmp
        chmod g-s         debian/tmp
        $(make_directory) debian/tmp/DEBIAN
        $(make_directory) debian/tmp/$(PRIVLIB)
        $(make_directory) debian/tmp/$(ARCHLIB)
        $(make_directory) debian/tmp/usr/man/man3
        $(make_directory) debian/tmp/usr/lib/menu
        $(make_directory) $(DOCDIR)
        $(install_file)   debian/changelog $(DOCDIR)/changelog.debian
        $(install_file)   debian/buildinfo $(DOCDIR)/buildinfo.Debian
        $(install_file)   debian/copyright $(DOCDIR)/copyright
# [excerpted]
        $(MAKE)           PREFIX=$(thisdir)/debian/tmp/usr \
                             INSTALLDIRS=perl \
                             INSTALLMAN1DIR=$(thisdir)/debian/tmp/usr/man/man1 \
                             INSTALLMAN3DIR=$(thisdir)/debian/tmp/usr/man/man3 \
                             pure_install
        -gzip -9qf         debian/tmp/usr/man/man3/*
        -rm -rf            debian/tmp/usr/lib/perl5/i386-linux
        $(install_program) debian/preinst  debian/tmp/DEBIAN/preinst
        $(install_program) debian/postinst debian/tmp/DEBIAN/postinst
        $(install_program) debian/postrm   debian/tmp/DEBIAN/postrm
        dpkg-gencontrol
        chmod -R          u+w debian/tmp/usr/
        chown -R          root.root debian/tmp/
        dpkg-deb          --build debian/tmp ..
        touch             stamp-binary


-- 
 There are still some other things to do, so don't think if I didn't
 fix your favorite bug that your bug report is in the bit bucket.  (It
 may be, but don't think it.  :-) Larry Wall in
 <7238@jpl-devvax.JPL.NASA.GOV>
Manoj Srivastava  <srivasta@acm.org> <http://www.datasync.com/%7Esrivasta/>
Key C7261095 fingerprint = CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: