File: Makefile.PL

package info (click to toggle)
libdata-uuid-libuuid-perl 0.05-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 336 kB
  • sloc: perl: 278; makefile: 3; ansic: 2
file content (49 lines) | stat: -rw-r--r-- 1,152 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
#!/usr/bin/perl -w

use strict;

use ExtUtils::MakeMaker;

my $conf = WriteMakefile(
    NAME         => 'Data::UUID::LibUUID',
    VERSION_FROM => 'lib/Data/UUID/LibUUID.pm',
    INSTALLDIRS  => 'site',
    SIGN         => 1,
    PL_FILES     => { },
    LIBS         => [ "-luuid" ],
    PREREQ_PM    => {
        'Test::use::ok' => 0,
        'Test::More' => 0,
        'Sub::Exporter' => 0,
        'MIME::Base64' => 0,
        'asa' => 0,
    },
);

unless ( try_compiling($conf, "hdr_check.c") ) {
    warn "\n*** ERROR: <uuid/uuid.h> seems to be missing ***\n"
       . "please install libuuid from e2fsprogs (available as uuid-dev on debian)\n\n";

    # Or CPAN::Reporter reports a failure
    unlink("Makefile");

    exit 1; # on Debian we want the build to abort
}

use File::Spec;

sub try_compiling {
    my ($conf, $file) = @_;

    my @cc = ( $conf->{CC}, '-c', $conf->{CCFLAGS}, $conf->{INC} || '' );

    if ( -e ( my $devnull = File::Spec->devnull ) ) {
        push @cc, '-o' => $devnull; # precompiled headers are pretty big
    }

    my $cmd = join " ", @cc, $file;

    warn "trying $cmd\n";

    return ( system($cmd) == 0 )
}