follow opkg rules
This commit is contained in:
parent
0f771a004b
commit
f7b51ed1a0
|
@ -1151,12 +1151,24 @@ module Gen(P : Params) = struct
|
||||||
| _ -> [dll ~dir lib]
|
| _ -> [dll ~dir lib]
|
||||||
in
|
in
|
||||||
List.concat
|
List.concat
|
||||||
[ List.map files ~f:(fun src ->
|
[ List.map files ~f:(Install.Entry.make Lib )
|
||||||
{ Install.Entry. src; dst = None; section = Lib })
|
; List.map dlls ~f:(Install.Entry.make Stublibs)
|
||||||
; List.map dlls ~f:(fun src ->
|
|
||||||
{ Install.Entry. src; dst = None; section = Stublibs })
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
let add_doc_file fn entries =
|
||||||
|
let suffixes = [""; ".md"; ".org"; ".txt"] in
|
||||||
|
match
|
||||||
|
List.find_map suffixes ~f:(fun suf ->
|
||||||
|
let path = Path.of_string (fn ^ suf) in
|
||||||
|
if Path.exists path then
|
||||||
|
Some path
|
||||||
|
else
|
||||||
|
None)
|
||||||
|
with
|
||||||
|
| None -> entries
|
||||||
|
| Some path ->
|
||||||
|
Install.Entry.make Doc path :: entries
|
||||||
|
|
||||||
let install_file package =
|
let install_file package =
|
||||||
let entries =
|
let entries =
|
||||||
List.concat_map P.stanzas ~f:(fun { ctx_dir = dir; stanzas; _ } ->
|
List.concat_map P.stanzas ~f:(fun { ctx_dir = dir; stanzas; _ } ->
|
||||||
|
@ -1169,11 +1181,18 @@ module Gen(P : Params) = struct
|
||||||
let entries =
|
let entries =
|
||||||
let meta = Path.of_string "META" in
|
let meta = Path.of_string "META" in
|
||||||
if Path.exists meta then
|
if Path.exists meta then
|
||||||
{ Install.Entry.
|
Install.Entry.make Lib meta :: entries
|
||||||
src = meta
|
else
|
||||||
; dst = None
|
entries
|
||||||
; section = Lib
|
in
|
||||||
} :: entries
|
let entries =
|
||||||
|
List.fold_left ["README"; "LICENSE"] ~init:entries ~f:(fun acc fn ->
|
||||||
|
add_doc_file fn acc)
|
||||||
|
in
|
||||||
|
let entries =
|
||||||
|
let opam = Path.of_string "opam" in
|
||||||
|
if Path.exists opam then
|
||||||
|
Install.Entry.make Lib opam :: entries
|
||||||
else
|
else
|
||||||
entries
|
entries
|
||||||
in
|
in
|
||||||
|
|
|
@ -51,6 +51,14 @@ module List = struct
|
||||||
let partition_map l ~f =
|
let partition_map l ~f =
|
||||||
let l, r = rev_partition_map l ~f in
|
let l, r = rev_partition_map l ~f in
|
||||||
(List.rev l, List.rev r)
|
(List.rev l, List.rev r)
|
||||||
|
|
||||||
|
let rec find_map l ~f =
|
||||||
|
match l with
|
||||||
|
| [] -> None
|
||||||
|
| x :: l ->
|
||||||
|
match f x with
|
||||||
|
| None -> find_map l ~f
|
||||||
|
| Some _ as res -> res
|
||||||
end
|
end
|
||||||
|
|
||||||
module Hashtbl = struct
|
module Hashtbl = struct
|
||||||
|
|
|
@ -38,6 +38,12 @@ module Entry = struct
|
||||||
; dst : string option
|
; dst : string option
|
||||||
; section : Section.t
|
; section : Section.t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let make section ?dst src =
|
||||||
|
{ src
|
||||||
|
; dst
|
||||||
|
; section
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
module SMap = Map.Make(Section)
|
module SMap = Map.Make(Section)
|
||||||
|
|
|
@ -22,6 +22,8 @@ module Entry : sig
|
||||||
; dst : string option
|
; dst : string option
|
||||||
; section : Section.t
|
; section : Section.t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val make : Section.t -> ?dst:string -> Path.t -> t
|
||||||
end
|
end
|
||||||
|
|
||||||
val files : Entry.t list -> Path.Set.t
|
val files : Entry.t list -> Path.Set.t
|
||||||
|
|
Loading…
Reference in New Issue