Merge branch 'master' into subsystem-versioned

This commit is contained in:
Rudi Grinberg 2018-07-03 18:59:02 +07:00 committed by GitHub
commit 63eb0f2312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 125 additions and 94 deletions

View File

@ -108,6 +108,8 @@ next
- Do not require opam-installer anymore (#941, @diml) - Do not require opam-installer anymore (#941, @diml)
- Add the `lib_root` and `libexec_root` install sections (#947, @diml)
1.0+beta20 (10/04/2018) 1.0+beta20 (10/04/2018)
----------------------- -----------------------

View File

@ -603,7 +603,9 @@ The syntax is as follows:
manual. The following sections are available: manual. The following sections are available:
- ``lib`` - ``lib``
- ``lib_root``
- ``libexec`` - ``libexec``
- ``libexec_root``
- ``bin`` - ``bin``
- ``sbin`` - ``sbin``
- ``toplevel`` - ``toplevel``

View File

@ -3,7 +3,9 @@ open Import
module Section = struct module Section = struct
type t = type t =
| Lib | Lib
| Lib_root
| Libexec | Libexec
| Libexec_root
| Bin | Bin
| Sbin | Sbin
| Toplevel | Toplevel
@ -18,109 +20,130 @@ module Section = struct
let compare : t -> t -> Ordering.t = compare let compare : t -> t -> Ordering.t = compare
let to_string = function let to_string = function
| Lib -> "lib" | Lib -> "lib"
| Libexec -> "libexec" | Lib_root -> "lib_root"
| Bin -> "bin" | Libexec -> "libexec"
| Sbin -> "sbin" | Libexec_root -> "libexec_root"
| Toplevel -> "toplevel" | Bin -> "bin"
| Share -> "share" | Sbin -> "sbin"
| Share_root -> "share_root" | Toplevel -> "toplevel"
| Etc -> "etc" | Share -> "share"
| Doc -> "doc" | Share_root -> "share_root"
| Stublibs -> "stublibs" | Etc -> "etc"
| Man -> "man" | Doc -> "doc"
| Misc -> "misc" | Stublibs -> "stublibs"
| Man -> "man"
| Misc -> "misc"
let of_string = function let of_string = function
| "lib" -> Some Lib |"lib" -> Some Lib
| "libexec" -> Some Libexec |"lib_root" -> Some Lib_root
| "bin" -> Some Bin |"libexec" -> Some Libexec
| "sbin" -> Some Sbin |"libexec_root" -> Some Libexec_root
| "toplevel" -> Some Toplevel |"bin" -> Some Bin
| "share" -> Some Share |"sbin" -> Some Sbin
| "share_root" -> Some Share_root |"toplevel" -> Some Toplevel
| "etc" -> Some Etc |"share" -> Some Share
| "doc" -> Some Doc |"share_root" -> Some Share_root
| "stublibs" -> Some Stublibs |"etc" -> Some Etc
| "man" -> Some Man |"doc" -> Some Doc
| "misc" -> Some Misc |"stublibs" -> Some Stublibs
| _ -> None |"man" -> Some Man
|"misc" -> Some Misc
| _ -> None
let t = let t =
let open Sexp.Of_sexp in let open Sexp.Of_sexp in
enum enum
[ "lib" , Lib [ "lib" , Lib
; "libexec" , Libexec ; "lib_root" , Lib_root
; "bin" , Bin ; "libexec" , Libexec
; "sbin" , Sbin ; "libexec_root" , Libexec_root
; "toplevel" , Toplevel ; "bin" , Bin
; "share" , Share ; "sbin" , Sbin
; "share_root" , Share_root ; "toplevel" , Toplevel
; "etc" , Etc ; "share" , Share
; "doc" , Doc ; "share_root" , Share_root
; "stublibs" , Stublibs ; "etc" , Etc
; "man" , Man ; "doc" , Doc
; "misc" , Misc ; "stublibs" , Stublibs
; "man" , Man
; "misc" , Misc
] ]
let should_set_executable_bit = function let should_set_executable_bit = function
| Lib -> false | Lib
| Libexec -> true | Lib_root
| Bin -> true | Toplevel
| Sbin -> true | Share
| Toplevel -> false | Share_root
| Share -> false | Etc
| Share_root -> false | Doc
| Etc -> false | Man
| Doc -> false | Misc
| Stublibs -> true -> false
| Man -> false | Libexec
| Misc -> false | Libexec_root
| Bin
| Sbin
| Stublibs
-> true
module Paths = struct module Paths = struct
type t = type t =
{ lib : Path.t { lib : Path.t
; libexec : Path.t ; lib_root : Path.t
; bin : Path.t ; libexec : Path.t
; sbin : Path.t ; libexec_root : Path.t
; toplevel : Path.t ; bin : Path.t
; share : Path.t ; sbin : Path.t
; share_root : Path.t ; toplevel : Path.t
; etc : Path.t ; share : Path.t
; doc : Path.t ; share_root : Path.t
; stublibs : Path.t ; etc : Path.t
; man : Path.t ; doc : Path.t
; stublibs : Path.t
; man : Path.t
} }
let make ~package ~destdir ?(libdir=Path.relative destdir "lib") () = let make ~package ~destdir ?(libdir=Path.relative destdir "lib") () =
let package = Package.Name.to_string package in let package = Package.Name.to_string package in
{ bin = Path.relative destdir "bin" let lib_root = libdir in
; sbin = Path.relative destdir "sbin" let libexec_root = libdir in
; toplevel = Path.relative libdir "toplevel" let share_root = Path.relative destdir "share" in
; share_root = Path.relative libdir "share" let etc_root = Path.relative destdir "etc" in
; stublibs = Path.relative libdir "lib/stublibs" let doc_root = Path.relative destdir "doc" in
; man = Path.relative destdir "man" { lib_root
; lib = Path.relative libdir package ; libexec_root
; libexec = Path.relative libdir package ; share_root
; share = Path.relative destdir ("share/" ^ package) ; bin = Path.relative destdir "bin"
; etc = Path.relative destdir ("etc/" ^ package) ; sbin = Path.relative destdir "sbin"
; doc = Path.relative destdir ("doc/" ^ package) ; man = Path.relative destdir "man"
; toplevel = Path.relative libdir "toplevel"
; stublibs = Path.relative libdir "stublibs"
; lib = Path.relative lib_root package
; libexec = Path.relative libexec_root package
; share = Path.relative share_root package
; etc = Path.relative etc_root package
; doc = Path.relative doc_root package
} }
let get t section = let get t section =
match section with match section with
| Lib -> t.lib | Lib -> t.lib
| Libexec -> t.libexec | Lib_root -> t.lib_root
| Bin -> t.bin | Libexec -> t.libexec
| Sbin -> t.sbin | Libexec_root -> t.libexec_root
| Toplevel -> t.toplevel | Bin -> t.bin
| Share -> t.share | Sbin -> t.sbin
| Share_root -> t.share_root | Toplevel -> t.toplevel
| Etc -> t.etc | Share -> t.share
| Doc -> t.doc | Share_root -> t.share_root
| Stublibs -> t.stublibs | Etc -> t.etc
| Man -> t.man | Doc -> t.doc
| Misc -> invalid_arg "Install.Paths.get" | Stublibs -> t.stublibs
| Man -> t.man
| Misc -> invalid_arg"Install.Paths.get"
end end
end end

View File

@ -5,7 +5,9 @@ open Stdune
module Section : sig module Section : sig
type t = type t =
| Lib | Lib
| Lib_root
| Libexec | Libexec
| Libexec_root
| Bin | Bin
| Sbin | Sbin
| Toplevel | Toplevel
@ -27,17 +29,19 @@ module Section : sig
type section = t type section = t
type t = type t =
{ lib : Path.t { lib : Path.t
; libexec : Path.t ; lib_root : Path.t
; bin : Path.t ; libexec : Path.t
; sbin : Path.t ; libexec_root : Path.t
; toplevel : Path.t ; bin : Path.t
; share : Path.t ; sbin : Path.t
; share_root : Path.t ; toplevel : Path.t
; etc : Path.t ; share : Path.t
; doc : Path.t ; share_root : Path.t
; stublibs : Path.t ; etc : Path.t
; man : Path.t ; doc : Path.t
; stublibs : Path.t
; man : Path.t
} }
val make val make