diff --git a/src/build_system.ml b/src/build_system.ml index 275fed05..071099bb 100644 --- a/src/build_system.ml +++ b/src/build_system.ml @@ -278,6 +278,10 @@ module Alias0 = struct let doc = make "doc" let private_doc = make "doc-private" let lint = make "lint" + + let package_install ~(context : Context.t) ~pkg = + make (sprintf "install-%s" (Package.Name.to_string pkg)) + ~dir:context.build_dir end module Dir_status = struct diff --git a/src/build_system.mli b/src/build_system.mli index df6edbc5..84df0422 100644 --- a/src/build_system.mli +++ b/src/build_system.mli @@ -107,6 +107,8 @@ module Alias : sig val private_doc : dir:Path.t -> t val lint : dir:Path.t -> t + val package_install : context:Context.t -> pkg:Package.Name.t -> t + (** Return the underlying stamp file *) val stamp_file : t -> Path.t diff --git a/src/install_rules.ml b/src/install_rules.ml index 67a5f5b2..8d7eb6e4 100644 --- a/src/install_rules.ml +++ b/src/install_rules.ml @@ -206,6 +206,8 @@ module Gen(P : Install_params) = struct Path.append install_dir (Install.Entry.relative_installed_path entry ~package) in SC.add_rule sctx (Build.symlink ~src:entry.src ~dst); + SC.add_alias_deps sctx + (Alias.package_install ~context:ctx ~pkg:package) [dst]; Install.Entry.set_src entry dst) let promote_install_file = diff --git a/src/jbuild.ml b/src/jbuild.ml index 303acd78..df692fb0 100644 --- a/src/jbuild.ml +++ b/src/jbuild.ml @@ -230,6 +230,7 @@ module Dep_conf = struct | Alias_rec of String_with_vars.t | Glob_files of String_with_vars.t | Files_recursively_in of String_with_vars.t + | Package of String_with_vars.t | Universe let t = @@ -243,6 +244,7 @@ module Dep_conf = struct ; cstr_sw "alias_rec" (fun x -> Alias_rec x) ; cstr_sw "glob_files" (fun x -> Glob_files x) ; cstr_sw "files_recursively_in" (fun x -> Files_recursively_in x) + ; cstr_sw "package" (fun x -> Package x) ; cstr "universe" nil Universe ] in @@ -266,6 +268,9 @@ module Dep_conf = struct | Files_recursively_in t -> List [Sexp.unsafe_atom_of_string "files_recursively_in" ; String_with_vars.sexp_of_t t] + | Package t -> + List [Sexp.unsafe_atom_of_string "package" ; + String_with_vars.sexp_of_t t] | Universe -> Sexp.unsafe_atom_of_string "universe" end diff --git a/src/jbuild.mli b/src/jbuild.mli index 82c5a64c..a5fa3a9c 100644 --- a/src/jbuild.mli +++ b/src/jbuild.mli @@ -125,6 +125,7 @@ module Dep_conf : sig | Alias_rec of String_with_vars.t | Glob_files of String_with_vars.t | Files_recursively_in of String_with_vars.t + | Package of String_with_vars.t | Universe val t : t Sexp.Of_sexp.t diff --git a/src/super_context.ml b/src/super_context.ml index 214c423a..b8733474 100644 --- a/src/super_context.ml +++ b/src/super_context.ml @@ -351,6 +351,10 @@ module Deps = struct let path = Path.relative dir (expand_vars t ~scope ~dir s) in Build.files_recursively_in ~dir:path ~file_tree:t.file_tree >>^ Pset.to_list + | Package p -> + let pkg = Package.Name.of_string (expand_vars t ~scope ~dir p) in + Alias.dep (Alias.package_install ~context:t.context ~pkg) + >>^ fun () -> [] | Universe -> Build.path Build_system.universe_file >>^ fun () -> []