Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 113 lines (94 sloc) 3.45 kb
8814aba @Benabik Initial build script
Benabik authored
1 // Copyright (C) 2012, Parrot Foundation.
2
3 // Build system for PACT, using Rosella.Winxed.Distutils
4
6b248a8 @Benabik setup: Build headers
Benabik authored
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
e6e2db2 @Benabik setup.winxed: refactor adding compilation steps
Benabik authored
13 ////// Helpers to add a series of steps for a file.
6b248a8 @Benabik setup: Build headers
Benabik authored
14 // Name arguments should not have .winxed, .pir, etc
e6e2db2 @Benabik setup.winxed: refactor adding compilation steps
Benabik authored
15
16 // Convert winxed file to a packfile
44a45ef @Benabik Move PACT sources into src/
Benabik authored
17 function pbc_winxed(var pact, string name, string dir = 'src/') {
18 pact['pir_winxed'][name+'.pir'] = dir+name+'.winxed';
19 pact['pbc_pir' ][name+'.pbc'] = name+'.pir';
e6e2db2 @Benabik setup.winxed: refactor adding compilation steps
Benabik authored
20 }
21
22 // Create an installable program from winxed
23 function installable_winxed(var pact, string name, string prefix) {
44a45ef @Benabik Move PACT sources into src/
Benabik authored
24 pbc_winxed(pact, prefix, '');
e6e2db2 @Benabik setup.winxed: refactor adding compilation steps
Benabik authored
25 pact['installable_pbc'][name] = prefix+'.pbc';
26 }
27
869a191 @Benabik Add PACT.Packfile
Benabik authored
28 // Create an installable library from winxed
6b248a8 @Benabik setup: Build headers
Benabik authored
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);
869a191 @Benabik Add PACT.Packfile
Benabik authored
62 }
63
8814aba @Benabik Initial build script
Benabik authored
64 function main[main](var argv) {
65 int exit_code = 0;
66
67 try {
68 // Load and setup Rosella.Winxed.Distutils
69 load_bytecode('rosella/winxed.pbc');
70 Rosella.Winxed.Distutils.winxed_setup();
71
6b248a8 @Benabik setup: Build headers
Benabik authored
72 // Add new distutils stages
73 register_step_after('build', build_header_pbc);
74
8814aba @Benabik Initial build script
Benabik authored
75 // Setup build hash
76 var pact = {
77 'name' : 'PACT',
78 'abstract' : 'Parrot Alternate Compiler Toolkit',
79 'authority' : 'http://github.com/parrot',
80 'copyright_holder' : 'Parrot Foundation',
81 'keywords' : ['compiler'],
82 'license_type' : 'Artistic License 2.0',
83 'license_uri' : 'http://www.perlfoundation.org/artistic_license_2_0',
84 'checkout_uri' : 'git://github.com/parrot/PACT.git',
85 'browser_uri' : 'http://github.com/parrot/PACT',
86 'project_uri' : 'http://github.com/parrot/PACT',
87 'winxed_debug' : false,
e6e2db2 @Benabik setup.winxed: refactor adding compilation steps
Benabik authored
88 'pir_winxed' : {},
89 'pbc_pir' : {},
6b248a8 @Benabik setup: Build headers
Benabik authored
90 'header_pbc' : {},
0b3151e @Benabik setup: Actually install the libraries
Benabik authored
91 'installable_pbc' : {},
c1f27b1 @Benabik Test Decompiling a (basically) empty sub
Benabik authored
92 'inst_lib' : [],
93 'prove_files' : 't/*.t t/*/*.t'
8814aba @Benabik Initial build script
Benabik authored
94 };
95
b2f2d80 @Benabik Recapitalize
Benabik authored
96 library_winxed(pact, 'PACT/Packfile');
97 library_winxed(pact, 'PACT/Packfile/Decompile');
e6e2db2 @Benabik setup.winxed: refactor adding compilation steps
Benabik authored
98 installable_winxed(pact, 'pact_disasm', 'src/disasm');
99
8814aba @Benabik Initial build script
Benabik authored
100 // Invoke distutils
101 argv.shift();
102 setup(argv, pact);
103 } catch (e) {
104 say(e['message']);
105 for (string bt in e.backtrace_strings())
106 say(bt);
107 exit_code = 1;
108 }
109
110 if (exit_code != 0)
111 exit(exit_code);
112 }
Something went wrong with that request. Please try again.