From a7806d55614d64d824008be0763c44708b741f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9?= Date: Mon, 30 Mar 2020 16:14:08 +0200 Subject: [PATCH] Use NQP prefix for finding profiler template --- src/vm/moar/HLL/Backend.nqp | 4 ++-- tools/lib/NQP/Config/NQP.pm | 8 ++++++++ tools/templates/Makefile-common.in | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/vm/moar/HLL/Backend.nqp b/src/vm/moar/HLL/Backend.nqp index 236de995d0..7cbeee2b22 100644 --- a/src/vm/moar/HLL/Backend.nqp +++ b/src/vm/moar/HLL/Backend.nqp @@ -13,7 +13,7 @@ my sub literal_subst(str $source, str $pattern, $replacement) { class HLL::Backend::MoarVM { our %moar_config := nqp::backendconfig(); - + my sub read_ui32($fh, $buf?) { unless $buf { $buf := nqp::create($NQPBuf) } nqp::readfh($fh, $buf, 4); @@ -691,7 +691,7 @@ class HLL::Backend::MoarVM { my str $template; if !$want_json && !$want_sql { - my $temppath := nqp::backendconfig() ~ '/share/nqp/lib/profiler/template.html'; + my $temppath := nqpconfig() ~ '/share/nqp/lib/profiler/template.html'; $template := try slurp('src/vm/moar/profiler/template.html'); unless $template { $template := try slurp($temppath); diff --git a/tools/lib/NQP/Config/NQP.pm b/tools/lib/NQP/Config/NQP.pm index 1c1a59d4b0..fbf03825cd 100644 --- a/tools/lib/NQP/Config/NQP.pm +++ b/tools/lib/NQP/Config/NQP.pm @@ -93,6 +93,14 @@ sub configure_misc { $config->{moar_stage0} = $self->nfp( "src/vm/moar/stage0", no_quote => 1 ); $config->{jvm_stage0} = $self->nfp( "src/vm/jvm/stage0", no_quote => 1 ); + + # TODO: Use the template infrastructure from nqp-configure? + open my $configfile, '>', 'src/core/Config.nqp'; + print $configfile "# This file is generated automatically by $0\n"; + print $configfile "sub nqpconfig() {\n"; + print $configfile " nqp::hash('prefix', '$config->{prefix}');\n"; + print $configfile "}\n"; + close $configfile; } sub configure_moar_backend { diff --git a/tools/templates/Makefile-common.in b/tools/templates/Makefile-common.in index 93377f7680..44a02d0ca9 100644 --- a/tools/templates/Makefile-common.in +++ b/tools/templates/Makefile-common.in @@ -12,6 +12,7 @@ COMMON_HLL_SOURCES = \ HLL_COMBINED = NQPHLL.nqp CORE_SETTING_SOURCES = \ + @nfp(src/core/Config.nqp)@ \ @nfp(src/core/NativeTypes.nqp)@ \ @nfp(src/core/NQPRoutine.nqp)@ \ @nfp(src/core/NQPMu.nqp)@ \