Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

setup: Build headers

Use Rosella to build header files
  • Loading branch information...
commit 6b248a89270ea7376ddd9937655e200c1f057da0 1 parent 44a45ef
Brian Gernhardt authored July 23, 2012

Showing 1 changed file with 46 additions and 4 deletions. Show diff stats Hide diff stats

  1. 50  setup.winxed
50  setup.winxed
@@ -2,8 +2,16 @@
2 2
 
3 3
 // Build system for PACT, using Rosella.Winxed.Distutils
4 4
 
  5
+
  6
+////// Inlines for useful opcodes
  7
+inline does(var pbc, string role) return int {
  8
+    int ret;
  9
+    ${ does ret, pbc, role };
  10
+    return ret;
  11
+}
  12
+
5 13
 ////// Helpers to add a series of steps for a file.
6  
-// Prefix arguments should not have .winxed, .pir, etc
  14
+// Name arguments should not have .winxed, .pir, etc
7 15
 
8 16
 // Convert winxed file to a packfile
9 17
 function pbc_winxed(var pact, string name, string dir = 'src/') {
@@ -18,9 +26,39 @@ function installable_winxed(var pact, string name, string prefix) {
18 26
 }
19 27
 
20 28
 // Create an installable library from winxed
21  
-function library_winxed(var pact, string prefix) {
22  
-    pbc_winxed(pact, prefix);
23  
-    push(pact['inst_lib'], prefix+'.pbc');
  29
+function library_winxed(var pact, string name) {
  30
+    pbc_winxed(pact, name);
  31
+    pact['header_pbc'][name+'.winxed'] = name+'.pbc';
  32
+    push(pact['inst_lib'], name+'.pbc');
  33
+}
  34
+
  35
+////// Distutils stages
  36
+// Create a header file from a pbc
  37
+function build_header_pbc(var kv [slurpy, named]) {
  38
+    if (!exists kv['header_pbc'])
  39
+        return;
  40
+
  41
+    var hash = kv['header_pbc'];
  42
+    var jobs = new 'ResizableStringArray';
  43
+    string header, pbc;
  44
+
  45
+    for (header in hash) {
  46
+        var depends = hash[header];
  47
+        if (does(depends, 'array')) {
  48
+            if (newer(header, depends))
  49
+                continue;
  50
+            pbc = shift(depends);
  51
+        } else {
  52
+            pbc = depends;
  53
+            if (newer(header, pbc))
  54
+                continue;
  55
+        }
  56
+        mkpath(dirname(header), 1 : [named('verbose')]);
  57
+        string cmd = 'winxed_mk_header ' + pbc + ' > ' + header;
  58
+        push(jobs, cmd);
  59
+    }
  60
+
  61
+    return run_jobs(jobs);
24 62
 }
25 63
 
26 64
 function main[main](var argv) {
@@ -31,6 +69,9 @@ function main[main](var argv) {
31 69
         load_bytecode('rosella/winxed.pbc');
32 70
         Rosella.Winxed.Distutils.winxed_setup();
33 71
 
  72
+        // Add new distutils stages
  73
+        register_step_after('build', build_header_pbc);
  74
+
34 75
         // Setup build hash
35 76
         var pact = {
36 77
             'name'             : 'PACT',
@@ -46,6 +87,7 @@ function main[main](var argv) {
46 87
             'winxed_debug'     : false,
47 88
             'pir_winxed'       : {},
48 89
             'pbc_pir'          : {},
  90
+            'header_pbc'       : {},
49 91
             'installable_pbc'  : {},
50 92
             'inst_lib'         : []
51 93
         };

0 notes on commit 6b248a8

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