The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

rpm-build-perl/README.ALT - notes on Perl packaging

DESCRIPTION

This document is an early attempt of Perl policy for ALT Linux Team.

Most of the packages, modules and even files mentioned in this document have comprehensive documentation. Be sure to read it, too!

Blind guess: what you are looking for is probably _perl_lib_path. See below.

Packages

perl-base is a part of basesystem.

perl-devel is required to build Perl modules that have Makefile.PL.

perl-Module-Build is additionally required to build modules that have Build.PL.

perl-CPAN is useful for finding modules that need updating.

rpm-build is required to build RPM packages.

rpm-build-perl is required to build Perl RPM packages; it contains scripts for automatic dependency tracking, RPM macros for Perl, and this document.

rpm-utils has buildreq script which automatically inserts/updates BuildRequires clause in specfile.

sisyphus_check is to check package acceptability for Sisyphus.

hasher is a build system.

Files and modules

/usr/lib/rpm/perl.req, /usr/lib/rpm/perl.prov - scripts for automatic dependency tracking.

        $ alias perl.req=/usr/lib/rpm/perl.req
        $ perl.req --verbose /usr/lib/perl5/perl5db.pl
        # perl(IO/Handle.pm) at line 492
        # perl(strict.pm) at line 4582 (builtin SKIP)
        # perl(Config.pm) at line 1157 inside eval (SKIP)
        # perl(IO/Socket.pm) at line 1560
        # perl(Carp.pm) at line 7338 (builtin SKIP)
        # perl(Term/ReadLine.pm) at line 5725 inside eval (SKIP)
        # perl(Config.pm) at line 7633
        # perl(dumpvar.pl) at line 2222
        # perl(PadWalker.pm) >= 0.080 at line 2409 inside eval (SKIP)
        # perl(dumpvar.pl) at line 2418
        # perl(dumpvar.pl) at line 5316
        # perl(Class/ISA.pm) at line 4576 inside eval (SKIP)
        # perl(Carp.pm) at line 7278 (builtin SKIP)
        # perl(Devel/Peek.pm) at line 7487 inside eval (SKIP)
        /usr/lib/perl5/perl5db.pl syntax OK
        perl(Config.pm)
        perl(dumpvar.pl)
        perl(IO/Handle.pm)
        perl(IO/Socket.pm)
        $

/etc/rpm/macros.d/perl5 - RPM macros for Perl.

ExtUtils::MakeMaker - process Makefile.PL and build Perl module.

        $ cd libnet-1.19
        $ perl Makefile.PL PRINT_PREREQ=1
        Checking for Socket...ok
        Checking for IO::Socket...ok
        perl(IO::Socket)>=1.05  perl(Socket)>=1.3
        $

Module::Build - process Build.PL and build Perl module.

CPAN - list modules than need updating:

        $ perl -MCPAN -e 'CPAN::Shell->r'

Download and test a module:

        $ perl -MCPAN -e 'CPAN::Shell->test("Some::Module")'

But don't you run CPAN as root!

Directories

INSTALLDIRS=vendor is used by default for RPM packages. See ExtUtils::MakeMaker for details.

%perl_vendor_privlib - standard RPM directory for architecture-independent perl modules. (Disclaimer: there's no ANSI standard so far.)

%perl_vendor_privlib/auto - standard RPM directory for architecture-independent autosplitted functions (used rarely).

%perl_vendor_archlib - standard RPM directory for architecture-dependent perl modules.

%perl_vendor_autolib - a shortcut for %perl_vendor_archlib/auto, standard RPM directory for architecture-dependent autosplitted functions and compiled extensions.

Typical %files sections:

        %files # noarch
        %perl_vendor_privlib/Module*

        %files # i586
        %perl_vendor_archlib/Module*
        %perl_vendor_autolib/Module*

Directory ownership!!!

        %files # WRONG, Module/ directory is not owned by any package
        %perl_vendor_privlib/Module/*

        %files # WRONG, auto/ directory is captured
        %perl_vendor_privlib/*

_perl_lib_path must be defined when non-standard library path for perl modules is used (which is discouraged).

        # from kdoc.spec
        %define _perl_lib_path %_datadir/%name

        %files # kdoc*.pm are under non-standard location
        %_datadir/%name

Scriplets

%perl_vendor_build - basically equivalent to perl Makefile.PL INSTALLDIRS=vendor; make; make test.

Typical %build sections:

        %build
        %perl_vendor_build [arguments for Makefile.PL]

Sample arguments for Makefile.PL:

        INC=-I%_includedir/ncurses LIBS=-lncurses DEFINE=-DHAVE_STRING_H

To disable make test completely:

        # This package is broken but I think that it works.
        %def_without test

To disable some tests:

        %__rm -fv t/bad-test-1.t t/bad-test-2.t

To disable X-server dependent tests:

        # always run tests for maintainer
        $ echo '%_build_display :0' >> ~/.rpmmacros

        # don't run tests for others
        %ifndef _build_display
        %def_without test
        %endif

To disable tests in BTE (hasher or sandman):

        %ifdef __BTE
        %def_without test
        %endif

To disable tests when syslog is not available:

        %if "%(logger -d -u /dev/log -p user.debug test >/dev/null 2>&1 || echo no)" == "no"
        %def_without test
        %endif

To skip tests when /dev/tty is not available:

        %if "%([ -c /dev/tty ] || echo no)" == "no"
        %def_without test
        %endif

%perl_vendor_install - basically equivalent to make install DESTDIR=%buildroot.

Typical %install section:

        %install
        %perl_vendor_install [arguments to make]

Dependencies

%add_findreq_skiplist */Some/Module.pm -- don't run perl.req against files that match the given shell pattern. (Generally discouraged.)

%add_findprov_skiplist */Some/Module.pm don't run perl.prov against files that match the given shell pattern. (Generally discouraged.)

There's no way to skip a particular dependency so far.

AUTHOR

Written by Alexey Tourbin <at@altlinux.org>.

COPYING

Copyright (c) 2004 Alexey Tourbin, ALT Linux Team.

What is the best license for such a document, by the way?

SEE ALSO

Debian Perl Policy, http://www.debian.org/doc/packaging-manuals/perl-policy/.