Guest User

Untitled

a guest
Feb 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.79 KB | None | 0 0
  1. diff --git a/Changes b/Changes
  2. index 21177e4..3b15908 100644
  3. --- a/Changes
  4. +++ b/Changes
  5. @@ -88,6 +88,11 @@ OCamlbuild:
  6. (Peter Zotov)
  7. - PR#6720: pass -g to C compilers when tag 'debug' is set
  8. (Peter Zotov, Gabriel Scherer)
  9. +- PR#6733: add .byte.so and .native.so targets to pass
  10. + -output-obj -cclib -shared.
  11. + (Peter Zotov)
  12. +- PR#6733: "runtime_variant(X)" to pass -runtime-variant X option.
  13. + (Peter Zotov)
  14.  
  15. Tools:
  16. - PR#6641: add -g, -ocamlcflags, -ocamloptflags options to ocamlmklib
  17. diff --git a/ocamlbuild/ocaml_compiler.ml b/ocamlbuild/ocaml_compiler.ml
  18. index c270a7f..7526598 100644
  19. --- a/ocamlbuild/ocaml_compiler.ml
  20. +++ b/ocamlbuild/ocaml_compiler.ml
  21. @@ -156,7 +156,7 @@ let byte_compile_ocaml_interf mli cmi env build =
  22. let compile_ocaml_interf mli cmi env build =
  23. let mli = env mli and cmi = env cmi in
  24. prepare_compile build mli;
  25. - let tags = tags_of_pathname mli++"interf" in
  26. + let tags = tags_of_pathname mli++"interf" in
  27. let comp_c = if Tags.mem "native" tags then ocamlopt_c else ocamlc_c in
  28. comp_c tags mli cmi
  29.  
  30. @@ -266,6 +266,9 @@ let byte_link = byte_link_gen ocamlc_link_prog
  31. let byte_output_obj = byte_link_gen ocamlc_link_prog
  32. (fun tags -> tags++"ocaml"++"link"++"byte"++"output_obj")
  33.  
  34. +let byte_output_shared = byte_link_gen ocamlc_link_prog
  35. + (fun tags -> tags++"ocaml"++"link"++"byte"++"output_obj"++"output_shared")
  36. +
  37. let byte_library_link = byte_link_gen byte_lib_linker byte_lib_linker_tags
  38.  
  39. let byte_debug_link_gen =
  40. @@ -286,6 +289,9 @@ let native_link x = native_link_gen ocamlopt_link_prog
  41. let native_output_obj x = native_link_gen ocamlopt_link_prog
  42. (fun tags -> tags++"ocaml"++"link"++"native"++"output_obj") x
  43.  
  44. +let native_output_shared x = native_link_gen ocamlopt_link_prog
  45. + (fun tags -> tags++"ocaml"++"link"++"native"++"output_obj"++"output_shared") x
  46. +
  47. let native_library_link x =
  48. native_link_gen native_lib_linker native_lib_linker_tags x
  49.  
  50. diff --git a/ocamlbuild/ocaml_compiler.mli b/ocamlbuild/ocaml_compiler.mli
  51. index 38206e5..0c951ab 100644
  52. --- a/ocamlbuild/ocaml_compiler.mli
  53. +++ b/ocamlbuild/ocaml_compiler.mli
  54. @@ -43,11 +43,13 @@ val link_gen :
  55. string -> string -> Rule.action
  56. val byte_link : string -> string -> Rule.action
  57. val byte_output_obj : string -> string -> Rule.action
  58. +val byte_output_shared : string -> string -> Rule.action
  59. val byte_library_link : string -> string -> Rule.action
  60. val byte_debug_link : string -> string -> Rule.action
  61. val byte_debug_library_link : string -> string -> Rule.action
  62. val native_link : string -> string -> Rule.action
  63. val native_output_obj : string -> string -> Rule.action
  64. +val native_output_shared : string -> string -> Rule.action
  65. val native_library_link : string -> string -> Rule.action
  66. val native_shared_library_link : ?tags:(string list) -> string -> string -> Rule.action
  67. val native_profile_link : string -> string -> Rule.action
  68. diff --git a/ocamlbuild/ocaml_specific.ml b/ocamlbuild/ocaml_specific.ml
  69. index 3162850..99c38a7 100644
  70. --- a/ocamlbuild/ocaml_specific.ml
  71. +++ b/ocamlbuild/ocaml_specific.ml
  72. @@ -61,7 +61,9 @@ let x_p_dll = "%.p"-.-ext_dll;;
  73. (* -output-obj targets *)
  74. let x_byte_c = "%.byte.c";;
  75. let x_byte_o = "%.byte"-.-ext_obj;;
  76. +let x_byte_so = "%.byte"-.-ext_dll;;
  77. let x_native_o = "%.native"-.-ext_obj;;
  78. +let x_native_so = "%.native"-.-ext_dll;;
  79.  
  80. rule "target files"
  81. ~dep:"%.itarget"
  82. @@ -221,6 +223,15 @@ rule "ocaml: cmo* -> byte.c"
  83. ~dep:"%.cmo"
  84. (Ocaml_compiler.byte_output_obj "%.cmo" x_byte_c);;
  85.  
  86. +rule "ocaml: cmo* -> byte.(so|dll|dylib)"
  87. + ~prod:x_byte_so
  88. + ~dep:"%.cmo"
  89. + ~doc:"The foo.byte.so target, or foo.byte.dll under Windows, \
  90. + or foo.byte.dylib under Mac OS X will produce a shared library file
  91. + by passing the -output-obj and -cclib -shared options \
  92. + to the OCaml compiler. See also foo.native.{so,dll,dylib}."
  93. + (Ocaml_compiler.byte_output_shared "%.cmo" x_byte_so);;
  94. +
  95. rule "ocaml: p.cmx* & p.o* -> p.native"
  96. ~prod:"%.p.native"
  97. ~deps:["%.p.cmx"; x_p_o]
  98. @@ -239,6 +250,11 @@ rule "ocaml: cmx* & o* -> native.(o|obj)"
  99. ~deps:["%.cmx"; x_o]
  100. (Ocaml_compiler.native_output_obj "%.cmx" x_native_o);;
  101.  
  102. +rule "ocaml: cmx* & o* -> native.(so|dll|dylib)"
  103. + ~prod:x_native_so
  104. + ~deps:["%.cmx"; x_o]
  105. + (Ocaml_compiler.native_output_shared "%.cmx" x_native_so);;
  106. +
  107. rule "ocaml: mllib & d.cmo* -> d.cma"
  108. ~prod:"%.d.cma"
  109. ~dep:"%.mllib"
  110. @@ -624,6 +640,8 @@ let () =
  111. (fun param -> S [A "-open"; A param]);
  112. pflag ["ocaml"; "compile"] "open"
  113. (fun param -> S [A "-open"; A param]);
  114. + pflag ["ocaml"; "link"] "runtime_variant"
  115. + (fun param -> S [A "-runtime-variant"; A param]);
  116. ()
  117.  
  118. let camlp4_flags camlp4s =
  119. @@ -678,6 +696,7 @@ flag ["c"; "debug"; "compile"] (A "-g");
  120. flag ["c"; "debug"; "link"] (A "-g");
  121. flag ["ocaml"; "link"; "native"; "output_obj"] (A"-output-obj");;
  122. flag ["ocaml"; "link"; "byte"; "output_obj"] (A"-output-obj");;
  123. +flag ["ocaml"; "link"; "output_shared"] & (S[A"-cclib"; A"-shared"]);;
  124. flag ["ocaml"; "dtypes"; "compile"] (A "-dtypes");;
  125. flag ["ocaml"; "annot"; "compile"] (A "-annot");;
  126. flag ["ocaml"; "annot"; "pack"] (A "-annot");;
  127. diff --git a/ocamlbuild/testsuite/internal.ml b/ocamlbuild/testsuite/internal.ml
  128. index d02946b..b669851 100644
  129. --- a/ocamlbuild/testsuite/internal.ml
  130. +++ b/ocamlbuild/testsuite/internal.ml
  131. @@ -160,6 +160,13 @@ let () = test "OutputObj"
  132. ~tree:[T.f "hello.ml" ~content:"print_endline \"Hello, World!\""]
  133. ~targets:("hello.byte.o",["hello.byte.c";"hello.native.o"]) ();;
  134.  
  135. +let () = test "OutputShared"
  136. + ~options:[`no_ocamlfind]
  137. + ~description:"output_shared targets for native and bytecode (PR #6733)"
  138. + ~tree:[T.f "hello.ml" ~content:"print_endline \"Hello, World!\"";
  139. + T.f "_tags" ~content:"<*.so>: runtime_variant(_shared)"]
  140. + ~targets:("hello.byte.so",["hello.native.so"]) ();;
  141. +
  142. let () = test "StrictSequenceFlag"
  143. ~options:[`no_ocamlfind; `quiet]
  144. ~description:"strict_sequence tag"
Add Comment
Please, Sign In to add comment