man-pages/man3/Glib::MakeHelper.3pm.html
2021-03-31 01:06:50 +01:00

329 lines
9.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of Glib::MakeHelper</TITLE>
</HEAD><BODY>
<H1>Glib::MakeHelper</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2020-02-18<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
Glib::MakeHelper - Makefile.PL utilities for Glib-based extensions
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
eval &quot;use Glib::MakeHelper; 1&quot;
or complain_that_glib_is_too_old_and_die();
%xspod_files = Glib::MakeHelper-&gt;do_pod_files (@xs_files);
package MY;
sub postamble {
return Glib::MakeHelper-&gt;postamble_clean ()
. Glib::MakeHelper-&gt;postamble_docs (@main::xs_files)
. Glib::MakeHelper-&gt;postamble_rpms (
MYLIB =&gt; $build_reqs{MyLib},
);
}
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The Makefile.PL for your typical Glib-based module is huge and hairy, thanks to
all the crazy hoops you have to jump through to get things right. This module
wraps up some of the more intense and error-prone bits to reduce the amount of
copied code and potential for errors.
<A NAME="lbAE">&nbsp;</A>
<H2>METHODS</H2>
<DL COMPACT>
<DT id="1"><FONT SIZE="-1">HASH</FONT> = Glib::MakeHelper-&gt;do_pod_files (@xs_files)<DD>
Scan the <I></I>@xs_files<I></I> and return a hash describing the pod files that will
be created. This is in the format wanted by <B>WriteMakefile()</B>. If <TT>@ARGV</TT> contains
the string <TT>&quot;disable-apidoc&quot;</TT> an empty list will be returned and thus no apidoc
pod will be generated speeding up the build process.
<DT id="2"><FONT SIZE="-1">LIST</FONT> = Glib::MakeHelper-&gt;select_files_by_version ($stem, $major, $minor)<DD>
Returns a list of all files that match ``$stem-\d+\.\d+'' and for which the first
number is bigger than <I></I>$major<I></I> and the second number is bigger than <I></I>$minor<I></I>.
If <I></I>$minor<I></I> is odd, it will be incremented by one so that the version number of
an upcoming stable release can be used during development as well.
<DT id="3"><FONT SIZE="-1">LIST</FONT> = Glib::MakeHelper-&gt;read_source_list_file ($filename)<DD>
Reads <I></I>$filename<I></I>, removes all comments (starting with ``#'') and leading and
trailing whitespace, and returns a list of all lines that survived the treatment.
<DT id="4">string = Glib::MakeHelper-&gt;get_configure_requires_yaml (%module_to_version)<DD>
Generates <FONT SIZE="-1">YAML</FONT> code that lists every module found in <I></I>%module_to_version<I></I>
under the <TT>&quot;configure_requires&quot;</TT> key. This can be used with
ExtUtils::MakeMaker's <TT>&quot;EXTRA_META&quot;</TT> parameter to specify which modules are
needed at <I>Makefile.PL</I> time.
<P>
This function is <B>deprecated</B> since ExtUtils::MakeMaker 6.46 removed
support for <TT>&quot;EXTRA_META&quot;</TT> in favor of the new keys <TT>&quot;META_MERGE&quot;</TT> and
<TT>&quot;META_ADD&quot;</TT>.
<DT id="5">string = Glib::MakeHelper-&gt;postamble_clean (@files)<DD>
Create and return the text of a realclean rule that cleans up after much
of the autogeneration performed by Glib-based modules. Everything in <TT>@files</TT>
will be deleted, too (it may be empty).
<P>
The reasoning behind using this instead of just having you use the 'clean'
or 'realclean' keys is that this avoids you having to remember to put Glib's
stuff in your Makefile.PL's WriteMakefile arguments.
<DT id="6">string = Glib::MakeHelper-&gt;postamble_docs (@xs_files)<DD>
<FONT SIZE="-1">NOTE:</FONT> this is The Old Way. see postamble_docs_full for The New Way.
<P>
Create and return the text of Makefile rules to build documentation from
the <FONT SIZE="-1">XS</FONT> files with Glib::ParseXSDoc and Glib::GenPod.
<P>
Use this in your MY::postamble to enable autogeneration of <FONT SIZE="-1">POD.</FONT>
<P>
This updates dependencies with the list of pod names generated by an earlier
run of <TT>&quot;do_pod_files&quot;</TT>.
<P>
There is a special Makefile variable <FONT SIZE="-1">POD_DEPENDS</FONT> that should be set to the
list of files that need to be created before the doc.pl step is run, include
files.
<P>
There is also a variable <FONT SIZE="-1">BLIB_DONE</FONT> which should be used as a dependency
anywhere a rule needs to be sure that a loadable and working module resides in
the blib directory before running.
<DT id="7">string = Glib::MakeHelper-&gt;postamble_docs_full (...)<DD>
Create and return the text of Makefile rules to build documentation from
the <FONT SIZE="-1">XS</FONT> files with Glib::ParseXSDoc and Glib::GenPod.
<P>
Use this in your MY::postamble to enable autogeneration of <FONT SIZE="-1">POD.</FONT>
<P>
This updates dependencies with the list of pod names generated by an earlier
run of <TT>&quot;do_pod_files&quot;</TT>.
<P>
There is a special Makefile variable <FONT SIZE="-1">POD_DEPENDS</FONT> that should be set to the
list of files that need to be created before the doc.pl step is run, include
files.
<P>
There is also a variable <FONT SIZE="-1">BLIB_DONE</FONT> which should be used as a dependency
anywhere a rule needs to be sure that a loadable and working module resides in
the blib directory before running.
<P>
The parameters are a list of key=&gt;value pairs. You must specify at minimum
either <FONT SIZE="-1">DEPENDS</FONT> or <FONT SIZE="-1">XS_FILES.</FONT>
<DL COMPACT><DT id="8"><DD>
<DL COMPACT>
<DT id="9"><FONT SIZE="-1">DEPENDS</FONT> =&gt; ExtUtils::Depends object<DD>
Most gtk2-perl modules use ExtUtils::Depends to find headers, typemaps,
and other data from parent modules and to install this data for child
modules. We can find from this object the list of <FONT SIZE="-1">XS</FONT> files to scan for
documentation, doctype mappings for parent modules, and other goodies.
<DT id="10"><FONT SIZE="-1">XS_FILES</FONT> =&gt; \@xs_file_names<DD>
A list of xs files to scan for documentation. Ignored if <FONT SIZE="-1">DEPENDS</FONT> is
used.
<DT id="11"><FONT SIZE="-1">DOCTYPES</FONT> =&gt; \@doctypes_file_names<DD>
List of filenames to pass to <TT>&quot;Glib::GenPod::add_types&quot;</TT>. May be omitted.
<DT id="12"><FONT SIZE="-1">COPYRIGHT</FONT> =&gt; string<DD>
<FONT SIZE="-1">POD</FONT> text to be inserted in the '<FONT SIZE="-1">COPYRIGHT</FONT>' section of each generated page.
May be omitted.
<DT id="13"><FONT SIZE="-1">COPYRIGHT_FROM</FONT> =&gt; file name<DD>
The name of a file containing the <FONT SIZE="-1">POD</FONT> to be inserted in the '<FONT SIZE="-1">COPYRIGHT</FONT>'
section of each generated page. May be omitted.
<DT id="14"><FONT SIZE="-1">NAME</FONT> =&gt; extension name<DD>
The name of the extension, used to set the main mod for Glib::GenPod (used in the
generated see-also listings). May be omitted in favor of the name held
inside the ExtUtils::Depends object. If <FONT SIZE="-1">DEPENDS</FONT> is also specified, <FONT SIZE="-1">NAME</FONT> wins.
</DL>
</DL>
<DL COMPACT><DT id="15"><DD>
</DL>
<DT id="16">string = Glib::MakeHelper-&gt;postamble_rpms (<FONT SIZE="-1">HASH</FONT>)<DD>
Create and return the text of Makefile rules to manage building RPMs.
You'd put this in your Makefile.PL's MY::postamble.
<P>
<I></I><FONT SIZE="-1"><I>HASH</I></FONT><I></I> is a set of search and replace keys for the spec file. All
occurrences of @<I>key</I>@ in the spec file template perl-$(<FONT SIZE="-1">DISTNAME</FONT>).spec.in
will be replaced with <I>value</I>. '<FONT SIZE="-1">VERSION</FONT>' and '<FONT SIZE="-1">SOURCE</FONT>' are supplied for
you. For example:
<P>
<PRE>
Glib::MakeHelper-&gt;postamble_rpms (
MYLIB =&gt; 2.0.0, # we can work with anything from this up
MYLIB_RUN =&gt; 2.3.1, # we are actually compiled against this one
PERL_GLIB =&gt; 1.01, # you must have this version of Glib
);
</PRE>
<P>
will replace <TT>@MYLIB</TT>@, <TT>@MYLIB_RUN</TT>@, and <TT>@PERL_GLIB</TT>@ in spec file. See
the build setups for Glib and Gtk2 for examples.
<P>
Note: This function just returns an empty string on Win32.
<DT id="17">string = Glib::MakeHelper-&gt;postamble_precompiled_headers (@headers)<DD>
Create and return the text of Makefile rules for a 'precompiled-headers' target
that precompiles <I></I>@headers<I></I>. If you call this before you call
<TT>&quot;postamble_clean&quot;</TT>, all temporary files will be removed by the 'realclean'
target.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>NOTICE</H2>
The MakeMaker distributed with perl 5.8.x generates makefiles with a bug that
causes object files to be created in the wrong directory. There is an override
inserted by this module under the name MY::const_cccmd to fix this issue.
<A NAME="lbAG">&nbsp;</A>
<H2>AUTHOR</H2>
Ross McFarland &lt;rwmcfa1 at neces dot com&gt;
<P>
hacked up and documented by muppet.
<A NAME="lbAH">&nbsp;</A>
<H2>COPYRIGHT AND LICENSE</H2>
Copyright 2003-2004, 2012 by the gtk2-perl team
<P>
This library is free software; you can redistribute it and/or modify
it under the terms of the Lesser General Public License (<FONT SIZE="-1">LGPL</FONT>). For
more information, see <A HREF="http://www.fsf.org/licenses/lgpl.txt">http://www.fsf.org/licenses/lgpl.txt</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="18"><A HREF="#lbAB">NAME</A><DD>
<DT id="19"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="20"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="21"><A HREF="#lbAE">METHODS</A><DD>
<DT id="22"><A HREF="#lbAF">NOTICE</A><DD>
<DT id="23"><A HREF="#lbAG">AUTHOR</A><DD>
<DT id="24"><A HREF="#lbAH">COPYRIGHT AND LICENSE</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:45 GMT, March 31, 2021
</BODY>
</HTML>