ExtUtils::Depends(3)
๐ NAME ๐
okay so bestie, this is the ExtUtils::Depends(3) page from the User Contributed Perl Documentation โ and itโs literally here to make one thing easy: ExtUtils::Depends - Easily build XS extensions that depend on XS extensions. thatโs the whole NAME vibe. iconic. โจ
๐ SYNOPSIS ๐
use ExtUtils::Depends;
$package = new ExtUtils::Depends ('pkg::name', 'base::package')
# 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('code.c');
$package->add_xs('module-code.xs');
# 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('Files.pm');
WriteMakefile(
'NAME' => 'Mymodule',
$package->get_makefile_vars()
);
๐ธ DESCRIPTION ๐ธ
so the whole point: this module tries to make it easy to build Perl extensions that use functions and typemaps provided by other perl extensions. basically a perl extension gets treated like a shared library that also hands you a C and an XS interface besides the perl one. slay. ๐
This works as long as the base (or "producing") extension is loaded with the RTLD_GLOBAL flag โ usually done with this in the main .pm file:
sub dl_load_flags {0x01}
...if you need to use functions defined in the module. That "producing" extension also has to tell ExtUtils::MakeMaker which specific functions to export, with arguments to WriteMakefile like:
FUNCLIST => [qw(function_name)],
DL_FUNCS => { 'Extension::Name' => [] },
The basic scheme of operation is: collect info about a module in the instance, 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 that ExtUtils::MakeMaker's WriteMakefile function requires. ๐ซถ
For the deets on how to make your module fit into this scheme, see hashref = ExtUtils::Depends::load (name).
When you create a new Depends object, you give it a name โ the name of the module you are building. You can also specify the names of modules your module depends on. Those dependencies get loaded automatically, and their typemaps, header files, etc. get merged with your new object's stuff. When you store the data for your object, the list of dependencies gets stored with it, so another module depending on yours needn't know exactly which modules yours depends on. iykyk. ๐ฅ
For example:
Gtk2 depends on Glib
Gnome2::Canvas depends on Gtk2
ExtUtils::Depends->new ('Gnome2::Canvas', 'Gtk2');
this command automatically brings in all the stuff needed
for Glib, since Gtk2 depends on it.
When the configuration info is saved, it also includes a class method called Inline, inheritable by your module. That lets your module simply say at the top:
package Mymod;
use parent 'Mymod::Install::Files'; # to inherit 'Inline' method
And users of Mymod who want to write inline code (using Inline) can simply write:
use Inline with => 'Mymod';
And all the necessary header files, defines, and libraries get added for them. no cap. ๐
The Mymod::Install::Files will also implement a deps method, which returns a list of any modules that Mymod depends on โ you will not normally need to use this:
require Mymod::Install::Files;
@deps = Mymod::Install::Files->deps;
๐ง METHODS ๐ง
$object = ExtUtils::Depends->new($name, @deps)โ creates a new depends object named $name. Any modules listed in @deps (which may be empty) get added as dependencies, and their dependency information is loaded. If any dependency information can't be loaded, an exception is raised. ๐$depends->add_deps (@deps)โ adds the modules listed in @deps as dependencies. ๐(hashes) = $depends->get_depsโ fetches info on the dependencies of $depends as a hash of hashes, which are dependency information indexed by module name. Seeload. ๐$depends->set_inc (@newinc)โ adds strings to the includes or cflags variables.$depends->set_libs (@newlibs)โ adds strings to the libs (linker flags) variable.$depends->add_pm (%pm_files)โ adds files to the hash to be passed through ExtUtils::WriteMakefile'sPMkey.$depends->add_xs (@xs_files)โ adds xs files to be compiled.$depends->add_c (@c_files)โ adds C files to be compiled.$depends->add_typemaps (@typemaps)โ adds typemap files to be used and installed.$depends->add_headers (list)โ no-op, for backward compatibility. it's giving legacy support ๐ซก$depends->install (@files)โ installs @files to the data directory for $depends. This actually works by adding them to the hash of pm files that gets passed throughWriteMakefile'sPMkey. ๐ฆ$depends->save_config ($filename)โ saves the important information from $depends to $filename, and sets it up to be installed asname::Install::Files.
Note: the actual value of$filenameis unimportant so long as it doesn't clash with any other local files. It will be installed asname::Install::Files.
hash = $depends->get_makefile_varsโ returns the information in $depends in a format digestible byWriteMakefile. This sets at least these keys:
INC
LIBS
TYPEMAPS
PM
And these if there is data to fill them:
clean
OBJECT
XS
hashref = ExtUtils::Depends::load (name)โ loads and returns dependency information for name. Croaks if no such information can be found. The info comes back as an anonymous hash containing these keys:instpathโ the absolute path to the data install directory for this module.typemapsโ list of absolute pathnames for this module's typemap files.incโ CFLAGS string for this module.libsโ LIBS string for this module.depsโ list of modules on which this one depends. This key will not exist when loading files created by old versions of ExtUtils::Depends. ๐ฐ๏ธ
If you want to make module name support this, you must provide a module name::Install::Files, which on loading will implement these class methods:
$hashref = name::Install::Files->Inline('C');
# hash to contain any necessary TYPEMAPS (array-ref), LIBS, INC
@deps = name::Install::Files->deps;
# any modules on which "name" depends
An easy way to achieve this is to use the method $depends->save_config ($filename), but your package may have different facilities already. ๐
$depends->load_depsโ loads $depends dependencies, by callingloadon each dependency module. This is usually done for you, and should only be needed if you want to callget_depsafter callingadd_depsmanually. ๐ง
๐ SUPPORT ๐
๐ 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. ๐
This module is tightly coupled to the ExtUtils::MakeMaker architecture. no cap.
You can submit new bugs/feature requests by using one of two bug trackers (below). ๐
๐ฎ 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 PAUSE ID or Bitcard), or by sending an e-mail to bug-ExtUtils-Depends at rt.cpan.org.
๐ Gnome.org Bugtracker ๐
Report bugs/feature requests to 'perl-extutils-depends' (requires login) <https://gitlab.gnome.org/GNOME/perl-extutils-depends/-/issues/>.
Patches that implement new features with test cases, and/or test cases that exercise existing bugs are always welcome. ๐ซถ
The Gtk-Perl support forum is at <https://discourse.gnome.org/tags/c/platform/language-bindings/11/perl>.
๐ฟ Source Code ๐ฟ
The source code to ExtUtils::Depends is available at the Gnome.org Git repo (<https://gitlab.gnome.org/GNOME/perl-extutils-depends>). Create your own copy of the Git repo with:
git clone git://git.gnome.org/perl-ExtUtils-Depends (Git protocol)
git clone https://git.gnome.org/browse/perl-ExtUtils-Depends/ (HTTPS)
๐ SEE ALSO ๐
ExtUtils::MakeMaker. that's it. periodt. ๐
โ๏ธ 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. iconic collaboration. ๐
๐ MAINTAINER ๐
The Gtk2 project, <http://gtk2-perl.sf.net>/"gtk-perl-list at gnome dot org". ๐ซถ
๐ LICENSE ๐
This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself. ๐ธ
okay bestie, thatโs the whole page: source/version is perl v5.42.0, dated 2025-07-25, and itโs the ExtUtils::Depends(3) manpage. go build something iconic, mwah ๐โจ
๐ฆ where this page comes from
- fedora 43: perl-ExtUtils-Depends 0.8002-2.fc43 ยท GPL-1.0-or-later OR Artistic-1.0-Perl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms