[svn:parrot] r35849 - in trunk/config: gen/makefiles inter

[email protected] Tue, 20 Jan 2009 17:07:26 -0800 (PST)
Newsgroups perl.cvs.parrot
Message-ID <[email protected]>
Author: chromatic
Date: Tue Jan 20 17:07:25 2009
New Revision: 35849

Modified:
   trunk/config/gen/makefiles/root.in
   trunk/config/inter/libparrot.pm

Log:
[install] Added linker magic so that installable binaries get the correct rpath
to work with the installed libparrot (Andy Dougherty).

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in	(original)
+++ trunk/config/gen/makefiles/root.in	Tue Jan 20 17:07:25 2009
@@ -798,7 +798,7 @@
     $(PARROT)
 	$(LINK) @ld_out@$@ \
     $(SRC_DIR)/main$(O) \
-    $(ALL_PARROT_LIBS) $(LINKFLAGS) $(SRC_DIR)/install_config$(O)
+    @rpath_lib@ $(ALL_PARROT_LIBS) $(LINKFLAGS) $(SRC_DIR)/install_config$(O)
 #IF(win32):	if exist [email protected] mt.exe -nologo -manifest [email protected] -outputresource:$@;1
 
 $(INC_DIR)/parrot.h : $(INC_DIR)/pbcversion.h $(INC_DIR)/vtable.h
@@ -897,7 +897,7 @@
 	$(LINK) @ld_out@$@ \
     $(SRC_DIR)/parrot_debugger$(O) \
     $(SRC_DIR)/parrot_config$(O) \
-    $(ALL_PARROT_LIBS) $(LINKFLAGS)
+    @rpath_lib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
 #IF(win32):	if exist [email protected] mt.exe -nologo -manifest [email protected] -outputresource:$@;1
 
 #
@@ -915,7 +915,7 @@
 $(INSTALLABLEDIS) : $(SRC_DIR)/pbc_disassemble$(O) $(LIBPARROT)
 	$(LINK) @ld_out@$@ \
     $(SRC_DIR)/pbc_disassemble$(O) \
-    $(ALL_PARROT_LIBS) $(LINKFLAGS)
+    @rpath_lib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
 #IF(win32):	if exist [email protected] mt.exe -nologo -manifest [email protected] -outputresource:$@;1
 
 #
@@ -933,7 +933,8 @@
 $(INSTALLABLEPDUMP) : $(SRC_DIR)/pdump$(O) $(SRC_DIR)/packdump$(O) $(LIBPARROT)
 	$(LINK) @ld_out@$@ \
     $(SRC_DIR)/pdump$(O) \
-    $(SRC_DIR)/packdump$(O) $(ALL_PARROT_LIBS) $(LINKFLAGS)
+    $(SRC_DIR)/packdump$(O) \
+    @rpath_lib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
 #IF(win32):	if exist [email protected] mt.exe -nologo -manifest [email protected] -outputresource:$@;1
 
 
@@ -949,7 +950,7 @@
 $(INSTALLABLEPINFO) : $(SRC_DIR)/pbc_info$(O) $(LIBPARROT)
 	$(LINK) @ld_out@$@ \
     $(SRC_DIR)/pbc_info$(O) \
-    $(ALL_PARROT_LIBS) $(LINKFLAGS)
+    @rpath_lib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
 #IF(win32):	if exist [email protected] mt.exe -nologo -manifest [email protected] -outputresource:$@;1
 
 #
@@ -967,7 +968,7 @@
 	$(LINK) @ld_out@$@ \
     $(SRC_DIR)/pbc_merge$(O) \
     $(SRC_DIR)/install_config$(O) \
-    $(ALL_PARROT_LIBS) $(LINKFLAGS)
+    @rpath_lib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
 #IF(win32):	if exist [email protected] mt.exe -nologo -manifest [email protected] -outputresource:$@;1
 
 

Modified: trunk/config/inter/libparrot.pm
==============================================================================
--- trunk/config/inter/libparrot.pm	(original)
+++ trunk/config/inter/libparrot.pm	Tue Jan 20 17:07:25 2009
@@ -75,6 +75,8 @@
         : '$(LIBPARROT_STATIC)',
     );
 
+    # Set -rpath (or equivalent) for executables to find the
+    # shared libparrot in the build directory.
     $conf->data->set(
         rpath_blib => ( $parrot_is_shared && $conf->data->get('rpath') )
         ? $conf->data->get('rpath')
@@ -83,6 +85,15 @@
             . $conf->data->get('blib_dir')
         : ''
     );
+    
+    # Set -rpath (or equivalent) for the installed executables to find the
+    # installed shared libparrot.
+    $conf->data->set(
+        rpath_lib => ( $parrot_is_shared && $conf->data->get('rpath') )
+        ? $conf->data->get('rpath')
+            . $conf->data->get('libdir')
+        : ''
+    );
 
     unless ( defined( $conf->data->get('libparrot_ldflags') ) ) {
         $conf->data->set(libparrot_ldflags =>