# New Ticket Created by  Reini Urban 
# Please include the string:  [perl #57188]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57188 >


---
osname= cygwin
osvers= 1.5.25(0.15642)
arch=   cygwin-thread-multi-64int
cc=     gcc
---
Flags:
    category=install
    severity=high
    ack=no
---

Attached patch adds --install to pbc_to_exe,
adds a basic pod to pbc_to_exe,
and applies --install to perl6.

link against install_config.o and add installable prefix.
Limitation: With --install the first arg infile must have no directory part!

Now we can generate make install for the languages.
---
Summary of my parrot 0.6.4 (r0) configuration:
  configdate='Sat Jul 19 07:34:08 2008 GMT'
  Platform:
    osname=cygwin, archname=cygwin-thread-multi-64int
    jitcapable=1, jitarchname=i386-cygwin,
    jitosname=CYGWIN, jitcpuarch=i386
    execcapable=1
    perl=/usr/bin/perl.exe
  Compiler:
    cc='gcc', ccflags='-U__STRICT_ANSI__  -pipe -I/usr/local/include
-DHASATTRIBUTE_CONST  -DHASATTRIBUTE_DEPRECATED  -DHASATTRIBUTE_MALLOC
 -DHASATTRIBUTE_NONNULL  -DHASATTRIBUTE_NORETURN  -DHASATTRIBUTE_PURE
-DHASATTRIBUTE_UNUSED  -DHASATTRIBUTE_WARN_UNUSED_RESULT
-falign-functions=16 -maccumulate-outgoing-args -W -Wall
-Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts
-Wcomment -Wdisabled-optimization -Wendif-labels -Wextra -Wformat
-Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k
-Wimplicit -Wimport -Winit-self -Winline -Winvalid-pch
-Wmissing-braces -Wno-missing-format-attribute -Wpacked -Wparentheses
-Wpointer-arith -Wreturn-type -Wsequence-point -Wno-shadow
-Wsign-compare -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch
-Wswitch-default -Wtrigraphs -Wundef -Wunknown-pragmas -Wno-unused
-Wwrite-strings -Wbad-function-cast -Wdeclaration-after-statement
-Wimplicit-function-declaration -Wimplicit-int -Wmain
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wnonnull
-DDISABLE_GC_DEBUG=1 -DNDEBUG -O3 -DHAS_GETTEXT',
  Linker and Libraries:
    ld='gcc', ldflags=' -Wl,--enable-auto-import
-Wl,--export-all-symbols -Wl,--stack,8388608
-Wl,--enable-auto-image-base -L/usr/local/lib',
    cc_ldflags='',
    libs='-lcrypt -lgmp -lreadline -lpcre -lcrypto -lintl'
  Dynamic Linking:
    share_ext='.dll', ld_share_flags='-shared',
    load_ext='.dll', ld_load_flags='-shared'
  Types:
    iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4,
    ptrsize=4, ptr_alignment=1 byteorder=1234,
    nv=double, numvalsize=8, doublesize=8
  Locally applied patches:
     [perl #51944] [DOCS]  Cygwin Readme
     [perl #56562] [PATCH] root.in: add cygwin importlib
     [perl #56544] [PATCH] install_files.pl
     [perl #56558] [PATCH] pdb rename to parrot_pdb
     [perl #56998] [TODO]  rename cygwin dll to
cygparrot$MAJOR_$MINOR_$PATCH.dll
     [perl #57006] [PATCH] add cygwin opengl config quirks
     [perl #57110] [PATCH] ncurses for cygwin
     [perl #57112] [PATCH] postgres for cygwin
     [perl #57114] [PATCH] urm RealBin issue
---
Environment:
    CYGWIN =server
    HOME =/home/rurban
    LANG  (unset)
    LANGUAGE  (unset)
    LD_LIBRARY_PATH  (unset)
    LOGDIR  (unset)
    PATH
=~/bin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/usr/bin:/cygdrive/c/WINDOWS/System32/Wbem:
    SHELL  (unset)
difforig languages/perl6/config/makefiles/root.in tools/dev/pbc_to_exe_gen.pl

	* add --install to pbc_to_exe to link against install_config.o and add installable prefix. 
	Limitation: With --install the first arg infile must have no directory part!

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
@@ -11,6 +11,22 @@
 __END__
 #! parrot
 
+=head1 TITLE
+
+pbc_to_exe
+
+=head2 SYNOPSIS
+
+  pbc_to_exe my.pbc
+  => my.exe
+
+  pbc_to_exe my.pbc --install
+  => installable_my.exe
+
+Warning! With -install there must be no directory prefix in the first arg yet.
+
+=cut
+
 .include 'library/config.pir'
 
 .sub 'main' :main
@@ -54,8 +70,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 +318,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 +367,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 +386,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
@@ -361,6 +417,8 @@
     link .= objfile
     link .= pathquote
     link .= ' '
+    link .= config
+    link .= ' '
     link .= rpath
     link .= ' '
     link .= libparrot
@@ -372,8 +430,6 @@
     link .= libs
     link .= ' '
     link .= icushared
-    link .= ' '
-    link .= config
 
     say link
     .local int status

Reply via email to