1use 5.006; 2use strict; 3use warnings; 4use ExtUtils::MakeMaker; 5use Config; 6use Getopt::Long qw(GetOptions :config pass_through); 7use Pod::Usage qw(pod2usage); 8# See lib/ExtUtils/MakeMaker.pm for details of how to influence 9# the contents of the Makefile that is written. 10 11#added by Lincoln Baxter to fix cflags (for long long on HPUX) 12#guidence from DBD-Oracle module 13{ 14 package MY; # SUPER needs package context, $self is not sufficient 15 use strict; 16 use Config; 17 my $os = $^O; 18 19 sub const_cccmd { 20 my ($self) = shift; 21 local($_) = $self->SUPER::const_cccmd(@_); 22 # are we using the non-bundled hpux compiler? 23 if ($os eq "hpux" and $Config::Config{ccflags} =~ /-Aa\b/) { 24 print "Changing -Aa to -Ae for HP-UX in ccmd to allow for long long.\n" 25 if s/-Aa\b/-Ae/g; # allow "long long" in UUID.h 26 } 27 $_; 28 } 29 sub cflags 30 { 31 my ($self) = shift; 32 local($_) = $self->SUPER::cflags(@_); 33 # are we using the non-bundled hpux compiler? 34 if ($os eq "hpux" and $Config::Config{ccflags} =~ /-Aa\b/) { 35 print "Changing -Aa to -Ae for HP-UX in cflags.\n" 36 if s/-Aa\b/-Ae/g; # allow "long long" in UUID.h 37 } 38 $_; 39 } 40}; 41 42WriteMakefile( 43 ($] >= 5.005 ## Add these new keywords supported since 5.005 44 ? (ABSTRACT_FROM => 'UUID.pm', # retrieve abstract from module 45 AUTHOR => 'Ricardo Signes <rjbs[at]cpan.org>') 46 : ()), 47 48 NAME => 'Data::UUID', 49 VERSION_FROM => 'UUID.pm', # finds $VERSION 50 PREREQ_PM => { 'Digest::MD5' => '0' }, # e.g., Module::Name => 1.1 51 LICENSE => 'bsd', 52 LIBS => [], # e.g., '-lm' 53 #works without -lsocket 54 DEFINE => '', # e.g., '-DHAVE_SOMETHING' 55 # Insert -I. if you add *.h files later: 56 INC => '', # e.g., '-I/usr/include/other' 57 # Un-comment this if you add C files to link with later: 58 OBJECT => '$(O_FILES)', # link all the C files too 59 CONFIGURE => sub { 60 my %opt; 61 GetOptions(\%opt, 's|state-storage-directory:s', 'd|default-umask:s', 62 'help|?', 'man') or pod2usage(2); 63 pod2usage(1) if $opt{help}; 64 pod2usage(-verbose => 2) if $opt{man}; 65 66 print "Configured options (run perl Makefile.PL --help for how to change this):\n"; 67 68 my $d; 69 if ($^O eq 'MSWin32' and -d "c:/tmp/") { 70 $d="c:/tmp"; 71 } else { 72 $d=eval { require File::Spec; File::Spec->tmpdir; } || '/var/tmp'; 73 } 74 $d = $opt{s} || $d; 75 print "\tUUID state storage: $d\n"; 76 $d =~ s/\\/\\\\/g if $^O eq 'MSWin32'; 77 78 my $m = '0007'; 79 unless ($^O eq 'MSWin32') { 80 $m = $opt{d} || $m; 81 print "\tdefault umask: $m\n"; 82 } 83 84 chmod(0666, sprintf("%s/%s", $d, ".UUID_NODEID")); 85 chmod(0666, sprintf("%s/%s", $d, ".UUID_STATE")); 86 return { 87 DEFINE => qq(-D_STDIR=\\"$d\\") 88 . qq( -D__$Config{osname}__) 89 . qq( -D_DEFAULT_UMASK=$m) 90 }; 91 } 92); 93 94__END__ 95 96=head1 NAME 97 98Makefile.PL - configure Makefile for Data::UUID 99 100=head1 SYNOPSIS 101 102perl Makefile.PL [options] [EU::MM options] 103 104perl Makefile.PL -s=/var/local/lib/data-uuid -d=0007 105 106 Options: 107 --state-storage-directory directory for storing library state information 108 --default-umask umask for files in the state storage directory 109 --help brief help message 110 --man full documentation 111 112Options can be abbreviated, see L<Getopt::Long/"Case and abbreviations">. 113 114=head1 OPTIONS 115 116=over 117 118=item --state-storage-directory 119 120Optional. Takes a string that is interpreted as directory for storing library 121state information. Default is c:/tmp/ on Windows if it already exists, or the 122operating system's temporary directory (see tmpdir in L<File::Spec/"METHODS">), 123or /var/tmp as fallback. 124 125=item --default-umask 126 127Optional. Takes a string that is interpreted as umask for the files in the state 128storage directory. Default is 0007. This is ignored on Windows. 129 130=item --help 131 132Print a brief help message and exits. 133 134=item --man 135 136Prints the manual page and exits. 137 138=back 139 140=head1 DESCRIPTION 141 142B<Makefile.PL> writes the Makefile for the Data::UUID library. It is configured 143with the options L</"--state-storage-directory"> and L</"--default-umask">. 144Unless given, default values are used. In any case the values are printed for 145confirmation. 146 147Additionally, the usual EU::MM options are processed, see 148L<ExtUtils::MakeMaker/"Using Attributes and Parameters">. 149