| 1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
| 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 "2003-08-18" "perl v5.8.0" "User Contributed Perl Documentation" |
| 133 | .SH "NAME" |
| 134 | ExtUtils::MakeMaker::FAQ \- Frequently Asked Questions About MakeMaker |
| 135 | .SH "DESCRIPTION" |
| 136 | .IX Header "DESCRIPTION" |
| 137 | FAQs, 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?" |
| 142 | Recent versions of MakeMaker will only install man pages on Unix like |
| 143 | operating systems. |
| 144 | .Sp |
| 145 | For an individual module: |
| 146 | .Sp |
| 147 | .Vb 1 |
| 148 | \& perl Makefile.PL INSTALLMAN1DIR=none INSTALLMAN3DIR=none |
| 149 | .Ve |
| 150 | .Sp |
| 151 | If you want to suppress man page installation for all modules you have |
| 152 | to reconfigure Perl and tell it 'none' when it asks where to install |
| 153 | man 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?" |
| 156 | Two 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 |
| 164 | blib/lib and blib/arch directories. |
| 165 | .Sp |
| 166 | The 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 |
| 172 | And then set \s-1PERL5LIB\s0 to /tmp/lib/perl. This works well when you have |
| 173 | multiple modules to work with. It also ensures that the module goes |
| 174 | through 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>?" |
| 179 | Why did MakeMaker reinvent the build configuration wheel? Why not |
| 180 | just use autoconf or automake or ppm or Ant or ... |
| 181 | .Sp |
| 182 | There are many reasons, but the major one is cross-platform |
| 183 | compatibility. |
| 184 | .Sp |
| 185 | Perl is one of the most ported pieces of software ever. It works on |
| 186 | operating systems I've never even heard of (see perlport for details). |
| 187 | It needs a build tool that can work on all those platforms and with |
| 188 | any wacky C compilers and linkers they might have. |
| 189 | .Sp |
| 190 | No such build tool exists. Even make itself has wildly different |
| 191 | dialects. 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?" |
| 194 | Module::Build is a project by Ken Williams to supplant MakeMaker. |
| 195 | Its primary advantages are: |
| 196 | .RS 4 |
| 197 | .IP "\(bu pure perl. no make, no shell commands" 8 |
| 198 | .IX Item "pure perl. no make, no shell commands" |
| 199 | .PD 0 |
| 200 | .IP "\(bu easier to customize" 8 |
| 201 | .IX Item "easier to customize" |
| 202 | .IP "\(bu cleaner internals" 8 |
| 203 | .IX Item "cleaner internals" |
| 204 | .IP "\(bu less cruft" 8 |
| 205 | .IX Item "less cruft" |
| 206 | .RE |
| 207 | .RS 4 |
| 208 | .PD |
| 209 | .Sp |
| 210 | Module::Build is the official heir apparent to MakeMaker and we |
| 211 | encourage people to work on M::B rather than spending time adding features |
| 212 | to 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?" |
| 219 | Often you want to manually set the \f(CW$VERSION\fR in the main module |
| 220 | distribution because this is the version that everybody sees on \s-1CPAN\s0 |
| 221 | and maybe you want to customize it a bit. But for all the other |
| 222 | modules in your dist, \f(CW$VERSION\fR is really just bookkeeping and all that's |
| 223 | important is it goes up every time the module is changed. Doing this |
| 224 | by hand is a pain and you often forget. |
| 225 | .Sp |
| 226 | Simplest way to do it automatically is to use your version control |
| 227 | system's revision number (you are using version control, right?). |
| 228 | .Sp |
| 229 | In \s-1CVS\s0 and \s-1RCS\s0 you use $\&Revision$ writing it like so: |
| 230 | .Sp |
| 231 | .Vb 1 |
| 232 | \& $VERSION = sprintf "%d.%03d", q$Revision: 1.10 $ =~ /(\ed+)/g; |
| 233 | .Ve |
| 234 | .Sp |
| 235 | Every time the file is checked in the $\&Revision$ will be updated, |
| 236 | updating your \f(CW$VERSION\fR. |
| 237 | .Sp |
| 238 | In \s-1CVS\s0 version 1.9 is followed by 1.10. Since \s-1CPAN\s0 compares version |
| 239 | numbers numerically we use a \fIsprintf()\fR to convert 1.9 to 1.009 and |
| 240 | 1.10 to 1.010 which compare properly. |
| 241 | .Sp |
| 242 | If branches are involved (ie. $\&Revision: 1.5.3.4) its a little more |
| 243 | complicated. |
| 244 | .Sp |
| 245 | .Vb 2 |
| 246 | \& # must be all on one line or MakeMaker will get confused. |
| 247 | \& $VERSION = do { my @r = (q$Revision: 1.10 $ =~ /\ed+/g); sprintf "%d."."%03d" x $#r, @r }; |
| 248 | .Ve |
| 249 | .IP "What's this \fI\s-1META\s0.yml\fR thing and how did it get in my \fI\s-1MANIFEST\s0\fR?!" 4 |
| 250 | .IX Item "What's this META.yml thing and how did it get in my MANIFEST?!" |
| 251 | \&\fI\s-1META\s0.yml\fR is a module meta-data file pioneered by Module::Build and |
| 252 | automatically generated as part of the 'distdir' target (and thus |
| 253 | \&'dist'). See \*(L"Module Meta\-Data\*(R" in ExtUtils::MakeMaker. |
| 254 | .Sp |
| 255 | To shut off its generation, pass the \f(CW\*(C`NO_META\*(C'\fR flag to \f(CW\*(C`WriteMakefile()\*(C'\fR. |
| 256 | .Sh "\s-1XS\s0" |
| 257 | .IX Subsection "XS" |
| 258 | .ie n .IP "How to I prevent ""object version X.XX does not match bootstrap parameter Y.YY"" errors?" 4 |
| 259 | .el .IP "How to I prevent ``object version X.XX does not match bootstrap parameter Y.YY'' errors?" 4 |
| 260 | .IX Item "How to I prevent object version X.XX does not match bootstrap parameter Y.YY errors?" |
| 261 | \&\s-1XS\s0 code is very sensitive to the module version number and will |
| 262 | complain if the version number in your Perl module doesn't match. If |
| 263 | you change your module's version # without reruning Makefile.PL the old |
| 264 | version number will remain in the Makefile causing the \s-1XS\s0 code to be built |
| 265 | with the wrong number. |
| 266 | .Sp |
| 267 | To avoid this, you can force the Makefile to be rebuilt whenever you |
| 268 | change the module containing the version number by adding this to your |
| 269 | \&\fIWriteMakefile()\fR arguments. |
| 270 | .Sp |
| 271 | .Vb 1 |
| 272 | \& depend => { '$(FIRST_MAKEFILE)' => '$(VERSION_FROM)' } |
| 273 | .Ve |
| 274 | .IP "How do I make two or more \s-1XS\s0 files coexist in the same directory?" 4 |
| 275 | .IX Item "How do I make two or more XS files coexist in the same directory?" |
| 276 | Sometimes you need to have two and more \s-1XS\s0 files in the same package. |
| 277 | One way to go is to put them into separate directories, but sometimes |
| 278 | this is not the most suitable solution. The following technique allows |
| 279 | you to put two (and more) \s-1XS\s0 files in the same directory. |
| 280 | .Sp |
| 281 | Let's assume that we have a package \f(CW\*(C`Cool::Foo\*(C'\fR, which includes |
| 282 | \&\f(CW\*(C`Cool::Foo\*(C'\fR and \f(CW\*(C`Cool::Bar\*(C'\fR modules each having a separate \s-1XS\s0 |
| 283 | file. First we use the following \fIMakefile.PL\fR: |
| 284 | .Sp |
| 285 | .Vb 1 |
| 286 | \& use ExtUtils::MakeMaker; |
| 287 | .Ve |
| 288 | .Sp |
| 289 | .Vb 6 |
| 290 | \& WriteMakefile( |
| 291 | \& NAME => 'Cool::Foo', |
| 292 | \& VERSION_FROM => 'Foo.pm', |
| 293 | \& OBJECT => q/$(O_FILES)/, |
| 294 | \& # ... other attrs ... |
| 295 | \& ); |
| 296 | .Ve |
| 297 | .Sp |
| 298 | Notice the \f(CW\*(C`OBJECT\*(C'\fR attribute. MakeMaker generates the following |
| 299 | variables in \fIMakefile\fR: |
| 300 | .Sp |
| 301 | .Vb 7 |
| 302 | \& # Handy lists of source code files: |
| 303 | \& XS_FILES= Bar.xs \e |
| 304 | \& Foo.xs |
| 305 | \& C_FILES = Bar.c \e |
| 306 | \& Foo.c |
| 307 | \& O_FILES = Bar.o \e |
| 308 | \& Foo.o |
| 309 | .Ve |
| 310 | .Sp |
| 311 | Therefore we can use the \f(CW\*(C`O_FILES\*(C'\fR variable to tell MakeMaker to use |
| 312 | these objects into the shared library. |
| 313 | .Sp |
| 314 | That's pretty much it. Now write \fIFoo.pm\fR and \fIFoo.xs\fR, \fIBar.pm\fR |
| 315 | and \fIBar.xs\fR, where \fIFoo.pm\fR bootstraps the shared library and |
| 316 | \&\fIBar.pm\fR simply loading \fIFoo.pm\fR. |
| 317 | .Sp |
| 318 | The only issue left is to how to bootstrap \fIBar.xs\fR. This is done |
| 319 | from \fIFoo.xs\fR: |
| 320 | .Sp |
| 321 | .Vb 1 |
| 322 | \& MODULE = Cool::Foo PACKAGE = Cool::Foo |
| 323 | .Ve |
| 324 | .Sp |
| 325 | .Vb 3 |
| 326 | \& BOOT: |
| 327 | \& # boot the second XS file |
| 328 | \& boot_Cool__Bar(aTHX_ cv); |
| 329 | .Ve |
| 330 | .Sp |
| 331 | If you have more than two files, this is the place where you should |
| 332 | boot extra \s-1XS\s0 files from. |
| 333 | .Sp |
| 334 | The following four files sum up all the details discussed so far. |
| 335 | .Sp |
| 336 | .Vb 3 |
| 337 | \& Foo.pm: |
| 338 | \& ------- |
| 339 | \& package Cool::Foo; |
| 340 | .Ve |
| 341 | .Sp |
| 342 | .Vb 1 |
| 343 | \& require DynaLoader; |
| 344 | .Ve |
| 345 | .Sp |
| 346 | .Vb 3 |
| 347 | \& our @ISA = qw(DynaLoader); |
| 348 | \& our $VERSION = '0.01'; |
| 349 | \& bootstrap Cool::Foo $VERSION; |
| 350 | .Ve |
| 351 | .Sp |
| 352 | .Vb 1 |
| 353 | \& 1; |
| 354 | .Ve |
| 355 | .Sp |
| 356 | .Vb 3 |
| 357 | \& Bar.pm: |
| 358 | \& ------- |
| 359 | \& package Cool::Bar; |
| 360 | .Ve |
| 361 | .Sp |
| 362 | .Vb 1 |
| 363 | \& use Cool::Foo; # bootstraps Bar.xs |
| 364 | .Ve |
| 365 | .Sp |
| 366 | .Vb 1 |
| 367 | \& 1; |
| 368 | .Ve |
| 369 | .Sp |
| 370 | .Vb 5 |
| 371 | \& Foo.xs: |
| 372 | \& ------- |
| 373 | \& #include "EXTERN.h" |
| 374 | \& #include "perl.h" |
| 375 | \& #include "XSUB.h" |
| 376 | .Ve |
| 377 | .Sp |
| 378 | .Vb 1 |
| 379 | \& MODULE = Cool::Foo PACKAGE = Cool::Foo |
| 380 | .Ve |
| 381 | .Sp |
| 382 | .Vb 3 |
| 383 | \& BOOT: |
| 384 | \& # boot the second XS file |
| 385 | \& boot_Cool__Bar(aTHX_ cv); |
| 386 | .Ve |
| 387 | .Sp |
| 388 | .Vb 1 |
| 389 | \& MODULE = Cool::Foo PACKAGE = Cool::Foo PREFIX = cool_foo_ |
| 390 | .Ve |
| 391 | .Sp |
| 392 | .Vb 2 |
| 393 | \& void |
| 394 | \& cool_foo_perl_rules() |
| 395 | .Ve |
| 396 | .Sp |
| 397 | .Vb 2 |
| 398 | \& CODE: |
| 399 | \& fprintf(stderr, "Cool::Foo says: Perl Rules\en"); |
| 400 | .Ve |
| 401 | .Sp |
| 402 | .Vb 5 |
| 403 | \& Bar.xs: |
| 404 | \& ------- |
| 405 | \& #include "EXTERN.h" |
| 406 | \& #include "perl.h" |
| 407 | \& #include "XSUB.h" |
| 408 | .Ve |
| 409 | .Sp |
| 410 | .Vb 1 |
| 411 | \& MODULE = Cool::Bar PACKAGE = Cool::Bar PREFIX = cool_bar_ |
| 412 | .Ve |
| 413 | .Sp |
| 414 | .Vb 2 |
| 415 | \& void |
| 416 | \& cool_bar_perl_rules() |
| 417 | .Ve |
| 418 | .Sp |
| 419 | .Vb 2 |
| 420 | \& CODE: |
| 421 | \& fprintf(stderr, "Cool::Bar says: Perl Rules\en"); |
| 422 | .Ve |
| 423 | .Sp |
| 424 | And of course a very basic test: |
| 425 | .Sp |
| 426 | .Vb 9 |
| 427 | \& test.pl: |
| 428 | \& -------- |
| 429 | \& use Test; |
| 430 | \& BEGIN { plan tests => 1 }; |
| 431 | \& use Cool::Foo; |
| 432 | \& use Cool::Bar; |
| 433 | \& Cool::Foo::perl_rules(); |
| 434 | \& Cool::Bar::perl_rules(); |
| 435 | \& ok 1; |
| 436 | .Ve |
| 437 | .Sp |
| 438 | This tip has been brought to you by Nick Ing-Simmons and Stas Bekman. |
| 439 | .SH "PATCHING" |
| 440 | .IX Header "PATCHING" |
| 441 | If you have a question you'd like to see added to the \s-1FAQ\s0 (whether or |
| 442 | not you have the answer) please send it to makemaker@perl.org. |
| 443 | .SH "AUTHOR" |
| 444 | .IX Header "AUTHOR" |
| 445 | The denizens of makemaker@perl.org. |
| 446 | .SH "SEE ALSO" |
| 447 | .IX Header "SEE ALSO" |
| 448 | ExtUtils::MakeMaker |