Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Supported a build system with NQP language

  • Loading branch information...
commit ce014947aa0dc7222e773d72865b32a2df867b4c 1 parent 32dfc3a
Denis Boyun authored August 14, 2013

Showing 1 changed file with 94 additions and 0 deletions. Show diff stats Hide diff stats

  1. 94  project-templates/hll.parrot
94  project-templates/hll.parrot
@@ -297,6 +297,99 @@ function _config(string key) {
297 297
 [% END %]
298 298
 
299 299
 [% IF object.build_system == NQP %]
  300
+__README__
  301
+Language '[% object.name %]' with [% object.build_system %] build system and [% object.test_system %] test system.
  302
+    $ parrot-nqp setup.nqp
  303
+    $ parrot-nqp setup.nqp test
  304
+    # parrot-nqp setup.nqp install
  305
+    
  306
+__setup.nqp__
  307
+#!/usr/bin/env parrot-nqp
  308
+
  309
+sub MAIN() {
  310
+    # Load distutils library
  311
+    pir::load_bytecode('distutils.pbc');
  312
+
  313
+    # ALL DISTUTILS CONFIGURATION IN THIS HASH
  314
+    my %config := hash(
  315
+        # General
  316
+        setup            => 'setup.nqp',
  317
+        name             => '[% object.name %]',
  318
+        abstract         => 'the [% object.name %] compiler',
  319
+        authority        => '',
  320
+        copyright_holder => '',
  321
+        description      => 'the [% object.name %] for Parrot VM.',
  322
+        keywords         => < parrot [% object.name %] >,
  323
+        license_type     => '',
  324
+        license_uri      => '',
  325
+        checkout_uri     => '',
  326
+        browser_uri      => '',
  327
+        project_uri      => '',
  328
+
  329
+        # Build
  330
+        # XXX: Doesn't actually work; need distutils to make any
  331
+        #      missing directories before performing compiles
  332
+[% IF object.with_ops %]
  333
+        dynops			 => unflatten(
  334
+        	'[% object.name %]_ops'						,'src/ops/[% object.name %].ops'
  335
+        ),
  336
+[% END %]
  337
+[% IF object.with_pmc %]
  338
+        dynpmc			 => unflatten(
  339
+        	'[% object.name %]_group'					,'src/pmc/[% object.name %].pmc'
  340
+        ),
  341
+[% END %]
  342
+        pir_nqprx        => unflatten(
  343
+            'src/gen_actions.pir'			, 'src/[% object.name %]/Actions.pm',
  344
+            'src/gen_compiler.pir'    		, 'src/[% object.name %]/Compiler.pm',
  345
+            'src/gen_grammar.pir'     		, 'src/[% object.name %]/Grammar.pm',
  346
+            'src/gen_runtime.pir'     		, 'src/[% object.name %]/Runtime.pm'
  347
+        ),
  348
+        pbc_pir          => unflatten(
  349
+            '[% object.name %]/[% object.name %].pbc', 'src/[% object.name %].pir',
  350
+            '[% object.name %].pbc'         , '[% object.name %].pir'
  351
+        ),
  352
+        exe_pbc          => unflatten(
  353
+            'installable_[% object.name %]' , '[% object.name %].pbc'
  354
+        ),
  355
+        installable_pbc  => unflatten(
  356
+            'parrot-[% object.name %]'      , '[% object.name %].pbc'
  357
+        ),
  358
+
  359
+        # Test
  360
+        prove_exec       => get_nqp(),
  361
+
  362
+        # Dist/Install
  363
+        inst_lang         => <
  364
+                              [% object.name %]/[% object.name %].pbc
  365
+                              installable_[% object.name %]
  366
+                            >,
  367
+        inst_data        => glob('metadata/*.json'),
  368
+        doc_files        => glob('README doc/*/*.pod'),
  369
+    );
  370
+
  371
+
  372
+    # Boilerplate; should not need to be changed
  373
+    my @*ARGS := pir::getinterp__P()[2];
  374
+       @*ARGS.shift;
  375
+
  376
+    setup(@*ARGS, %config);
  377
+}
  378
+
  379
+# Work around minor nqp-rx limitations
  380
+sub hash     (*%h ) { %h }
  381
+sub unflatten(*@kv) { my %h; for @kv -> $k, $v { %h{$k} := $v }; %h }
  382
+
  383
+# Start it up!
  384
+MAIN();
  385
+
  386
+
  387
+# Local Variables:
  388
+#   mode: cperl
  389
+#   cperl-indent-level: 4
  390
+#   fill-column: 100
  391
+# End:
  392
+# vim: expandtab shiftwidth=4:
300 393
 
301 394
 [% END %]
302 395
 
@@ -305,6 +398,7 @@ __README__
305 398
 Language '[% object.name %]' with [% object.build_system %] build system and [% object.test_system %] test system.
306 399
     $ parrot setup.pir
307 400
     $ parrot setup.pir test
  401
+    # parrot setup.pir install
308 402
 
309 403
 __setup.pir__
310 404
 #!/usr/bin/env parrot

0 notes on commit ce01494

Please sign in to comment.
Something went wrong with that request. Please try again.