Skip to content

Instantly share code, notes, and snippets.

@ysasaki
Last active December 20, 2015 17:58
Show Gist options
  • Save ysasaki/6172482 to your computer and use it in GitHub Desktop.
Save ysasaki/6172482 to your computer and use it in GitHub Desktop.
Minillaでsrc/hello.cをscript/helloにcompileしてinstallする感じのMyBuilder.pm
package builder::MyBuilder;
use strict;
use warnings;
use base qw(Module::Build);
use File::Spec;
sub new {
my ( $self, %args ) = @_;
$self->SUPER::new( %args, c_source => ['src'], );
}
sub process_support_files {
my $self = shift;
# set objects in $self->{properties}->{objects}
$self->SUPER::process_support_files();
# compile an executable file
my $script_dir = 'script';
mkdir $script_dir; # TODO
my $b = $self->cbuilder;
my $exe = $b->link_executable(
objects => $self->{properties}->{objects},
exe_file => File::Spec->catfile($script_dir, 'hello'),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment