forked from yoriyuki/Camomile
/
jbuild
36 lines (28 loc) · 778 Bytes
/
jbuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(* -*- tuareg -*- *)
module J = Jbuild_plugin.V1
let locales =
Sys.readdir "."
|> Array.to_list
|> List.filter (fun f -> Filename.check_suffix f ".txt")
|> List.map Filename.chop_extension
|> List.sort compare
let file locale = Printf.sprintf "(%s.mar as locales/%s.mar)" locale locale
let rule locale = Printf.sprintf {|
(rule
((targets (%s.mar))
(deps (%s.txt (alias database)))
(action (chdir .. (run tools/camomilelocaledef.exe --file ${<} locales)))))
|} locale locale
let () = Printf.ksprintf J.send {|
(jbuild_version 1)
(install
((section share)
(files (
%s
))))
(alias
((name database)
(deps ((glob_files ../database/*.mar)))))
%s
|} (String.concat "\n" (List.map file locales))
(String.concat "\n" (List.map rule locales))