Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use platform independent library name
Requires latest panda
  • Loading branch information
niner committed Dec 23, 2015
1 parent 81243ea commit 320187e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
9 changes: 8 additions & 1 deletion Build.pm
Expand Up @@ -12,8 +12,15 @@ class Build is Panda::Builder {
shell('perl -MFilter::Simple -e ""')
or die "\nPlease install the Filter::Simple Perl 5 module!\n";

my %vars = get-vars($dir);
%vars<p5helper> = $*VM.platform-library-name('p5helper'.IO);
mkdir "$dir/resources" unless "$dir/resources".IO.e;
make($dir, $dir);
mkdir "$dir/resources/libraries" unless "$dir/resources/libraries".IO.e;
process-makefile($dir, %vars);
my $goback = $*CWD;
chdir($dir);
shell(%vars<MAKE>);
chdir($goback);
}
}

Expand Down
2 changes: 1 addition & 1 deletion META.info
Expand Up @@ -12,7 +12,7 @@
"Inline::Perl5" : "lib/Inline/Perl5.pm6"
},
"resources" : [
"p5helper.so"
"libraries/p5helper"
],
"repo-type" : "git",
"source-url" : "git://github.com/niner/Inline-Perl5.git",
Expand Down
8 changes: 4 additions & 4 deletions Makefile.in
@@ -1,8 +1,8 @@
.PHONY: clean test
all: %DESTDIR%/resources/p5helper%SO%
all: %DESTDIR%/resources/libraries/%p5helper%
clean:
rm %DESTDIR%/resources/p5helper%SO%
%DESTDIR%/resources/p5helper%SO%: p5helper.c
gcc -Wall p5helper.c `perl -MExtUtils::Embed -e ccopts -e ldopts` -shared -o %DESTDIR%/resources/p5helper%SO% -fPIC -g
rm %DESTDIR%/resources/libraries/%p5helper%
%DESTDIR%/resources/libraries/%p5helper%: p5helper.c
gcc -Wall p5helper.c `perl -MExtUtils::Embed -e ccopts -e ldopts` -shared -o %DESTDIR%/resources/libraries/%p5helper% -fPIC -g
test: all
prove -e 'perl6 -Ilib' t
5 changes: 4 additions & 1 deletion configure.pl6
Expand Up @@ -9,7 +9,10 @@ shell('perl -MFilter::Simple -e ""')
or die "\nPlease install the Filter::Simple Perl 5 module!\n";

my %vars = get-vars('.');
%vars<p5helper> = $*VM.platform-library-name('p5helper'.IO);
mkdir "resources" unless "resources".IO.e;
mkdir "resources/libraries" unless "resources/libraries".IO.e;
process-makefile('.', %vars);
make('.', '.');
shell(%vars<MAKE>);

# vim: ft=perl6
7 changes: 2 additions & 5 deletions lib/Inline/Perl5.pm6
Expand Up @@ -18,12 +18,9 @@ has Bool $!scalar_context = False;
my $default_perl5;

sub native(Sub $sub) {
my $so = $*VM.config<dll>;
$so ~~ s!^.*\%s!p5helper!;

my Str $path = %?RESOURCES{$so}.Str;
my Str $path = %?RESOURCES<libraries/p5helper>.Str;
unless $path {
die "unable to find $so";
die "unable to find p5helper library";
}
trait_mod:<is>($sub, :native($path));
}
Expand Down

0 comments on commit 320187e

Please sign in to comment.