Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/Changes b/Changes
- index 21177e4..3b15908 100644
- --- a/Changes
- +++ b/Changes
- @@ -88,6 +88,11 @@ OCamlbuild:
- (Peter Zotov)
- - PR#6720: pass -g to C compilers when tag 'debug' is set
- (Peter Zotov, Gabriel Scherer)
- +- PR#6733: add .byte.so and .native.so targets to pass
- + -output-obj -cclib -shared.
- + (Peter Zotov)
- +- PR#6733: "runtime_variant(X)" to pass -runtime-variant X option.
- + (Peter Zotov)
- Tools:
- - PR#6641: add -g, -ocamlcflags, -ocamloptflags options to ocamlmklib
- diff --git a/ocamlbuild/ocaml_compiler.ml b/ocamlbuild/ocaml_compiler.ml
- index c270a7f..7526598 100644
- --- a/ocamlbuild/ocaml_compiler.ml
- +++ b/ocamlbuild/ocaml_compiler.ml
- @@ -156,7 +156,7 @@ let byte_compile_ocaml_interf mli cmi env build =
- let compile_ocaml_interf mli cmi env build =
- let mli = env mli and cmi = env cmi in
- prepare_compile build mli;
- - let tags = tags_of_pathname mli++"interf" in
- + let tags = tags_of_pathname mli++"interf" in
- let comp_c = if Tags.mem "native" tags then ocamlopt_c else ocamlc_c in
- comp_c tags mli cmi
- @@ -266,6 +266,9 @@ let byte_link = byte_link_gen ocamlc_link_prog
- let byte_output_obj = byte_link_gen ocamlc_link_prog
- (fun tags -> tags++"ocaml"++"link"++"byte"++"output_obj")
- +let byte_output_shared = byte_link_gen ocamlc_link_prog
- + (fun tags -> tags++"ocaml"++"link"++"byte"++"output_obj"++"output_shared")
- +
- let byte_library_link = byte_link_gen byte_lib_linker byte_lib_linker_tags
- let byte_debug_link_gen =
- @@ -286,6 +289,9 @@ let native_link x = native_link_gen ocamlopt_link_prog
- let native_output_obj x = native_link_gen ocamlopt_link_prog
- (fun tags -> tags++"ocaml"++"link"++"native"++"output_obj") x
- +let native_output_shared x = native_link_gen ocamlopt_link_prog
- + (fun tags -> tags++"ocaml"++"link"++"native"++"output_obj"++"output_shared") x
- +
- let native_library_link x =
- native_link_gen native_lib_linker native_lib_linker_tags x
- diff --git a/ocamlbuild/ocaml_compiler.mli b/ocamlbuild/ocaml_compiler.mli
- index 38206e5..0c951ab 100644
- --- a/ocamlbuild/ocaml_compiler.mli
- +++ b/ocamlbuild/ocaml_compiler.mli
- @@ -43,11 +43,13 @@ val link_gen :
- string -> string -> Rule.action
- val byte_link : string -> string -> Rule.action
- val byte_output_obj : string -> string -> Rule.action
- +val byte_output_shared : string -> string -> Rule.action
- val byte_library_link : string -> string -> Rule.action
- val byte_debug_link : string -> string -> Rule.action
- val byte_debug_library_link : string -> string -> Rule.action
- val native_link : string -> string -> Rule.action
- val native_output_obj : string -> string -> Rule.action
- +val native_output_shared : string -> string -> Rule.action
- val native_library_link : string -> string -> Rule.action
- val native_shared_library_link : ?tags:(string list) -> string -> string -> Rule.action
- val native_profile_link : string -> string -> Rule.action
- diff --git a/ocamlbuild/ocaml_specific.ml b/ocamlbuild/ocaml_specific.ml
- index 3162850..99c38a7 100644
- --- a/ocamlbuild/ocaml_specific.ml
- +++ b/ocamlbuild/ocaml_specific.ml
- @@ -61,7 +61,9 @@ let x_p_dll = "%.p"-.-ext_dll;;
- (* -output-obj targets *)
- let x_byte_c = "%.byte.c";;
- let x_byte_o = "%.byte"-.-ext_obj;;
- +let x_byte_so = "%.byte"-.-ext_dll;;
- let x_native_o = "%.native"-.-ext_obj;;
- +let x_native_so = "%.native"-.-ext_dll;;
- rule "target files"
- ~dep:"%.itarget"
- @@ -221,6 +223,15 @@ rule "ocaml: cmo* -> byte.c"
- ~dep:"%.cmo"
- (Ocaml_compiler.byte_output_obj "%.cmo" x_byte_c);;
- +rule "ocaml: cmo* -> byte.(so|dll|dylib)"
- + ~prod:x_byte_so
- + ~dep:"%.cmo"
- + ~doc:"The foo.byte.so target, or foo.byte.dll under Windows, \
- + or foo.byte.dylib under Mac OS X will produce a shared library file
- + by passing the -output-obj and -cclib -shared options \
- + to the OCaml compiler. See also foo.native.{so,dll,dylib}."
- + (Ocaml_compiler.byte_output_shared "%.cmo" x_byte_so);;
- +
- rule "ocaml: p.cmx* & p.o* -> p.native"
- ~prod:"%.p.native"
- ~deps:["%.p.cmx"; x_p_o]
- @@ -239,6 +250,11 @@ rule "ocaml: cmx* & o* -> native.(o|obj)"
- ~deps:["%.cmx"; x_o]
- (Ocaml_compiler.native_output_obj "%.cmx" x_native_o);;
- +rule "ocaml: cmx* & o* -> native.(so|dll|dylib)"
- + ~prod:x_native_so
- + ~deps:["%.cmx"; x_o]
- + (Ocaml_compiler.native_output_shared "%.cmx" x_native_so);;
- +
- rule "ocaml: mllib & d.cmo* -> d.cma"
- ~prod:"%.d.cma"
- ~dep:"%.mllib"
- @@ -624,6 +640,8 @@ let () =
- (fun param -> S [A "-open"; A param]);
- pflag ["ocaml"; "compile"] "open"
- (fun param -> S [A "-open"; A param]);
- + pflag ["ocaml"; "link"] "runtime_variant"
- + (fun param -> S [A "-runtime-variant"; A param]);
- ()
- let camlp4_flags camlp4s =
- @@ -678,6 +696,7 @@ flag ["c"; "debug"; "compile"] (A "-g");
- flag ["c"; "debug"; "link"] (A "-g");
- flag ["ocaml"; "link"; "native"; "output_obj"] (A"-output-obj");;
- flag ["ocaml"; "link"; "byte"; "output_obj"] (A"-output-obj");;
- +flag ["ocaml"; "link"; "output_shared"] & (S[A"-cclib"; A"-shared"]);;
- flag ["ocaml"; "dtypes"; "compile"] (A "-dtypes");;
- flag ["ocaml"; "annot"; "compile"] (A "-annot");;
- flag ["ocaml"; "annot"; "pack"] (A "-annot");;
- diff --git a/ocamlbuild/testsuite/internal.ml b/ocamlbuild/testsuite/internal.ml
- index d02946b..b669851 100644
- --- a/ocamlbuild/testsuite/internal.ml
- +++ b/ocamlbuild/testsuite/internal.ml
- @@ -160,6 +160,13 @@ let () = test "OutputObj"
- ~tree:[T.f "hello.ml" ~content:"print_endline \"Hello, World!\""]
- ~targets:("hello.byte.o",["hello.byte.c";"hello.native.o"]) ();;
- +let () = test "OutputShared"
- + ~options:[`no_ocamlfind]
- + ~description:"output_shared targets for native and bytecode (PR #6733)"
- + ~tree:[T.f "hello.ml" ~content:"print_endline \"Hello, World!\"";
- + T.f "_tags" ~content:"<*.so>: runtime_variant(_shared)"]
- + ~targets:("hello.byte.so",["hello.native.so"]) ();;
- +
- let () = test "StrictSequenceFlag"
- ~options:[`no_ocamlfind; `quiet]
- ~description:"strict_sequence tag"
Add Comment
Please, Sign In to add comment