Skip to content

Commit

Permalink
Use %vars<mecab> instead of if-else
Browse files Browse the repository at this point in the history
  • Loading branch information
titsuki committed Jan 4, 2017
1 parent 00dbf55 commit 93bc4ca
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions Build.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,18 @@ class Build {
}
my $srcdir = "$workdir/src";
my %vars = get-vars($workdir);
%vars<libmecab> = $*VM.platform-library-name('libmecab'.IO);
%vars<mecab> = $*VM.platform-library-name('mecab'.IO);
mkdir "$workdir/resources" unless "$workdir/resources".IO.e;
mkdir "$workdir/resources/libraries" unless "$workdir/resources/libraries".IO.e;

my $HOME = qq:x/echo \$HOME/.subst(/\s*/,"",:g);
my $prefix = "$HOME/.p6mecab";
self!install-mecab($workdir, $prefix);
self!install-mecab-ipadic($workdir, $prefix);
if "$workdir/resources/libraries/libmecab.so".IO.f {
run 'rm', '-f', "$workdir/resources/libraries/libmecab.so";
}
if $*DISTRO.name eq 'macosx' {
run 'ln', '-s', "$prefix/lib/libmecab.dylib", "$workdir/resources/libraries/libmecab.dylib"
} else {
# linux
run 'ln', '-s', "$prefix/lib/libmecab.so", "$workdir/resources/libraries/libmecab.so"
if "$workdir/resources/libraries/%vars<mecab>".IO.f {
run 'rm', '-f', "$workdir/resources/libraries/%vars<mecab>";
}
run 'ln', '-s', "$prefix/lib/%vars<mecab>", "$workdir/resources/libraries/%vars<mecab>";
}

method !install-mecab($workdir, $prefix) {
Expand Down

0 comments on commit 93bc4ca

Please sign in to comment.