Skip to content

Commit bd39fe2

Browse files
committed
Option for a source-name different from the actual source file
While absolute paths are useful for reading source files reliably, we don't want to save those absolute paths in precompiled files as the source files may move after precompilation. This happens when modules are packaged for Linux distributions and the build process runs with an unprivileged user while the result should be installed in a system location. The source-name option allows for specifying a different string to use for the $?FILES variable and thus for the path to the source file in backtraces.
1 parent 78a021d commit bd39fe2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/HLL/Compiler.nqp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class HLL::Compiler does HLL::Backend::Default {
2323
@!stages := nqp::split(' ', 'start parse ast ' ~ $!backend.stages());
2424

2525
# Command options and usage.
26-
@!cmdoptions := nqp::split(' ', 'e=s help|h target=s trace|t=s encoding=s output|o=s combine version|v show-config verbose-config|V stagestats=s? ll-exception rxtrace nqpevent=s profile=s? profile-compile=s? profile-filename=s');
26+
@!cmdoptions := nqp::split(' ', 'e=s help|h target=s trace|t=s encoding=s output|o=s source-name=s combine version|v show-config verbose-config|V stagestats=s? ll-exception rxtrace nqpevent=s profile=s? profile-compile=s? profile-filename=s');
2727
%!config := nqp::hash();
2828
}
2929

@@ -383,7 +383,7 @@ class HLL::Compiler does HLL::Backend::Default {
383383
nqp::exit(1) if $err;
384384
}
385385
my $code := join('', @codes);
386-
my $?FILES := join(' ', @files);
386+
my $?FILES := %adverbs<source-name> || join(' ', @files);
387387
my $r := self.eval($code, |@args, |%adverbs);
388388
if $target eq '' || $!backend.is_textual_stage($target) || %adverbs<output> {
389389
return $r;

0 commit comments

Comments
 (0)