4.8. How to handle RPM packages with Perls scripts
Since RHEL 8, the Perl programming language is not included in the default buildroot. Therefore, the RPM packages that include Perl scripts must explicitly indicate the dependency on Perl using the
BuildRequires: directive in RPM SPEC file.
4.8.1. Common Perl-related dependencies
The most frequently occurring Perl-related build dependencies used in
BuildRequires: are :
Automatically generates run-time
Providesfor installed Perl files. When you install a Perl script or a Perl module, you must include a build dependency on this package.
The Perl interpreter must be listed as a build dependency if it is called in any way, either explicitly via the
perlpackage or the
%__perlmacro, or as a part of your package’s build system.
Provides Perl header files. If building architecture-specific code which links to the
libperl.solibrary, such as an XS Perl module, you must include
4.8.2. Using a specific Perl module
If a specific Perl module is required at build time, use the following procedure:
Apply the following syntax in your RPM SPEC file:
Apply this syntax to Perl core modules as well, because they can move in and out of the
perlpackage over time.
4.8.3. Limiting a package to a specific Perl version
To limit your package to a specific Perl version, follow this procedure:
perl(:VERSION)dependency with the desired version constraint in your RPM SPEC file:
For example, to limit a package to Perl version 5.30 and higher, use:
BuildRequires: perl(:VERSION) >= 5.30
Do not use a comparison against the version of the
perl package because it includes an epoch number.
4.8.4. Ensuring that a package uses the correct Perl interpreter
Red Hat provides multiple Perl interpreters, which are not fully compatible. Therefore, any package that delivers a Perl module must use at run time the same Perl interpreter that was used at build time.
To ensure this, follow the procedure below:
Requiresin RPM SPEC file for any package that delivers a Perl module:
Requires: perl(:MODULE_COMPAT_%(eval `perl -V:version`; echo $version))