Source

shakespeare-parrot / setup.pir

Full commit
fperrad dfcc448 
















































































fperrad_ 92b8e34 











fperrad dfcc448 






#!/usr/bin/env parrot

=head1 NAME

setup.pir - Python distutils style

=head1 DESCRIPTION

No Configure step, no Makefile generated.

See F<runtime/library/distutils.pir>.

=head1 USAGE

    $ parrot setup.pir build
    $ parrot setup.pir test
    $ sudo parrot setup.pir install

=cut

.sub 'main' :main
    .param pmc args
    $S0 = shift args
    load_bytecode 'distutils.pbc'

    .const 'Sub' spectest = 'spectest'
    register_step('spectest', spectest)

    $P0 = new 'Hash'
    $P0['name'] = 'Shakespeare'
    $P0['abstract'] = 'The Shakespeare Programming Language, on Parrot'
    $P0['authority'] = 'http://bitbucket.org/riffraff/'
    $P0['description'] = 'The Shakespeare Programming Language, on Parrot'
    $P0['license_type'] = 'BEER-WARE LICENSE'
#    $P0['license_uri'] = ''
    $P0['copyright_holder'] = 'Parrot Foundation'
    $P0['checkout_uri'] = 'http://bitbucket.org/riffraff/shakespeare-parrot/'
    $P0['browser_uri'] = 'http://bitbucket.org/riffraff/shakespeare-parrot/src/'
    $P0['project_uri'] = 'http://bitbucket.org/riffraff/shakespeare-parrot/'

    # build
    $P1 = new 'Hash'
    $P2 = split ' ', 'src/parser/grammar.pg src/parser/words.pg'
    $P1['src/gen_grammar.pir'] = $P2
    $P0['pir_pge'] = $P1

    $P3 = new 'Hash'
    $P3['src/gen_actions.pir'] = 'src/parser/actions.pm'
    $P0['pir_nqp'] = $P3

    $P4 = new 'Hash'
    $P5 = split "\n", <<'SOURCES'
shakespeare.pir
src/gen_grammar.pir
src/gen_actions.pir
src/builtins/base.pir
SOURCES
    $S0 = pop $P5
    $P4['shakespeare.pbc'] = $P5
    $P0['pbc_pir'] = $P4

    $P5 = new 'Hash'
    $P5['parrot-shakespeare'] = 'shakespeare.pbc'
    $P0['installable_pbc'] = $P5

    # test
    $S0 = get_parrot()
    $S0 .= ' shakespeare.pbc'
    $P0['prove_exec'] = $S0

    # dist
    $P10 = glob('manual.txt example/*.spl t/test.rb')
    $P0['manifest_includes'] = $P10

    .tailcall setup(args :flat, $P0 :flat :named)
.end

.sub 'spectest' :anon
    .param pmc kv :slurpy :named
    run_step('build', kv :flat :named)

    load_bytecode 'TAP/Harness.pbc'
    .local pmc opts, files, harness, aggregate
    opts = new 'Hash'
    opts['exec'] = 'ruby'
    files = split ' ', 't/test.rb'
    harness = new ['TAP';'Harness']
    harness.'process_args'(opts)
    aggregate = harness.'runtests'(files)
    $I0 = aggregate.'has_errors'()
    unless $I0 goto L1
    die "test fails"
  L1:
.end

# Local Variables:
#   mode: pir
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: