Skip to content

Commit

Permalink
Merge pull request #16 from titsuki/fix-travis
Browse files Browse the repository at this point in the history
Use zef instead of panda
  • Loading branch information
titsuki authored Jul 19, 2017
2 parents 1c35ef1 + ed07b5e commit 440e4e0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ language: perl6
perl6:
- latest
install:
- rakudobrew build-panda
- panda --notests installdeps .
- rakudobrew build-zef
- zef --debug --depsonly --/test install .
script:
- perl6 -MPanda::Builder -e 'Panda::Builder.build(~$*CWD)'
- zef build .
- PERL6LIB=$PWD/lib prove -e perl6 -vr t/
sudo: false
72 changes: 41 additions & 31 deletions Build.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use LibraryMake;
use Zef::Fetch;
use Zef::Extract;

class Build {
method build($workdir) {
Expand All @@ -25,21 +27,23 @@ class Build {
my $goback = $*CWD;
my $srcdir = "$workdir/src";
my %vars = get-vars($workdir);
chdir($srcdir);
my $wget-exit-code = run 'which', 'wget';
if $wget-exit-code == 0 {
my $CMD = qq:x/which wget/.subst(/\s*/,"",:g);
my $url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE";
my $dl-exit-code = run $CMD, $url, "-O", "mecab-0.996.tar.gz";
if not $dl-exit-code == 0 {
die;
}
}
if "mecab-0.996".IO.d {
run 'rm', '-rf', 'mecab-0.996';
}
run 'tar', 'xvzf', 'mecab-0.996.tar.gz';


my @fetch-backends = [
{ module => "Zef::Service::Shell::wget" },
{ module => "Zef::Service::Shell::curl" },
];
my $fetcher = Zef::Fetch.new(:backends(@fetch-backends));
my $uri = 'https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE';
my $archive-file = "mecab-0.996.tar.gz".IO.e
?? "mecab-0.996.tar.gz"
!! $fetcher.fetch($uri, "mecab-0.996.tar.gz");

my @extract-backends = [
{ module => "Zef::Service::Shell::tar" },
{ module => "Zef::Service::Shell::p5tar" },
];
my $extractor = Zef::Extract.new(:backends(@extract-backends));
my $extract-dir = $extractor.extract($archive-file, $*CWD);
if "mecab-0.996".IO.d {
shell "patch -p1 mecab-0.996/src/mecab.h < $srcdir/mecab.h.patch";
shell "patch -p1 mecab-0.996/src/libmecab.cpp < $srcdir/libmecab.cpp.patch";
Expand All @@ -52,32 +56,38 @@ class Build {
run 'echo', "$prefix/lib", '>', '/etc/ld.so.conf.d/mecab.conf';
chdir($goback);
}

method !install-mecab-ipadic($workdir, $prefix) {
my $goback = $*CWD;
my $srcdir = "$workdir/src";
my %vars = get-vars($workdir);
chdir($srcdir);
my $wget-exit-code = run 'which', 'wget';
if $wget-exit-code == 0 {
my $CMD = qq:x/which wget/.subst(/\s*/,"",:g);
my $url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM";
my $dl-exit-code = run $CMD, $url, "-O", "mecab-ipadic-2.7.0-20070801.tar.gz";
if not $dl-exit-code == 0 {
die;
}
}
if "mecab-ipadic-2.7.0-20070801".IO.d {
run 'rm', '-rf', 'mecab-ipadic-2.7.0-20070801';
}
run 'tar', 'xvzf', 'mecab-ipadic-2.7.0-20070801.tar.gz';

my @fetch-backends = [
{ module => "Zef::Service::Shell::wget" },
{ module => "Zef::Service::Shell::curl" },
];
my $fetcher = Zef::Fetch.new(:backends(@fetch-backends));
my $uri = 'https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM';
my $archive-file = "mecab-ipadic-2.7.0-20070801.tar.gz".IO.e
?? "mecab-ipadic-2.7.0-20070801.tar.gz"
!! $fetcher.fetch($uri, "mecab-ipadic-2.7.0-20070801.tar.gz");

my @extract-backends = [
{ module => "Zef::Service::Shell::tar" },
{ module => "Zef::Service::Shell::p5tar" },
];
my $extractor = Zef::Extract.new(:backends(@extract-backends));
my $extract-dir = $archive-file.IO.basename.subst(/\.tar\.gz/, '').IO.e
?? $archive-file.IO.basename.subst(/\.tar\.gz/, '').IO
!! $extractor.extract($archive-file, $*CWD);

chdir("mecab-ipadic-2.7.0-20070801");
shell("./configure --with-charset=utf8 --prefix=$prefix --with-mecab-config=$prefix/bin/mecab-config");
shell("make");
shell("make install");
chdir($goback);
}

method isa($what) {
return True if $what.^name eq 'Panda::Builder';
callsame;
Expand Down
3 changes: 2 additions & 1 deletion META6.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
],
"depends" : [ ],
"description" : "A Perl 6 bindings for libmecab ( http://taku910.github.io/mecab/ )",
"name" : "MeCab",
"license" : "Artistic-2.0",
"name" : "MeCab",
"perl" : "6.c",
"provides" : {
"MeCab" : "lib/MeCab.pm6",
Expand All @@ -21,6 +21,7 @@
"libraries/mecab"
],
"source-url" : "git://github.com/titsuki/p6-MeCab.git",
"tags" : [ ],
"test-depends" : [ ],
"version" : "0.0.4"
}

0 comments on commit 440e4e0

Please sign in to comment.