Install all manual pages

This commit is contained in:
Jeremie Dimino 2017-02-24 17:36:39 +00:00
parent ecc3462912
commit a0ce6a68aa
6 changed files with 118 additions and 5 deletions

View File

@ -17,4 +17,7 @@ reinstall: uninstall reinstall
clean:
rm -rf _build
.PHONY: default install uninstall reinstall clean
cinaps:
cinaps -i doc/jbuild
.PHONY: default install uninstall reinstall clean cinaps

View File

@ -3,6 +3,8 @@
(libraries (unix jbuilder jbuilder_cmdliner))
(preprocess no_preprocessing)))
(provides (jbuilder (file main.exe)))
(install
((section bin)
(files ((main.exe as jbuilder)))))

View File

@ -1,3 +1,96 @@
;; When adding a command to jbuilder, add it to the [cmds] variable in
;; this file and run "make cinaps"
(install
((section doc)
(files (manual.org))))
#|(*$
open StdLabels
open Printf
let cmds =
[ "build"
; "build-package"
; "external-lib-deps"
; "install"
; "installed-libraries"
; "runtest"
; "uninstall"
]
let cmds = ("", "") :: List.map cmds ~f:(fun x -> ("-" ^ x, x))
let () =
print_endline ("|"^"#");
List.iter cmds ~f:(fun (suffix, cmd) ->
printf {|
(rule
((targets (jbuilder%s.1))
(action (with-stdout-to ${@}
(run ${bin:jbuilder} %s --help=groff)))))
|}
suffix cmd);
print_string ";; "
*)|#
(rule
((targets (jbuilder.1))
(action (with-stdout-to ${@}
(run ${bin:jbuilder} --help=groff)))))
(rule
((targets (jbuilder-build.1))
(action (with-stdout-to ${@}
(run ${bin:jbuilder} build --help=groff)))))
(rule
((targets (jbuilder-build-package.1))
(action (with-stdout-to ${@}
(run ${bin:jbuilder} build-package --help=groff)))))
(rule
((targets (jbuilder-external-lib-deps.1))
(action (with-stdout-to ${@}
(run ${bin:jbuilder} external-lib-deps --help=groff)))))
(rule
((targets (jbuilder-install.1))
(action (with-stdout-to ${@}
(run ${bin:jbuilder} install --help=groff)))))
(rule
((targets (jbuilder-installed-libraries.1))
(action (with-stdout-to ${@}
(run ${bin:jbuilder} installed-libraries --help=groff)))))
(rule
((targets (jbuilder-runtest.1))
(action (with-stdout-to ${@}
(run ${bin:jbuilder} runtest --help=groff)))))
(rule
((targets (jbuilder-uninstall.1))
(action (with-stdout-to ${@}
(run ${bin:jbuilder} uninstall --help=groff)))))
;; (*$*)
(install
((section man)
(files (
;; (*$List.iter cmds ~f:(fun (suf, _) -> printf "\n jbuilder%s.1" suf); printf "\n;; "*)
jbuilder.1
jbuilder-build.1
jbuilder-build-package.1
jbuilder-external-lib-deps.1
jbuilder-install.1
jbuilder-installed-libraries.1
jbuilder-runtest.1
jbuilder-uninstall.1
;; (*$*)
))))
(alias
((name runtest)
(deps (jbuild))
(action (run ${bin:cinaps} ${<}))))

View File

@ -176,7 +176,7 @@ let action ~targets =
(fun { Action. prog; args; env; dir; stdout_to; touches } ->
List.iter touches ~f:(fun fn ->
close_out (open_out_bin (Path.to_string fn)));
let stdout_to = Option.map stdout_to ~f:(Path.reach ~from:dir) in
let stdout_to = Option.map stdout_to ~f:Path.to_string in
Future.run ~dir:(Path.to_string dir) ~env ?stdout_to (Path.reach ~from:dir prog)
args)

View File

@ -656,9 +656,9 @@ module Rule = struct
}
let common =
field "targets" (list file_in_current_dir) >>= fun targets ->
field "deps" (list Dep_conf.t) >>= fun deps ->
field "action" User_action.Unexpanded.t >>= fun action ->
field "targets" (list file_in_current_dir) >>= fun targets ->
field "deps" (list Dep_conf.t) ~default:[] >>= fun deps ->
field "action" User_action.Unexpanded.t >>= fun action ->
return { targets; deps; action }
let v1 = record common

View File

@ -78,6 +78,8 @@ rule main stack = parse
{ Buffer.clear escaped_buf;
scan_string escaped_buf (Lexing.lexeme_start_p lexbuf) stack lexbuf
}
| "#|"
{ block_comment 0 stack lexbuf }
| unquoted* as s
{ new_sexp main (Sexp (Atom s, atom_loc lexbuf, stack)) lexbuf }
| eof
@ -87,6 +89,19 @@ rule main stack = parse
| _
{ error lexbuf "syntax error" }
and block_comment depth stack = parse
| "#|"
{ block_comment (depth + 1) stack lexbuf }
| "|#"
{ if depth = 0 then
main stack lexbuf
else
block_comment (depth - 1) stack lexbuf }
| _
{ block_comment depth stack lexbuf }
| eof
{ error lexbuf "unterminated block comment" }
and scan_string buf start stack = parse
| '"'
{ new_sexp main