Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / man / man3 / ExtUtils::MakeMaker::FAQ.3
CommitLineData
920dae64
AT
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "ExtUtils::MakeMaker::FAQ 3"
132.TH ExtUtils::MakeMaker::FAQ 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
133.SH "NAME"
134ExtUtils::MakeMaker::FAQ \- Frequently Asked Questions About MakeMaker
135.SH "DESCRIPTION"
136.IX Header "DESCRIPTION"
137FAQs, tricks and tips for \f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR.
138.Sh "Module Installation"
139.IX Subsection "Module Installation"
140.IP "How do I keep from installing man pages?" 4
141.IX Item "How do I keep from installing man pages?"
142Recent versions of MakeMaker will only install man pages on Unix like
143operating systems.
144.Sp
145For an individual module:
146.Sp
147.Vb 1
148\& perl Makefile.PL INSTALLMAN1DIR=none INSTALLMAN3DIR=none
149.Ve
150.Sp
151If you want to suppress man page installation for all modules you have
152to reconfigure Perl and tell it 'none' when it asks where to install
153man pages.
154.IP "How do I use a module without installing it?" 4
155.IX Item "How do I use a module without installing it?"
156Two ways. One is to build the module normally...
157.Sp
158.Vb 2
159\& perl Makefile.PL
160\& make
161.Ve
162.Sp
163\&...and then set the \s-1PERL5LIB\s0 environment variable to point at the
164blib/lib and blib/arch directories.
165.Sp
166The other is to install the module in a temporary location.
167.Sp
168.Vb 1
169\& perl Makefile.PL PREFIX=~/tmp LIB=~/tmp/lib/perl
170.Ve
171.Sp
172And then set \s-1PERL5LIB\s0 to \fI~/tmp/lib/perl\fR. This works well when you have
173multiple modules to work with. It also ensures that the module goes
174through its full installation process which may modify it.
175.Sh "Philosophy and History"
176.IX Subsection "Philosophy and History"
177.IP "Why not just use <insert other build config tool here>?" 4
178.IX Item "Why not just use <insert other build config tool here>?"
179Why did MakeMaker reinvent the build configuration wheel? Why not
180just use autoconf or automake or ppm or Ant or ...
181.Sp
182There are many reasons, but the major one is cross-platform
183compatibility.
184.Sp
185Perl is one of the most ported pieces of software ever. It works on
186operating systems I've never even heard of (see perlport for details).
187It needs a build tool that can work on all those platforms and with
188any wacky C compilers and linkers they might have.
189.Sp
190No such build tool exists. Even make itself has wildly different
191dialects. So we have to build our own.
192.IP "What is Module::Build and how does it relate to MakeMaker?" 4
193.IX Item "What is Module::Build and how does it relate to MakeMaker?"
194Module::Build is a project by Ken Williams to supplant MakeMaker.
195Its primary advantages are:
196.RS 4
197.IP "* pure perl. no make, no shell commands" 8
198.IX Item "pure perl. no make, no shell commands"
199.PD 0
200.IP "* easier to customize" 8
201.IX Item "easier to customize"
202.IP "* cleaner internals" 8
203.IX Item "cleaner internals"
204.IP "* less cruft" 8
205.IX Item "less cruft"
206.RE
207.RS 4
208.PD
209.Sp
210Module::Build is the official heir apparent to MakeMaker and we
211encourage people to work on M::B rather than spending time adding features
212to MakeMaker.
213.RE
214.Sh "Module Writing"
215.IX Subsection "Module Writing"
216.ie n .IP "How do I keep my $VERSION up to date without resetting it manually?" 4
217.el .IP "How do I keep my \f(CW$VERSION\fR up to date without resetting it manually?" 4
218.IX Item "How do I keep my $VERSION up to date without resetting it manually?"
219Often you want to manually set the \f(CW$VERSION\fR in the main module
220distribution because this is the version that everybody sees on \s-1CPAN\s0
221and maybe you want to customize it a bit. But for all the other
222modules in your dist, \f(CW$VERSION\fR is really just bookkeeping and all that's
223important is it goes up every time the module is changed. Doing this
224by hand is a pain and you often forget.
225.Sp
226Simplest way to do it automatically is to use your version control
227system's revision number (you are using version control, right?).
228.Sp
229In \s-1CVS\s0, \s-1RCS\s0 and \s-1SVN\s0 you use \f(CW$Revision\fR$ (see the documentation of your
230version control system for details) writing it like so:
231.Sp
232.Vb 1
233\& $VERSION = sprintf "%d.%03d", q$Revision$ =~ /(\ed+)/g;
234.Ve
235.Sp
236Every time the file is checked in the \f(CW$Revision\fR$ will be updated,
237updating your \f(CW$VERSION\fR.
238.Sp
239In \s-1CVS\s0 version 1.9 is followed by 1.10. Since \s-1CPAN\s0 compares version
240numbers numerically we use a \fIsprintf()\fR to convert 1.9 to 1.009 and
2411.10 to 1.010 which compare properly.
242.Sp
243If branches are involved (ie. \f(CW$Revision:\fR 1.5.3.4$) its a little more
244complicated.
245.Sp
246.Vb 2
247\& # must be all on one line or MakeMaker will get confused.
248\& $VERSION = do { my @r = (q$Revision$ =~ /\ed+/g); sprintf "%d."."%03d" x $#r, @r };
249.Ve
250.IP "What's this \fI\s-1META\s0.yml\fR thing and how did it get in my \fI\s-1MANIFEST\s0\fR?!" 4
251.IX Item "What's this META.yml thing and how did it get in my MANIFEST?!"
252\&\fI\s-1META\s0.yml\fR is a module meta-data file pioneered by Module::Build and
253automatically generated as part of the 'distdir' target (and thus
254\&'dist'). See \*(L"Module Meta\-Data\*(R" in ExtUtils::MakeMaker.
255.Sp
256To shut off its generation, pass the \f(CW\*(C`NO_META\*(C'\fR flag to \f(CW\*(C`WriteMakefile()\*(C'\fR.
257.Sh "\s-1XS\s0"
258.IX Subsection "XS"
259.ie n .IP "How to I prevent ""object version X.XX does not match bootstrap parameter Y.YY"" errors?" 4
260.el .IP "How to I prevent ``object version X.XX does not match bootstrap parameter Y.YY'' errors?" 4
261.IX Item "How to I prevent object version X.XX does not match bootstrap parameter Y.YY errors?"
262\&\s-1XS\s0 code is very sensitive to the module version number and will
263complain if the version number in your Perl module doesn't match. If
264you change your module's version # without reruning Makefile.PL the old
265version number will remain in the Makefile causing the \s-1XS\s0 code to be built
266with the wrong number.
267.Sp
268To avoid this, you can force the Makefile to be rebuilt whenever you
269change the module containing the version number by adding this to your
270\&\fIWriteMakefile()\fR arguments.
271.Sp
272.Vb 1
273\& depend => { '$(FIRST_MAKEFILE)' => '$(VERSION_FROM)' }
274.Ve
275.IP "How do I make two or more \s-1XS\s0 files coexist in the same directory?" 4
276.IX Item "How do I make two or more XS files coexist in the same directory?"
277Sometimes you need to have two and more \s-1XS\s0 files in the same package.
278One way to go is to put them into separate directories, but sometimes
279this is not the most suitable solution. The following technique allows
280you to put two (and more) \s-1XS\s0 files in the same directory.
281.Sp
282Let's assume that we have a package \f(CW\*(C`Cool::Foo\*(C'\fR, which includes
283\&\f(CW\*(C`Cool::Foo\*(C'\fR and \f(CW\*(C`Cool::Bar\*(C'\fR modules each having a separate \s-1XS\s0
284file. First we use the following \fIMakefile.PL\fR:
285.Sp
286.Vb 1
287\& use ExtUtils::MakeMaker;
288.Ve
289.Sp
290.Vb 6
291\& WriteMakefile(
292\& NAME => 'Cool::Foo',
293\& VERSION_FROM => 'Foo.pm',
294\& OBJECT => q/$(O_FILES)/,
295\& # ... other attrs ...
296\& );
297.Ve
298.Sp
299Notice the \f(CW\*(C`OBJECT\*(C'\fR attribute. MakeMaker generates the following
300variables in \fIMakefile\fR:
301.Sp
302.Vb 7
303\& # Handy lists of source code files:
304\& XS_FILES= Bar.xs \e
305\& Foo.xs
306\& C_FILES = Bar.c \e
307\& Foo.c
308\& O_FILES = Bar.o \e
309\& Foo.o
310.Ve
311.Sp
312Therefore we can use the \f(CW\*(C`O_FILES\*(C'\fR variable to tell MakeMaker to use
313these objects into the shared library.
314.Sp
315That's pretty much it. Now write \fIFoo.pm\fR and \fIFoo.xs\fR, \fIBar.pm\fR
316and \fIBar.xs\fR, where \fIFoo.pm\fR bootstraps the shared library and
317\&\fIBar.pm\fR simply loading \fIFoo.pm\fR.
318.Sp
319The only issue left is to how to bootstrap \fIBar.xs\fR. This is done
320from \fIFoo.xs\fR:
321.Sp
322.Vb 1
323\& MODULE = Cool::Foo PACKAGE = Cool::Foo
324.Ve
325.Sp
326.Vb 3
327\& BOOT:
328\& # boot the second XS file
329\& boot_Cool__Bar(aTHX_ cv);
330.Ve
331.Sp
332If you have more than two files, this is the place where you should
333boot extra \s-1XS\s0 files from.
334.Sp
335The following four files sum up all the details discussed so far.
336.Sp
337.Vb 3
338\& Foo.pm:
339\& -------
340\& package Cool::Foo;
341.Ve
342.Sp
343.Vb 1
344\& require DynaLoader;
345.Ve
346.Sp
347.Vb 3
348\& our @ISA = qw(DynaLoader);
349\& our $VERSION = '0.01';
350\& bootstrap Cool::Foo $VERSION;
351.Ve
352.Sp
353.Vb 1
354\& 1;
355.Ve
356.Sp
357.Vb 3
358\& Bar.pm:
359\& -------
360\& package Cool::Bar;
361.Ve
362.Sp
363.Vb 1
364\& use Cool::Foo; # bootstraps Bar.xs
365.Ve
366.Sp
367.Vb 1
368\& 1;
369.Ve
370.Sp
371.Vb 5
372\& Foo.xs:
373\& -------
374\& #include "EXTERN.h"
375\& #include "perl.h"
376\& #include "XSUB.h"
377.Ve
378.Sp
379.Vb 1
380\& MODULE = Cool::Foo PACKAGE = Cool::Foo
381.Ve
382.Sp
383.Vb 3
384\& BOOT:
385\& # boot the second XS file
386\& boot_Cool__Bar(aTHX_ cv);
387.Ve
388.Sp
389.Vb 1
390\& MODULE = Cool::Foo PACKAGE = Cool::Foo PREFIX = cool_foo_
391.Ve
392.Sp
393.Vb 2
394\& void
395\& cool_foo_perl_rules()
396.Ve
397.Sp
398.Vb 2
399\& CODE:
400\& fprintf(stderr, "Cool::Foo says: Perl Rules\en");
401.Ve
402.Sp
403.Vb 5
404\& Bar.xs:
405\& -------
406\& #include "EXTERN.h"
407\& #include "perl.h"
408\& #include "XSUB.h"
409.Ve
410.Sp
411.Vb 1
412\& MODULE = Cool::Bar PACKAGE = Cool::Bar PREFIX = cool_bar_
413.Ve
414.Sp
415.Vb 2
416\& void
417\& cool_bar_perl_rules()
418.Ve
419.Sp
420.Vb 2
421\& CODE:
422\& fprintf(stderr, "Cool::Bar says: Perl Rules\en");
423.Ve
424.Sp
425And of course a very basic test:
426.Sp
427.Vb 9
428\& test.pl:
429\& --------
430\& use Test;
431\& BEGIN { plan tests => 1 };
432\& use Cool::Foo;
433\& use Cool::Bar;
434\& Cool::Foo::perl_rules();
435\& Cool::Bar::perl_rules();
436\& ok 1;
437.Ve
438.Sp
439This tip has been brought to you by Nick Ing-Simmons and Stas Bekman.
440.SH "PATCHING"
441.IX Header "PATCHING"
442If you have a question you'd like to see added to the \s-1FAQ\s0 (whether or
443not you have the answer) please send it to makemaker@perl.org.
444.SH "AUTHOR"
445.IX Header "AUTHOR"
446The denizens of makemaker@perl.org.
447.SH "SEE ALSO"
448.IX Header "SEE ALSO"
449ExtUtils::MakeMaker