Skip to content

Commit

Permalink
Updates required by @*INC going and new %?RESOURCES
Browse files Browse the repository at this point in the history
fixes #1
  • Loading branch information
jonathanstowe committed Dec 6, 2015
1 parent d73d58e commit 5a0f12d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -20,3 +20,4 @@ nytprof.out
*.so
*.bs
/_eumm/
.precomp
8 changes: 6 additions & 2 deletions Build.pm
Expand Up @@ -17,7 +17,11 @@ class Build is Panda::Builder {
die "This currently does not work on darwin";
}
}
mkpath "$workdir/blib/lib";
make("$workdir/src", "$workdir/blib/lib");
my Str $blib = "$workdir/blib";
rm_rf($blib);
mkpath "$blib/lib/Sys";
mkpath "$blib/lib/../resources/lib";
make("$workdir/src", "$blib/lib");
}
}
# vim: expandtab shiftwidth=4 ft=perl6 ts=4 sts=4
11 changes: 8 additions & 3 deletions META.info
@@ -1,19 +1,23 @@
{
"name" : "Sys::Lastlog",
"support" : {
"source" : "git://github.com/jonathanstowe/p6-Sys-Lastlog.git"
"source" : "git://github.com/jonathanstowe/p6-Sys-Lastlog.git",
"irc" : "irc://irc.freenode.net/#perl6",
"bugtracker" : "https://github.com/jonathanstowe/p6-Sys-Lastlog/issues"
},
"source-url" : "git://github.com/jonathanstowe/p6-Sys-Lastlog.git",
"authors" : [ "Jonathan Stowe <jns+git@gellyfish.com>" ],
"author" : "Jonathan Stowe <jns+git@gellyfish.com>",
"perl" : "v6",
"build-depends" : [
"panda",
"LibraryMake"
"LibraryMake",
"Shell::Command"
],
"provides" : {
"Sys::Lastlog" : "lib/Sys/Lastlog.pm"
},
"resources" : [ "lib/lastloghelper.so" ],
"depends" : [
"LibraryMake",
"System::Passwd"
Expand All @@ -22,6 +26,7 @@
"Test"
],
"description" : "Perl 6 access to Lastlog information on Unix-like systems",
"version" : "v0.0.4",
"version" : "v0.0.5",
"tags" : [ "unix", "audit", "lastlog" ],
"auth" : "github:jonathanstowe"
}
26 changes: 7 additions & 19 deletions lib/Sys/Lastlog.pm
Expand Up @@ -147,7 +147,7 @@ record is for.
=end pod

class Sys::Lastlog:ver<v0.0.4>:auth<github:jonathanstowe> {
class Sys::Lastlog:ver<v0.0.5>:auth<github:jonathanstowe> {

use System::Passwd;

Expand Down Expand Up @@ -189,26 +189,14 @@ class Sys::Lastlog:ver<v0.0.4>:auth<github:jonathanstowe> {

sub library {
my $so = get-vars('')<SO>;
my $libname = "lastloghelper$so";
my $base = "lib/Sys/Lastlog/$libname";
for @*INC <-> $v {
if $v ~~ Str {
$v ~~ s/^.*\#//;
if ($v ~ '/' ~ $libname).IO.r {
return $v ~ '/' ~ $libname;
}
}
else {
if my @files = ($v.files($base) || $v.files("blib/$base")) {
my $files = @files[0]<files>;
my $tmp = $files{$base} || $files{"blib/$base"};
my $libname = "lib/lastloghelper$so";

$tmp.IO.copy($*SPEC.tmpdir ~ '/' ~ $libname);
return $*SPEC.tmpdir ~ '/' ~ $libname;
}
}
my $lib = %?RESOURCES{$libname}.Str;

if not $lib.defined {
die "Unable to find library";
}
die "Unable to find library";
$lib;
}

my sub p_getllent() returns Entry is native(&library) { * }
Expand Down
2 changes: 2 additions & 0 deletions src/Configure.pl6
Expand Up @@ -3,8 +3,10 @@
use v6;

use LibraryMake;
use Shell::Command;

my $destdir = '../lib';
my %vars = get-vars($destdir);
mkpath "lib/../resources/lib";
process-makefile('src', %vars);
make('src', $destdir);
6 changes: 3 additions & 3 deletions src/Makefile.in
@@ -1,7 +1,7 @@
all: %DESTDIR%/lastloghelper%SO%
all: %DESTDIR%/../resources/lib/lastloghelper%SO%

%DESTDIR%/lastloghelper%SO%: lastloghelper%O%
%LD% %LDSHARED% %LDFLAGS% %LIBS% %LDOUT%%DESTDIR%/lastloghelper%SO% lastloghelper%O%
%DESTDIR%/../resources/lib/lastloghelper%SO%: lastloghelper%O%
%LD% %LDSHARED% %LDFLAGS% %LIBS% %LDOUT%%DESTDIR%/../resources/lib/lastloghelper%SO% lastloghelper%O%

lastloghelper%O%: lastloghelper.c
%CC% -c %CCSHARED% %CCFLAGS% %CCOUT%lastloghelper%O% lastloghelper.c
2 changes: 1 addition & 1 deletion t/02-lastlog.t
Expand Up @@ -13,7 +13,7 @@ use Sys::Lastlog;
my $uid;
my $logname;

diag try { qx/id/ };
#diag try { qx/id/ };

if $*USER.defined {
$uid = $*USER.Numeric;
Expand Down

0 comments on commit 5a0f12d

Please sign in to comment.