Affix
view release on metacpan or search on metacpan
lib/Affix/Build.pm view on Meta::CPAN
# Futhark -> C
my $c_file = $build_dir->child( $self->_base($file) . '.c' );
my $prefix = $build_dir->child( $self->_base($file) );
$self->_run( $fut, 'c', '--library', "$file", '-o', "$prefix" );
# Reuse C builder
return $self->_build_c( { path => $c_file }, $out, $mode );
}
method _build_pascal ( $src, $out, $mode ) {
my $file = $src->{path};
my $fpc = $self->_can_run('fpc') // croak "FPC not found";
if ( $mode eq 'dynamic' ) {
# Free Pascal needs 'library' keyword in source for shared libs usually
# -CD creates dynamic lib
$self->_run( $fpc, '-CD', "$file", "-o$out" );
return $out;
}
else {
my $obj = $build_dir->child( $self->_base($file) . $Config{_o} );
my @cmd = ( $fpc, '-Cn', "$file", "-o$obj" );
push @cmd, '-Cg' unless $os eq 'MSWin32';
$self->_run(@cmd);
return { file => $obj };
}
}
method _build_cobol ( $file, $out, $mode ) {
my $cobc = $self->_can_run('cobc') // croak "GnuCOBOL not found";
if ( $mode eq 'dynamic' ) {
# -b = build dynamic module
$self->_run( $cobc, '-b', "$file", '-o', "$out" );
return $out;
}
else {
my $obj = $build_dir->child( $self->_base($file) . $Config{_o} );
my @cmd = ( $cobc, '-c', "$file", '-o', "$obj" );
push @cmd, '-fPIC' unless $os eq 'MSWin32';
$self->_run(@cmd);
return { file => $obj, libs => ['cob'] };
}
}
method _build_ocaml ( $file, $out, $mode ) {
my $ml = $self->_can_run('ocamlopt') // croak "OCaml not found";
if ( $mode eq 'dynamic' ) {
# ocamlopt -shared -o lib.so file.ml
$self->_run( $ml, '-shared', "$file", '-o', "$out" );
return $out;
}
my $obj = $build_dir->child( $self->_base($file) . $Config{_o} );
$self->_run( $ml, '-output-obj', "$file", '-o', "$obj" );
return { file => $obj };
}
#~ https://wiki.liberty-eiffel.org/index.php/Compile
#~ https://svn.eiffel.com/eiffelstudio-public/branches/Eiffel_54/Delivery/docs/papers/dll.html
method _build_eiffel ( $file, $out, $mode ) {
my $se = $self->_can_run('se') // croak "SmartEiffel not found";
# Transpile to C
my $c_file = $build_dir->child( $self->_base($file) . '.c' );
$self->_run( $se, 'c', '-o', "$c_file", "$file" );
# Reuse C builder
return $self->_build_c( $c_file, $out, $mode );
}
}
}
1;
__END__
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under
the terms found in the Artistic License 2. Other copyrights, terms, and
conditions may apply to data transmitted through this module.
( run in 2.650 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )