File: Makefile.PL

package info (click to toggle)
libdata-uuid-perl 1.219-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 184 kB
  • ctags: 136
  • sloc: ansic: 344; perl: 70; makefile: 11
file content (155 lines) | stat: -rw-r--r-- 4,704 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
use 5.006;
use strict;
use warnings;
use ExtUtils::MakeMaker;
use Config;
use Getopt::Long qw(GetOptions :config pass_through);
use Pod::Usage qw(pod2usage);
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.

#added by Lincoln Baxter to fix cflags (for long long on HPUX)
#guidence from DBD-Oracle module
{
    package MY; # SUPER needs package context, $self is not sufficient
    use strict;
    use Config;
    my $os = $^O;

    sub const_cccmd {
        my ($self) = shift;
        local($_) = $self->SUPER::const_cccmd(@_);
        # are we using the non-bundled hpux compiler?
        if ($os eq "hpux" and $Config::Config{ccflags} =~ /-Aa\b/) {
            print "Changing -Aa to -Ae for HP-UX in ccmd to allow for long long.\n"
             if s/-Aa\b/-Ae/g;  # allow "long long" in UUID.h
        }
        $_;
    }
    sub cflags 
    {
        my ($self) = shift;
        local($_) = $self->SUPER::cflags(@_);
        # are we using the non-bundled hpux compiler?
        if ($os eq "hpux" and $Config::Config{ccflags} =~ /-Aa\b/) {
            print "Changing -Aa to -Ae for HP-UX in cflags.\n"
             if s/-Aa\b/-Ae/g;  # allow "long long" in UUID.h
        }
        $_;
    }
};

WriteMakefile(
  ($] >= 5.005 ## Add these new keywords supported since 5.005
  ? (ABSTRACT_FROM => 'UUID.pm', # retrieve abstract from module
     AUTHOR        => 'Ricardo Signes <rjbs[at]cpan.org>')
  : ()),

  NAME                => 'Data::UUID',
  VERSION_FROM        => 'UUID.pm', # finds $VERSION
  PREREQ_PM           => { 'Digest::MD5' => '0' }, # e.g., Module::Name => 1.1
  LICENSE             => 'bsd',
  LIBS                => [], # e.g., '-lm'
  #works without -lsocket
  DEFINE              => '', # e.g., '-DHAVE_SOMETHING'
  # Insert -I. if you add *.h files later:
  INC                 => '', # e.g., '-I/usr/include/other'
  # Un-comment this if you add C files to link with later:
  OBJECT              => '$(O_FILES)', # link all the C files too
  META_MERGE => {
    resources => {
      bugtracker  => 'https://github.com/rjbs/Data-UUID/issues',
      repository  => 'https://github.com/rjbs/Data-UUID',
    },
},

  CONFIGURE           => sub {
    my %opt;
    GetOptions(\%opt, 's|state-storage-directory:s', 'd|default-umask:s',
        'help|?', 'man') or pod2usage(2);
    pod2usage(1) if $opt{help};
    pod2usage(-verbose => 2) if $opt{man};

    print "Configured options (run perl Makefile.PL --help for how to change this):\n";

    my $d;
    if ($^O eq 'MSWin32' and -d "c:/tmp/") {
     $d="c:/tmp";
    } else {
     $d=eval { require File::Spec; File::Spec->tmpdir; } || '/var/tmp';
    }
    $d = $opt{s} || $d;
    print "\tUUID state storage: $d\n";
    $d =~ s/\\/\\\\/g if $^O eq 'MSWin32';

    my $m = '0007';
    unless ($^O eq 'MSWin32') {
        $m = $opt{d} || $m;
        print "\tdefault umask: $m\n";
    }

    chmod(0666, sprintf("%s/%s", $d, ".UUID_NODEID"));
    chmod(0666, sprintf("%s/%s", $d, ".UUID_STATE"));
    return {
      DEFINE => qq(-D_STDIR=\\"$d\\")
              . qq( -D__$Config{osname}__)
              . qq( -D_DEFAULT_UMASK=$m)
    };
  }
);

__END__

=head1 NAME

Makefile.PL - configure Makefile for Data::UUID

=head1 SYNOPSIS

perl Makefile.PL [options] [EU::MM options]

perl Makefile.PL -s=/var/local/lib/data-uuid -d=0007

    Options:
    --state-storage-directory   directory for storing library state information
    --default-umask             umask for files in the state storage directory
    --help                      brief help message
    --man                       full documentation

Options can be abbreviated, see L<Getopt::Long/"Case and abbreviations">.

=head1 OPTIONS

=over

=item --state-storage-directory

Optional. Takes a string that is interpreted as directory for storing library
state information. Default is c:/tmp/ on Windows if it already exists, or the
operating system's temporary directory (see tmpdir in L<File::Spec/"METHODS">),
or /var/tmp as fallback.

=item --default-umask

Optional. Takes a string that is interpreted as umask for the files in the state
storage directory. Default is 0007. This is ignored on Windows.

=item --help

Print a brief help message and exits.

=item --man

Prints the manual page and exits.

=back

=head1 DESCRIPTION

B<Makefile.PL> writes the Makefile for the Data::UUID library. It is configured
with the options L</"--state-storage-directory"> and L</"--default-umask">.
Unless given, default values are used. In any case the values are printed for
confirmation.

Additionally, the usual EU::MM options are processed, see
L<ExtUtils::MakeMaker/"Using Attributes and Parameters">.