.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" 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
.\" ========================================================================
.\"
.IX Title "ExtUtils::Depends 3"
.TH ExtUtils::Depends 3 "2021-05-16" "perl v5.26.3" "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"
ExtUtils::Depends \- Easily build XS extensions that depend on XS extensions
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 10
\& use ExtUtils::Depends;
\& $package = new ExtUtils::Depends (\*(Aqpkg::name\*(Aq, \*(Aqbase::package\*(Aq)
\& # set the flags and libraries to compile and link the module
\& $package\->set_inc("\-I/opt/blahblah");
\& $package\->set_libs("\-lmylib");
\& # add a .c and an .xs file to compile
\& $package\->add_c(\*(Aqcode.c\*(Aq);
\& $package\->add_xs(\*(Aqmodule\-code.xs\*(Aq);
\& # add the typemaps to use
\& $package\->add_typemaps("typemap");
\& # install some extra data files and headers
\& $package\->install (qw/foo.h data.txt/);
\& # save the info
\& $package\->save_config(\*(AqFiles.pm\*(Aq);
\&
\& WriteMakefile(
\& \*(AqNAME\*(Aq => \*(AqMymodule\*(Aq,
\& $package\->get_makefile_vars()
\& );
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module tries to make it easy to build Perl extensions that use
functions and typemaps provided by other perl extensions. This means
that a perl extension is treated like a shared library that provides
also a C and an \s-1XS\s0 interface besides the perl one.
.PP
This works as long as the base extension is loaded with the \s-1RTLD_GLOBAL\s0
flag (usually done with a
.PP
.Vb 1
\& sub dl_load_flags {0x01}
.Ve
.PP
in the main .pm file) if you need to use functions defined in the module.
.PP
The basic scheme of operation is to collect information about a module
in the instance, and then store that data in the Perl library where it
may be retrieved later. The object can also reformat this information
into the data structures required by ExtUtils::MakeMaker's WriteMakefile
function.
.PP
For information on how to make your module fit into this scheme, see
\&\*(L"hashref = ExtUtils::Depends::load (name)\*(R".
.PP
When creating a new Depends object, you give it a name, which is the name
of the module you are building. You can also specify the names of modules
on which this module depends. These dependencies will be loaded
automatically, and their typemaps, header files, etc merged with your new
object's stuff. When you store the data for your object, the list of
dependencies are stored with it, so that another module depending on your
needn't know on exactly which modules yours depends.
.PP
For example:
.PP
.Vb 1
\& Gtk2 depends on Glib
\&
\& Gnome2::Canvas depends on Gtk2
\&
\& ExtUtils::Depends\->new (\*(AqGnome2::Canvas\*(Aq, \*(AqGtk2\*(Aq);
\& this command automatically brings in all the stuff needed
\& for Glib, since Gtk2 depends on it.
.Ve
.PP
When the configuration information is saved, it also includes a class
method called \f(CW\*(C`Inline\*(C'\fR, inheritable by your module. This allows you in
your module to simply say at the top:
.PP
.Vb 2
\& package Mymod;
\& use parent \*(AqMymod::Install::Files\*(Aq; # to inherit \*(AqInline\*(Aq method
.Ve
.PP
And users of \f(CW\*(C`Mymod\*(C'\fR who want to write inline code (using Inline)
will simply be able to write:
.PP
.Vb 1
\& use Inline with => \*(AqMymod\*(Aq;
.Ve
.PP
And all the necessary header files, defines, and libraries will be added
for them.
.PP
The \f(CW\*(C`Mymod::Install::Files\*(C'\fR will also implement a \f(CW\*(C`deps\*(C'\fR method,
which will return a list of any modules that \f(CW\*(C`Mymod\*(C'\fR depends on \-
you will not normally need to use this:
.PP
.Vb 2
\& require Mymod::Install::Files;
\& @deps = Mymod::Install::Files\->deps;
.Ve
.SH "METHODS"
.IX Header "METHODS"
.ie n .IP "$object = ExtUtils::Depends\->new($name, @deps)" 4
.el .IP "\f(CW$object\fR = ExtUtils::Depends\->new($name, \f(CW@deps\fR)" 4
.IX Item "$object = ExtUtils::Depends->new($name, @deps)"
Create a new depends object named \fI\f(CI$name\fI\fR. Any modules listed in \fI\f(CI@deps\fI\fR
(which may be empty) are added as dependencies and their dependency
information is loaded. An exception is raised if any dependency information
cannot be loaded.
.ie n .IP "$depends\->add_deps (@deps)" 4
.el .IP "\f(CW$depends\fR\->add_deps (@deps)" 4
.IX Item "$depends->add_deps (@deps)"
Add modules listed in \fI\f(CI@deps\fI\fR as dependencies.
.ie n .IP "(hashes) = $depends\->get_deps" 4
.el .IP "(hashes) = \f(CW$depends\fR\->get_deps" 4
.IX Item "(hashes) = $depends->get_deps"
Fetch information on the dependencies of \fI\f(CI$depends\fI\fR as a hash of hashes,
which are dependency information indexed by module name. See \f(CW\*(C`load\*(C'\fR.
.ie n .IP "$depends\->set_inc (@newinc)" 4
.el .IP "\f(CW$depends\fR\->set_inc (@newinc)" 4
.IX Item "$depends->set_inc (@newinc)"
Add strings to the includes or cflags variables.
.ie n .IP "$depends\->set_libs (@newlibs)" 4
.el .IP "\f(CW$depends\fR\->set_libs (@newlibs)" 4
.IX Item "$depends->set_libs (@newlibs)"
Add strings to the libs (linker flags) variable.
.ie n .IP "$depends\->add_pm (%pm_files)" 4
.el .IP "\f(CW$depends\fR\->add_pm (%pm_files)" 4
.IX Item "$depends->add_pm (%pm_files)"
Add files to the hash to be passed through ExtUtils::WriteMakefile's
\&\s-1PM\s0 key.
.ie n .IP "$depends\->add_xs (@xs_files)" 4
.el .IP "\f(CW$depends\fR\->add_xs (@xs_files)" 4
.IX Item "$depends->add_xs (@xs_files)"
Add xs files to be compiled.
.ie n .IP "$depends\->add_c (@c_files)" 4
.el .IP "\f(CW$depends\fR\->add_c (@c_files)" 4
.IX Item "$depends->add_c (@c_files)"
Add C files to be compiled.
.ie n .IP "$depends\->add_typemaps (@typemaps)" 4
.el .IP "\f(CW$depends\fR\->add_typemaps (@typemaps)" 4
.IX Item "$depends->add_typemaps (@typemaps)"
Add typemap files to be used and installed.
.ie n .IP "$depends\->add_headers (list)" 4
.el .IP "\f(CW$depends\fR\->add_headers (list)" 4
.IX Item "$depends->add_headers (list)"
No-op, for backward compatibility.
.ie n .IP "$depends\->install (@files)" 4
.el .IP "\f(CW$depends\fR\->install (@files)" 4
.IX Item "$depends->install (@files)"
Install \fI\f(CI@files\fI\fR to the data directory for \fI\f(CI$depends\fI\fR.
.Sp
This actually works by adding them to the hash of pm files that gets
passed through WriteMakefile's \s-1PM\s0 key.
.ie n .IP "$depends\->save_config ($filename)" 4
.el .IP "\f(CW$depends\fR\->save_config ($filename)" 4
.IX Item "$depends->save_config ($filename)"
Save the important information from \fI\f(CI$depends\fI\fR to \fI\f(CI$filename\fI\fR, and
set it up to be installed as \fIname\fR::Install::Files.
.Sp
Note: the actual value of \fI\f(CI$filename\fI\fR is unimportant so long as it
doesn't clash with any other local files. It will be installed as
\&\fIname\fR::Install::Files.
.ie n .IP "hash = $depends\->get_makefile_vars" 4
.el .IP "hash = \f(CW$depends\fR\->get_makefile_vars" 4
.IX Item "hash = $depends->get_makefile_vars"
Return the information in \fI\f(CI$depends\fI\fR in a format digestible by
WriteMakefile.
.Sp
This sets at least the following keys:
.Sp
.Vb 4
\& INC
\& LIBS
\& TYPEMAPS
\& PM
.Ve
.Sp
And these if there is data to fill them:
.Sp
.Vb 3
\& clean
\& OBJECT
\& XS
.Ve
.IP "hashref = ExtUtils::Depends::load (name)" 4
.IX Item "hashref = ExtUtils::Depends::load (name)"
Load and return dependency information for \fIname\fR. Croaks if no such
information can be found. The information is returned as an anonymous
hash containing these keys:
.RS 4
.IP "instpath" 4
.IX Item "instpath"
The absolute path to the data install directory for this module.
.IP "typemaps" 4
.IX Item "typemaps"
List of absolute pathnames for this module's typemap files.
.IP "inc" 4
.IX Item "inc"
\&\s-1CFLAGS\s0 string for this module.
.IP "libs" 4
.IX Item "libs"
\&\s-1LIBS\s0 string for this module.
.IP "deps" 4
.IX Item "deps"
List of modules on which this one depends. This key will not exist when
loading files created by old versions of ExtUtils::Depends.
.RE
.RS 4
.Sp
If you want to make module \fIname\fR support this, you must provide
a module \fIname\fR::Install::Files, which on loading will implement the
following class methods:
.Sp
.Vb 4
\& $hashref = name::Install::Files\->Inline(\*(AqC\*(Aq);
\& # hash to contain any necessary TYPEMAPS (array\-ref), LIBS, INC
\& @deps = name::Install::Files\->deps;
\& # any modules on which "name" depends
.Ve
.Sp
An easy way to achieve this is to use the method
\&\*(L"$depends\->save_config ($filename)\*(R", but your package may have
different facilities already.
.RE
.ie n .IP "$depends\->load_deps" 4
.el .IP "\f(CW$depends\fR\->load_deps" 4
.IX Item "$depends->load_deps"
Load \fI\f(CI$depends\fI\fR dependencies, by calling \f(CW\*(C`load\*(C'\fR on each dependency module.
This is usually done for you, and should only be needed if you want to call
\&\f(CW\*(C`get_deps\*(C'\fR after calling \f(CW\*(C`add_deps\*(C'\fR manually.
.SH "SUPPORT"
.IX Header "SUPPORT"
.SS "Bugs/Feature Requests"
.IX Subsection "Bugs/Feature Requests"
Version 0.2 discards some of the more esoteric features provided by the
older versions. As they were completely undocumented, and this module
has yet to reach 1.0, this may not exactly be a bug.
.PP
This module is tightly coupled to the ExtUtils::MakeMaker architecture.
.PP
You can submit new bugs/feature requests by using one of two bug trackers
(below).
.IP "\s-1CPAN\s0 Request Tracker" 4
.IX Item "CPAN Request Tracker"
You can submit bugs/feature requests via the web by going to
<https://rt.cpan.org/Public/Bug/Report.html?Queue=ExtUtils\-Depends> (requires
\&\s-1PAUSE ID\s0 or Bitcard), or by sending an e\-mail to
\&\*(L"bug-ExtUtils-Depends at rt.cpan.org\*(R".
.IP "Gnome.org Bugzilla" 4
.IX Item "Gnome.org Bugzilla"
Report bugs/feature requests to the 'gnome\-perl' product (requires login)
<http://bugzilla.gnome.org/enter_bug.cgi?product=gnome\-perl>
.PP
Patches that implement new features with test cases, and/or test cases that
exercise existing bugs are always welcome.
.PP
The Gtk-Perl mailing list is at \*(L"gtk-perl-list at gnome dot org\*(R".
.SS "Source Code"
.IX Subsection "Source Code"
The source code to ExtUtils::Depends is available at the Gnome.org Git repo
(<https://git.gnome.org/browse/perl\-ExtUtils\-Depends/>). Create your own
copy of the Git repo with:
.PP
.Vb 2
\& git clone git://git.gnome.org/perl\-ExtUtils\-Depends (Git protocol)
\& git clone https://git.gnome.org/browse/perl\-ExtUtils\-Depends/ (HTTPS)
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
ExtUtils::MakeMaker.
.SH "AUTHOR"
.IX Header "AUTHOR"
Paolo Molaro <lupus at debian dot org> wrote the original version for
Gtk-Perl. muppet <scott at asofyet dot org> rewrote the innards for
version 0.2, borrowing liberally from Paolo's code.
.SH "MAINTAINER"
.IX Header "MAINTAINER"
The Gtk2 project, <http://gtk2\-perl.sf.net>/\*(L"gtk-perl-list at gnome dot org\*(R".
.SH "LICENSE"
.IX Header "LICENSE"
This library is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.