Subject: | Patch for building on Apple OS X |
Audio::TagLib fails to build on Apple OS X. This patch allows it to
build, install and operate correctly. Currently this patch is geared to
use the default bundled Perl in OS X, but that can probably be fixed
when I figure out a dynamic way to get the path.
This patch should have no effect on other systems.
Some of the builtin tests do fail on OS X, but I can't find anyway to
fix them, and it works just fine in my programs.
Subject: | osx-patch.diff |
--- Audio-TagLib-1.42/Makefile.PL 2006-04-17 05:43:46.000000000 -0600
+++ Audio-TagLib-1.42-OSX/Makefile.PL 2006-10-28 17:14:09.000000000 -0600
@@ -7,20 +7,28 @@
print STDOUT "ONLY support TagLib version 1.4.* on Linux\n";
require Carp;
# FIXME
- # openned for FreeBSD
+ # openned for FreeBSD and OS X (darwin)
Carp::croak("currently only support Linux\n")
- unless $^O eq 'linux' or $^O eq 'freebsd';
+ unless $^O eq 'linux' or $^O eq 'freebsd' or $^O eq 'darwin';
our $libpath = qx(taglib-config --prefix);
chomp($libpath);
our $incpath = $libpath . "/include/taglib";
$libpath .= -d $libpath. "/lib64" ? "/lib64" : "/lib";
my ($lib) = glob($libpath . "/libtag.so.1.4.*");
+ # OS X uses dylibs
+ if ($^O eq 'darwin') {
+ ($lib) = glob($libpath . "/libtag.1.4.*.dylib");
+ }
if (defined $lib) {
print STDOUT "got $lib, good, go on\n";
} else {
Carp::croak("version 1.4.* not found,".
"please install firstly\n");
}
+ our $libs = ['-ltag']; # e.g., '-lm'
+ if ($^O eq 'darwin') {
+ $libs = ['-liconv -L/System/Library/Perl/lib/5.8 -lperl ' . qx(taglib-config --libs)];
+ }
}
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
@@ -35,9 +43,9 @@
AUTHOR => 'Dongxu, Ma <dongxu@cpan.org>') : ()),
CC => 'g++',
LD => 'g++',
- LDDLFLAGS => "-shared -L${libpath}",
+ LDDLFLAGS => $^O eq 'darwin' ? "-dynamiclib -L${libpath}" : "-shared -L${libpath}",
XSOPT => '-C++ -hiertype',
- LIBS => ['-ltag'], # e.g., '-lm'
+ LIBS => $libs,
DEFINE => $^O eq 'freebsd' ? '-D_BSD_ICONV -DNO_DOXYGEN' : '-DNO_DOXYGEN', # e.g., '-DHAVE_SOMETHING'
INC => "-I${incpath} -I/usr/include -I./include ", # e.g., '-I. -I/usr/include/other'
# Un-comment this if you add C files to link with later: