Alexey Tourbin


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


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.


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/
        # perl(IO/ at line 492
        # perl( at line 4582 (builtin SKIP)
        # perl( at line 1157 inside eval (SKIP)
        # perl(IO/ at line 1560
        # perl( at line 7338 (builtin SKIP)
        # perl(Term/ at line 5725 inside eval (SKIP)
        # perl( at line 7633
        # perl( at line 2222
        # perl( >= 0.080 at line 2409 inside eval (SKIP)
        # perl( at line 2418
        # perl( at line 5316
        # perl(Class/ at line 4576 inside eval (SKIP)
        # perl( at line 7278 (builtin SKIP)
        # perl(Devel/ at line 7487 inside eval (SKIP)
        /usr/lib/perl5/ syntax OK

/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!


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

        %files # i586

Directory ownership!!!

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

        %files # WRONG, auto/ directory is captured

_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


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

Typical %build sections:

        %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

To disable tests in BTE (hasher or sandman):

        %ifdef __BTE
        %def_without test

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

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

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

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

Typical %install section:

        %perl_vendor_install [arguments to make]


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

%add_findprov_skiplist */Some/ 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.


Written by Alexey Tourbin <>.


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

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


Debian Perl Policy,