[Pkg-ocaml-maint-commits] [SCM] OCaml packaging branch, 312/master, updated. debian/3.11.2-4-42-g49f9260
Stephane Glondu
steph at glondu.net
Fri Mar 18 23:01:01 UTC 2011
The following commit has been merged in the 312/master branch:
commit 49f9260fab34a863e81d1df473cbdffb4d5de0a1
Author: Stephane Glondu <steph at glondu.net>
Date: Fri Mar 18 15:33:45 2011 +0100
Add 0008-Embed-bytecode-in-C-object-when-using-custom.patch
diff --git a/debian/patches/0008-Embed-bytecode-in-C-object-when-using-custom.patch b/debian/patches/0008-Embed-bytecode-in-C-object-when-using-custom.patch
new file mode 100644
index 0000000..46f3f5a
--- /dev/null
+++ b/debian/patches/0008-Embed-bytecode-in-C-object-when-using-custom.patch
@@ -0,0 +1,84 @@
+From: Stephane Glondu <steph at glondu.net>
+Date: Sun, 17 Aug 2008 17:10:03 +0200
+Subject: Embed bytecode in C object when using -custom
+
+This patch fixes non-strippability of bytecode executables linked with
+custom runtime.
+
+Forwarded: not-needed
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=256900
+Signed-off-by: Stephane Glondu <steph at glondu.net>
+---
+ bytecomp/bytelink.ml | 30 ++++++++++++++++++++++++++----
+ 1 files changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
+index 4a6426d..e2f7bcd 100644
+--- a/bytecomp/bytelink.ml
++++ b/bytecomp/bytelink.ml
+@@ -402,7 +402,7 @@ let output_cds_file outfile =
+
+ (* Output a bytecode executable as a C file *)
+
+-let link_bytecode_as_c tolink outfile =
++let link_bytecode_as_c tolink outfile with_main =
+ let outchan = open_out outfile in
+ begin try
+ (* The bytecode *)
+@@ -444,7 +444,18 @@ CAMLextern void caml_startup_code(\n\
+ (* The table of primitives *)
+ Symtable.output_primitive_table outchan;
+ (* The entry point *)
+- output_string outchan "\n\
++ if with_main then begin
++ output_string outchan "\n\
++int main(int argc, char **argv)\n\
++{\n\
++ caml_startup_code(caml_code, sizeof(caml_code),\n\
++ caml_data, sizeof(caml_data),\n\
++ caml_sections, sizeof(caml_sections),\n\
++ argv);\n\
++ return 0; /* not reached */\n\
++}\n"
++ end else begin
++ output_string outchan "\n
+ void caml_startup(char ** argv)\n\
+ {\n\
+ caml_startup_code(caml_code, sizeof(caml_code),\n\
+@@ -454,7 +465,8 @@ void caml_startup(char ** argv)\n\
+ }\n\
+ #ifdef __cplusplus\n\
+ }\n\
+-#endif\n";
++#endif\n"
++ end;
+ close_out outchan
+ with x ->
+ close_out outchan;
+@@ -501,6 +513,16 @@ let link objfiles output_name =
+ Clflags.dllibs := !lib_dllibs @ !Clflags.dllibs; (* put user's DLLs first *)
+ if not !Clflags.custom_runtime then
+ link_bytecode tolink output_name true
++ else if not !Clflags.make_runtime then
++ let c_file = Filename.temp_file "camlobj" ".c" in
++ try
++ link_bytecode_as_c tolink c_file true;
++ let exec_name = fix_exec_name output_name in
++ if not (build_custom_runtime c_file exec_name)
++ then raise(Error Custom_runtime);
++ with x ->
++ remove_file c_file;
++ raise x
+ else if not !Clflags.output_c_object then begin
+ let bytecode_name = Filename.temp_file "camlcode" "" in
+ let prim_name = Filename.temp_file "camlprim" ".c" in
+@@ -539,7 +561,7 @@ let link objfiles output_name =
+ if Sys.file_exists c_file then raise(Error(File_exists c_file));
+ let temps = ref [] in
+ try
+- link_bytecode_as_c tolink c_file;
++ link_bytecode_as_c tolink c_file false;
+ if not (Filename.check_suffix output_name ".c") then begin
+ temps := c_file :: !temps;
+ if Ccomp.compile_file c_file <> 0 then raise(Error Custom_runtime);
+--
diff --git a/debian/patches/series b/debian/patches/series
index e83eb68..73ce439 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@
0005-Patch-config.sh-for-installation.patch
0006-Install-ocamlbuild-as-a-link-on-either-.native-or-.b.patch
0007-Fix-ocamlopt-w.r.t.-binutils-2.21.patch
+0008-Embed-bytecode-in-C-object-when-using-custom.patch
--
OCaml packaging
More information about the Pkg-ocaml-maint-commits
mailing list