Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use %vars<mecab> instead of if-else #13

Merged
merged 1 commit into from
Jan 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use %vars<mecab> instead of if-else
  • Loading branch information
titsuki committed Jan 4, 2017
commit 93bc4ca6381d0d888edf0355152c3458ba12a260
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