lang/gnat-aux: Modify rpath handling for shared project libraries

The GNAT compiler project builder essentially doesn't support DESTDIR
out of the box.  By default, it sets rpath of shared libraries to the
directory to which they are installed.  One may add additional rpaths
through switches, but not remove these default ones.  Also added to
the default rpath are the paths to the ada library and the standard
localbase library.

This modification to the compiler will force the project builder to
recognize the -R switch (gnatlink uses this to disable rpaths), and
it reacts by not putting the library install path into rpath.  The
adalib and ${LOCALBASE}/lib paths will still make up the base rpath
definition of the built shared libraries.

This change was prompted by the rpath troubles of the XML/Ada package.
This commit is contained in:
marino 2011-12-03 07:28:18 +00:00
parent afe7739fd1
commit b75a4ca28c
4 changed files with 39 additions and 5 deletions

View file

@ -1,8 +1,8 @@
# $NetBSD: Makefile,v 1.6 2011/10/05 18:11:55 marino Exp $
# $NetBSD: Makefile,v 1.7 2011/12/03 07:28:18 marino Exp $
#
DISTNAME= gnat-aux-${SNAPSHOT}
PKGREVISION= 1
PKGREVISION= 2
CATEGORIES= lang
MASTER_SITES= http://downloads.dragonlace.net/src/ \
http://dragonlace.mirrors.ada.cx/src/

View file

@ -1,11 +1,11 @@
# $NetBSD: buildlink3.mk,v 1.1.1.1 2011/02/01 20:32:56 drochner Exp $
# $NetBSD: buildlink3.mk,v 1.2 2011/12/03 07:28:18 marino Exp $
BUILDLINK_TREE+= gnat-aux
.if !defined(GNAT_AUX_BUILDLINK3_MK)
GNAT_AUX_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.gnat-aux+= gnat-aux>=20101120
BUILDLINK_API_DEPENDS.gnat-aux+= gnat-aux>=20110627nb2
BUILDLINK_PKGSRCDIR.gnat-aux?= ../../lang/gnat-aux
.include "../../devel/zlib/buildlink3.mk"

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.5 2011/10/05 18:11:55 marino Exp $
$NetBSD: distinfo,v 1.6 2011/12/03 07:28:18 marino Exp $
SHA1 (gnat-aux-20110627.tar.bz2) = 598d2c21c3bbd1e2cada2ca98331107af3deb608
RMD160 (gnat-aux-20110627.tar.bz2) = 84b05832457568fef9355279214caeacca9c74ba
@ -21,3 +21,4 @@ Size (gnat-bootstrap.i386.solaris.tar.bz2) = 43247034 bytes
SHA1 (patch-aa) = 8a6199bb91fa1051db7af154e6995c116da71e63
SHA1 (patch-ab) = 76cff68f5f697ed5aacd41d06bbb4d9a805e9d91
SHA1 (patch-ac) = f8a73fc95b9119ae75b64a5578b94be6dbccb837
SHA1 (patch-ad) = b72ac305a11f40d77f76a8a1b579a93742123079

View file

@ -0,0 +1,33 @@
--- gcc/ada/mlib-prj.adb
+++ gcc/ada/mlib-prj.adb
@@ -341,6 +341,11 @@ package body MLib.Prj is
Foreign_Sources : Boolean;
+ Rpath_Disabled : Boolean := False;
+ -- If -R is passed through the library options for the linker, it will
+ -- prevent the implemented libraries portion of the rpath switch from
+ -- being built, even if the linker is capable of supporting rpath.
+
Rpath : String_Access := null;
-- Allocated only if Path Option is supported
@@ -790,7 +795,7 @@ package body MLib.Prj is
Opts.Table (Opts.Last) :=
new String'("-L" & Name_Buffer (1 .. Name_Len));
- if Path_Option /= null then
+ if not Rpath_Disabled and then Path_Option /= null then
Add_Rpath (Name_Buffer (1 .. Name_Len));
end if;
@@ -1285,6 +1290,9 @@ package body MLib.Prj is
Opts.Increment_Last;
Opts.Table (Opts.Last) :=
new String'(Name_Buffer (1 .. Name_Len));
+ if Name_Len = 2 and then Name_Buffer (1 .. 2) = "-R" then
+ Rpath_Disabled := True;
+ end if;
end if;
Current := Element.Next;