Reini Urban schrieb:
How is make install for the pbc_to_exe generated languages supposed to work?

For the utils you simply link to a fixed install_config.o with fixed builddir.
But the languages are generated from a .pir file with hardcoded, wrong builddir.

I think about adding support for an optional --install arg in all pir's for the
pbc_to_exe step sub 'compile_file', and use the install builddir then.
Maybe also replace in  'link_file' parrot_config with install_config.

Or is there a possibility to override the config hash in the pbc somehow?

I did it now this way:

pbc_to_exe accepts a 2nd optional arg.
If it's --install the exe is prefixed with "installable_", and it's not linked against parrot_config.o but against install_config.o

This way I can produce installable languages. For now I did it just for perl6.

Good? Bad?

---------- Forwarded message ----------
From: Reini Urban <[EMAIL PROTECTED]>
Date: 2008/7/21
Subject: Re: [ANNOUNCEMENT] Updated: parrot-0.6.4-1 with parrot-perl6
and parrot-languages
To: [EMAIL PROTECTED]

2008/7/21 Michael Schaap:
On 20-Jul-2008 17:36, Michael Schaap wrote:
On 19-Jul-2008 21:42, Reini Urban wrote:
Michael Schaap schrieb:
Is perl6 supposed to (somewhat) work, yet?
I get:
% perl6 -e 'say "Hello, World!"'
"load_bytecode" couldn't find file 'P6object.pbc'
current instr.: 'onload' pc 0 (src/gen_builtins.pir:28)
called from Sub 'parrot;Perl6::Compiler;main' pc -1 ((unknown file):-1)

P6object does exist, in /usr/lib/parrot/library.
If I cd to this directory first, I get:
% cd /usr/lib/parrot/library; perl6 -e 'say "Hello, World!"'
Null PMC access in get_string()
current instr.: 'parrot;P6metaclass;add_parent' pc 119
(runtime/parrot/library/P6object.pir:137)
called from Sub 'parrot;P6metaclass;add_parent' pc 241
(runtime/parrot/library/P6object.pir:215)
called from Sub 'parrot;P6metaclass;register' pc 411
(runtime/parrot/library/P6object.pir:295)
called from Sub 'parrot;Str;onload' pc 965 (src/gen_builtins.pir:619)
called from Sub 'parrot;Perl6::Compiler;main' pc -1 ((unknown file):-1)

Hmm...  I see in /usr/share/doc/parrot-0.6.4/languages/perl6/README:
If you want to create a binary executable of the compiler
that can be invoked as "perl6" from the command line, then
try "make perl6".  This will create a "perl6" (or "perl6.exe")
binary that can be directly used from the command line:

  $ ./perl6 hello.pl

This binary executable feature is still somewhat experimental,
and may not work on all platforms.  Also, the binary has hardcoded
paths to the Parrot build tree (especially the dynamic libraries
and modules), so removing the build tree will cause the binary
to stop working.

You are right. perl6 and all the similarlily generated
parrot-languages binaries
do not work. They have hardcoded paths to the builddir, which I
thought I have fixed, but my fix only affected parrot itself not the
dumped (with pbc_to_exe generated) languages executables. And my test
did not include renaming the builddir.

Best is to remove these two packages from the release dir until I fix it.
I'm behind a strict firewall now, can someone do this for me?
--
Reini Urban
http://phpwiki.org/  http://murbreak.at/
difforig languages/perl6/config/makefiles/root.in tools/dev/pbc_to_exe_gen.pl

diff -u languages/perl6/config/makefiles/root.in.orig languages/perl6/config/makefiles/root.in
--- languages/perl6/config/makefiles/root.in.orig	2008-07-11 06:47:06.000000000 +0000
+++ languages/perl6/config/makefiles/root.in	2008-07-21 20:14:57.250000000 +0000
@@ -113,6 +113,9 @@
 perl6.pbc: $(PARROT) $(SOURCES)
 	$(PARROT) $(PARROT_ARGS) -o perl6.pbc perl6.pir
 
+installable_perl6$(EXE): perl6.pbc
+	$(PBC_TO_EXE) perl6.pbc --install
+
 src/gen_grammar.pir: $(PERL6GRAMMAR) src/parser/grammar.pg src/parser/grammar-oper.pg
 	$(PARROT) $(PARROT_ARGS) $(PERL6GRAMMAR) \
 	    --output=src/gen_grammar.pir \
diff -u tools/dev/pbc_to_exe_gen.pl.orig tools/dev/pbc_to_exe_gen.pl
--- tools/dev/pbc_to_exe_gen.pl.orig	2008-07-19 08:18:54.671875000 +0000
+++ tools/dev/pbc_to_exe_gen.pl	2008-07-21 20:41:08.875000000 +0000
@@ -54,8 +54,40 @@
     argc = args
 
     if argc == 2 goto proper_args
+    if argc == 3 goto check_install
     .return ()
 
+check_install:
+    .local string infile, install
+
+    $P0    = shift args
+    infile = shift args
+    install = shift args
+    if install == '--install' goto proper_install
+    .return ()
+
+proper_install:
+    .local string cfile, objfile, obj, exefile, exe
+
+    $P0    = '_config'()
+    obj    = $P0['o']
+    exe    = $P0['exe']
+
+    .local int infile_len
+    infile_len  = length infile
+    infile_len -= 3
+
+    cfile       = substr infile, 0, infile_len
+    cfile      .= 'c'
+
+    dec infile_len
+    objfile     = substr infile, 0, infile_len
+    exefile     = 'installable_'
+    exefile    .= objfile
+    exefile    .= exe
+    objfile    .= obj
+    .return(infile, cfile, objfile, exefile)
+
 proper_args:
     .local string infile, cfile, objfile, obj, exefile, exe
 
@@ -270,6 +302,7 @@
 .sub 'compile_file'
     .param string cfile
     .param string objfile
+    .param int install :optional
 
     $P0 = '_config'()
     .local string cc, ccflags, cc_o_out, osname, build_dir, slash
@@ -318,6 +351,7 @@
 .sub 'link_file'
     .param string objfile
     .param string exefile
+    .param int install :optional
 
     $P0 = '_config'()
     .local string cc, ld, link_dynamic, linkflags, ld_out, libparrot, libs, o
@@ -336,11 +370,17 @@
     slash        = $P0['slash']
     icushared    = $P0['icu_shared']
 
-    .local string config, pathquote
+    .local string config, pathquote, exeprefix
+    exeprefix = substr exefile, 0, 12
     config     = concat build_dir, slash
     config    .= 'src'
     config    .= slash
+    if exeprefix == 'installable_' goto config_install
     config    .= 'parrot_config'
+    goto config_cont
+ config_install:
+    config    .= 'install_config'
+ config_cont:
     config    .= o
     pathquote  = ''
     unless osname == 'MSWin32' goto not_windows

Reply via email to