Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 05dc11a480
Fetching contributors…

Cannot retrieve contributors at this time

113 lines (94 sloc) 3.45 kb
// Copyright (C) 2012, Parrot Foundation.
// Build system for PACT, using Rosella.Winxed.Distutils
////// Inlines for useful opcodes
inline does(var pbc, string role) return int {
int ret;
${ does ret, pbc, role };
return ret;
}
////// Helpers to add a series of steps for a file.
// Name arguments should not have .winxed, .pir, etc
// Convert winxed file to a packfile
function pbc_winxed(var pact, string name, string dir = 'src/') {
pact['pir_winxed'][name+'.pir'] = dir+name+'.winxed';
pact['pbc_pir' ][name+'.pbc'] = name+'.pir';
}
// Create an installable program from winxed
function installable_winxed(var pact, string name, string prefix) {
pbc_winxed(pact, prefix, '');
pact['installable_pbc'][name] = prefix+'.pbc';
}
// Create an installable library from winxed
function library_winxed(var pact, string name) {
pbc_winxed(pact, name);
pact['header_pbc'][name+'.winxed'] = name+'.pbc';
push(pact['inst_lib'], name+'.pbc');
}
////// Distutils stages
// Create a header file from a pbc
function build_header_pbc(var kv [slurpy, named]) {
if (!exists kv['header_pbc'])
return;
var hash = kv['header_pbc'];
var jobs = new 'ResizableStringArray';
string header, pbc;
for (header in hash) {
var depends = hash[header];
if (does(depends, 'array')) {
if (newer(header, depends))
continue;
pbc = shift(depends);
} else {
pbc = depends;
if (newer(header, pbc))
continue;
}
mkpath(dirname(header), 1 : [named('verbose')]);
string cmd = 'winxed_mk_header ' + pbc + ' > ' + header;
push(jobs, cmd);
}
return run_jobs(jobs);
}
function main[main](var argv) {
int exit_code = 0;
try {
// Load and setup Rosella.Winxed.Distutils
load_bytecode('rosella/winxed.pbc');
Rosella.Winxed.Distutils.winxed_setup();
// Add new distutils stages
register_step_after('build', build_header_pbc);
// Setup build hash
var pact = {
'name' : 'PACT',
'abstract' : 'Parrot Alternate Compiler Toolkit',
'authority' : 'http://github.com/parrot',
'copyright_holder' : 'Parrot Foundation',
'keywords' : ['compiler'],
'license_type' : 'Artistic License 2.0',
'license_uri' : 'http://www.perlfoundation.org/artistic_license_2_0',
'checkout_uri' : 'git://github.com/parrot/PACT.git',
'browser_uri' : 'http://github.com/parrot/PACT',
'project_uri' : 'http://github.com/parrot/PACT',
'winxed_debug' : false,
'pir_winxed' : {},
'pbc_pir' : {},
'header_pbc' : {},
'installable_pbc' : {},
'inst_lib' : [],
'prove_files' : 't/*.t t/*/*.t'
};
library_winxed(pact, 'PACT/Packfile');
library_winxed(pact, 'PACT/Packfile/Decompile');
installable_winxed(pact, 'pact_disasm', 'src/disasm');
// Invoke distutils
argv.shift();
setup(argv, pact);
} catch (e) {
say(e['message']);
for (string bt in e.backtrace_strings())
say(bt);
exit_code = 1;
}
if (exit_code != 0)
exit(exit_code);
}
Jump to Line
Something went wrong with that request. Please try again.