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 META_MERGE => { 60 resources => { 61 bugtracker => 'https://github.com/rjbs/Data-UUID/issues', 62 repository => 'https://github.com/rjbs/Data-UUID', 63 }, 64}, 65 66 CONFIGURE => sub { 67 my %opt; 68 GetOptions(\%opt, 's|state-storage-directory:s', 'd|default-umask:s', 69 'help|?', 'man') or pod2usage(2); 70 pod2usage(1) if $opt{help}; 71 pod2usage(-verbose => 2) if $opt{man}; 72 73 print "Configured options (run perl Makefile.PL --help for how to change this):\n"; 74 75 my $d; 76 if ($^O eq 'MSWin32' and -d "c:/tmp/") { 77 $d="c:/tmp"; 78 } else { 79 $d=eval { require File::Spec; File::Spec->tmpdir; } || '/var/tmp'; 80 } 81 $d = $opt{s} || $d; 82 print "\tUUID state storage: $d\n"; 83 $d =~ s/\\/\\\\/g if $^O eq 'MSWin32'; 84 85 my $m = '0007'; 86 unless ($^O eq 'MSWin32') { 87 $m = $opt{d} || $m; 88 print "\tdefault umask: $m\n"; 89 } 90 91 chmod(0666, sprintf("%s/%s", $d, ".UUID_NODEID")); 92 chmod(0666, sprintf("%s/%s", $d, ".UUID_STATE")); 93 return { 94 DEFINE => qq(-D_STDIR=\\"$d\\") 95 . qq( -D__$Config{osname}__) 96 . qq( -D_DEFAULT_UMASK=$m) 97 }; 98 } 99); 100 101__END__ 102 103=head1 NAME 104 105Makefile.PL - configure Makefile for Data::UUID 106 107=head1 SYNOPSIS 108 109perl Makefile.PL [options] [EU::MM options] 110 111perl Makefile.PL -s=/var/local/lib/data-uuid -d=0007 112 113 Options: 114 --state-storage-directory directory for storing library state information 115 --default-umask umask for files in the state storage directory 116 --help brief help message 117 --man full documentation 118 119Options can be abbreviated, see L<Getopt::Long/"Case and abbreviations">. 120 121=head1 OPTIONS 122 123=over 124 125=item --state-storage-directory 126 127Optional. Takes a string that is interpreted as directory for storing library 128state information. Default is c:/tmp/ on Windows if it already exists, or the 129operating system's temporary directory (see tmpdir in L<File::Spec/"METHODS">), 130or /var/tmp as fallback. 131 132=item --default-umask 133 134Optional. Takes a string that is interpreted as umask for the files in the state 135storage directory. Default is 0007. This is ignored on Windows. 136 137=item --help 138 139Print a brief help message and exits. 140 141=item --man 142 143Prints the manual page and exits. 144 145=back 146 147=head1 DESCRIPTION 148 149B<Makefile.PL> writes the Makefile for the Data::UUID library. It is configured 150with the options L</"--state-storage-directory"> and L</"--default-umask">. 151Unless given, default values are used. In any case the values are printed for 152confirmation. 153 154Additionally, the usual EU::MM options are processed, see 155L<ExtUtils::MakeMaker/"Using Attributes and Parameters">. 156