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 :
perl-generators
Automatically generates run-time
Requires
andProvides
for installed Perl files. When you install a Perl script or a Perl module, you must include a build dependency on this package.perl-interpreter
The Perl interpreter must be listed as a build dependency if it is called in any way, either explicitly via the
perl
package or the%__perl
macro, or as a part of your package’s build system.perl-devel
Provides Perl header files. If building architecture-specific code which links to the
libperl.so
library, such as an XS Perl module, you must includeBuildRequires: perl-devel
.
4.8.2. Using a specific Perl module
If a specific Perl module is required at build time, use the following procedure:
Procédure
Apply the following syntax in your RPM SPEC file:
BuildRequires: perl(MODULE)
NoteApply this syntax to Perl core modules as well, because they can move in and out of the
perl
package 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:
Procédure
Use the
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:
Procédure
Include versioned
MODULE_COMPAT
Requires
in RPM SPEC file for any package that delivers a Perl module:Requires: perl(:MODULE_COMPAT_%(eval `perl -V:version`; echo $version))