Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 232 lines (206 sloc) 6.149 kb
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18
19 (* depends *)
20 module Arg = Base.Arg
21 module String = Base.String
22
23 type makefile_rule =
24 | Bytecode
25 | Native
26 | Bytecode_and_native
27 | Bytecode_or_native
28
29 (**
30 Command-line options for the Qml to OCaml compiler.
31
32
33 @author Mathieu Barbin
34 @author David Rajchenbach-Teller (Additional options)
35 *)
36
37 (** STATICS PARAMETERS *)
38
39 module StaticParameters =
40 struct
41 (** the other values are not mutable -- cf opa options -I -x to add some more libraries *)
42 let options_compiler =
43 ["-w a"]
44
45 let options_linker =
46 ["-w a"]
47 @ (if Base.is_windows then
48 ["-cclib"; "Dnsapi.lib"; "-cclib"; "libeay32.lib"; "-cclib"; "ssleay32.lib" (*; "ssl_stubs.obj" *)]
49 else [])
50
51 (**
52 Absolute path for include directory, will be passed with the option -I to the ocaml compiler.
53 *)
54 let server_include_dir = [
55 "+zip" ; "+site-lib/zip" ; "+site-lib/camlzip" ;
56 "+ssl" ; "+site-lib/ssl" ;
57 "+cryptokit"; "+site-lib/cryptokit" ;
58 "+ulex" ; "+site-lib/ulex" ;
59 ]
60
61 (**
62 Like [server_include_dir] but the path is not absolute, but relative to MLSTATELIBS directory.
63 The following directories will be prefixed by MLSTATELIBS before passing to ocaml compiler with -I
64 *)
65 let server_include_mlstate_dir =
66 InstallDir.lib_opa ::
67 (
68 if Base.is_windows
69 then
70 (*
71 FIXME
72 What is the purpose of this ?
73 This will be concatenated with a Filename.concat anyway
74 *)
75 if BuildInfos.is_release
76 then ["windows_libs/openssl/lib"]
77 else ["/windows_libs/openssl/lib"]
78 else []
79 )
80
81 (**
82 The list of ocaml libraries. Will be suffixed by ".cma" or ".cmxa" depending of the option --bytecode.
83 Theses libraries should be installed in one of the directory reachable by option -I (server_include_dir & server_include_mlstate_dir)
84 *)
85 let common_server_libraries = [
86 "str" ;
87 "unix" ;
88 "bigarray";
89 "ssl" ;
f764139 @nrs135 [feature] Badop_light: Attempt at OPA integration (partially successful...
nrs135 authored
90 "dbm" ;
fccc685 Initial open-source release
MLstate authored
91 "zip" ;
92 "nums" ;
93 "ulexing" ;
94 "buildinfos" ;
95 "libbase" ;
96 "libtrx" ;
97 "libruntime" ;
98 "appruntime" ;
99 "libtools" ;
100 "libsecurity" ;
101 "libnet" ;
102 "libirc" ;
103 "database" ;
104 "oparuntime";
105 "libsession" ;
106 ]
107
108 let qml_server_libraries = [
109 "qmlflat", common_server_libraries @ [ "qmlcpsserver" ; "qmlflatserver"; "opabsl_for_server" ];
110 "qmlfake", common_server_libraries @ [ "qmlcpsserver" ; "qmlfakeserver"; "opabsl_for_server" ];
111 ]
112
113 let opa_server_libraries =
114 [ "cryptokit" ; "opabsl_for_server" ]
115
116 (** the 2 following options will be used only in the case of resp bytecode / native *)
117 let extra_bytecode_options = [ "-g" ]
118 let extra_native_options = [ "-g" (* "-compact" *) ]
119 end
120
121 type input_file = QmlFile of string | OpaFile of string
122 let input_filename = function
123 | QmlFile f
124 | OpaFile f -> f
125
126 (*
127 TODO
128 for historic reasons, this used to be the options for the OPA compiler.
129 now, this correspond only to the options used by the ocaml back-end.
130 The current status is messy:
131 -lots of these options are unused (never set, never read).
132 -lots of these options are override by opa/passes.ml/pass_OpaOptionsToQmlOptions
133 a big clean-up is expected
134 *)
135 type argv_options = {
136 (*
137 1) Options used by passes after qmlcompilation
138 *)
139 camlp4o : bool ;
140 check_lib : bool ;
141 compilation_directory : string ;
142 compile_via_makefile : bool ;
143 exe_run : bool ;
144 exe_argv : string list ;
145 extra_lib : string list ;
146 extra_path : string list ;
147 hacker_mode : bool ;
148 makefile_max_jobs : int ;
149 makefile_rule : makefile_rule;
150 mlcopt : string list ;
151 mllopt : string list ;
152 no_move : bool ;
153 ocamlc : string ;
154 ocamlopt : string ;
155 profile : bool ;
156 show_compilation : bool ;
157 target : string ;
158
159 (*
160 2) Options used by the pass qmlcompilation
161 *)
162 cps : bool ;
163 no_assert: bool;
164 qml_closure: bool;
165 top_magic : bool ;
166
167 (*
168 3) Used by the command line tool qmljs
169 This should be refactored, somehow
170 *)
171 bypass_plugin : string list ;
172 cps_toplevel_concurrency : bool ;
173 constant_sharing : bool ;
174 input_files : input_file list ;
175 lambda_lifting : bool ;
176 no_stdlib : bool ;
177
178 (*
179 4) trash
180 *)
181 display_schema : string option ;
182 server_side : bool ;
183 split_ocaml_value : int ;
184 }
185
186 module ArgvOptions :
187 sig
188 val default : string -> argv_options
189 end
190 =
191 struct
192
193 let default backend = {
194 bypass_plugin = [] ;
195 camlp4o = false ;
196 check_lib = false ;
197 compilation_directory = "" ; (* set by opa *)
198 compile_via_makefile = false ;
199 constant_sharing = false ;
200 cps = false ;
201 cps_toplevel_concurrency = false ;
202 server_side = true ;
203 display_schema = None ;
204 exe_argv = [] ;
205 exe_run = false ;
206 extra_lib = (
207 let qml = List.assoc backend StaticParameters.qml_server_libraries in
208 let opa = StaticParameters.opa_server_libraries in
209 qml@opa
210 ) ;
211 extra_path = [] ;
212 hacker_mode = false ;
213 input_files = [] ;
214 lambda_lifting = false ;
215 makefile_max_jobs = 7 ;
216 makefile_rule = Native ;
217 mlcopt = StaticParameters.options_compiler ;
218 mllopt = StaticParameters.options_linker ;
219 no_assert = false ;
220 no_stdlib = false ;
221 no_move = false ;
222 ocamlc = "" ; (* set by opa *)
223 ocamlopt = "" ; (* set by opa *)
224 profile = false ;
225 qml_closure = false ;
226 show_compilation = false ; (* set by opa *)
227 split_ocaml_value = 100 ; (* set by opa *)
228 target = "" ; (* set by opa *)
229 top_magic = true ; (* set by opa *)
230 }
231 end
Something went wrong with that request. Please try again.