File: Makefile.PL

package info (click to toggle)
libfile-libmagic-perl 0.96-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 208 kB
  • ctags: 22
  • sloc: perl: 290; pascal: 88; ansic: 54; makefile: 16
file content (79 lines) | stat: -rw-r--r-- 2,619 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
#! perl -w

use 5.008;
use ExtUtils::MakeMaker;
use Config qw/%Config/;

use lib qw(inc);
use Devel::CheckLib;

check_lib_or_exit( lib => 'magic', header => 'magic.h' );

WriteMakefile(
    'NAME'		=> 'File::LibMagic',
    'VERSION_FROM'	=> 'LibMagic.pm', # finds $VERSION
    'PREREQ_PM'		=> { },
    'ABSTRACT_FROM'     => 'LibMagic.pm', # retrieve abstract from module
    'AUTHOR'            => 'Andreas Fitzner <andreas.fitzner@fv-berlin.de>',
    'LIBS'		=> ['-lmagic'], # e.g., '-lm'
    'DEFINE'		=> '', # e.g., '-DHAVE_SOMETHING'
    'INC'		=> '-I.', # e.g., '-I. -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
);
if  (eval {require ExtUtils::Constant; 1}) {
  # If you edit these definitions to change the constants used by this module,
  # you will need to use the generated const-c.inc and const-xs.inc
  # files to replace their "fallback" counterparts before distributing your
  # changes.

  my @names = (qw(MAGIC_CHECK MAGIC_COMPRESS MAGIC_CONTINUE MAGIC_DEBUG
               MAGIC_DEVICES MAGIC_ERROR MAGIC_MIME MAGIC_NONE
               MAGIC_PRESERVE_ATIME MAGIC_RAW MAGIC_SYMLINK));

  ExtUtils::Constant::WriteConstants(
                                     NAME         => 'File::LibMagic',
                                     NAMES        => \@names,
                                     DEFAULT_TYPE => 'IV',
                                     C_FILE       => 'const-c.inc',
                                     XS_FILE      => 'const-xs.inc',
                                  );

}
else {
  use File::Copy;
  use File::Spec;
  foreach my $file ('const-c.inc', 'const-xs.inc') {
    my $fallback = File::Spec->catfile('fallback', $file);
    copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
  }
}

# Michael does not like this test.

#open(TestFile,">test-if-libmagic-exists.c") || die "$|";
#print TestFile <<EOT;
##include <magic.h>
#
#int main(void) {
#	magic_t m;
#
#	m=magic_open(MAGIC_NONE);
#
#	return 0;
#}
#EOT
#
# my $exe = "test-if-libmagic-exists$Config{exe_ext}";
# $cc_cmd .= "$Config{cc} $Config{ccflags} -I$Config{archlibexp}/CORE -o $exe";
# my $rc = system("$cc_cmd $Config{ldflags} test-if-libmagic-exists.c -lmagic $Config{libs}");
#
# unlink("test-if-libmagic-exists.c", $exe, "test-if-libmagic-exists$Config{obj_ext}");
#
# if ($rc) {
#        warn "Can't compile test program. Make sure you have the file-4.x package installed\n",
#              "and libmagic is accessable (use ldconfig).\n";
#        exit 1; # exit with error to the shell
#  }

exit 0;