Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
19f26192
Commit
19f26192
authored
Jul 10, 2007
by
Pietro Abate
Browse files
[r2004-04-23 13:17:18 by afrisch] Build oCaml_all.cma/cmxa ourselves
Original author: afrisch Date: 2004-04-23 13:17:19+00:00
parent
98c6f80e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Makefile.conf.template
View file @
19f26192
...
...
@@ -9,8 +9,17 @@ NATIVE = true
PROFILE
=
false
# .mli/.cmi file support to interface CDuce with OCaml.
# possible values: false, flat, tree
# - if ML_INTERFACE=flat, set ML_MODULES to a directory that
# contains all the compiled modules from the directory
# utils, parsing, typing of the OCaml compilers
# - if ML_INTERFACE=tree, set ML_MODULES to a directory
# with three subdirectories utils/ parsing/ typing/
# that contain the compiled modules
# (see cdo2cmo/Makefile for more details)
ML_INTERFACE
=
false
# use wlex lexers for parsing XML files with PXP
PXP_WLEX
=
false
...
...
Makefile.distrib
View file @
19f26192
...
...
@@ -74,7 +74,7 @@ else
LINK
=
$(CAMLC)
-custom
-linkpkg
gramlib.cma
endif
ifeq
($(ML_INTERFACE),
tru
e)
if
n
eq
($(ML_INTERFACE),
fals
e)
SYNTAX
+=
-symbol
ML_INTERFACE
=
ML_LIB
=
oCaml_all.
$(EXTENSION_LIB)
ML_INTERFACE_OBJ
=
\
...
...
@@ -187,6 +187,9 @@ cDuce_all.$(EXTENSION_LIB): $(OBJECTS:.cmo=.$(EXTENSION))
$(COMPILE)
-o
cDuce_all.
$(EXTENSION)
-pack
$^
$(LINK)
-a
-o
$@
cDuce_all.
$(EXTENSION)
oCaml_all.$(EXTENSION_LIB)
:
cd
cdo2cmo
;
$(MAKE)
PREFIX
=
$(ML_MODULES)
MODEL
=
$(ML_INTERFACE)
$@
webiface
:
$(WEBIFACE:.cmo=.$(EXTENSION))
$(LINK)
-verbose
$(INCLUDES)
-o
$@
$^
-ccopt
-static
# webiface is made static to be able to move it more easily
...
...
@@ -207,7 +210,7 @@ compute_depend: $(DEPEND_OCAMLDEP)
sed
-e
"s|: |: misc/q_symbol.cmo |"
>
depend
clean
:
for
i
in
$(CLEAN_DIRS)
;
do
\
(
cd
$$
i
;
rm
-f
*
.cmi
*
.cmo
*
.cma
*
.cmx
*
.o
*
~
)
;
\
(
cd
$$
i
;
rm
-f
*
.cmi
*
.cmo
*
.cma
*
.cmx
*
.o
*
.a
*
.cmxa
*
~
)
;
\
done
(
cd
expat
;
$(MAKE)
clean
)
rm
-f
`
find
.
-name
"*~"
`
...
...
@@ -216,12 +219,13 @@ clean:
rm
-f
dtd2cduce pool webiface validate
rm
-Rf
prepro package
rm
-f
web/www/
*
.html web/
*
~
rm
-f
web/
*
.cdo
distclean
:
clean
rm
-f
Makefile.conf
$(ML_INTERFACE_OBJ
:
.cmo=.$(EXTENSION)): oCaml_all.$(EXTENSION_LIB)
.SUFFIXES
:
.ml .mli .cmo .cmi .cmx
...
...
cdo2cmo/Makefile
View file @
19f26192
PREFIX
=
/home/frisch/tmp/ocaml-3.07
MODEL
=
tree
# This Makefile generates oCaml_all.cma/.cmxa and put it in ..
#
# We need the units such that typing/types.cmo (.cmx)
# - If OCaml has been compiler in a directory DIR,
# you can do:
# make MODEL=tree PREFIX=DIR
# e.g.: make oCaml_all.cma MODEL=tree PREFIX=$HOME/ocaml-3.07
#
# - If you have a (flat) directory DIR will all the compiled units
# from utils/ parsing/ and typing/, you can do:
# make MODEL=flat PREFIX=DIR
# e.g.: make oCaml_all.cma MODEL=fal PREFIX=$HOME/godi/lib/ocaml/compiler-lib
OBJECTS
=
$(
patsubst
%,
$(PREFIX)
/%,
$(UNITS)
)
XOBJECTS
=
$(OBJECTS:.cmo=.cmx)
...
...
@@ -19,13 +30,13 @@ endif
oCaml_all.cma
:
ocamlc
-pack
-o
oCaml_all.cmo
$(OBJECTS)
ocamlc
-a
-o
oCaml_all.cma oCaml_all.cmo
cp
oCaml_all.cma oCaml_all.cmi ..
mv
oCaml_all.cma oCaml_all.cmi ..
rm
-f
oCaml_all.
*
oCaml_all.cmxa
:
ocamlopt
-pack
-o
oCaml_all.cmx
$(XOBJECTS)
ocamlopt
-a
-o
oCaml_all.cmxa oCaml_all.cmx
cp
oCaml_all.cmxa oCaml_all.cmi ..
mv
oCaml_all.cmxa
oCaml_all.a
oCaml_all.cmi ..
rm
-f
oCaml_all.
*
clean
:
...
...
configure.ml
View file @
19f26192
...
...
@@ -19,12 +19,14 @@ Optional features:
Available features:
ocamlopt use ocamlopt instead of ocamlc to build CDuce
mliface support for the CDuce/OCaml interface
pxp_wlex use wlexers for parsing utf8 with PXP [default: false]
expat support for the expat XML parser
curl support for the libcurl library
netclient support for the netclient library
OCaml/CDuce interface:
--mliface=DIR build the interface
Installation directories:
--prefix=PREFIX install files in PREFIX [/usr/local]
--bindir=DIR install user executables in DIR [PREFIX/bin]
...
...
@@ -54,11 +56,24 @@ let vars =
"cgidir"
,
ref
""
;
"htmldir"
,
ref
""
;
"sessiondir"
,
ref
"/tmp/cduce_sessions"
]
"sessiondir"
,
ref
"/tmp/cduce_sessions"
;
"mliface"
,
ref
""
]
let
fatal
s
=
printf
"*** Fatal error: %s
\n
"
s
;
exit
1
let
warning
s
=
printf
"* Warning: %s
\n
"
s
let
log
s
=
let
oc
=
open_out_gen
[
Open_append
;
Open_creat
]
0o600
"configure.log"
in
output_string
oc
s
;
output_char
oc
'\n'
;
close_out
oc
;
flush
stdout
let
command
s
=
log
(
"==> "
^
s
);
Sys
.
command
(
sprintf
"%s 2>> configure.log"
s
)
=
0
let
start_with
s
p
=
let
ls
=
String
.
length
s
and
lp
=
String
.
length
p
in
if
(
ls
>=
lp
)
&&
(
String
.
sub
s
0
lp
=
p
)
...
...
@@ -81,34 +96,49 @@ let parse_arg s =
let
()
=
print_endline
"Configuring CDuce for compilation...
\n
"
;
try
for
i
=
1
to
Array
.
length
Sys
.
argv
-
1
do
parse_arg
Sys
.
argv
.
(
i
)
done
with
Not_found
->
usage
()
;
fatal
"Incorrect command line"
(
try
for
i
=
1
to
Array
.
length
Sys
.
argv
-
1
do
parse_arg
Sys
.
argv
.
(
i
)
done
with
Not_found
->
usage
()
;
fatal
"Incorrect command line"
);
(
try
Sys
.
remove
"configure.log"
with
Sys_error
_
->
()
);
ignore
(
Sys
.
command
"uname -a >> configure.log"
)
let
print
s
=
print_string
s
;
flush
stdout
let
check_feature
f
p
=
printf
"%s: "
f
;
match
!
(
List
.
assoc
f
features
)
with
|
`no
->
print
f
"disabled
\n
"
;
false
print
"disabled
\n
"
;
false
|
`yes
->
print
f
"checking... "
;
print
"checking... "
;
if
p
()
then
(
print
f
"ok
\n
"
;
true
)
else
(
print
f
"failed !
\n
"
;
fatal
"Required feature is not available"
)
then
(
print
"ok
\n
"
;
true
)
else
(
print
"failed !
\n
"
;
fatal
"Required feature is not available"
)
|
`auto
->
print
f
"autodetecting... "
;
print
"autodetecting... "
;
if
p
()
then
(
printf
"enabled
\n
"
;
true
)
else
(
printf
"disabled
\n
"
;
false
)
then
(
print
"enabled
\n
"
;
true
)
else
(
print
"disabled
\n
"
;
false
)
let
native
=
check_feature
"ocamlopt"
(
fun
()
->
command
"ocamlfind ocamlopt"
)
let
check_pkg
p
()
=
try
ignore
(
Findlib
.
package_directory
p
);
true
with
Fl_package_base
.
No_such_package
(
_
,_
)
->
false
try
(* ignore (Findlib.package_property
[ (if native then "native" else "bytecode") ]
p "archive"); *)
command
(
sprintf
"ocamlfind ocaml%s -package %s -linkpkg -o /dev/null"
(
if
native
then
"opt"
else
"c"
)
p
)
with
Not_found
->
false
let
need_pkg
p
=
printf
"Checking for package %s... "
p
;
printf
"Checking for package %s... "
p
;
flush
stdout
;
if
not
(
check_pkg
p
()
)
then
(
print
f
"failed !
\n
"
;
fatal
"Required package is not available"
)
else
(
print
f
"ok
\n
"
)
then
(
print
"failed !
\n
"
;
fatal
"Required package is not available"
)
else
(
print
"ok
\n
"
)
let
dir
?
def
d
=
let
s
=
!
(
List
.
assoc
d
vars
)
in
...
...
@@ -118,13 +148,27 @@ let dir ?def d =
|
None
->
fatal
(
sprintf
"%s cannot be empty"
d
)
let
native
=
check_feature
"ocamlopt"
(
fun
()
->
Sys
.
command
"ocamlfind ocamlopt 2> /dev/null"
=
0
)
let
exe
=
match
Sys
.
os_type
with
|
"Cygwin"
->
print
"Cygwin detected... executable will have .exe extension"
;
"exe"
|
_
->
""
let
ml_interface
=
check_feature
"mliface"
(
fun
()
->
Sys
.
command
"ocamlfind ocamlc -o /dev/null oCaml_all.cma 2> /dev/null"
=
0
)
let
dir
=
!
(
List
.
assoc
"mliface"
vars
)
in
if
dir
=
""
then
`no
else
let
file
=
if
native
then
"types.cmx"
else
"types.cmo"
in
printf
"Checking for ocaml compiler modules ..."
;
flush
stdout
;
if
Sys
.
file_exists
(
Filename
.
concat
dir
file
)
then
(
print
"ok (flat model)
\n
"
;
`flat
dir
)
else
if
Sys
.
file_exists
(
Filename
.
concat
(
Filename
.
concat
dir
"typing"
)
file
)
then
(
print
"ok'n"
;
`tree
dir
)
else
(
print
"not found
\n
"
;
fatal
(
"Cannot find ocaml compiler compiled modules, eg:"
^
file
))
let
expat
=
check_feature
"expat"
(
check_pkg
"expat"
)
let
curl
=
check_feature
"curl"
(
check_pkg
"curl"
)
let
netclient
=
check_feature
"netclient"
(
check_pkg
"netclient"
)
...
...
@@ -137,8 +181,6 @@ let cgidir = dir ~def:(wprefix^"/cgi-bin") "cgidir"
let
htmldir
=
dir
~
def
:
(
wprefix
^
"/html"
)
"htmldir"
let
sessiondir
=
dir
"sessiondir"
let
exe
=
match
Sys
.
os_type
with
"Cygwin"
->
"exe"
|
_
->
""
let
curl
,
netclient
=
match
curl
,
netclient
with
|
true
,
true
->
...
...
@@ -159,12 +201,15 @@ let () =
List
.
iter
need_pkg
required_packages
;
if
not
pxp_wlex
then
need_pkg
"pxp-lex-utf8"
;
print
_endline
"Creating Makefile.conf..."
;
print
"Creating Makefile.conf...
\n
"
;
let
out
=
open_out
"Makefile.conf"
in
fprintf
out
"# This file has been generated by the configure script
\n
"
;
fprintf
out
"NATIVE=%b
\n
"
native
;
fprintf
out
"ML_INTERFACE=%b
\n
"
ml_interface
;
(
match
ml_interface
with
|
`no
->
fprintf
out
"ML_INTERFACE=false
\n
"
|
`flat
d
->
fprintf
out
"ML_INTERFACE=flat
\n
ML_MODULES=%s
\n
"
d
|
`tree
d
->
fprintf
out
"ML_INTERFACE=tree
\n
ML_MODULES=%s
\n
"
d
);
fprintf
out
"EXPAT=%b
\n
"
expat
;
fprintf
out
"CURL=%b
\n
"
curl
;
fprintf
out
"NETCLIENT=%b
\n
"
netclient
;
...
...
depend
View file @
19f26192
...
...
@@ -110,8 +110,8 @@ schema/schema_parser.cmx: misc/q_symbol.cmo misc/encodings.cmx types/intervals.c
runtime/value.cmx schema/schema_parser.cmi
parser/location.cmo: misc/q_symbol.cmo parser/location.cmi
parser/location.cmx: misc/q_symbol.cmo parser/location.cmi
parser/url.cmo: misc/q_symbol.cmo
parser/location.cmi
parser/url.cmi
parser/url.cmx: misc/q_symbol.cmo
parser/location.cmx
parser/url.cmi
parser/url.cmo: misc/q_symbol.cmo parser/url.cmi
parser/url.cmx: misc/q_symbol.cmo parser/url.cmi
parser/ulexer.cmo: misc/q_symbol.cmo parser/ulexer.cmi
parser/ulexer.cmx: misc/q_symbol.cmo parser/ulexer.cmi
parser/ast.cmo: misc/q_symbol.cmo types/builtin_defs.cmi types/chars.cmi types/ident.cmo \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment