use strict;
use warnings;

use SPVM();
use SPVM::Dist;
use SPVM::Builder::Util;

  'h|help'          => \my $help,
  'v|version'       => \my $show_version,
  'q|quiet'   => \my $quiet,
  'f|force' => \my $force,
  'native=s' => \my $native,
  'precompile' => \my $precompile,
  'resource' => \my $resource,
  'only-lib-files' => \my $only_lib_files,
  'no-pm-file' => \my $no_pm_file,
  'genlib' => \my $genlib,

if ($help) {
  die SPVM::Builder::Util::extract_usage;
elsif ($show_version) {
  my $version_string = "spvmdist v$SPVM::VERSION";
  print "$version_string\n";
else {
  my ($class_name, $output_dir) = @ARGV;
  unless (defined $class_name) {
    die SPVM::Builder::Util::extract_usage;
  if ($genlib) {
    $only_lib_files = 1;
    $no_pm_file = 1;
  my $gendist= SPVM::Dist->new(
    class_name => $class_name,
    quiet => $quiet,
    force => $force,
    output_dir => $output_dir,
    native => $native,
    precompile => $precompile,
    only_lib_files => $only_lib_files,
    no_pm_file => $no_pm_file,
    resource => $resource,

=encoding utf8

=head1 NAME

spvmdist - Generating SPVM Distribution


  usage: spvmdist [<options>] <class_name> [<dir>]
    spvmdist Foo
    spvmdist Foo My-Foo
    spvmdist Foo::Bar::Baz
    spvmdist --native c Foo
    spvmdist --native c++ Foo
    spvmdist --precompile Foo
    spvmdist --resource Foo

    -h, --help                     Show this message
    -v, --version                  Show the version
    -q, --quiet                    Quiet output
    -f, --force                    Force to generate files
    --output-dir                   Output directory
    --native LANGUAGE              Add native files and setting
    --precompile                   Add precompile setting
    --only-lib-files               Output only the files in "lib" directory
    --no-pm-file                   Don't output Perl module(.pm) file
    --resource                     Output files for resource distribution
    --genlib                       Shorcut for --only-lib-files --no-pm-file


C<spvmdist> is the command to generate a SPVM distribution.