113.33.03
This commit is contained in:
parent
5b78706d34
commit
ba530c73b9
9
META.ab
9
META.ab
@ -1,8 +1,9 @@
|
||||
version = "$(pkg_version)"
|
||||
description = "Monadic let-bindings"
|
||||
requires = "ppx_core ppx_driver"
|
||||
archive(ppx_driver, byte ) = "ppx_let.cma"
|
||||
archive(ppx_driver, native ) = "ppx_let.cmxa"
|
||||
archive(ppx_driver, native, plugin) = "ppx_let.cmxs"
|
||||
archive(ppx_driver, byte ) = "ppx_let.cma"
|
||||
archive(ppx_driver, native) = "ppx_let.cmxa"
|
||||
plugin(ppx_driver, byte ) = "ppx_let.cma"
|
||||
plugin(ppx_driver, native) = "ppx_let.cmxs"
|
||||
exists_if = "ppx_let.cma"
|
||||
ppx(-ppx_driver) = "./ppx"
|
||||
ppx(-ppx_driver,-custom_ppx) = "./ppx"
|
||||
|
4
Makefile
4
Makefile
@ -26,8 +26,8 @@ all: $(SETUP)
|
||||
./$(SETUP) -all $(ALLFLAGS)
|
||||
$(MAKE) $(NAME).install
|
||||
|
||||
$(NAME).install: js-utils/gen_install.ml setup.log setup.data
|
||||
ocaml -I js-utils js-utils/gen_install.ml
|
||||
$(NAME).install: install.ml setup.log setup.data
|
||||
ocaml install.ml
|
||||
|
||||
install: $(NAME).install
|
||||
opam-installer -i --prefix $(PREFIX) $(NAME).install
|
||||
|
37
_oasis
37
_oasis
@ -1,20 +1,23 @@
|
||||
OASISFormat: 0.4
|
||||
OCamlVersion: >= 4.02.3
|
||||
FindlibVersion: >= 1.3.2
|
||||
Name: ppx_let
|
||||
Version: 113.33.00
|
||||
Synopsis: Monadic let-bindings
|
||||
Authors: Jane Street Group, LLC <opensource@janestreet.com>
|
||||
Copyrights: (C) 2015-2016 Jane Street Group LLC <opensource@janestreet.com>
|
||||
Maintainers: Jane Street Group, LLC <opensource@janestreet.com>
|
||||
License: Apache-2.0
|
||||
LicenseFile: LICENSE.txt
|
||||
Homepage: https://github.com/janestreet/ppx_let
|
||||
Plugins: StdFiles (0.3), DevFiles (0.3), META (0.3)
|
||||
XStdFilesAUTHORS: false
|
||||
XStdFilesREADME: false
|
||||
BuildTools: ocamlbuild
|
||||
FilesAB: META.ab
|
||||
OASISFormat: 0.4
|
||||
OCamlVersion: >= 4.02.3
|
||||
FindlibVersion: >= 1.3.2
|
||||
Name: ppx_let
|
||||
Version: 113.33.03
|
||||
Synopsis: Monadic let-bindings
|
||||
Authors: Jane Street Group, LLC <opensource@janestreet.com>
|
||||
Copyrights: (C) 2015-2016 Jane Street Group LLC <opensource@janestreet.com>
|
||||
Maintainers: Jane Street Group, LLC <opensource@janestreet.com>
|
||||
License: Apache-2.0
|
||||
LicenseFile: LICENSE.txt
|
||||
Homepage: https://github.com/janestreet/ppx_let
|
||||
Plugins: StdFiles (0.3), DevFiles (0.3)
|
||||
XStdFilesAUTHORS: false
|
||||
XStdFilesREADME: false
|
||||
BuildTools: ocamlbuild
|
||||
BetaFeatures: section_object
|
||||
AlphaFeatures: ocamlbuild_more_args
|
||||
XOCamlbuildPluginTags: package(js-build-tools.ocamlbuild_goodies)
|
||||
FilesAB: META.ab
|
||||
Description:
|
||||
Part of the Jane Street's PPX rewriters collection.
|
||||
|
||||
|
2
_tags
2
_tags
@ -1,7 +1,7 @@
|
||||
<**/*.ml{,i}>: warn(-40), no_alias_deps
|
||||
<**/*>: thread
|
||||
# This prevents the implicit addition of -ppx options by ocamlfind
|
||||
<**/*.ml{,i}>: predicate(ppx_driver)
|
||||
<**/*>: predicate(custom_ppx)
|
||||
<as_ppx/ppx.{byte,native}>: predicate(ppx_driver)
|
||||
<src/*>: linkall
|
||||
# OASIS_START
|
||||
|
10
install.ml
Normal file
10
install.ml
Normal file
@ -0,0 +1,10 @@
|
||||
#use "topfind";;
|
||||
#require "js-build-tools.oasis2opam_install";;
|
||||
|
||||
open Oasis2opam_install;;
|
||||
|
||||
generate ~package:"ppx_let"
|
||||
[ oasis_lib "ppx_let"
|
||||
; file "META" ~section:"lib"
|
||||
; oasis_exe "ppx" ~dest:"../lib/ppx_let/ppx"
|
||||
]
|
@ -1,102 +0,0 @@
|
||||
(* Generate <package>.install from setup.log *)
|
||||
|
||||
#use "install_tags.ml"
|
||||
|
||||
module String_map = Map.Make(String)
|
||||
let string_map_of_list =
|
||||
List.fold_left
|
||||
(fun acc (k, v) ->
|
||||
assert (not (String_map.mem k acc));
|
||||
String_map.add k v acc)
|
||||
String_map.empty
|
||||
|
||||
let lines_of_file fn =
|
||||
let ic = open_in fn in
|
||||
let rec loop acc =
|
||||
match input_line ic with
|
||||
| exception End_of_file ->
|
||||
close_in ic;
|
||||
List.rev acc
|
||||
| line ->
|
||||
loop (line :: acc)
|
||||
in
|
||||
loop []
|
||||
|
||||
let read_setup_log () =
|
||||
lines_of_file "setup.log"
|
||||
|> List.map (fun line -> Scanf.sscanf line "%S %S" (fun tag arg -> (tag, arg)))
|
||||
|
||||
let read_setup_data () =
|
||||
lines_of_file "setup.data"
|
||||
|> List.map (fun line -> Scanf.sscanf line "%[^=]=%S" (fun k v -> (k, v)))
|
||||
|
||||
let remove_cwd =
|
||||
let prefix = Sys.getcwd () ^ "/" in
|
||||
let len_prefix = String.length prefix in
|
||||
fun fn ->
|
||||
let len = String.length fn in
|
||||
if len >= len_prefix && String.sub fn 0 len_prefix = prefix then
|
||||
String.sub fn len_prefix (len - len_prefix)
|
||||
else
|
||||
fn
|
||||
|
||||
let gen_section oc name files =
|
||||
let pr fmt = Printf.fprintf oc (fmt ^^ "\n") in
|
||||
pr "%s: [" name;
|
||||
List.iter
|
||||
(fun (src, dst) ->
|
||||
let src = remove_cwd src in
|
||||
let dst =
|
||||
match dst with
|
||||
| None -> Filename.basename src
|
||||
| Some fn -> fn
|
||||
in
|
||||
if src = dst then
|
||||
pr " %S" src
|
||||
else
|
||||
pr " %S {%S}" src dst)
|
||||
files;
|
||||
pr "]"
|
||||
|
||||
let rec filter_log tags log acc =
|
||||
match log with
|
||||
| [] -> acc
|
||||
| (tag, fname) :: rest ->
|
||||
match String_map.find tag tags with
|
||||
| exception Not_found -> filter_log tags rest acc
|
||||
| dst -> filter_log tags rest ((fname, dst) :: acc)
|
||||
|
||||
let () =
|
||||
let log = read_setup_log () in
|
||||
let setup_data = read_setup_data () in
|
||||
let ext_dll =
|
||||
match List.assoc "ext_dll" setup_data with
|
||||
| ext -> ext
|
||||
| exception Not_found -> ".so"
|
||||
in
|
||||
let merge name files map =
|
||||
match String_map.find name map with
|
||||
| files' -> String_map.add name (files @ files') map
|
||||
| exception Not_found -> String_map.add name files map
|
||||
in
|
||||
let sections =
|
||||
List.fold_left
|
||||
(fun acc (name, tags, extra_files) ->
|
||||
let tags = string_map_of_list tags in
|
||||
let files = filter_log tags log [] @ extra_files in
|
||||
if name = "lib" then
|
||||
let stubs, others =
|
||||
List.partition
|
||||
(fun (fn, _) -> Filename.check_suffix fn ext_dll)
|
||||
files
|
||||
in
|
||||
merge "lib" others (merge "stublibs" stubs acc)
|
||||
else
|
||||
merge name files acc)
|
||||
String_map.empty sections
|
||||
|> String_map.bindings
|
||||
|> List.filter (fun (_, l) -> l <> [])
|
||||
in
|
||||
let oc = open_out (package_name ^ ".install") in
|
||||
List.iter (fun (name, files) -> gen_section oc name files) sections;
|
||||
close_out oc
|
@ -1,13 +0,0 @@
|
||||
let package_name = "ppx_let"
|
||||
|
||||
let sections =
|
||||
[ ("lib",
|
||||
[ ("built_lib_ppx_let", None)
|
||||
],
|
||||
[ ("META", None)
|
||||
])
|
||||
; ("bin",
|
||||
[ ("built_exec_ppx", Some "../lib/ppx_let/ppx")
|
||||
],
|
||||
[])
|
||||
]
|
@ -2,28 +2,13 @@
|
||||
(* OASIS_STOP *)
|
||||
# 3 "myocamlbuild.ml"
|
||||
|
||||
(* Temporary hacks *)
|
||||
let js_hacks = function
|
||||
| After_rules ->
|
||||
rule "Generate a cmxs from a cmxa"
|
||||
~dep:"%.cmxa"
|
||||
~prod:"%.cmxs"
|
||||
~insert:`top
|
||||
(fun env _ ->
|
||||
Cmd (S [ !Options.ocamlopt
|
||||
; A "-shared"
|
||||
; A "-linkall"
|
||||
; A "-I"; A (Pathname.dirname (env "%"))
|
||||
; A (env "%.cmxa")
|
||||
; A "-o"
|
||||
; A (env "%.cmxs")
|
||||
]));
|
||||
module JS = Jane_street_ocamlbuild_goodies
|
||||
|
||||
(* Pass -predicates to ocamldep *)
|
||||
pflag ["ocaml"; "ocamldep"] "predicate" (fun s -> S [A "-predicates"; A s])
|
||||
| _ -> ()
|
||||
let dev_mode = true
|
||||
|
||||
let () =
|
||||
Ocamlbuild_plugin.dispatch (fun hook ->
|
||||
js_hacks hook;
|
||||
JS.alt_cmxs_of_cmxa_rule hook;
|
||||
JS.pass_predicates_to_ocamldep hook;
|
||||
if dev_mode && not Sys.win32 then JS.track_external_deps hook;
|
||||
dispatch_default hook)
|
||||
|
Loading…
Reference in New Issue
Block a user