1 use ExtUtils::MakeMaker;
4 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
5 # the contents of the Makefile that is written.
7 # Note: This is a hack. This hack is necessary because MacFUSE's libfuse
8 # (and libfuse_ino64, by extension) don't link in libiconv. This wouldn't
9 # be a problem, but it appears the Darwin/OS X dynamic linker won't
10 # satisfy runtime link dependencies in those libraries from libraries
11 # imported by our library, and it uses a symbol from libiconv without
12 # actually linking the library to itself. Awesome.
14 sub test_via_harness {
15 my($self, $perl, $tests) = @_;
16 local $_ = $self->SUPER::test_via_harness($perl, $tests);
17 s/PERL_DL_NONLAZY=1//g if $^O eq 'darwin';
22 my($self, $perl, $tests) = @_;
23 local $_ = $self->SUPER::test_via_script($perl, $tests);
24 s/PERL_DL_NONLAZY=1//g if $^O eq 'darwin';
30 chomp(my $fusever = `pkg-config --modversion fuse 2> /dev/null`);
31 # Required for refuse on NetBSD
32 if (!$fusever && $^O eq 'netbsd') {
33 chomp($fusever = `fusermount -V`);
34 $fusever =~ s/^.*?version:\s+//;
38 # make CPANPLUS happy and don't report errors if fuse isn't installed
41 if (-e '/etc/debian_version') {
42 $explanation = 'You need to install "libfuse-dev" to provide build support for this module';
44 elsif (-e '/etc/redhat-release') {
45 $explanation = 'You need to install "fuse-devel" to provide build support for this module';
48 $explanation = 'I don\'t know your Linux distribution, but please install the FUSE libraries and headers to build this module';
51 elsif ($^O eq 'freebsd') {
52 $explanation = 'You need to install the "fusefs-libs" package from ports to support this module';
54 elsif ($^O eq 'netbsd') {
55 $explanation = 'Could not find librefuse? Maybe install "perfuse" from pkgsrc, or upgrade to newer NetBSD';
57 elsif ($^O eq 'darwin') {
58 $explanation = 'Please install MacFuse from http://code.google.com/p/macfuse/';
61 $explanation = 'There is no FUSE support for your platform to our knowledge, sorry';
63 die("Cannot build for platform: $^O\n", $explanation, "\n");
65 if ($fusever && $fusever + 0 < 2.6) {
66 die "FUSE API is ", $fusever, ", must be 2.6 or later\n";
68 warn "fuse version found: ", $fusever, "\n";
71 chomp(my $inc = `pkg-config --cflags-only-I fuse 2> /dev/null`);
72 chomp(my $libs = `pkg-config --libs-only-L fuse 2> /dev/null`);
73 chomp($libs .= `pkg-config --libs-only-l fuse 2> /dev/null` || (($^O eq 'netbsd') ? '-lrefuse' : '-lfuse'));
74 # Needed for Fuse on OS X 10.6, due to 10.6 and up always using the 64-bit
75 # inode structs; unfortunately MacFuse doesn't just do the right thing
77 if ($^O eq 'darwin' && (uname())[2] =~ /^10\./) {
78 $libs =~ s/-lfuse/-lfuse_ino64/;
80 chomp(my $def = '-Wall -DFUSE_USE_VERSION=26 ' . `pkg-config --cflags-only-other fuse 2> /dev/null` || '-D_FILE_OFFSET_BITS=64');
81 chomp($def .= `pkg-config --libs-only-other fuse 2> /dev/null`);
82 $def .= ' -DPERL_HAS_64BITINT' if $Config{'use64bitint'};
86 'VERSION_FROM' => 'Fuse.pm', # finds $VERSION
87 'PREREQ_PM' => { # e.g., Module::Name => 1.1
89 'Filesys::Statvfs' => 0,
92 ($] >= 5.005 ? ## Add these new keywords supported since 5.005
93 (ABSTRACT_FROM => 'Fuse.pm', # retrieve abstract from module
94 AUTHOR => 'Mark Glines <mark@glines.org>') : ()),
95 ($ExtUtils::MakeMaker::VERSION < 6.3002 ? () : (
96 'LICENSE' => 'LGPL_2_1',
98 ($ExtUtils::MakeMaker::VERSION < 6.46 ? () : (
101 license => 'http://www.gnu.org/licenses/lgpl-2.1.html',
102 bugtracker => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Fuse',
103 repository => 'http://github.com/dpavlin/perl-fuse'
107 'LIBS' => '-lpthread ' . $libs, # e.g., '-lm'
108 'DEFINE' => $def, # e.g., '-DHAVE_SOMETHING'
109 'OPTIMIZE' => '-g -ggdb',
110 # Insert -I. if you add *.h files later:
111 'INC' => $inc, # e.g., '-I/usr/include/other'
112 # Un-comment this if you add C files to link with later:
113 'OBJECT' => 'Fuse$(OBJ_EXT)', # link all the C files too
117 return <<'MAKE_MORE';
126 @echo -n "Upload" Fuse-*.tar.gz "to CPAN? [y/N]:"
127 @read upload && test "$$upload" == "y" && cpan-upload -verbose Fuse-*.tar.gz
132 svn2cvs.pl file:///home/dpavlin/private/svn/fuse/perl-llin :ext:dpavlin@fuse.cvs.sourceforge.net:/cvsroot/fuse perl
137 # vim: ts=4 ai et hls