fix ocamllex/ocamlyacc rules
This commit is contained in:
parent
6e25a7dfe5
commit
c3228ee95e
|
@ -3,8 +3,6 @@
|
|||
(libraries (unix jbuilder jbuilder_cmdliner))
|
||||
(preprocess no_preprocessing)))
|
||||
|
||||
(provides (jbuilder (file main.exe)))
|
||||
|
||||
(install
|
||||
((section bin)
|
||||
(files ((main.exe as jbuilder)))))
|
||||
|
|
|
@ -44,7 +44,7 @@ let create context stanzas =
|
|||
|
||||
let binary t name =
|
||||
if String_set.mem name t.local_bins then
|
||||
Ok (Path.relative (Config.local_install_dir ~context:t.context.name) name)
|
||||
Ok (Path.relative (Config.local_install_bin_dir ~context:t.context.name) name)
|
||||
else
|
||||
match String_map.find name t.provides with
|
||||
| Some p -> Ok p
|
||||
|
@ -60,8 +60,8 @@ let binary t name =
|
|||
let file_of_lib ?(use_provides=false) t ~lib ~file =
|
||||
if String_set.mem lib t.local_libs then
|
||||
let lib_install_dir =
|
||||
Path.relative (Config.local_install_dir ~context:t.context.name)
|
||||
(Findlib.root_package_name lib)
|
||||
Config.local_install_lib_dir ~context:t.context.name
|
||||
~package:(Findlib.root_package_name lib)
|
||||
in
|
||||
Ok (Path.relative lib_install_dir file)
|
||||
else
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
(** [Named_artifact] provides a way to reference artifacts in jbuild rules without having
|
||||
to hardcode their exact locations. These named artifacts will be looked up
|
||||
appropriately (in the tree, or for the public release, possibly in the PATH or in
|
||||
findlib). *)
|
||||
|
||||
open! Import
|
||||
|
||||
type t
|
||||
|
|
14
src/build.ml
14
src/build.ml
|
@ -294,7 +294,19 @@ let symlink ~src ~dst =
|
|||
else
|
||||
path src >>>
|
||||
create_file ~target:dst (fun () ->
|
||||
Unix.symlink (Path.to_string src) (Path.to_string dst))
|
||||
let src =
|
||||
if Path.is_root dst then
|
||||
Path.to_string src
|
||||
else
|
||||
Path.reach ~from:(Path.parent dst) src
|
||||
in
|
||||
let dst = Path.to_string dst in
|
||||
begin
|
||||
match Unix.lstat dst with
|
||||
| exception _ -> ()
|
||||
| _ -> Sys.remove dst
|
||||
end;
|
||||
Unix.symlink src dst)
|
||||
|
||||
let touch target =
|
||||
create_file ~target (fun _ ->
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
open! Import
|
||||
|
||||
let local_install_dir =
|
||||
let dir = Path.(relative root) "install" in
|
||||
let dir = Path.(relative root) "_build/install" in
|
||||
fun ~context -> Path.relative dir context
|
||||
|
||||
let local_install_bin_dir ~context =
|
||||
Path.relative (local_install_dir ~context) "bin"
|
||||
|
||||
let local_install_lib_dir ~context ~package =
|
||||
Path.relative
|
||||
(Path.relative (local_install_dir ~context) "lib")
|
||||
package
|
||||
|
|
|
@ -4,3 +4,6 @@ open! Import
|
|||
|
||||
(** Local installation directory *)
|
||||
val local_install_dir : context:string -> Path.t
|
||||
|
||||
val local_install_bin_dir : context:string -> Path.t
|
||||
val local_install_lib_dir : context:string -> package:string -> Path.t
|
||||
|
|
|
@ -576,7 +576,7 @@ module Rule = struct
|
|||
(Chdir
|
||||
(str "${ROOT}",
|
||||
Run (str "${bin:ocamllex}",
|
||||
[str "-q"; str "-o"; str dst; str src])))
|
||||
[str "-q"; str "-o"; str "${@}"; str "${<}"])))
|
||||
})
|
||||
|
||||
let ocamllex_vjs = ocamllex_v1
|
||||
|
@ -592,7 +592,7 @@ module Rule = struct
|
|||
(Chdir
|
||||
(str "${ROOT}",
|
||||
Run (str "${bin:ocamlyacc}",
|
||||
[str src])))
|
||||
[str "${<}"])))
|
||||
})
|
||||
|
||||
let ocamlyacc_vjs = ocamlyacc_v1
|
||||
|
|
|
@ -85,6 +85,9 @@ let report_error ?(map_fname=fun x->x) ppf exn ~backtrace =
|
|||
Description: %s\n\
|
||||
Backtrace:\n\
|
||||
%s" msg bt
|
||||
| Unix.Unix_error (err, func, fname) ->
|
||||
Format.fprintf ppf "@{<error>Error@}: %s: %s: %s\n"
|
||||
func fname (Unix.error_message err)
|
||||
| _ ->
|
||||
let s = Printexc.to_string exn in
|
||||
let bt = Printexc.raw_backtrace_to_string backtrace in
|
||||
|
@ -121,8 +124,9 @@ let bootstrap () =
|
|||
let main () =
|
||||
let anon s = raise (Arg.Bad (Printf.sprintf "don't know what to do with %s\n" s)) in
|
||||
Arg.parse
|
||||
[ "-j" , Set_int Clflags.concurrency, "JOBS concurrency"
|
||||
; "--dev", Set Clflags.dev_mode , " set development mode"
|
||||
[ "-j" , Set_int Clflags.concurrency, "JOBS concurrency"
|
||||
; "--dev" , Set Clflags.dev_mode , " set development mode"
|
||||
; "--debug-rules", Set Clflags.debug_rules , " print out rules"
|
||||
]
|
||||
anon "Usage: boot.exe [-j JOBS] [--dev]\nOptions are:";
|
||||
Future.Scheduler.go ~log:(create_log ())
|
||||
|
|
Loading…
Reference in New Issue