Nick Glencross wrote:

Guys,

Here's an updated version of the libparrot shared library patch.

Sorry, omitted one of the configure files!

I should mention that you probably want to remove config/inter/libparrot.pm before ever reapplying the patch otherwise you'll get the same content twice.

Nick

Index: debian/libparrot.install
===================================================================
--- debian/libparrot.install    (revision 10631)
+++ debian/libparrot.install    (working copy)
@@ -1 +1 @@
-usr/lib/blib/lib/libparrot.so.* usr/lib
+usr/lib/libparrot.so.* usr/lib
Index: debian/rules
===================================================================
--- debian/rules        (revision 10631)
+++ debian/rules        (working copy)
@@ -23,7 +23,7 @@
 
 build-stamp: configure-stamp 
        dh_testdir
-       $(MAKE) world_shared
+       $(MAKE) installable
        pod2man --section=1 --release="Debian Project" --center="Debian 
GNU/Linux manual" docs/running.pod debian/parrot.1
        pod2man --section=1 --release="Debian Project" --center="Debian 
GNU/Linux manual" parrot-config.imc debian/parrot-config.imc.1
        pod2man --section=1 --release="Debian Project" --center="Debian 
GNU/Linux manual" src/pdump.c debian/pdump.1
@@ -50,11 +50,11 @@
        dh_installdirs -plibparrot-dev usr/share/lintian/overrides
        $(MAKE) install PREFIX=$(CURDIR)/debian/tmp/usr
        dh_install --sourcedir=$(CURDIR)/debian/tmp --list-missing
-       install -m755 $(CURDIR)/debian/tmp/usr/bin/pdump_shared 
$(CURDIR)/debian/parrot/usr/bin/pdump
-       install -m755 $(CURDIR)/debian/tmp/usr/bin/pdb_shared 
$(CURDIR)/debian/parrot/usr/bin/parrot-debugger
-       install -m755 $(CURDIR)/debian/tmp/usr/bin/pbc_info_shared 
$(CURDIR)/debian/parrot/usr/bin/pbc_info
-       install -m755 $(CURDIR)/debian/tmp/usr/bin/pbc_merge_shared 
$(CURDIR)/debian/parrot/usr/bin/pbc_merge
-       install -m755 $(CURDIR)/debian/tmp/usr/bin/disassemble_shared 
$(CURDIR)/debian/parrot/usr/bin/disassemble
+       install -m755 $(CURDIR)/debian/tmp/usr/bin/installable_pdump 
$(CURDIR)/debian/parrot/usr/bin/pdump
+       install -m755 $(CURDIR)/debian/tmp/usr/bin/installable_pdb 
$(CURDIR)/debian/parrot/usr/bin/parrot-debugger
+       install -m755 $(CURDIR)/debian/tmp/usr/bin/installable_pbc_info 
$(CURDIR)/debian/parrot/usr/bin/pbc_info
+       install -m755 $(CURDIR)/debian/tmp/usr/bin/installable_pbc_merge 
$(CURDIR)/debian/parrot/usr/bin/pbc_merge
+       install -m755 $(CURDIR)/debian/tmp/usr/bin/installable_disassemble 
$(CURDIR)/debian/parrot/usr/bin/disassemble
        install -m644 debian/libparrot-dev.lintian-overrides 
$(CURDIR)/debian/libparrot-dev/usr/share/lintian/overrides/libparrot-dev
 
 # Build architecture-independent files here.
Index: tools/dev/install_files.pl
===================================================================
--- tools/dev/install_files.pl  (revision 10631)
+++ tools/dev/install_files.pl  (working copy)
@@ -110,12 +110,12 @@
 
 
################################################################################
 
-use File::Basename qw(dirname);
 use File::Copy;
 use File::Spec;
 use strict;
 use lib 'lib';
 use Parrot::Config;
+use File::Basename qw(dirname basename);
 
 my $exe = $PConfig{'exe'};
 
