File: Makefile.PL

package info (click to toggle)
libfile-extattr-perl 1.09-7
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 364 kB
  • sloc: ansic: 1,864; perl: 1,221; makefile: 42
file content (66 lines) | stat: -rw-r--r-- 2,508 bytes parent folder | download | duplicates (3)
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
use lib qw(inc);
use ExtUtils::MakeMaker;
use Cwd;
use File::Temp qw/tempdir/;
use IO::File;
use strict;

my @DIRS = qw(. /usr/include);

# OpenBSD does not support extended attributes.
if ($^O eq 'openbsd') {
    warn 'OpenBSD does not support extended attributes';
    die "OS unsupported";
}

# Check whether extended attributes are supported on this filesystem.
# If we're running non-interactive there is no point failing all the tests,
# because the machine is not set up correctly.
if ($^O eq 'linux') {
    my $basedir = $ENV{ATTR_TEST_DIR} || getcwd();
    my $template .= "$basedir/XXXXXXXX";
    my $dir = tempdir($template, CLEANUP => 1);
    my $file = "$dir/testfile";
    my $fh = new IO::File(">$file") or die "Unable to open $file: $!";
    undef $fh;

    my $output = `setfattr -n user.foo -v foo $file 2>&1`;
    if ($output =~ /command not found/i) {
        warn "Please install the attr package (containing the setfattr program)";
        exit(0) if ($ENV{AUTOMATED_TESTING});
    }
    if ($output =~ /Operation not supported/i) {
        warn "To run the tests, you need mount the filesystem containing $basedir with the user_xattr option";
        warn "Alternatively set the environment variable ATTR_TEST_DIR to point at a filesystem where user_xattr is enabled";
        exit(0) if ($ENV{AUTOMATED_TESTING});
    }
}

# TODO: Check filesystem on other operating systems

# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    NAME              => 'File::ExtAttr',
    VERSION_FROM      => 'lib/File/ExtAttr.pm', # finds $VERSION
    PREREQ_PM         => {
	# e.g., Module::Name => 1.1
	'Carp' => 0,
	'Scalar::Util' => 0
    },
    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
      (ABSTRACT_FROM  => 'lib/File/ExtAttr.pm', # retrieve abstract from module
       AUTHOR         => 'Kevin M. Goess <kgoess@ensenda.com>'
                         .', Richard Dawe <richdawe@cpan.org>') : ()),
# Don't actually need -lattr on Linux.
#    LIBS              => ['-lattr'], # e.g., '-lm'
    OBJECT            => '$(O_FILES)',
    DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
    INC               => join(' ', map { "-I$_" } @DIRS),
#    'MYEXTLIB' => 'mylib/libxattrlib$(LIB_EXT)',
	# Un-comment this if you add C files to link with later:
    # OBJECT            => '$(O_FILES)', # link all the C files too

    # Hand-roll META.yml and MANIFEST.
    NO_META           => 1,
);