Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 238 lines (212 sloc) 6.262 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" ;
88330c9 [fix] dbm: add +dbm for compiling opa servers
Mathieu Barbin authored
59 ] @ (
60 if Config.has_dbm then [
61 "+dbm" ; "+site-lib/dbm" ;
62 ] else []
63 )
fccc685 Initial open-source release
MLstate authored
64
65 (**
66 Like [server_include_dir] but the path is not absolute, but relative to MLSTATELIBS directory.
67 The following directories will be prefixed by MLSTATELIBS before passing to ocaml compiler with -I
68 *)
69 let server_include_mlstate_dir =
70 InstallDir.lib_opa ::
71 (
72 if Base.is_windows
73 then
74 (*
75 FIXME
76 What is the purpose of this ?
77 This will be concatenated with a Filename.concat anyway
78 *)
79 if BuildInfos.is_release
80 then ["windows_libs/openssl/lib"]
81 else ["/windows_libs/openssl/lib"]
82 else []
83 )
84
85 (**
86 The list of ocaml libraries. Will be suffixed by ".cma" or ".cmxa" depending of the option --bytecode.
87 Theses libraries should be installed in one of the directory reachable by option -I (server_include_dir & server_include_mlstate_dir)
88 *)
89 let common_server_libraries = [
90 "str" ;
91 "unix" ;
92 "bigarray";
93 "ssl" ;
ebb9f52 [feature] Database: making dblight compilation optional, depending on th...
Louis Gesbert authored
94 #<Ifstatic:HAS_DBM 1>
f764139 @nrs135 [feature] Badop_light: Attempt at OPA integration (partially successful...
nrs135 authored
95 "dbm" ;
ebb9f52 [feature] Database: making dblight compilation optional, depending on th...
Louis Gesbert authored
96 #<End>
fccc685 Initial open-source release
MLstate authored
97 "zip" ;
98 "nums" ;
99 "ulexing" ;
100 "buildinfos" ;
101 "libbase" ;
102 "libtrx" ;
103 "libruntime" ;
104 "appruntime" ;
105 "libtools" ;
106 "libsecurity" ;
107 "libnet" ;
108 "libirc" ;
109 "database" ;
110 "oparuntime";
111 "libsession" ;
112 ]
113
114 let qml_server_libraries = [
115 "qmlflat", common_server_libraries @ [ "qmlcpsserver" ; "qmlflatserver"; "opabsl_for_server" ];
116 "qmlfake", common_server_libraries @ [ "qmlcpsserver" ; "qmlfakeserver"; "opabsl_for_server" ];
117 ]
118
119 let opa_server_libraries =
120 [ "cryptokit" ; "opabsl_for_server" ]
121
122 (** the 2 following options will be used only in the case of resp bytecode / native *)
123 let extra_bytecode_options = [ "-g" ]
124 let extra_native_options = [ "-g" (* "-compact" *) ]
125 end
126
127 type input_file = QmlFile of string | OpaFile of string
128 let input_filename = function
129 | QmlFile f
130 | OpaFile f -> f
131
132 (*
133 TODO
134 for historic reasons, this used to be the options for the OPA compiler.
135 now, this correspond only to the options used by the ocaml back-end.
136 The current status is messy:
137 -lots of these options are unused (never set, never read).
138 -lots of these options are override by opa/passes.ml/pass_OpaOptionsToQmlOptions
139 a big clean-up is expected
140 *)
141 type argv_options = {
142 (*
143 1) Options used by passes after qmlcompilation
144 *)
145 camlp4o : bool ;
146 check_lib : bool ;
147 compilation_directory : string ;
148 compile_via_makefile : bool ;
149 exe_run : bool ;
150 exe_argv : string list ;
151 extra_lib : string list ;
152 extra_path : string list ;
153 hacker_mode : bool ;
154 makefile_max_jobs : int ;
155 makefile_rule : makefile_rule;
156 mlcopt : string list ;
157 mllopt : string list ;
158 no_move : bool ;
159 ocamlc : string ;
160 ocamlopt : string ;
161 profile : bool ;
162 show_compilation : bool ;
163 target : string ;
164
165 (*
166 2) Options used by the pass qmlcompilation
167 *)
168 cps : bool ;
169 no_assert: bool;
170 qml_closure: bool;
171 top_magic : bool ;
172
173 (*
174 3) Used by the command line tool qmljs
175 This should be refactored, somehow
176 *)
177 bypass_plugin : string list ;
178 cps_toplevel_concurrency : bool ;
179 constant_sharing : bool ;
180 input_files : input_file list ;
181 lambda_lifting : bool ;
182 no_stdlib : bool ;
183
184 (*
185 4) trash
186 *)
187 display_schema : string option ;
188 server_side : bool ;
189 split_ocaml_value : int ;
190 }
191
192 module ArgvOptions :
193 sig
194 val default : string -> argv_options
195 end
196 =
197 struct
198
199 let default backend = {
200 bypass_plugin = [] ;
201 camlp4o = false ;
202 check_lib = false ;
203 compilation_directory = "" ; (* set by opa *)
204 compile_via_makefile = false ;
205 constant_sharing = false ;
206 cps = false ;
207 cps_toplevel_concurrency = false ;
208 server_side = true ;
209 display_schema = None ;
210 exe_argv = [] ;
211 exe_run = false ;
212 extra_lib = (
213 let qml = List.assoc backend StaticParameters.qml_server_libraries in
214 let opa = StaticParameters.opa_server_libraries in
215 qml@opa
216 ) ;
217 extra_path = [] ;
218 hacker_mode = false ;
219 input_files = [] ;
220 lambda_lifting = false ;
221 makefile_max_jobs = 7 ;
222 makefile_rule = Native ;
223 mlcopt = StaticParameters.options_compiler ;
224 mllopt = StaticParameters.options_linker ;
225 no_assert = false ;
226 no_stdlib = false ;
227 no_move = false ;
228 ocamlc = "" ; (* set by opa *)
229 ocamlopt = "" ; (* set by opa *)
230 profile = false ;
231 qml_closure = false ;
232 show_compilation = false ; (* set by opa *)
233 split_ocaml_value = 100 ; (* set by opa *)
234 target = "" ; (* set by opa *)
235 top_magic = true ; (* set by opa *)
236 }
237 end
Something went wrong with that request. Please try again.