@@ -172,7 +172,7 @@
     $meta{$_} = 1 for (keys %meta); # Laziness
 
     if ($meta{lib}) {
-        $dest = File::Spec->catdir($options{libdir}, $dest);
+        $dest = File::Spec->catdir($options{libdir}, basename ($dest));
     } elsif ($meta{bin}) {
        $dest =~ s/^installable_//;     # parrot with different config
         $dest = File::Spec->catdir($options{bindir}, $dest);
Index: lib/Parrot/Test.pm
===================================================================
--- lib/Parrot/Test.pm  (revision 10631)
+++ lib/Parrot/Test.pm  (working copy)
@@ -575,18 +575,8 @@
             print SOURCE $source;
             close SOURCE;
 
-            (my $libparrot_root = $PConfig{blib_lib_libparrot_a}) =~ 
s/\$\(A\)//;
-            my $libparrot_dynamic = $libparrot_root.$PConfig{share_ext};
+            my $libparrot="$PConfig{link_rpath_blib}-L$PConfig{blib_dir} 
-lparrot";
 
-            my $libparrot;
-
-            # use shared library version if available
-            if( -e $libparrot_dynamic ) {
-                $libparrot = '-Lblib/lib -lparrot';
-            } else {
-                $libparrot = $libparrot_root.$PConfig{a};
-            }
-
             my $iculibs = "";
             if ($PConfig{'has_icu'}) {
                 $iculibs = $PConfig{icu_shared};
Index: MANIFEST
===================================================================
--- MANIFEST    (revision 10631)
+++ MANIFEST    (working copy)
@@ -252,6 +252,7 @@
 config/inter/encoding.pm                          []
 config/inter/exp.pm                               []
 config/inter/lex.pm                               []
+config/inter/libparrot.pm                         []
 config/inter/make.pm                              []
 config/inter/ops.pm                               []
 config/inter/pmc.pm                               []
Index: Configure.pl
===================================================================
--- Configure.pl        (revision 10631)
+++ Configure.pl        (working copy)
@@ -398,6 +398,7 @@
     auto::msvc
     init::optimize
     inter::shlibs
+    inter::libparrot
     inter::charset
     inter::encoding
     inter::types
@@ -453,11 +454,27 @@
 
 # tell users what to do next
 my $make = $conf->data->get('make');
+my $blib_dir = $conf->data->get ('blib_dir');
+my $link_rpath_blib = $conf->data->get ('link_rpath_blib');
+my $libparrot_is_shared = $conf->data->get ('libparrot_is_shared');
 
+my $shared_warning = "";
+
+if ($libparrot_is_shared && $link_rpath_blib eq '')
+{
+    $shared_warning =<<"END"
+
+NOTE: During the build I will create a shared library in `$blib_dir',
+but I will not be able to automatically make executables locate it,
+so you will need to add this directory to LD_LIBRARY_PATH, SH_LIBS
+or you PATH (depending on your platform) to locate it during building.
+END
+}
+
 print <<"END";
 
 Okay, we're done!
-
+$shared_warning
 You can now use `$make' to build your Parrot. After that,
 you can use `$make test' to run the test suite.
 
Index: MANIFEST.generated
===================================================================
--- MANIFEST.generated  (revision 10631)
+++ MANIFEST.generated  (working copy)
@@ -1,16 +1,13 @@
-disassemble                                       [main]bin
-disassemble_shared                                [main]bin
 installable_parrot                                [main]bin
-pdump                                             [main]bin
-pdump_shared                                      [main]bin
-pdb                                               [main]bin
-pdb_shared                                        [main]bin
-pbc_info                                          [main]bin
-pbc_info_shared                                   [main]bin
-pbc_merge                                         [main]bin
-pbc_merge_shared                                  [main]bin
+installable_disassemble                           [main]bin
+installable_pdump                                 [main]bin
+installable_pdb                                   [main]bin
+installable_pbc_info                              [main]bin
+installable_pbc_merge                             [main]bin
 blib/lib/libparrot.a                              [main]lib
+blib/lib/libparrot.so                             [main]lib
 blib/lib/libparrot.so.0.4.0                       [main]lib
+src/install_config.o                              [main]lib
 docs/ops/bit.pod                                  [main]doc
 docs/ops/cmp.pod                                  [main]doc
 docs/ops/core.pod                                 [main]doc
Index: config/inter/libparrot.pm
===================================================================
--- config/inter/libparrot.pm   (revision 0)
+++ config/inter/libparrot.pm   (revision 0)
@@ -0,0 +1,56 @@
+# Copyright: 2005 The Perl Foundation.  All Rights Reserved.
+# $Id: libparrot.pm $
+
+=head1 NAME
+
+config/inter/libparrot.pm - Determines build information for libparrot
+
+=head1 DESCRIPTION
+
+libparrot is the library containing the parrot VM. This configuration
+step determines whether it should be build static or shared.
+
+=cut
+
+package inter::libparrot;
+
+use strict;
+use vars qw($description $result @args);
+
+use base qw(Parrot::Configure::Step::Base);
+
+use Parrot::Configure::Step ':inter';
+
+$description = 'Determine if libparrot should be a shared library...';
+
[EMAIL PROTECTED] = qw(ask libparrot_is_shared);
+
+sub runstep {
+    my ($self, $conf) = @_;
+
+    my ($libparrot_is_shared) = $conf->options->get ('libparrot_is_shared');
+
+    $libparrot_is_shared =
+       integrate($conf->data->get('libparrot_is_shared'),
+                 $libparrot_is_shared);
+
+    if ($conf->options->get ('ask'))
+    {
+       $libparrot_is_shared=
+           prompt("\nShould libparrot be built as a shared library?",
+                  $libparrot_is_shared ? 'y' : 'n');
+
+       $libparrot_is_shared = lc($libparrot_is_shared) eq 'y';
+    }
+
+    $conf->data->set
+       (libparrot_is_shared => $libparrot_is_shared,
+        
+        libparrot => $libparrot_is_shared
+        ? '$(LIBPARROT_SHARED)'
+        : '$(LIBPARROT_STATIC)');
+
+    $result = $libparrot_is_shared ? 'yes' : 'no';
+}
+
+1;
Index: config/init/defaults.pm
===================================================================
--- config/init/defaults.pm     (revision 10631)
+++ config/init/defaults.pm     (working copy)
@@ -75,6 +75,10 @@
         # allow dynamic libraries to access the binary's symbols
         link_dynamic  => $Config{ccdlflags}, # e.g. -Wl,-E on HP-UX
 
+        # sets the shared library search path on an executable
+        # e.g. -Wl,-rpath=XXX on Linux/-Wl,+b -Wl,XXX on HP-UX
+        link_rpath_blib => '',
+
         # ld: Tool used to build shared libraries and dynamically loadable
         # modules. Often $cc on Unix-ish systems, but apparently sometimes
         # it's ld.
@@ -85,7 +89,11 @@
         # libraries and modules that can be dynamically loaded.  Flags to tell
         # ld to build a shared library, e.g.  -shared for GNU ld.
         ld_share_flags => $Config{lddlflags},
-    
+
+       # sets internal shared library name for libparrot versioning
+       # e.g. -Wl,-soname on Linux/+h on HP-UX linker
+       ld_libparrot_soname => '',
+   
         # These relate to building of dynclasses.
         cc_building_dynclass_flag => '',
     
@@ -100,7 +108,7 @@
 
         cc_inc   => "-I./include",
         cc_debug      => '-g',
-        link_debug    => '',
+        link_debug    => '',   # Note:non-GNU linkers generally don't accept -g
 
         o             => $Config{_o},         # object files extension
         share_ext     => ".$Config{so}",      # shared library extension
@@ -120,19 +128,30 @@
         # include debug info in executable
         ld_debug      => '',
 
-        # should we have a dependancy upon arc to generate .a's?
-        blib_lib_libparrot_a => 'blib/lib/libparrot$(A)',
+        # Library build directory
+       blib_dir      => 'blib/lib',
 
+        # libparrot library names
+        libparrot_static => 'libparrot$(A)',
+        libparrot_shared => 'libparrot$(SHARE_EXT)',
+
+       # If this is set it will be linked to libparrot_shared,
+        # which is useful for versioning (see hints/)
+       libparrot_shared_alias => '',
+
+       # default behaviour for building libparrot static or shared
+        libparrot_is_shared => '0',
+
         perl          => $^X,
         test_prog     => 'parrot',
         rm_f          => '$(PERL) -MExtUtils::Command -e rm_f',
         rm_rf         => '$(PERL) -MExtUtils::Command -e rm_rf',
+        mkdir         => '$(PERL) -MExtUtils::Command -e mkpath',
         ar            => $Config{ar},
         ar_flags      => 'cr',
         ar_out        => '',                  # for Win32
         ar_extra      => '',                  # for Borland C
         ranlib        => $Config{ranlib},
-        rpath         => '-Wl,-rpath=',
         make          => $Config{make},
         make_set_make => $Config{make_set_make},
         make_and      => '&&',
Index: config/init/hints/hpux.pm
===================================================================
--- config/init/hints/hpux.pm   (revision 10631)
+++ config/init/hints/hpux.pm   (working copy)
@@ -13,8 +13,61 @@
         $libs .= ' -lpthread';
     }
 
+    
+   # It is possible to have various permutations of compiler and linker on
+   # HP-UX:
+   #
+   #   * The bundled (K&R) compiler/linker, which won't ever build parrot
+   #   * The commercial (c89) compiler and HP linker
+   #   * gcc with the HP linker
+   #   * gcc with the GNU linker
+   #
+   # Ever though we may have gcc, we need to know which linker is being used
+   #
+   # Note: The only configuration currently available to me is gcc with the
+   #       HP linker 
+
+    my $cc_shared      = $conf->data->get('cc_shared');
+    my $ld_share_flags = $conf->data->get('ld_share_flags');
+
+    my ($link_rpath_blib, $ld_libparrot_soname);
+
+    if ($ld_share_flags eq '-b')
+    {
+       # HP linker
+
+       $link_rpath_blib = '-Wl,+s -Wl,+b -Wl,' .
+           $conf->data->get('build_dir') . 
+           $conf->data->get('slash') . 
+           $conf->data->get('blib_dir') . ' ';
+    
+       $ld_libparrot_soname = '+h libparrot$(SHARE_EXT).$(SOVERSION) ';
+    }
+    else
+    {
+       # GNU linker (based on Linux)
+       
+       $link_rpath_blib =
+           '-Wl,-rpath=' .
+           $conf->data->get('build_dir') . 
+           $conf->data->get('slash') . 
+           $conf->data->get('blib_dir') . ' ';
+
+       $ld_libparrot_soname   = 
'-Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION) ';
+    }
+
     $conf->data->set(
         libs => $libs,
+
+
+        libparrot_is_shared    => 1,
+        libparrot_shared       => 'libparrot$(SHARE_EXT).$(SOVERSION)',
+        libparrot_shared_alias => 'libparrot$(SHARE_EXT)',
+
+        link_rpath_blib        => $link_rpath_blib,
+
+        ld_libparrot_soname    => $ld_libparrot_soname,
+
     );
 }
 
Index: config/init/hints/linux.pm
===================================================================
--- config/init/hints/linux.pm  (revision 10631)
+++ config/init/hints/linux.pm  (working copy)
@@ -48,6 +48,18 @@
         i_lib_pthread  => 1,               # XXX fake a header entry
         linkflags      => $linkflags,
         link           => $link,
+
+        libparrot_is_shared   => 1,
+        libparrot_shared      => 'libparrot$(SHARE_EXT).$(SOVERSION)',
+        libparrot_shared_alias=> 'libparrot$(SHARE_EXT)',
+
+        ld_libparrot_soname   => 
'-Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION) ',
+
+        link_rpath_blib =>
+                    '-Wl,-rpath=' .
+                    $conf->data->get('build_dir') . 
+                    $conf->data->get('slash') . 
+                    $conf->data->get('blib_dir') . ' ',
     );
 
     if ((split('-', $Config{archname}))[0] eq 'ia64') {
Index: config/init/hints/mswin32.pm
===================================================================
--- config/init/hints/mswin32.pm        (revision 10631)
+++ config/init/hints/mswin32.pm        (working copy)
@@ -51,12 +51,15 @@
             ld_load_flags  => '-dll -def:libparrot.def',
             ld_out     => '-out:',
             ldflags    => '-nologo -nodefaultlib',
-            blib_lib_libparrot_a => 'blib/lib/libparrot_s$(A)',
             ar_flags   => '',
             ar_out     => '-out:',
             slash      => '\\',
+            blib_dir   => 'blib\\lib',
             ccflags    => $ccflags,
-            ccwarn     => ''
+            ccwarn     => '',
+
+            libparrot_static => 'blib/lib/libparrot_s$(A)',
+            libparrot_shared => 'blib/lib/libparrot_s$(SHARE_EXT)',
         );
         # 'link' needs to be link.exe, not cl.exe.
         # This makes 'link' and 'ld' the same.
@@ -98,13 +101,17 @@
             ld_load_flags   => '-dll -def:libparrot.def',
             ld_out     => '-out:',
             ldflags    => '-nologo -nodefaultlib',
-            blib_lib_libparrot_a => 'blib/lib/libparrot_s$(A)',
             ar         => 'xilib',
             ar_flags   => '',
             ar_out     => '-out:',
             slash      => '\\',
+            blib_dir   => 'blib\\lib',
             ccflags    => $ccflags,
-            ccwarn     => ''
+            ccwarn     => '',
+
+            libparrot_static => 'blib/lib/libparrot_s$(A)',
+            libparrot_shared => 'blib/lib/libparrot_s$(SHARE_EXT)',
+
         );
         # 'link' needs to be xilink.exe, not icl.exe.
         # This makes 'link' and 'ld' the same.
@@ -146,9 +153,11 @@
             ar_out => '',
             ar_extra => '/au',
             slash => '\\',
+            blib_dir   => 'blib\\lib',
             make_and => "\n\t",
 
-            blib_lib_libparrot_a => 'blib\lib\libparrot.lib',
+            libparrot_static => 'libparrot.lib',
+            libparrot_shared => 'libparrot$(SHARE_EXT)',
         );
     }
     elsif( $is_mingw ) {
@@ -170,6 +179,7 @@
                 ncilib_link_extra => 'src/libnci_test.def',
                 o => '.o',
                 slash => '\\',
+                blib_dir   => 'blib\\lib',
             );
             if ($conf->data->get(qw(optimize)) eq "1") {
                 $conf->data->set(
Index: config/gen/makefiles/root.in
===================================================================
--- config/gen/makefiles/root.in        (revision 10631)
+++ config/gen/makefiles/root.in        (working copy)
@@ -89,8 +89,7 @@
 TOUCH      = $(PERL) -MExtUtils::Command -e touch
 YACC       = ${yacc}
 LEX        = ${lex}
-# do not die when dir already exits
-MKDIR      = $(PERL) -e ${PQ}-d or mkdir $$_,0777 or die foreach @ARGV${PQ}
+MKDIR      = $(PERL) -MExtUtils::Command -e mkpath
 CC         = ${cc}
 CC_INC     = ${cc_inc}
 C_LIBS     = ${libs}
@@ -457,19 +456,30 @@
 # Executables
 PARROT            = $(CUR_DIR)/${test_prog}$(EXE)
 MINIPARROT        = $(CUR_DIR)/miniparrot$(EXE)
-INSTALLABLEPARROT = $(CUR_DIR)/installable_parrot$(EXE)
-PARROT_SO         = $(CUR_DIR)/${test_prog}_so$(EXE)
 DIS               = $(CUR_DIR)/disassemble$(EXE)
 PDUMP             = $(CUR_DIR)/pdump$(EXE)
 PINFO             = $(CUR_DIR)/pbc_info$(EXE)
 PBCMERGE          = $(CUR_DIR)/pbc_merge$(EXE)
 PDB               = $(CUR_DIR)/pdb$(EXE)
 
-# libs
-LIBPARROT         = ${blib_lib_libparrot_a}
-#CONDITIONED_LINE(has_icu):ICU_SHARED      = ${icu_shared}
-ALL_PARROT_LIBS   = $(LIBPARROT) $(ICU_SHARED) $(C_LIBS)
+# Installable executables
+INSTALLABLEPARROT   = $(CUR_DIR)/installable_parrot$(EXE)
+INSTALLABLEDIS      = $(CUR_DIR)/installable_disassemble$(EXE)
+INSTALLABLEPDUMP    = $(CUR_DIR)/installable_pdump$(EXE)
+INSTALLABLEPINFO    = $(CUR_DIR)/installable_pbc_info$(EXE)
+INSTALLABLEPBCMERGE = $(CUR_DIR)/installable_pbc_merge$(EXE)
+INSTALLABLEPDB      = $(CUR_DIR)/installable_pdb$(EXE)
 
+# Libraries
+LIBPARROT_STATIC  = ${blib_dir}${slash}${libparrot_static}
+LIBPARROT_SHARED  = ${blib_dir}${slash}${libparrot_shared}
+
+# This line controls whether a static or shared library is built
+LIBPARROT         = ${libparrot}
+
+#CONDITIONED_LINE(has_icu):ICU_SHARED  = ${icu_shared}
+ALL_PARROT_LIBS   = -L${blib_dir} -lparrot $(ICU_SHARED) $(C_LIBS)
+
 # dynamic extensions
 DYNEXT_DIR        = runtime/parrot/dynext
 LIBNCI_TEST_SO    = $(DYNEXT_DIR)/libnci_test$(LOAD_EXT)
@@ -583,11 +593,9 @@
        @echo "  all:               'parrot' and the documentation."
        @echo "                     This is the default."
        @echo ""
-       @echo "  shared:            'parrot', dynamically linked"
-       @echo "  all_shared:        'parrot', dynamically linked and the 
documentation"
-       @echo ""
        @echo "  world:             'all' and 'parrot_utils'."
-       @echo "  world_shared:      'all_shared' and 'parrot_utils_shared'"
+       @echo "  installable:       same as 'world', but targets for 
installation"
+
        @echo ""
        @echo "  parrot_utils:      $(PDUMP), $(DIS), $(PINFO), $(PDB) and 
$(PBCMERGE)"
        @echo "  $(PDUMP):             Parrot Dumper"
@@ -596,7 +604,6 @@
        @echo "  $(PDB):               Parrot Debugger"
        @echo "  $(PBCMERGE):         Parrot Debugger"
        @echo ""
-       @echo "  parrot_utils_shared: same as parrot_utils, but linked against 
a shared libparrot"
        @echo ""
        @echo "Installation:"
        @echo "  install:           Install under '/usr/local/parrot' on Unix 
systems"
@@ -673,11 +680,10 @@
 
 world : all parrot_utils
 
-world_shared: all_shared parrot_utils_shared
-
 parrot_utils : $(PDUMP) $(DIS) $(PINFO) $(PDB) $(PBCMERGE)
-parrot_utils_shared : $(PDUMP)_shared $(DIS)_shared $(PINFO)_shared 
$(PDB)_shared $(PBCMERGE)_shared
 
+installable : all $(INSTALLABLEPARROT) $(INSTALLABLEPDUMP) $(INSTALLABLEDIS) 
$(INSTALLABLEPINFO) $(INSTALLABLEPDB) $(INSTALLABLEPBCMERGE)
+
 flags_dummy :
        @echo Compiling with:
        @$(PERL) tools/dev/cc_flags.pl $(CUR_DIR)/CFLAGS echo $(CC) $(CFLAGS) 
-I$(@D) ${cc_o_out} xx$(O) -c xx.c
@@ -695,20 +701,21 @@
 $(PARROT) : $(IMCC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
        lib/Parrot/OpLib/core.pm $(SRC_DIR)/parrot_config$(O) \
        $(MINIPARROT) ${parrot_exe_def}
-       $(LINK) ${ld_out}$(PARROT) $(LINKFLAGS) $(LINK_DYNAMIC) 
${ld_parrot_exe_def} \
-       $(IMCC_DIR)/main$(O) $(ALL_PARROT_LIBS) $(SRC_DIR)/parrot_config$(O)
+       $(LINK) ${ld_out}$@ $(LINKFLAGS) $(LINK_DYNAMIC) ${ld_parrot_exe_def} \
+       $(IMCC_DIR)/main$(O) ${link_rpath_blib}$(ALL_PARROT_LIBS) \
+        $(SRC_DIR)/parrot_config$(O)
 #
 # TODO build the real miniparrot
 #
 $(MINIPARROT) : $(IMCC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
        lib/Parrot/OpLib/core.pm $(SRC_DIR)/null_config$(O)
-       $(LINK) ${ld_out}$(MINIPARROT) $(LINKFLAGS) $(IMCC_DIR)/main$(O) \
-       $(ALL_PARROT_LIBS) $(SRC_DIR)/null_config$(O)
+       $(LINK) ${ld_out}$@ $(LINKFLAGS) $(IMCC_DIR)/main$(O) \
+       ${link_rpath_blib}$(ALL_PARROT_LIBS) $(SRC_DIR)/null_config$(O)
 
 $(INSTALLABLEPARROT) : $(IMCC_DIR)/main$(O) $(GEN_HEADERS) $(LIBPARROT) \
        lib/Parrot/OpLib/core.pm $(SRC_DIR)/install_config$(O) \
        $(PARROT)
-       $(LINK) ${ld_out}$(INSTALLABLEPARROT) $(LINKFLAGS) \
+       $(LINK) ${ld_out}$@ $(LINKFLAGS) \
        $(IMCC_DIR)/main$(O) \
        $(ALL_PARROT_LIBS) $(SRC_DIR)/install_config$(O)
 
@@ -747,40 +754,27 @@
 check_source : $(GENERAL_H_FILES)
        $(PERL) tools/dev/check_source_standards.pl all_source
 
-###############################################################################
-#
-# Shared Library Targets:
-#
-###############################################################################
-
-shared : $(GEN_HEADERS) blib/lib/libparrot$(SHARE_EXT).$(SOVERSION) 
$(LIBPARROT) $(INSTALLABLEPARROT)
-       $(LINK) ${ld_out}$(INSTALLABLEPARROT) $(LINKFLAGS) $(IMCC_DIR)/main$(O) 
-Lblib/lib -lparrot $(ICU_SHARED) $(C_LIBS)
-
-all_shared : all shared
-
-static : $(GEN_HEADERS) $(LIBPARROT)
-
 # XXX changes don't always propagate into libparrot
 # e.g. when I change debug:fataly to xfataly, nm still shows the old symbol
 # and parrot builds fine (except for the unproto warning
 # so always delete the lib -leo
 
-$(LIBPARROT) : $(O_FILES)
+$(LIBPARROT_STATIC) : $(O_FILES)
        $(RM_F) $@
-       $(MKDIR) blib blib/lib
+       $(MKDIR) ${blib_dir}
+       $(RM_F) $(LIBPARROT_STATIC) $(LIBPARROT_SHARED)
        $(AR_CR) ${ar_out}$@ ${ar_extra} $(O_FILES)
        $(RANLIB) $@
 
-blib/lib/libparrot$(SHARE_EXT).$(SOVERSION) : $(O_FILES) 
$(SRC_DIR)/install_config$(O)
-       $(MKDIR) blib blib/lib
-       $(LD) -Wl,-soname=libparrot$(SHARE_EXT).$(SOVERSION) $(LD_SHARE_FLAGS) 
$(LDFLAGS) ${ld_out}blib/lib/libparrot$(SHARE_EXT).$(SOVERSION) $(O_FILES) 
$(SRC_DIR)/install_config$(O) $(C_LIBS) $(ICU_SHARED)) 
-       cp blib/lib/libparrot$(SHARE_EXT).$(SOVERSION) 
blib/lib/libparrot$(SHARE_EXT)
 
-$(PARROT_SO) : $(IMCC_DIR)/main$(O) blib/lib/libparrot$(SHARE_EXT) 
lib/Parrot/OpLib/core.pm
-       $(LINK) $(LINKFLAGS) ${ld_out}$(PARROT) $(IMCC_DIR)/main$(O) \
-       $(SRC_DIR)/parrot_config$(O) -Lblib/lib -lparrot \
-       $(C_LIBS) $(ICU_SHARED)
+$(LIBPARROT_SHARED) : $(O_FILES)
+       $(MKDIR) ${blib_dir}
+       $(RM_F) $(LIBPARROT_STATIC) $(LIBPARROT_SHARED)
+       $(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) ${ld_out}$@ \
+       ${ld_libparrot_soname}$(O_FILES) $(C_LIBS) $(ICU_SHARED)
+#CONDITIONED_LINE(libparrot_shared_alias):     ( cd ${blib_dir} ; ln -sf 
${libparrot_shared} ${libparrot_shared_alias} )
 
+
 #
 # Parrot Debugger
 #
@@ -788,15 +782,16 @@
 $(SRC_DIR)/pdb$(O) : $(GENERAL_H_FILES)
 
 $(PDB) : $(SRC_DIR)/pdb$(O) $(LIBPARROT)
-       $(LINK) ${ld_out}$(PDB) \
+       $(LINK) ${ld_out}$@ \
        $(SRC_DIR)/pdb$(O) \
        $(SRC_DIR)/null_config$(O) \
-       $(LINKFLAGS) $(ALL_PARROT_LIBS)
+       $(LINKFLAGS) ${link_rpath_blib}$(ALL_PARROT_LIBS)
 
-$(PDB)_shared : $(SRC_DIR)/pdb$(O) blib/lib/libparrot$(SHARE_EXT).$(SOVERSION)
-       $(LINK) ${ld_out}$(PDB)_shared \
+$(INSTALLABLEPDB) : $(SRC_DIR)/pdb$(O) $(LIBPARROT)
+       $(LINK) ${ld_out}$@ \
        $(SRC_DIR)/pdb$(O) \
-       $(LINKFLAGS) -Lblib/lib -lparrot $(ALL_PARROT_LIBS)
+       $(SRC_DIR)/install_config$(O) \
+       $(LINKFLAGS) $(ALL_PARROT_LIBS)
 
 #
 # Parrot Disassembler
@@ -805,61 +800,66 @@
 $(SRC_DIR)/disassemble$(O) : $(GENERAL_H_FILES)
 
 $(DIS) : $(SRC_DIR)/disassemble$(O) $(LIBPARROT)
-       $(LINK) ${ld_out}$(DIS) \
+       $(LINK) ${ld_out}$@ \
        $(SRC_DIR)/disassemble$(O) \
        $(SRC_DIR)/null_config$(O) \
-       $(LINKFLAGS) $(ALL_PARROT_LIBS)
+       $(LINKFLAGS) ${link_rpath_blib}$(ALL_PARROT_LIBS)
 
-$(DIS)_shared : $(SRC_DIR)/disassemble$(O) 
blib/lib/libparrot$(SHARE_EXT).$(SOVERSION)
-       $(LINK) ${ld_out}$(DIS)_shared \
+$(INSTALLABLEDIS) : $(SRC_DIR)/disassemble$(O) $(LIBPARROT)
+       $(LINK) ${ld_out}$@ \
        $(SRC_DIR)/disassemble$(O) \
-       $(LINKFLAGS) -Lblib/lib -lparrot $(ALL_PARROT_LIBS)
+       $(SRC_DIR)/install_config$(O) \
+       $(LINKFLAGS) $(ALL_PARROT_LIBS)
 
 #
 # Parrot Dump
 #
 
 $(PDUMP) : $(SRC_DIR)/pdump$(O) $(SRC_DIR)/packdump$(O) $(LIBPARROT)
-       $(LINK) ${ld_out}$(PDUMP) \
+       $(LINK) ${ld_out}$@ \
        $(SRC_DIR)/pdump$(O) \
        $(SRC_DIR)/null_config$(O) \
-       $(SRC_DIR)/packdump$(O) $(LINKFLAGS) $(ALL_PARROT_LIBS)
+       $(SRC_DIR)/packdump$(O) $(LINKFLAGS) 
${link_rpath_blib}$(ALL_PARROT_LIBS)
 
-$(PDUMP)_shared : $(SRC_DIR)/pdump$(O) $(SRC_DIR)/packdump$(O) 
blib/lib/libparrot$(SHARE_EXT).$(SOVERSION)
-       $(LINK) ${ld_out}$(PDUMP)_shared \
+$(INSTALLABLEPDUMP) : $(SRC_DIR)/pdump$(O) $(SRC_DIR)/packdump$(O) $(LIBPARROT)
+       $(LINK) ${ld_out}$@ \
        $(SRC_DIR)/pdump$(O) \
-       $(SRC_DIR)/packdump$(O) \
-       $(LINKFLAGS) -Lblib/lib -lparrot $(ALL_PARROT_LIBS)
+       $(SRC_DIR)/install_config$(O) \
+       $(SRC_DIR)/packdump$(O) $(LINKFLAGS) $(ALL_PARROT_LIBS)
 
 
 # pbc_info
 $(PINFO) : $(SRC_DIR)/pbc_info$(O) $(LIBPARROT)
-       $(LINK) ${ld_out}$(PINFO) \
+       $(LINK) ${ld_out}$@ \
        $(SRC_DIR)/pbc_info$(O) \
        $(SRC_DIR)/null_config$(O) \
-       $(LINKFLAGS) $(ALL_PARROT_LIBS)
+       $(LINKFLAGS) ${link_rpath_blib}$(ALL_PARROT_LIBS)
 
-$(PINFO)_shared : $(SRC_DIR)/pbc_info$(O) 
blib/lib/libparrot$(SHARE_EXT).$(SOVERSION)
-       $(LINK) ${ld_out}$(PINFO)_shared \
+$(INSTALLABLEPINFO) : $(SRC_DIR)/pbc_info$(O) $(LIBPARROT)
+       $(LINK) ${ld_out}$@ \
        $(SRC_DIR)/pbc_info$(O) \
-       $(LINKFLAGS) -Lblib/lib -lparrot $(ALL_PARROT_LIBS)
+       $(SRC_DIR)/install_config$(O) \
+       $(LINKFLAGS) $(ALL_PARROT_LIBS)
 
 #
 # Parrot Bytecode File Merger
 #
 
 $(PBCMERGE) : $(SRC_DIR)/pbc_merge$(O) $(LIBPARROT) 
$(SRC_DIR)/parrot_config$(O)
-       $(LINK) ${ld_out}$(PBCMERGE) \
+       $(LINK) ${ld_out}$@ \
        $(SRC_DIR)/pbc_merge$(O) \
        $(SRC_DIR)/parrot_config$(O) \
-       $(LINKFLAGS) $(LINK_DYNAMIC) $(ALL_PARROT_LIBS)
+       $(LINKFLAGS) $(LINK_DYNAMIC) ${link_rpath_blib}$(ALL_PARROT_LIBS)
 
-$(PBCMERGE)_shared : $(SRC_DIR)/pbc_merge$(O) 
blib/lib/libparrot$(SHARE_EXT).$(SOVERSION)
-       $(LINK) ${ld_out}$(PBCMERGE)_shared \
+
+$(INSTALLABLEPBCMERGE) : $(SRC_DIR)/pbc_merge$(O) $(LIBPARROT)
+       $(LINK) ${ld_out}$@ \
        $(SRC_DIR)/pbc_merge$(O) \
-       $(LINKFLAGS) -Lblib/lib -lparrot $(ALL_PARROT_LIBS)
+       $(SRC_DIR)/install_config$(O) \
+       $(LINKFLAGS) $(ALL_PARROT_LIBS)
 
 
+
 ###############################################################################
 #
 # Other Dependencies and Build Rules:
@@ -1417,18 +1417,25 @@
                $(PARROT) \
                $(MINIPARROT) \
                $(INSTALLABLEPARROT) \
+               $(INSTALLABLEDIS) \
+               $(INSTALLABLEPDUMP) \
+               $(INSTALLABLEPINFO) \
+               $(INSTALLABLEPBCMERGE) \
+               $(INSTALLABLEPDB) \
                $(IMCC_DIR)/main$(O) \
-               $(PDUMP) $(PDUMP)_shared $(SRC_DIR)/pdump$(O) 
$(SRC_DIR)/packdump$(O) \
-               $(SRC_DIR)/pbc_info$(O) $(PINFO)_shared $(PINFO) \
-               $(PDB) $(PDB)_shared $(SRC_DIR)/pdb$(O) \
-               $(PBCMERGE) $(PBCMERGE)_shared $(SRC_DIR)/pbc_merge$(O) \
-               $(DIS) $(DIS)_shared $(SRC_DIR)/disassemble$(O) \
+               $(PDUMP) $(SRC_DIR)/pdump$(O) $(SRC_DIR)/packdump$(O) \
+               $(SRC_DIR)/pbc_info$(O) $(PINFO) \
+               $(PDB) $(SRC_DIR)/pdb$(O) \
+               $(PBCMERGE) $(SRC_DIR)/pbc_merge$(O) \
+               $(DIS) $(SRC_DIR)/disassemble$(O) \
                $(SRC_DIR)/null_config$(O) \
                $(SRC_DIR)/parrot_config$(O) \
                $(SRC_DIR)/install_config$(O) \
                install_config.fpmc \
                $(LIBNCI_TEST_SO) \
-               $(LIBPARROT)
+#CONDITIONED_LINE(libparrot_shared_alias):              
${blib_dir}${slash}${libparrot_shared_alias} \
+               $(LIBPARROT_STATIC) \
+               $(LIBPARROT_SHARED)
        $(PERL) tools/build/c2str.pl --init
        $(RM_F) \
                $(INC_DIR)/string_private_cstring.h \
@@ -1559,7 +1566,7 @@
 #
 ###############################################################################
 
-install : $(INSTALLABLEPARROT)
+install : installable
        $(PERL) tools/dev/install_files.pl \
        --buildprefix=$(BUILDPREFIX) \
        --prefix=$(PREFIX) \
@@ -1616,11 +1623,8 @@
 ###############################################################################
 
 exec : $(SRC_DIR)/exec_start$(O) $(SRC_DIR)/parrot_config$(O) $(LIBPARROT)
-       $(LINK) ${ld_out}$(EXEC)$(EXE) $(LINKFLAGS) $(EXEC)$(O) 
$(SRC_DIR)/exec_start$(O) $(SRC_DIR)/parrot_config$(O) $(ALL_PARROT_LIBS)
+       $(LINK) ${ld_out}$(EXEC)$(EXE) $(LINKFLAGS) $(EXEC)$(O) 
$(SRC_DIR)/exec_start$(O) $(SRC_DIR)/parrot_config$(O) 
${link_rpath_blib}$(ALL_PARROT_LIBS)
 
-exec_so : $(SRC_DIR)/exec_start$(O) blib/lib/libparrot$(SHARE_EXT)
-       $(LINK) ${ld_out}$(EXEC)$(SHARE_EXT) $(LINKFLAGS) $(EXEC)$(O) 
$(SRC_DIR)/exec_start$(O) $(SRC_DIR)/parrot_config$(O) -lparrot $(C_LIBS)
-
 ###### OS depend targets ##########
 
 # for use by t/pmc/nci.t

Reply via email to