.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Module::Build::Using::PkgConfig 3pm" .TH Module::Build::Using::PkgConfig 3pm "2022-11-30" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" "Module::Build::Using::PkgConfig" \- extend "Module::Build" to more easily use platform libraries provided by pkg\-config .SH "SYNOPSIS" .IX Header "SYNOPSIS" In \fIBuild.PL\fR: .PP .Vb 1 \& use Module::Build::Using::PkgConfig; \& \& my $build = Module::Build::Using::PkgConfig\->new( \& module_name => "Module::Here", \& ... # other arguments as per Module::Build \& ); \& \& # A platform library provided by pkg\-config \& $build\->use_pkgconfig( "libfoo" ); \& \& # We need at least a given version \& $build\->use_pkgconfig( "libbar", \& atleast_version => "0.5", \& ); \& \& # A platform librariy that\*(Aqs also wrapped as an Alien module \& $build\->use_pkgconfig( "libsplot", \& atleast_version => "1.0", \& alien => "Alien::libsplot", \& alien_version => "0.05", # Alien::libsplot 0.05 provides libsplot v1.0 \& ); \& \& $build\->create_build_script; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This subclass of Module::Build provides some handy methods to assist the \&\fIBuild.PL\fR script of XS-based module distributions that make use of platform libraries managed by \fIpkg-config\fR. .PP As well as supporting libraries installed on a platform-wide basis and thus visible to \fIpkg-config\fR itself, this subclass also assists with \&\f(CW\*(C`Alien::\*(C'\fR\-based wrappers of these system libraries, allowing them to be dynamically installed at build time if the platform does not provide them. .SS "\s-1RPATH\s0 generation" .IX Subsection "RPATH generation" This module also provides some helper code to generate the required \f(CW\*(C`RPATH\*(C'\fR arguments needed to link against the libraries found by inspecting the \&\f(CW\*(C`extra_linker_flags\*(C'\fR. This attempts to duplicate the same logic performed by \fIlibtool\fR when it would link a C program or library, as we don't get to use its code when linking dynamic libraries for Perl. .SH "PROPERTIES" .IX Header "PROPERTIES" .IP "no_late_aliens => \s-1BOOL\s0" 4 .IX Item "no_late_aliens => BOOL" If true, applies the \f(CW\*(C`no_late_alien\*(C'\fR option to every use of \f(CW\*(C`use_pkgconfig\*(C'\fR that specifies an Alien module. .SH "METHODS" .IX Header "METHODS" .SS "use_pkgconfig" .IX Subsection "use_pkgconfig" .Vb 1 \& $build\->use_pkgconfig( $modname, ... ) .Ve .PP Requires the given \fIpkg-config\fR module of the given version, and extends the compiler and linker arguments sufficient to build from it. .PP Takes the following named options: .ie n .IP "atleast_version => $modver" 4 .el .IP "atleast_version => \f(CW$modver\fR" 4 .IX Item "atleast_version => $modver" If given, the \fIpkg-config\fR module is required to be at least the given version. If unspecified, then any version is considered sufficient. .ie n .IP "alien => $alien" 4 .el .IP "alien => \f(CW$alien\fR" 4 .IX Item "alien => $alien" If given and the \fIpkg-config\fR module does not exist, try to use the given \&\f(CW\*(C`Alien::\*(C'\fR module to provide it instead. .Sp If this module is not yet available and the \f(CW\*(C`no_late_alien\*(C'\fR option is not true, the Alien module is added to the \f(CW\*(C`requires\*(C'\fR dynamic dependencies and checked again at \f(CW\*(C`build\*(C'\fR action time. .IP "no_late_alien => \s-1BOOL\s0" 4 .IX Item "no_late_alien => BOOL" If true, suppresses the dynamic \f(CW\*(C`requires\*(C'\fR feature of Alien modules described above. .ie n .IP "alien_version => $version" 4 .el .IP "alien_version => \f(CW$version\fR" 4 .IX Item "alien_version => $version" If the \f(CW\*(C`Alien::\*(C'\fR module is not available, gives the module version of it that will be required to provide the \fIpkg-config\fR module of the required version. This gets added to \f(CW\*(C`requires\*(C'\fR. .PP If neither the \fIpkg-config\fR module and no \f(CW\*(C`Alien::\*(C'\fR module was requested (or none was found and \f(CW\*(C`no_late_alien\*(C'\fR was set), this method dies with an \&\f(CW\*(C`OS unsupported\*(C'\fR message, which is usually what is required for a \fIBuild.PL\fR script. .SS "try_pkconfig" .IX Subsection "try_pkconfig" .Vb 1 \& $ok = $build\->try_pkconfig( $modname, ... ) .Ve .PP Boolean-returning version of \*(L"use_pkgconfig\*(R". If successful, returns true. If it fails it returns false rather than dying, allowing the \fIBuild.PL\fR script to take alternative action. .SS "pkgconfig_atleast_version" .IX Subsection "pkgconfig_atleast_version" .Vb 1 \& $ok = $build\->pkgconfig_atleast_version( $modname, $modver ) .Ve .PP Returns true if the \fIpkg-config\fR module name exists and has at least the given version. .SS "add_cflags_libs_from_pkgconfig" .IX Subsection "add_cflags_libs_from_pkgconfig" .Vb 1 \& $build\->add_cflags_libs_from_pkgconfig( $modname ) .Ve .PP Extend the \f(CW\*(C`extra_compiler_flags\*(C'\fR and \f(CW\*(C`extra_linker_flags\*(C'\fR arguments from the \f(CW\*(C`\-\-cflags\*(C'\fR and \f(CW\*(C`\-\-libs\*(C'\fR from the given \fIpkg-config\fR module name. .SS "alien_atleast_version" .IX Subsection "alien_atleast_version" .Vb 1 \& $ok = $build\->alien_atleast_version( $alien, $modver ) .Ve .PP Returns true if the given \f(CW\*(C`Alien::\*(C'\fR module provides a \fIpkg-config\fR module version at least the given version. .SS "add_cflags_libs_from_alien" .IX Subsection "add_cflags_libs_from_alien" .Vb 1 \& $build\->add_cflags_libs_from_alien( $alien ) .Ve .PP Extend the \f(CW\*(C`extra_compiler_flags\*(C'\fR and \f(CW\*(C`extra_linker_flags\*(C'\fR arguments from the \f(CW\*(C`\-\-cflags\*(C'\fR and \f(CW\*(C`\-\-libs\*(C'\fR from the given \f(CW\*(C`Alien::\*(C'\fR module name. .SS "use_late_alien" .IX Subsection "use_late_alien" .Vb 1 \& $ok = $build\->use_late_alien( $alien, ... ) .Ve .PP Adds an Alien module directly to the \f(CW\*(C`requires\*(C'\fR hash, and makes a note to use its cflags and libraries later at build time. .PP Normally this method would not be necessary as it is automatically called from use_pkgconfig if required, but one use-case may be to provide a final last-ditch attempt after trying some other possible attempts, after an earlier call to \f(CW\*(C`use_pkgconfig\*(C'\fR with \f(CW\*(C`no_late_alien\*(C'\fR set. .SS "push_extra_compiler_flags" .IX Subsection "push_extra_compiler_flags" .Vb 1 \& $build\->push_extra_compiler_flags( @flags ) .Ve .PP Appends more values onto the \f(CW\*(C`extra_compiler_flags\*(C'\fR. .SS "push_extra_linker_flags" .IX Subsection "push_extra_linker_flags" .Vb 1 \& $build\->push_extra_linker_flags( @flags ) .Ve .PP Appends more values onto the \f(CW\*(C`extra_linker_flags\*(C'\fR. .SH "TODO" .IX Header "TODO" .IP "\(bu" 4 Consider a \f(CW\*(C`quiet\*(C'\fR option to suppress verbose printing .IP "\(bu" 4 Consider defining a constructor argument, perhaps \f(CW\*(C`build_requires_pkgconfig\*(C'\fR, to neaten the common case of simple requirements. .IP "\(bu" 4 Consider further stealing the various helper methods from ExtUtils::CChecker and possibly splitting this class into a lower \*(L"C\-using \s-1XS\s0 modules\*(R" and higher-level \fIpkg-config\fR+Alien layer. .SH "AUTHOR" .IX Header "AUTHOR" Paul Evans