Skip to content

Commit

Permalink
A fix for issue #1239
Browse files Browse the repository at this point in the history
The problem and the proposed solution are presented there:

https://forge.ocamlcore.org/tracker/index.php?func=detail&aid=1239&group_id=54&atid=291
  • Loading branch information
pveber committed Dec 15, 2012
1 parent dc996cf commit a477770
Showing 1 changed file with 39 additions and 24 deletions.
63 changes: 39 additions & 24 deletions src/plugins/ocamlbuild/OCamlbuildPlugin.ml
Expand Up @@ -767,42 +767,57 @@ let add_ocamlbuild_files ctxt pkg =
in

let ctxt =
(* Generate .mllib or .mlpack files *)
let extension, not_extension =
if lib.lib_pack then
"mlpack", "mllib"
else
"mllib", "mlpack"
in
(* Generate .mllib *)
let fn_base = prepend_bs_path bs cs.cs_name in
let fn =
OASISHostPath.add_extension fn_base extension
in
let not_fn =
OASISHostPath.add_extension fn_base not_extension
in
let mllib =
OASISHostPath.add_extension fn_base "mllib"
and mlpack =
OASISHostPath.add_extension fn_base "mlpack"
in
let module_list =
lib.lib_modules @ lib.lib_internal_modules
in
let mllib_template_lines =
(* mllib contains either the name of the pack or the list of modules*)
if lib.lib_pack then
[ String.capitalize cs.cs_name ]

This comment has been minimized.

Copy link
@pveber

pveber Dec 15, 2012

Author Owner

Is this the correct way to obtain the capitalized name of the pack?

else
module_list
in
let ctxt =
add_file
(template_make
fn
mllib
comment_ocamlbuild
[]
(lib.lib_modules @ lib.lib_internal_modules)
mllib_template_lines
[])
ctxt
in
{ctxt with
if lib.lib_pack then
(* generate .mlpack for packed libraries *)
add_file
(template_make
mlpack
comment_ocamlbuild
[]
module_list
[])
ctxt
else {
(* make sure there is no conflicting mlpack file *)
ctxt with
other_actions =
(fun ()->
if OASISFileUtil.file_exists_case not_fn then
OASISMessage.error ~ctxt:ctxt.ctxt
(f_ "Conflicting file '%s' and '%s' \
if OASISFileUtil.file_exists_case mlpack then
OASISMessage.error ~ctxt:ctxt.ctxt
(f_ "Conflicting file '%s' and '%s' \
exists, remove '%s'.")
fn not_fn not_fn)
:: ctxt.other_actions}
in

ctxt, tag_t, myocamlbuild_t
mllib mlpack mlpack)
:: ctxt.other_actions
}
in
ctxt, tag_t, myocamlbuild_t
end

| Object (cs, bs, obj) as sct ->
Expand Down

0 comments on commit a477770

Please sign in to comment.