view release on metacpan or search on metacpan
4567891011121314151617# =========================================================================
use
5.008_001;
use
strict;
use
Module::Build::Tiny 0.035;
use
Devel::CheckBin;
check_bin(
'perl'
);
exit
;(
'1'
);
Build_PL();
builder/Affix.pm view on Meta::CPAN
462463464465466467468469470471472473474475476477478479480481482483
for
grep
{
defined
}
@opt
{
qw/install_base destdir prefix/
},
values
%{
$opt
{install_path} };
@opt
{
'config'
,
'meta'
} = ( ExtUtils::Config->new(
$opt
{config} ), get_meta() );
exit
$actions
{
$action
}->(
%opt
,
install_paths
=> ExtUtils::InstallPaths->new(
%opt
,
dist_name
=>
$opt
{meta}->name )
);
}
sub
Build_PL {
my
$meta
= get_meta();
printf
"Creating new 'Build' script for '%s' version '%s'\n"
,
$meta
->name,
$meta
->version;
my
$dir
=
$meta
->name eq
'Module-Build-Tiny'
?
"use lib '../lib';"
:
''
;
write_file(
'Build'
,
"#!$^X\n$dir\nuse lib '.';use "
. __PACKAGE__ .
";\nBuild();\n"
);
make_executable(
'Build'
);
my
@env
=
defined
$ENV
{PERL_MB_OPT} ? split_like_shell(
$ENV
{PERL_MB_OPT} ) : ();
write_file(
'_build_params'
, encode_json( [ \
@env
, \
@ARGV
] ) );
$meta
->save(
@$_
)
for
[
'MYMETA.json'
], [
'MYMETA.yml'
=> {
version
=> 1.4 } ];
}
sub
unzip {
my
(
$file
,
$dest
) =
@_
;
my
$retval
;
my
$u
= IO::Uncompress::Unzip->new(
$file
) or
die
"Cannot open $file: $UnzipError"
;
eg/benchmark.pl view on Meta::CPAN
12345678910111213
eg/unix_math.pl view on Meta::CPAN
12345678910111213
eg/win32_screenres.pl view on Meta::CPAN
12345678910111213141516name =
"Affix"
badges = [
"github-actions/linux.yaml"
,
"github-actions/windows.yaml"
,
"github-actions/osx.yaml"
,
"github-actions/freebsd.yaml"
,
"metacpan"
]
authority =
"cpan:SANKO"
module_maker =
"ModuleBuildTiny"
static_install =
"auto"
license =
"artistic_2"
requires_external_bin=[
"perl');\nuse lib '.';use builder::Affix; builder::Affix::Build_PL();\nexit;('1"
]
markdown_maker =
"Pod::Markdown::Github"
[release]
hook=[
'tidyall -a'
]
[Metadata]
X_No_Archive =
'Yes'
t/00_compile.t view on Meta::CPAN
12345678910use
strict;
use
Test::More 0.98;
use_ok
$_
for
qw[Affix]
;
#
diag
'supported features:'
;
diag
' syscall: '
. ( Affix::Feature::Syscall() ?
'yes'
:
'no'
);
diag
' aggrbyval: '
. ( Affix::Feature::AggrByVal() ?
'yes'
:
'no'
);
#
done_testing;
t/01_types_and_pointers.t view on Meta::CPAN
12345678910111213use
strict;
use
Test::More 0.98;
use
Affix;
#
subtest
'coderef'
=>
sub
{
my
$ptr
= Affix::sv2ptr(
sub
{ pass
'coderef called'
;
return
'Okay'
}, CodeRef [ [] => Str ] );
isa_ok
$ptr
,
'Affix::Pointer'
;
my
$cv
= Affix::ptr2sv(
$ptr
, CodeRef [ [] => Str ] );
isa_ok
$cv
,
'CODE'
;
is
$cv
->(),
'Okay'
,
'return value from coderef'
;
subtest
'inside struct'
=>
sub
{
my
$type
= Struct [
cb
=> CodeRef [ [Str] => Str ] ];
t/02_affix_wrap_sin.t view on Meta::CPAN
12345678910111213use
strict;
use
warnings;
use
Test::More;
use
Config;
$|++;
#
my
$libfile
= Affix::locate_lib( $^O eq
'MSWin32'
?
'msvcrt'
:
$^O eq
'darwin'
?
'/usr/lib/libm.dylib'
:
$^O eq
'bsd'
?
'/usr/lib/libm.so'
:
$Config
{archname} =~ /64/ ?
t/06_affix_synopsis.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
Affix;
#
sub
pow : Native(get_lib) : Signature([Double, Double]=>Double);
plan
skip_all
=>
'I know nothing about macOS'
if
$^O eq
'darwin'
;
is pow( 2, 10 ), 1024,
'pow( 2, 10 ) == 1024'
;
done_testing;
sub
get_lib {
return
'ntdll'
if
$^O eq
'MSWin32'
;
return
'/usr/lib/libSystem.dylib'
if
$^O eq
'darwin'
;
t/07_affix_locate_lib.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
Affix;
#
subtest
'Library Paths and Names'
=>
sub
{
diag
'.dll located on Win32: '
. Affix::locate_lib(
'ntdll'
)
if
$^O eq
'MSWin32'
;
diag
'.dynlib/.bundle located on OSX: '
. Affix::locate_lib(
'm'
)
if
$^O eq
'darwin'
;
if
( $^O eq
'linux'
) {
diag
'libc located on Linux: '
. ( Affix::locate_lib(
'c'
) //
'error'
);
diag
'libm v6 located on Linux: '
. ( Affix::locate_lib(
'm'
, 6 ) //
'error'
);
diag
'libm v4 located on Linux: '
. ( Affix::locate_lib(
'm'
, 4 ) //
'error'
);
}
t/41_affix_argless.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
File::Spec;
use
t::lib::nativecall;
#
compile_test_lib(
'41_argless'
);
#
sub
Nothing : Native(
't/src/41_argless'
);
sub
Argless : Native(
't/src/41_argless'
) : Signature([]=>Int);
sub
ArglessChar : Native(
't/src/41_argless'
) : Signature([]=>Char);
sub
ArglessLongLong : Native(
't/src/41_argless'
) : Signature([]=>LongLong);
t/42_affix_simple_args.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
File::Spec;
use
t::lib::nativecall;
$|++;
#
compile_test_lib(
'42_simple_args'
);
# Int related
sub
TakeInt : Native(
't/src/42_simple_args'
) : Signature([Int]=>Int);
t/43_affix_simple_returns.t view on Meta::CPAN
123456789101112131415use
strict;
no
warnings
'portable'
;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
File::Spec;
use
t::lib::nativecall;
$|++;
#
compile_test_lib(
'43_simple_returns'
);
#
sub
ReturnVoid : Signature([Int]=>Void) : Native(
't/src/43_simple_returns'
);
is ReturnVoid(4),
undef
,
'returning void works'
;
t/44_affix_aggr_args.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
File::Spec;
use
t::lib::nativecall;
$|++;
plan
skip_all
=>
'no support for aggregates by value'
unless
Affix::Feature::AggrByVal();
#
compile_test_lib(
'44_affix_aggr_args'
);
# Int related
t/50_affix_pointers.t view on Meta::CPAN
12345678910111213141516use
strict;
no
warnings
'portable'
;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
File::Spec;
use
t::lib::nativecall;
use
Config;
$|++;
#
plan
skip_all
=>
'no support for aggregates by value'
unless
Affix::Feature::AggrByVal();
diag __LINE__;
compile_test_lib(
'50_affix_pointers'
);
#
diag __LINE__;
t/51_affix_sizeof_offsetof.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
Affix;
use
Config;
$|++;
#
use
t::lib::nativecall;
#
my
$lib
= compile_test_lib(
'51_affix_sizeof_offsetof'
);
subtest
'fundamental types'
=>
sub
{
#diag sizeof(Double);
t/54_affix_callbacks.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
Affix;
use
Config;
$|++;
#
use
t::lib::nativecall;
#
plan
skip_all
=>
'no support for aggregates by value'
unless
Affix::Feature::AggrByVal();
#
my
$lib
= compile_test_lib(
'54_affix_callbacks'
);
diag
$lib
;
t/55_affix_enum.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
Affix;
$|++;
use
t::lib::nativecall;
#
compile_test_lib(
'55_affix_enum'
);
#
{
my
$ab
= IntEnum [
'alpha'
,
'beta'
];
isa_ok
$ab
,
'Affix::Type::Enum'
;
is_deeply
$ab
->{
values
}, [
'alpha'
,
'beta'
],
qq![ 'alpha', 'beta' ] values!
;
t/56_affix_arrayref.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
Affix;
$|++;
use
t::lib::nativecall;
# Cribbed from FFI::Platypus example
my
$lib
= compile_test_lib(
'56_affix_arrayref'
);
#
affix
$lib
,
array_reverse
=> [ ArrayRef [Int], Int ], Int;
affix
$lib
,
array_reverse10
=> [ ArrayRef [ Int, 10 ] ], Int;
affix
$lib
,
array_sum
=> [ ArrayRef [Int] ], Int;
t/58_affix_import_vars.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
File::Spec;
use
t::lib::nativecall;
$|++;
#
compile_test_lib(
'58_affix_import_vars'
);
sub
get_integer : Native(
't/src/58_affix_import_vars'
) : Signature([]=>Int);
sub
get_string : Native(
't/src/58_affix_import_vars'
) : Signature([]=>Str);
subtest
'integer'
=>
sub
{
t/63_affix_raw_pointer.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
$|++;
#
#plan skip_all => q[You use *BSD. You don't like nice things.] if $^O =~ /bsd/i;
#
subtest
'memchr'
=>
sub
{
my
$str
= malloc(7);
memcpy(
$str
,
'ABCDEFG'
, 7 );
my
@chars
=
qw[D d]
;
is memchr(
$str
,
'D'
, 7 )->raw(4),
'DEFG'
,
'D (68) found'
;
t/64_affix_wchar_t.t view on Meta::CPAN
123456789101112131415use
strict;
use
utf8;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
File::Spec;
use
t::lib::nativecall;
$|++;
plan
skip_all
=>
'wchar * is broken on *BSD and Solaris'
if
$^O =~ /(?:bsd|solaris)/i;
#
compile_test_lib(
'64_affix_wchar_t'
);
sub
check_string : Native(
't/src/64_affix_wchar_t'
) : Signature([WStr]=>Int);
t/70_affix_varargs.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
Affix;
use
Config;
$|++;
#
use
t::lib::nativecall;
#
my
$lib
= compile_test_lib(
'70_affix_varargs'
);
#
#int min(int arg_count, ...)
subtest
'ellipsis varargs'
=>
sub
{
t/82_affix_mangle_itanium.t view on Meta::CPAN
123456789101112131415use
strict;
use
utf8;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
t::lib::nativecall;
$|++;
#
my
$lib
= compile_test_lib(
'82_affix_mangle_itanium'
);
#~ system 'nm -D ' . $lib;
#
typedef
'MyClass'
=> Struct [
myNum
=> Int,
myString
=> Str ];
t/85_affix_mangle_rust.t view on Meta::CPAN
123456789101112131415use
strict;
use
utf8;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
t::lib::nativecall;
use
Devel::CheckBin;
use
Config;
$|++;
#
#~ my $lib = 't/src/85_affix_mangle_rust/target/release/' .
#~ ( $^O eq 'MSWin32' ? '' : 'lib' ) . 'affix_rust.' . $Config{so};
#~ warn $lib;
t/99_valgrind.t view on Meta::CPAN
1234567891011121314use
strict;
use
Test::More 0.98;
BEGIN {
chdir
'../'
if
!-d
't'
; }
use
Config;
use
Affix;
$|++;
#
use
t::lib::nativecall;
#
plan
skip_all
=>
'Only run valgrind tests locally'
unless
-e
't/'
. __FILE__;
plan
skip_all
=>
'Test::Valgrind is required to test your distribution with valgrind'
#