Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ocamlmklib patch to (conditionally) properly handle RPATH (Re: xentools41 LDFLAGS Re: broken packages for 2012Q3)



On Tue, Mar 12, 2013 at 01:08:57PM +0100, Ignatios Souvatzis wrote:

> (...) Unfortunately, this doesn't solve the issue. If we do this, both the 
> -L and the -Wl,-rpath path are added to the .so's rpath.
> 
> That's because ocamlmklib adds the -L arguments to the rpath used later with
> -R, if they're absolute (defined for Unixoids as "starting with '/'"):
> 
> From ocamlmklib:
> 
>     else if starts_with s "-L" then
>       (c_Lopts := s :: !c_Lopts;
>       let l = chop_prefix s "-L" in
>          if not (Filename.is_relative l) then rpath := l :: !rpath)

I've prepared a patch for ocaml to make this conditional on not setting
a new flag, "-elfmode". (see below).

This way we can proceed for the time being until the Inria OCamL people 
have decided what to do.

May I commit?

        -is
? fistinfo
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/lang/ocaml/Makefile,v
retrieving revision 1.82
diff -u -r1.82 Makefile
--- Makefile    4 Mar 2013 08:52:53 -0000       1.82
+++ Makefile    13 Mar 2013 13:40:12 -0000
@@ -2,6 +2,8 @@
 
 .include "Makefile.common"
 
+PKGREVISION=           1
+
 CONFIGURE_ARGS+=       -no-tk
 CONFIGURE_ARGS+=       -cc ${CC}
 CONFIGURE_ENV+=                disable_x11=yes
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/lang/ocaml/distinfo,v
retrieving revision 1.69
diff -u -r1.69 distinfo
--- distinfo    18 Feb 2013 16:29:28 -0000      1.69
+++ distinfo    13 Mar 2013 13:40:12 -0000
@@ -29,3 +29,4 @@
 SHA1 (patch-stdlib_Makefile) = 85c89d6b9caf08056407da3564e7d2f5353b93a0
 SHA1 (patch-stdlib_Makefile.shared) = 42dafb10f88b501982fb0d65c380f1fa61740f54
 SHA1 (patch-tools_Makefile.shared) = 8c23fc72c627e2315451e6223946e9257c3e341d
+SHA1 (patch-tools_ocamlmklib) = 4c288c1d7e281aaee9f7ef6d7158b848b49ed2a6
Index: patches/patch-tools_ocamlmklib
===================================================================
RCS file: patches/patch-tools_ocamlmklib
diff -N patches/patch-tools_ocamlmklib
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-tools_ocamlmklib      13 Mar 2013 13:40:12 -0000
@@ -0,0 +1,41 @@
+$NetBSD$
+
+--- tools/ocamlmklib.mlp.orig  2012-07-17 18:25:54.000000000 +0000
++++ tools/ocamlmklib.mlp
+@@ -26,6 +26,7 @@ and c_objs = ref []         (* .o, .a, .
+ and caml_libs = ref []      (* -cclib to pass to ocamlc, ocamlopt *)
+ and caml_opts = ref []      (* -ccopt to pass to ocamlc, ocamlopt *)
+ and dynlink = ref supports_shared_libraries
++and elfmode = ref false     (* do not add C link lib path to run-time path *)
+ and failsafe = ref false    (* whether to fall back on static build only *)
+ and c_libs = ref []         (* libs to pass to mksharedlib and ocamlc -cclib 
*)
+ and c_Lopts = ref []      (* options to pass to mksharedlib and ocamlc -cclib 
*)
+@@ -95,8 +96,9 @@ let parse_arguments argv =
+       c_libs := s :: !c_libs
+     else if starts_with s "-L" then
+      (c_Lopts := s :: !c_Lopts;
+-      let l = chop_prefix s "-L" in
+-      if not (Filename.is_relative l) then rpath := l :: !rpath)
++      if not !elfmode then
++      (let l = chop_prefix s "-L" in
++       if not (Filename.is_relative l) then rpath := l :: !rpath))
+     else if s = "-ocamlc" then
+       ocamlc := next_arg ()
+     else if s = "-ocamlopt" then
+@@ -107,6 +109,8 @@ let parse_arguments argv =
+       output_c := next_arg()
+     else if s = "-dllpath" || s = "-R" || s = "-rpath" then
+       rpath := next_arg() :: !rpath
++    else if s = "-elfmode" then
++      elfmode := true
+     else if starts_with s "-R" then
+       rpath := chop_prefix s "-R" :: !rpath
+     else if s = "-Wl,-rpath" then
+@@ -150,6 +154,7 @@ Usage: ocamlmklib [options] <.cmo|.cma|.
+ \n  -ccopt <opt>   C option passed to ocamlc -a or ocamlopt -a only\
+ \n  -custom        disable dynamic loading\
+ \n  -dllpath <dir> Add <dir> to the run-time search path for DLLs\
++\n  -elfmode       Do not add link-time search path to run-time path\
+ \n  -F<dir>        Specify a framework directory (MacOSX)\
+ \n  -framework <name>    Use framework <name> (MacOSX)\
+ \n  -help          Print this help message and exit\


Home | Main Index | Thread Index | Old Index