Permalink
Browse files

[enhance] build: plugins are installed in lib/plugins instead of lib

  • Loading branch information...
1 parent f183898 commit 0e979bfb8ab0e3878ab2d5654a3043c03f4000b3 @Aqua-Ye Aqua-Ye committed Jul 12, 2012
View
@@ -254,7 +254,7 @@ install-bld:
# Install an opa wrapper with different stdlib and options (for some backwards-compatibility)
install-qmlflat: # depends on opabsl_for_compiler, but we don't want to run ocamlbuild twice
@mkdir -p $(INSTALL_DIR)/bin $(INSTALL_DIR)/share/opa/mlstatebsl
- @$(INSTALL) $(BUILD_DIR)/lib/opabsl.opp/lib/plugins/opabsl/mlstatebsl/opabsl_*.opa $(INSTALL_DIR)/share/opa/mlstatebsl
+ @$(INSTALL) $(BUILD_DIR)/lib/plugins/opabsl.opp/lib/plugins/opabsl/mlstatebsl/opabsl_*.opa $(INSTALL_DIR)/share/opa/mlstatebsl
@echo "#!/usr/bin/env bash" > $(INSTALL_DIR)/bin/qmlflat
@echo "set -e" >> $(INSTALL_DIR)/bin/qmlflat
@echo "set -u" >> $(INSTALL_DIR)/bin/qmlflat
View
@@ -2,8 +2,6 @@
# AIE AIE AIE : qmltop is so greedy in libs than we are lazy to clean this up
<**/*.{ml,mli,byte,native}>: thread, use_ssl, use_graph, use_zip, use_str, use_unix, use_bigarray, use_buildinfos, use_libbase, use_libqmlcompil, use_libbsl, use_qmlslicer, use_libruntime, use_appruntime, use_oparuntime, use_libnet, use_libsecurity, use_libtools, use_database, use_ulex, use_libtrx, use_qmlcpsserver, use_cryptokit, use_nums, use_passlib, use_dynlink, use_opalang, use_compilerlib, use_ocamllang, use_jslang, use_opacapi, use_qmlpasses, use_libsession, iconv
-<lib/opabsl>: traverse
-
<gen_opatop_manpage.*>: use_pplib
<opatop.*>: use_pplib
@@ -1 +0,0 @@
-lib/opabsl.opp/OpabslPlugin
@@ -1 +0,0 @@
-lib/opabsl.opp/OpabslLoader
@@ -1 +0,0 @@
-lib/opabsl.opp/OpabslMLRuntime
@@ -1 +1 @@
-lib/plugins/opabsl/OpabslgenPlugin
+lib/plugins/opabsl.opp/OpabslPlugin
@@ -1 +1 @@
-lib/plugins/opabsl/OpabslgenLoader
+lib/plugins/opabsl.opp/OpabslLoader
@@ -1 +1 @@
-lib/plugins/opabsl/OpabslgenMLRuntime
+lib/plugins/opabsl.opp/OpabslMLRuntime
View
@@ -48,6 +48,6 @@ internal qmlpasses compiler/qmlpasses
internal qmlslicer compiler/qmlslicer
# internal libopa compiler/opa
-internal opabsl_for_compiler lib/opabsl.opp
-internal opabsl_for_server lib/opabsl.opp
-internal opabsl_for_interpreter lib/opabsl.opp
+internal opabsl_for_compiler lib/plugins/opabsl.opp
+internal opabsl_for_server lib/plugins/opabsl.opp
+internal opabsl_for_interpreter lib/plugins/opabsl.opp
View
@@ -31,6 +31,10 @@ def_stubs ~dir:"ocamllib/libbase" "stubs";
def_stubs ~dir:"ocamllib/libsecurity" "ssl_ext";
def_stubs ~dir:"ocamllib/appruntime" "io";
+(* PATHS *)
+
+let plugins_dir = "lib" / "plugins" in
+
let link_cmd = if windows_mode then S[Sh"cp";A"-r"] else S[Sh"ln";A"-s";A"-f"] in
let extralib_opt = function
@@ -91,12 +95,13 @@ flag_and_dep ["ocaml"; "doc"] (S[A"-g";P"tools/utils/ocamldoc_plugin.cmxs"]);
cheat by copying the opabsl generated files so that they can be seen as
local by opatop. *)
let magic_import_from_opabsl dest f =
- rule ("import from opabsl: "^f) ~deps:["lib"/"opabsl.opp/"^f] ~prod:(dest / f)
+ let opabsl_opp = "opabsl.opp" in
+ rule ("import from opabsl: "^f) ~deps:[plugins_dir/opabsl_opp/f] ~prod:(dest / f)
(fun env build ->
Seq[Cmd(S[Sh"mkdir";A"-p";P dest]);
- if Pathname.exists ("lib"/"opabsl.opp")
- then (build_list build ["lib"/"opabsl.opp" / f]; cp ("lib"/"opabsl.opp"/f) dest)
- else cp (mlstatelibs/"lib"/"opabsl.opp"/ f) dest
+ if Pathname.exists (plugins_dir/opabsl_opp)
+ then (build_list build [plugins_dir/opabsl_opp/f]; cp (plugins_dir/opabsl_opp/f) dest)
+ else cp (mlstatelibs/plugins_dir/opabsl_opp/f) dest
])
in
List.iter
@@ -207,7 +212,7 @@ rule "Opa Compiler Interface Validation (opacapi)"
A "-o" ;
P opacapi_validation ;
] @ (List.rev_map (fun file -> P file) opa_opacapi_files)
- @ (List.map (fun x -> P ("lib"/(x ^ ".opp"))) opa_opacapi_plugins))
+ @ (List.map (fun x -> P (plugins_dir/(x ^ ".opp"))) opa_opacapi_plugins))
)
);
@@ -367,10 +372,8 @@ let gen_tag prefix s =
else None
in
let use_tag s =
- if s = "use_opabsl" then
- Some ("lib"/"opabsl.opp")
- else
- gen_tag "use" s
+ if s = "use_opabsl" then Some (plugins_dir/"opabsl.opp")
+ else gen_tag "use" s
in
let clib_tag s = gen_tag "clib" s in
let opa_plugin_builder_name = "opa-plugin-builder-bin" in
@@ -417,7 +420,7 @@ let opp_build opa_plugin opp oppf env build =
(* HACK:
For some reason, I couldn't get the dep ocamlbuild function
to pull this dependency... *)
- build_list build ["lib"/"opabsl.opp"/"opabslMLRuntime.cmx"]
+ build_list build [plugins_dir/"opabsl.opp"/"opabslMLRuntime.cmx"]
else
();
let files_js = List.filter (fun f-> Pathname.check_extension f "js") files in
@@ -453,11 +456,11 @@ let opp_build opa_plugin opp oppf env build =
files *)
[A"--static"; A"--no-build"],
mv ((Pathname.basename (env opp)) -.- "opp")
- ("lib"/((Pathname.basename (env opp)) -.- "save"))
+ (plugins_dir/((Pathname.basename (env opp)) -.- "save"))
else
[],
mv ((Pathname.basename (env opp)) -.- "opp")
- ("lib"/((Pathname.basename (env opp)) -.- "opp"))
+ (plugins_dir/((Pathname.basename (env opp)) -.- "opp"))
in
let options = [A"-o" ; P((Pathname.basename (env opp)))] @ preprocess_js @
@@ -484,38 +487,38 @@ rule "opa_plugin_dir: opa_plugin -> oppf"
(opp_build "%.opa_plugin" "%" "%.oppf")
;
-dep ["plugin_opabsl"] ["lib"/"plugins"/"opabsl"/"opabsl.oppf"];
+dep ["plugin_opabsl"] [plugins_dir/"opabsl"/"opabsl.oppf"];
let opabsl_files =
- (List.map (fun file -> "lib"/"opabsl.opp"/file) [
+ (List.map (fun file -> plugins_dir/"opabsl.opp"/file) [
"opabslPlugin.ml"; "opabslMLRuntime.ml";
"opabslLoader.ml"; "serverLib.mli"
])
in
List.iter (
fun file ->
- let tags = Tags.elements (tags_of_pathname ("lib"/"plugins"/"opabsl"/file)) in
- tag_file ("lib"/"opabsl.opp"/file) tags
+ let tags = Tags.elements (tags_of_pathname (plugins_dir/"opabsl"/file)) in
+ tag_file (plugins_dir/"opabsl.opp"/file) tags
) ["opabslPlugin.ml"; "opabslMLRuntime.ml";
"opabslLoader.ml"; "serverLib.mli"]
;
rule "opabsl files"
~deps:[
- "lib"/"plugins"/"opabsl"/"opabsl.oppf";
- "lib"/"plugins"/"opabsl"/"serverLib.mli"
+ plugins_dir/"opabsl"/"opabsl.oppf";
+ plugins_dir/"opabsl"/"serverLib.mli"
]
~prods:opabsl_files
(fun _ _ ->
Seq[
- mv ("lib"/"opabsl.save") ("lib"/"opabsl.opp");
- cp ("lib"/"plugins"/"opabsl"/"serverLib.mli") ("lib"/"opabsl.opp"/"serverLib.mli");
+ mv (plugins_dir/"opabsl.save") (plugins_dir/"opabsl.opp");
+ cp (plugins_dir/"opabsl"/"serverLib.mli") (plugins_dir/"opabsl.opp"/"serverLib.mli");
(* The .mli file is meant to be linked with actual opa
applications. Thus, it doesn't expose all the symbols
defined in the .ml file. We remove this file so that ocamlc
export all symbols defined there. *)
- rm_f ("lib"/"opabsl.opp"/"opabslMLRuntime.mli")
+ rm_f (plugins_dir/"opabsl.opp"/"opabslMLRuntime.mli")
]
)
;
@@ -823,7 +826,7 @@ let dir_rec_all_files dir =
in
rule "opa application creator"
- ~deps:("lib/opabsl_for_server.cmxa" :: (dir_rec_all_files "tools/opa-create"))
+ ~deps:("lib/plugins/opabsl_for_server.cmxa" :: (dir_rec_all_files "tools/opa-create"))
~prods: [opa_create_dst]
(fun env build ->
Cmd(S[
@@ -832,7 +835,7 @@ rule "opa application creator"
A"-o"; P opa_create_dst; P opa_create_src;
A"--opx-dir";A "stdlib.qmlflat";
A"--back-end";A "qmlflat";
- A"-I"; A "lib";
+ A"-I"; A plugins_dir;
A"-I"; A opa_prefix
]));
@@ -844,7 +847,7 @@ let package_building ?(nodebackend=false) ~name ~stamp ~stdlib_only ~rebuild ()
(fun env build ->
try
let plugins = "opabsl" :: string_list_of_file all_plugins_file in
- let plugins = List.map (fun f -> "lib"/"plugins"/f/f -.- "oppf") plugins in
+ let plugins = List.map (fun f -> plugins_dir/f/f -.- "oppf") plugins in
build_list build plugins;
let packages = string_list_of_file (all_packages_file nodebackend) in
let packages =
@@ -917,7 +920,7 @@ let package_building ?(nodebackend=false) ~name ~stamp ~stdlib_only ~rebuild ()
A"--project-root"; P Pathname.pwd; (* because the @static_resource in the stdlib expect this *)
A"--no-stdlib";
A"--parser"; A"classic";
- A"-I"; A"lib";
+ A"-I"; A plugins_dir;
opaopt;
S all_files;
] @ extra_opt));
View
@@ -57,7 +57,7 @@ internal opa-bin compiler/opa/main.native lib/opa/bin
internal opa_bash_completion tools/bash/bash_completion share/opa
# for now, these can't be built cleanly from opageneral
-internal opabsl.bypass lib/opabsl.opp/opabsl.bypass lib/opa/static
+internal opabsl.bypass lib/plugins/opabsl.opp/opabsl.bypass lib/opa/static
internal serverLib.cmi lib/plugins/opabsl/serverLib.cmi lib/opa/static
# for helping developpers of plugins we can distribute the source of the interface
@@ -25,4 +25,4 @@ ocamllib/libnet/runtimeMain.cmx
ocamllib/libnet/runtimeMain.o
ocamllib/libirc.cmxa
-lib/opabsl_for_server.cmxa
+lib/plugins/opabsl_for_server.cmxa

0 comments on commit 0e979bf

Please sign in to comment.