root/lang/perl/Text-MeCab/trunk/Makefile.PL @ 4334

Revision 4334, 1.9 kB (checked in by daisuke, 6 years ago)

lang/perl/Text-MeCab?; define MECAB_CONFIG constant

  • Property svn:keywords set to Id
Line 
1#!perl
2# $Id$
3#
4# Copyright (c) 2006-2008 Daisuke Maki <daisuke@endeworks.jp>
5# All rights reserved.
6
7use strict;
8use ExtUtils::MakeMaker;
9
10my $debugging = 0;
11for(my $i = 0; $i < @ARGV; $i++) {
12    if ($ARGV[$i] =~ /^--debugging$/) {
13        splice(@ARGV, $i, 1);
14        $debugging = 1;
15        $i--;
16    }
17}
18
19
20my $result = do 'tools/probe_mecab.pl';
21die if $@;
22
23print
24    "Detected the following mecab information:\n",
25    "   version: $result->{version}\n",
26    "   cflags: $result->{cflags}\n",
27    "   libs: $result->{libs}\n"
28;
29
30# XXX - I want to include this in future releases, but I don't know if
31# it works with Win32 properly (i.e., untested)
32# use Devel::CheckLib;
33# check_lib_or_exit(
34#     lib  => 'mecab',
35#     LIBS => join(' ', split(/\s+/, $result->{libs})),
36# );
37
38$result->{cflags} ||= '';
39$result->{cflags} .= ' -I src';
40
41# Hack. I don't like the layout where .xs files are on the top level.
42link("lib/Text/MeCab.xs", "MeCab.xs");
43
44my @define = (
45    "-DTEXT_MECAB_ENCODING='\"$result->{encoding}\"'",
46    "-DTEXT_MECAB_CONFIG='\"$result->{config}\"'",
47);
48if ($debugging) {
49    push @define, "-DTEXT_MECAB_DEBUG=1";
50}
51
52my %INFO = (
53    ABSTRACT     => 'Alternative Interface To libmecab',
54    AUTHOR       => 'Daisuke Maki <daisuke@endeworks.jp>',
55    CCFLAGS      => $result->{cflags},
56    DEFINE       => join( " ", @define ),
57    DISTNAME     => 'Text-MeCab',
58    INSTALLDIRS  => 'site',
59    LIBS         => [ split(/\s+/, $result->{libs}) ],
60    NAME         => 'Text::MeCab',
61    OBJECT       => '$(O_FILES)',
62    PREREQ_PM    => {
63#        'Devel::CheckLib' => 0,
64        'Encode'          => 0,
65        'Exporter'        => 0,
66        'File::Spec'      => 0,
67        'Test::More'      => 0,
68    },
69    VERSION_FROM => 'lib/Text/MeCab.pm',
70    clean        => {
71        FILES => 'lib/typemap MeCab.xs'
72    },
73    test         => {
74        TESTS    => 't/*.t t/*/*.t'
75    }
76);
77$INFO{OPTIMIZE} = '-g' if $debugging;
78
79WriteMakefile(%INFO);
Note: See TracBrowser for help on using the browser.