log available
This commit is contained in:
76
build.cm
76
build.cm
@@ -260,48 +260,50 @@ Build.build_module_dylib = function(pkg, file, target, opts) {
|
||||
var build_dir = get_build_dir()
|
||||
ensure_dir(build_dir)
|
||||
var dylib_path = build_dir + '/' + link_key + '.' + _target + dylib_ext
|
||||
var cmd_parts = null
|
||||
var cmd_str = null
|
||||
var ret = null
|
||||
|
||||
if (fd.is_file(dylib_path))
|
||||
return dylib_path
|
||||
if (!fd.is_file(dylib_path)) {
|
||||
cmd_parts = [cc, '-shared', '-fPIC']
|
||||
|
||||
var cmd_parts = [cc, '-shared', '-fPIC']
|
||||
if (tc.system == 'darwin') {
|
||||
cmd_parts = array(cmd_parts, [
|
||||
'-undefined', 'dynamic_lookup',
|
||||
'-Wl,-dead_strip',
|
||||
'-Wl,-rpath,@loader_path/../local',
|
||||
'-Wl,-rpath,' + local_dir
|
||||
])
|
||||
} else if (tc.system == 'linux') {
|
||||
cmd_parts = array(cmd_parts, [
|
||||
'-Wl,--allow-shlib-undefined',
|
||||
'-Wl,--gc-sections',
|
||||
'-Wl,-rpath,$ORIGIN/../local',
|
||||
'-Wl,-rpath,' + local_dir
|
||||
])
|
||||
} else if (tc.system == 'windows') {
|
||||
push(cmd_parts, '-Wl,--allow-shlib-undefined')
|
||||
}
|
||||
|
||||
if (tc.system == 'darwin') {
|
||||
cmd_parts = array(cmd_parts, [
|
||||
'-undefined', 'dynamic_lookup',
|
||||
'-Wl,-dead_strip',
|
||||
'-Wl,-rpath,@loader_path/../local',
|
||||
'-Wl,-rpath,' + local_dir
|
||||
])
|
||||
} else if (tc.system == 'linux') {
|
||||
cmd_parts = array(cmd_parts, [
|
||||
'-Wl,--allow-shlib-undefined',
|
||||
'-Wl,--gc-sections',
|
||||
'-Wl,-rpath,$ORIGIN/../local',
|
||||
'-Wl,-rpath,' + local_dir
|
||||
])
|
||||
} else if (tc.system == 'windows') {
|
||||
push(cmd_parts, '-Wl,--allow-shlib-undefined')
|
||||
push(cmd_parts, '-L"' + local_dir + '"')
|
||||
push(cmd_parts, '"' + obj + '"')
|
||||
arrfor(_extra, function(extra_obj) {
|
||||
push(cmd_parts, '"' + extra_obj + '"')
|
||||
})
|
||||
cmd_parts = array(cmd_parts, resolved_ldflags)
|
||||
cmd_parts = array(cmd_parts, target_ldflags)
|
||||
push(cmd_parts, '-o')
|
||||
push(cmd_parts, '"' + dylib_path + '"')
|
||||
|
||||
cmd_str = text(cmd_parts, ' ')
|
||||
log.console('Linking module ' + file + ' -> ' + fd.basename(dylib_path))
|
||||
ret = os.system(cmd_str)
|
||||
if (ret != 0) {
|
||||
print('Linking failed: ' + file); disrupt
|
||||
}
|
||||
}
|
||||
|
||||
push(cmd_parts, '-L"' + local_dir + '"')
|
||||
push(cmd_parts, '"' + obj + '"')
|
||||
arrfor(_extra, function(extra_obj) {
|
||||
push(cmd_parts, '"' + extra_obj + '"')
|
||||
})
|
||||
cmd_parts = array(cmd_parts, resolved_ldflags)
|
||||
cmd_parts = array(cmd_parts, target_ldflags)
|
||||
push(cmd_parts, '-o')
|
||||
push(cmd_parts, '"' + dylib_path + '"')
|
||||
|
||||
var cmd_str = text(cmd_parts, ' ')
|
||||
log.console('Linking module ' + file + ' -> ' + fd.basename(dylib_path))
|
||||
var ret = os.system(cmd_str)
|
||||
if (ret != 0) {
|
||||
print('Linking failed: ' + file); disrupt
|
||||
}
|
||||
|
||||
// Install to deterministic lib/<pkg>/<stem>.dylib
|
||||
// Always install to deterministic lib/<pkg>/<stem>.dylib
|
||||
// Strip .c/.cpp extension so the loader can find it by module name
|
||||
var file_stem = file
|
||||
if (ends_with(file_stem, '.cpp')) file_stem = text(file_stem, 0, -4)
|
||||
|
||||
@@ -382,6 +382,7 @@ os.run_ast_fn = run_ast_fn
|
||||
os.run_ast_noopt_fn = run_ast_noopt_fn
|
||||
core_extras.core_json = json
|
||||
core_extras.actor_api = $_
|
||||
core_extras.log = log
|
||||
core_extras.runtime_env = runtime_env
|
||||
core_extras.content_hash = content_hash
|
||||
core_extras.cache_path = cache_path
|
||||
|
||||
Reference in New Issue
Block a user