Codebase list findlib / e4dcf2c
Imported Upstream version 1.5.4 Stephane Glondu 9 years ago
26 changed file(s) with 2092 addition(s) and 1830 deletion(s). Raw diff Collapse all Expand all
00 #! /bin/sh
1 # $Id: configure 237 2014-09-16 11:21:09Z gerd $
1 # $Id: configure 244 2014-10-15 11:06:21Z gerd $
22 # ----------------------------------------------------------------------
33 #
44
66
77 #set -x
88
9 version="1.5.3"
9 version="1.5.4"
1010
1111 # Remember the old IFS value:
1212 oldifs="$IFS"
381381 ocaml unix.cma itest-aux/simple.ml >/dev/null || have_dlls="no"
382382
383383 ######################################################################
384 # Does this version of OCaml support extension points?
385
386 echo "Testing whether ppxopt can be supported..."
387
388 with_ppxopt=1
389 enable_topfind_ppxopt=true
390
391 ocaml -I +compiler-libs itest-aux/ppx.ml >/dev/null || {
392 with_ppxopt=0
393 enable_topfind_ppxopt=false
394 }
395
396 ######################################################################
384397 # Configure libraries
385398
386399 echo "Configuring libraries..."
582595 echo "USE_CYGPATH=${use_cygpath}" >>Makefile.config
583596 echo "HAVE_NATDYNLINK=${have_natdynlink}" >>Makefile.config
584597 echo "VERSION=${version}" >>Makefile.config
598 echo "ENABLE_TOPFIND_PPXOPT=${enable_topfind_ppxopt}" >>Makefile.config
585599 echo "SYSTEM=${system}" >>Makefile.config
586600 if [ "$mingw_lib" != "" ]; then
587601 echo "OCAMLC_FLAGS=-I \"${mingw_lib}\"" >>Makefile.config
610624 echo " topfind script: omitted"
611625 fi
612626
627 if [ $with_ppxopt -gt 0 ]; then
628 echo "Topfind ppxopt support: yes"
629 else
630 echo "Topfind ppxopt support: no"
631 fi
632
613633 if [ $with_toolbox -gt 0 ]; then
614634 echo "Toolbox: yes"
615635 else
8484 List of Changes
8585 ==============================================================================
8686
87 - 1.5.4: New ppxopt META variables (Peter Zotov).
88 Support for OCAMLFIND_TOOLCHAIN environment variable (Peter Zotov).
89
8790 - 1.5.3: The installation of "bytes" respects now $prefix and the configured
8891 destination.
8992 New option -pp for "ocamlfind query", to get preprocessor packages.
109109 <ul>
110110
111111 <li>
112 <p><em>1.5.4:</em> New ppxopt META variables (Peter Zotov).</p>
113 <p>Support for OCAMLFIND_TOOLCHAIN environment variable (Peter Zotov).
114 </p>
115 </li>
116
117 <li>
112118 <p><em>1.5.3:</em> The installation of "bytes" respects now $prefix and
113119 the configured destination.</p>
114120 <p>New option -pp for "ocamlfind query", to get preprocessor packages.</p>
+0
-139
doc/ref-html/c1045.html less more
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
1 <HTML
2 ><HEAD
3 ><TITLE
4 >The findlib library</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
8 REL="HOME"
9 TITLE="The findlib Reference Manual"
10 HREF="index.html"><LINK
11 REL="UP"
12 TITLE="Library"
13 HREF="p1043.html"><LINK
14 REL="PREVIOUS"
15 TITLE="Library"
16 HREF="p1043.html"></HEAD
17 ><BODY
18 CLASS="CHAPTER"
19 BGCOLOR="#FFFFFF"
20 TEXT="#000000"
21 LINK="#0000FF"
22 VLINK="#840084"
23 ALINK="#0000FF"
24 ><DIV
25 CLASS="NAVHEADER"
26 ><TABLE
27 SUMMARY="Header navigation table"
28 WIDTH="100%"
29 BORDER="0"
30 CELLPADDING="0"
31 CELLSPACING="0"
32 ><TR
33 ><TH
34 COLSPAN="3"
35 ALIGN="center"
36 >The findlib Reference Manual</TH
37 ></TR
38 ><TR
39 ><TD
40 WIDTH="10%"
41 ALIGN="left"
42 VALIGN="bottom"
43 ><A
44 HREF="p1043.html"
45 ACCESSKEY="P"
46 >Prev</A
47 ></TD
48 ><TD
49 WIDTH="80%"
50 ALIGN="center"
51 VALIGN="bottom"
52 ></TD
53 ><TD
54 WIDTH="10%"
55 ALIGN="right"
56 VALIGN="bottom"
57 >&nbsp;</TD
58 ></TR
59 ></TABLE
60 ><HR
61 ALIGN="LEFT"
62 WIDTH="100%"></DIV
63 ><DIV
64 CLASS="CHAPTER"
65 ><H1
66 ><A
67 NAME="AEN1045"
68 ></A
69 >Chapter 1. The findlib library</H1
70 ><P
71 > <A
72 HREF="lib/index.html"
73 TARGET="_top"
74 >The findlib library</A
75 >
76 </P
77 ></DIV
78 ><DIV
79 CLASS="NAVFOOTER"
80 ><HR
81 ALIGN="LEFT"
82 WIDTH="100%"><TABLE
83 SUMMARY="Footer navigation table"
84 WIDTH="100%"
85 BORDER="0"
86 CELLPADDING="0"
87 CELLSPACING="0"
88 ><TR
89 ><TD
90 WIDTH="33%"
91 ALIGN="left"
92 VALIGN="top"
93 ><A
94 HREF="p1043.html"
95 ACCESSKEY="P"
96 >Prev</A
97 ></TD
98 ><TD
99 WIDTH="34%"
100 ALIGN="center"
101 VALIGN="top"
102 ><A
103 HREF="index.html"
104 ACCESSKEY="H"
105 >Home</A
106 ></TD
107 ><TD
108 WIDTH="33%"
109 ALIGN="right"
110 VALIGN="top"
111 >&nbsp;</TD
112 ></TR
113 ><TR
114 ><TD
115 WIDTH="33%"
116 ALIGN="left"
117 VALIGN="top"
118 >Library</TD
119 ><TD
120 WIDTH="34%"
121 ALIGN="center"
122 VALIGN="top"
123 ><A
124 HREF="p1043.html"
125 ACCESSKEY="U"
126 >Up</A
127 ></TD
128 ><TD
129 WIDTH="33%"
130 ALIGN="right"
131 VALIGN="top"
132 >&nbsp;</TD
133 ></TR
134 ></TABLE
135 ></DIV
136 ></BODY
137 ></HTML
138 >
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
1 <HTML
2 ><HEAD
3 ><TITLE
4 >The findlib library</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
8 REL="HOME"
9 TITLE="The findlib Reference Manual"
10 HREF="index.html"><LINK
11 REL="UP"
12 TITLE="Library"
13 HREF="p1052.html"><LINK
14 REL="PREVIOUS"
15 TITLE="Library"
16 HREF="p1052.html"></HEAD
17 ><BODY
18 CLASS="CHAPTER"
19 BGCOLOR="#FFFFFF"
20 TEXT="#000000"
21 LINK="#0000FF"
22 VLINK="#840084"
23 ALINK="#0000FF"
24 ><DIV
25 CLASS="NAVHEADER"
26 ><TABLE
27 SUMMARY="Header navigation table"
28 WIDTH="100%"
29 BORDER="0"
30 CELLPADDING="0"
31 CELLSPACING="0"
32 ><TR
33 ><TH
34 COLSPAN="3"
35 ALIGN="center"
36 >The findlib Reference Manual</TH
37 ></TR
38 ><TR
39 ><TD
40 WIDTH="10%"
41 ALIGN="left"
42 VALIGN="bottom"
43 ><A
44 HREF="p1052.html"
45 ACCESSKEY="P"
46 >Prev</A
47 ></TD
48 ><TD
49 WIDTH="80%"
50 ALIGN="center"
51 VALIGN="bottom"
52 ></TD
53 ><TD
54 WIDTH="10%"
55 ALIGN="right"
56 VALIGN="bottom"
57 >&nbsp;</TD
58 ></TR
59 ></TABLE
60 ><HR
61 ALIGN="LEFT"
62 WIDTH="100%"></DIV
63 ><DIV
64 CLASS="CHAPTER"
65 ><H1
66 ><A
67 NAME="AEN1054"
68 ></A
69 >Chapter 1. The findlib library</H1
70 ><P
71 > <A
72 HREF="lib/index.html"
73 TARGET="_top"
74 >The findlib library</A
75 >
76 </P
77 ></DIV
78 ><DIV
79 CLASS="NAVFOOTER"
80 ><HR
81 ALIGN="LEFT"
82 WIDTH="100%"><TABLE
83 SUMMARY="Footer navigation table"
84 WIDTH="100%"
85 BORDER="0"
86 CELLPADDING="0"
87 CELLSPACING="0"
88 ><TR
89 ><TD
90 WIDTH="33%"
91 ALIGN="left"
92 VALIGN="top"
93 ><A
94 HREF="p1052.html"
95 ACCESSKEY="P"
96 >Prev</A
97 ></TD
98 ><TD
99 WIDTH="34%"
100 ALIGN="center"
101 VALIGN="top"
102 ><A
103 HREF="index.html"
104 ACCESSKEY="H"
105 >Home</A
106 ></TD
107 ><TD
108 WIDTH="33%"
109 ALIGN="right"
110 VALIGN="top"
111 >&nbsp;</TD
112 ></TR
113 ><TR
114 ><TD
115 WIDTH="33%"
116 ALIGN="left"
117 VALIGN="top"
118 >Library</TD
119 ><TD
120 WIDTH="34%"
121 ALIGN="center"
122 VALIGN="top"
123 ><A
124 HREF="p1052.html"
125 ACCESSKEY="U"
126 >Up</A
127 ></TD
128 ><TD
129 WIDTH="33%"
130 ALIGN="right"
131 VALIGN="top"
132 >&nbsp;</TD
133 ></TR
134 ></TABLE
135 ></DIV
136 ></BODY
137 ></HTML
138 >
7373 >&nbsp;--&nbsp;[File that specifies metainformation of OCaml packages]</DT
7474 ><DT
7575 ><A
76 HREF="r796.html"
76 HREF="r798.html"
7777 >findlib.conf</A
7878 >&nbsp;--&nbsp;[Configuration of findlib/ocamlfind]</DT
7979 ><DT
8080 ><A
81 HREF="r985.html"
81 HREF="r994.html"
8282 >site-lib</A
8383 >&nbsp;--&nbsp;[Location of package directories]</DT
8484 ></DL
8585 ></DD
8686 ><DT
8787 >III. <A
88 HREF="p1043.html"
88 HREF="p1052.html"
8989 >Library</A
9090 ></DT
9191 ><DD
9292 ><DL
9393 ><DT
9494 >1. <A
95 HREF="c1045.html"
95 HREF="c1054.html"
9696 >The findlib library</A
9797 ></DT
9898 ></DL
+0
-154
doc/ref-html/p1043.html less more
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
1 <HTML
2 ><HEAD
3 ><TITLE
4 >Library</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
8 REL="HOME"
9 TITLE="The findlib Reference Manual"
10 HREF="index.html"><LINK
11 REL="PREVIOUS"
12 TITLE="site-lib"
13 HREF="r985.html"><LINK
14 REL="NEXT"
15 TITLE="The findlib library"
16 HREF="c1045.html"></HEAD
17 ><BODY
18 CLASS="PART"
19 BGCOLOR="#FFFFFF"
20 TEXT="#000000"
21 LINK="#0000FF"
22 VLINK="#840084"
23 ALINK="#0000FF"
24 ><DIV
25 CLASS="NAVHEADER"
26 ><TABLE
27 SUMMARY="Header navigation table"
28 WIDTH="100%"
29 BORDER="0"
30 CELLPADDING="0"
31 CELLSPACING="0"
32 ><TR
33 ><TH
34 COLSPAN="3"
35 ALIGN="center"
36 >The findlib Reference Manual</TH
37 ></TR
38 ><TR
39 ><TD
40 WIDTH="10%"
41 ALIGN="left"
42 VALIGN="bottom"
43 ><A
44 HREF="r985.html"
45 ACCESSKEY="P"
46 >Prev</A
47 ></TD
48 ><TD
49 WIDTH="80%"
50 ALIGN="center"
51 VALIGN="bottom"
52 ></TD
53 ><TD
54 WIDTH="10%"
55 ALIGN="right"
56 VALIGN="bottom"
57 ><A
58 HREF="c1045.html"
59 ACCESSKEY="N"
60 >Next</A
61 ></TD
62 ></TR
63 ></TABLE
64 ><HR
65 ALIGN="LEFT"
66 WIDTH="100%"></DIV
67 ><DIV
68 CLASS="PART"
69 ><A
70 NAME="AEN1043"
71 ></A
72 ><DIV
73 CLASS="TITLEPAGE"
74 ><H1
75 CLASS="TITLE"
76 >III. Library</H1
77 ><DIV
78 CLASS="TOC"
79 ><DL
80 ><DT
81 ><B
82 >Table of Contents</B
83 ></DT
84 ><DT
85 >1. <A
86 HREF="c1045.html"
87 >The findlib library</A
88 ></DT
89 ></DL
90 ></DIV
91 ></DIV
92 ></DIV
93 ><DIV
94 CLASS="NAVFOOTER"
95 ><HR
96 ALIGN="LEFT"
97 WIDTH="100%"><TABLE
98 SUMMARY="Footer navigation table"
99 WIDTH="100%"
100 BORDER="0"
101 CELLPADDING="0"
102 CELLSPACING="0"
103 ><TR
104 ><TD
105 WIDTH="33%"
106 ALIGN="left"
107 VALIGN="top"
108 ><A
109 HREF="r985.html"
110 ACCESSKEY="P"
111 >Prev</A
112 ></TD
113 ><TD
114 WIDTH="34%"
115 ALIGN="center"
116 VALIGN="top"
117 ><A
118 HREF="index.html"
119 ACCESSKEY="H"
120 >Home</A
121 ></TD
122 ><TD
123 WIDTH="33%"
124 ALIGN="right"
125 VALIGN="top"
126 ><A
127 HREF="c1045.html"
128 ACCESSKEY="N"
129 >Next</A
130 ></TD
131 ></TR
132 ><TR
133 ><TD
134 WIDTH="33%"
135 ALIGN="left"
136 VALIGN="top"
137 >site-lib</TD
138 ><TD
139 WIDTH="34%"
140 ALIGN="center"
141 VALIGN="top"
142 >&nbsp;</TD
143 ><TD
144 WIDTH="33%"
145 ALIGN="right"
146 VALIGN="top"
147 >The findlib library</TD
148 ></TR
149 ></TABLE
150 ></DIV
151 ></BODY
152 ></HTML
153 >
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
1 <HTML
2 ><HEAD
3 ><TITLE
4 >Library</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
8 REL="HOME"
9 TITLE="The findlib Reference Manual"
10 HREF="index.html"><LINK
11 REL="PREVIOUS"
12 TITLE="site-lib"
13 HREF="r994.html"><LINK
14 REL="NEXT"
15 TITLE="The findlib library"
16 HREF="c1054.html"></HEAD
17 ><BODY
18 CLASS="PART"
19 BGCOLOR="#FFFFFF"
20 TEXT="#000000"
21 LINK="#0000FF"
22 VLINK="#840084"
23 ALINK="#0000FF"
24 ><DIV
25 CLASS="NAVHEADER"
26 ><TABLE
27 SUMMARY="Header navigation table"
28 WIDTH="100%"
29 BORDER="0"
30 CELLPADDING="0"
31 CELLSPACING="0"
32 ><TR
33 ><TH
34 COLSPAN="3"
35 ALIGN="center"
36 >The findlib Reference Manual</TH
37 ></TR
38 ><TR
39 ><TD
40 WIDTH="10%"
41 ALIGN="left"
42 VALIGN="bottom"
43 ><A
44 HREF="r994.html"
45 ACCESSKEY="P"
46 >Prev</A
47 ></TD
48 ><TD
49 WIDTH="80%"
50 ALIGN="center"
51 VALIGN="bottom"
52 ></TD
53 ><TD
54 WIDTH="10%"
55 ALIGN="right"
56 VALIGN="bottom"
57 ><A
58 HREF="c1054.html"
59 ACCESSKEY="N"
60 >Next</A
61 ></TD
62 ></TR
63 ></TABLE
64 ><HR
65 ALIGN="LEFT"
66 WIDTH="100%"></DIV
67 ><DIV
68 CLASS="PART"
69 ><A
70 NAME="AEN1052"
71 ></A
72 ><DIV
73 CLASS="TITLEPAGE"
74 ><H1
75 CLASS="TITLE"
76 >III. Library</H1
77 ><DIV
78 CLASS="TOC"
79 ><DL
80 ><DT
81 ><B
82 >Table of Contents</B
83 ></DT
84 ><DT
85 >1. <A
86 HREF="c1054.html"
87 >The findlib library</A
88 ></DT
89 ></DL
90 ></DIV
91 ></DIV
92 ></DIV
93 ><DIV
94 CLASS="NAVFOOTER"
95 ><HR
96 ALIGN="LEFT"
97 WIDTH="100%"><TABLE
98 SUMMARY="Footer navigation table"
99 WIDTH="100%"
100 BORDER="0"
101 CELLPADDING="0"
102 CELLSPACING="0"
103 ><TR
104 ><TD
105 WIDTH="33%"
106 ALIGN="left"
107 VALIGN="top"
108 ><A
109 HREF="r994.html"
110 ACCESSKEY="P"
111 >Prev</A
112 ></TD
113 ><TD
114 WIDTH="34%"
115 ALIGN="center"
116 VALIGN="top"
117 ><A
118 HREF="index.html"
119 ACCESSKEY="H"
120 >Home</A
121 ></TD
122 ><TD
123 WIDTH="33%"
124 ALIGN="right"
125 VALIGN="top"
126 ><A
127 HREF="c1054.html"
128 ACCESSKEY="N"
129 >Next</A
130 ></TD
131 ></TR
132 ><TR
133 ><TD
134 WIDTH="33%"
135 ALIGN="left"
136 VALIGN="top"
137 >site-lib</TD
138 ><TD
139 WIDTH="34%"
140 ALIGN="center"
141 VALIGN="top"
142 >&nbsp;</TD
143 ><TD
144 WIDTH="33%"
145 ALIGN="right"
146 VALIGN="top"
147 >The findlib library</TD
148 ></TR
149 ></TABLE
150 ></DIV
151 ></BODY
152 ></HTML
153 >
8888 >&nbsp;--&nbsp;[File that specifies metainformation of OCaml packages]</DT
8989 ><DT
9090 ><A
91 HREF="r796.html"
91 HREF="r798.html"
9292 >findlib.conf</A
9393 >&nbsp;--&nbsp;[Configuration of findlib/ocamlfind]</DT
9494 ><DT
9595 ><A
96 HREF="r985.html"
96 HREF="r994.html"
9797 >site-lib</A
9898 >&nbsp;--&nbsp;[Location of package directories]</DT
9999 ></DL
12891289 ><P
12901290 >Alternatively, you can change the configuration file
12911291 <A
1292 HREF="r796.html#FINDLIB.CONF"
1292 HREF="r798.html#FINDLIB.CONF"
12931293 >findlib.conf</A
12941294 >.</P
12951295 ></DIV
18911891 >destdir</TT
18921892 > of
18931893 <A
1894 HREF="r796.html#FINDLIB.CONF"
1894 HREF="r798.html#FINDLIB.CONF"
18951895 >findlib.conf</A
18961896 >), or in the directory
18971897 specified by the -destdir option. This
19131913 >metadir</TT
19141914 > of
19151915 <A
1916 HREF="r796.html#FINDLIB.CONF"
1916 HREF="r798.html#FINDLIB.CONF"
19171917 >findlib.conf</A
19181918 >, or to specify the
19191919 -metadir option. In this case, the file called META is copied to the
20472047 >destdir</TT
20482048 > of
20492049 <A
2050 HREF="r796.html#FINDLIB.CONF"
2050 HREF="r798.html#FINDLIB.CONF"
20512051 >findlib.conf</A
20522052 >). If the package
20532053 resides at a different location, it will not be removed by default;
20642064 >metadir</TT
20652065 > variable
20662066 of <A
2067 HREF="r796.html#FINDLIB.CONF"
2067 HREF="r798.html#FINDLIB.CONF"
20682068 >findlib.conf</A
20692069 >, or by specifying
20702070 the -metadir option.</P
23072307 > The configuration file and environment variables are documented
23082308 in the manual page for
23092309 <A
2310 HREF="r796.html#FINDLIB.CONF"
2310 HREF="r798.html#FINDLIB.CONF"
23112311 >findlib.conf</A
23122312 >.</P
23132313 ></DIV
23562356 can switch to different command sets. For instance, the toolchain
23572357 "foo" may consist of a patched ocamlc compiler.
23582358 See <A
2359 HREF="r796.html#FINDLIB.CONF"
2359 HREF="r798.html#FINDLIB.CONF"
23602360 >findlib.conf</A
23612361 > how to
23622362 configure toolchains.</P
1616 HREF="p698.html"><LINK
1717 REL="NEXT"
1818 TITLE="findlib.conf"
19 HREF="r796.html"></HEAD
19 HREF="r798.html"></HEAD
2020 ><BODY
2121 CLASS="REFENTRY"
2222 BGCOLOR="#FFFFFF"
5858 ALIGN="right"
5959 VALIGN="bottom"
6060 ><A
61 HREF="r796.html"
61 HREF="r798.html"
6262 ACCESSKEY="N"
6363 >Next</A
6464 ></TD
280280 depends on whether it is contained in a main or sub package, and
281281 whether the standard repository layout or the alternate layout is in
282282 effect (see <A
283 HREF="r985.html#SITE-LIB"
283 HREF="r994.html#SITE-LIB"
284284 >site-lib</A
285285 > for these terms).
286286 For a main package in standard layout the base directory is the
368368 relative to the current directory (e.g. ./cmd), the command is expected
369369 in the package directory. The special forms as defined for "archive"
370370 are also available (e.g. @otherpkg/cmd). Additional arguments can be
371 specified on the ocamlfind command line with the -ppxopt option.</P
371 specified on the ocamlfind command line with the -ppxopt option
372 or the "ppxopt" variable.</P
373 ></LI
374 ><LI
375 STYLE="list-style-type: disc"
376 ><P
377 >The variable "ppxopt" is a set of options that are added to the ppx
378 rewriter invocation. The contents of the variable consists of one or
379 several whitespace-separated parts. Every part consists of several
380 comma-separated subparts; the first subpart indicates the package
381 that contains the ppx rewriter invocation, the rest contain the options
382 to be appended. If the option is a path relative to the current directory
383 (e.g. ./foo.cma), the path is expanded relative to the package directory.
384 The special forms as defined for "archive" are also available
385 (e.g. @otherpkg/foo.cma).</P
372386 ></LI
373387 ></UL
374388 ><P
378392 ><DIV
379393 CLASS="REFSECT1"
380394 ><A
381 NAME="AEN769"
395 NAME="AEN771"
382396 ></A
383397 ><H2
384398 >PREDICATES</H2
494508 ALIGN="right"
495509 VALIGN="top"
496510 ><A
497 HREF="r796.html"
511 HREF="r798.html"
498512 ACCESSKEY="N"
499513 >Next</A
500514 ></TD
+0
-820
doc/ref-html/r796.html less more
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
1 <HTML
2 ><HEAD
3 ><TITLE
4 >findlib.conf</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
8 REL="HOME"
9 TITLE="The findlib Reference Manual"
10 HREF="index.html"><LINK
11 REL="UP"
12 TITLE="Files"
13 HREF="p698.html"><LINK
14 REL="PREVIOUS"
15 TITLE="META"
16 HREF="r700.html"><LINK
17 REL="NEXT"
18 TITLE="site-lib"
19 HREF="r985.html"></HEAD
20 ><BODY
21 CLASS="REFENTRY"
22 BGCOLOR="#FFFFFF"
23 TEXT="#000000"
24 LINK="#0000FF"
25 VLINK="#840084"
26 ALINK="#0000FF"
27 ><DIV
28 CLASS="NAVHEADER"
29 ><TABLE
30 SUMMARY="Header navigation table"
31 WIDTH="100%"
32 BORDER="0"
33 CELLPADDING="0"
34 CELLSPACING="0"
35 ><TR
36 ><TH
37 COLSPAN="3"
38 ALIGN="center"
39 >The findlib Reference Manual</TH
40 ></TR
41 ><TR
42 ><TD
43 WIDTH="10%"
44 ALIGN="left"
45 VALIGN="bottom"
46 ><A
47 HREF="r700.html"
48 ACCESSKEY="P"
49 >Prev</A
50 ></TD
51 ><TD
52 WIDTH="80%"
53 ALIGN="center"
54 VALIGN="bottom"
55 ></TD
56 ><TD
57 WIDTH="10%"
58 ALIGN="right"
59 VALIGN="bottom"
60 ><A
61 HREF="r985.html"
62 ACCESSKEY="N"
63 >Next</A
64 ></TD
65 ></TR
66 ></TABLE
67 ><HR
68 ALIGN="LEFT"
69 WIDTH="100%"></DIV
70 ><H1
71 ><A
72 NAME="AEN796"
73 ></A
74 >findlib.conf</H1
75 ><DIV
76 CLASS="REFNAMEDIV"
77 ><A
78 NAME="FINDLIB.CONF"
79 ></A
80 ><H2
81 >Name</H2
82 >findlib.conf&nbsp;--&nbsp;[Configuration of findlib/ocamlfind]</DIV
83 ><DIV
84 CLASS="REFSECT1"
85 ><A
86 NAME="AEN804"
87 ></A
88 ><H2
89 >GENERAL</H2
90 ><P
91 >There are three possibilities to configure the findlib library:
92
93 <P
94 ></P
95 ><DIV
96 CLASS="VARIABLELIST"
97 ><DL
98 ><DT
99 >Build time:</DT
100 ><DD
101 ><P
102 > Before findlib is compiled, a "configure" script is invoked to figure
103 out the settings that are most likely to work on the system. Most
104 settings are simply entered into text files and can easily be changed
105 after installation. The following properties cannot be changed later
106 because they are compiled into the resulting binaries:
107
108 <P
109 ></P
110 ><UL
111 ><LI
112 ><P
113 > The default location of the configuration file findlib.conf. However,
114 you can set a different location by the environment variable
115 <TT
116 CLASS="LITERAL"
117 >OCAMLFIND_CONF</TT
118 >.
119 </P
120 ></LI
121 ><LI
122 ><P
123 > Whether the installed O'Caml version supports autolinking or not.
124 </P
125 ></LI
126 ></UL
127 >
128 </P
129 ></DD
130 ><DT
131 >Configuration file findlib.conf:</DT
132 ><DD
133 ><P
134 > An initial version of this file is generated by the configure script,
135 but you are free to modify it later. Most important, this file
136 contains the system-wide search path used to look up packages, and the
137 default location where to install new packages.
138 </P
139 ><P
140 > All files with the suffix ".conf" found in the directory
141 findlib.conf.d are also scanned for parameters.
142 </P
143 ></DD
144 ><DT
145 >Environment variables:</DT
146 ><DD
147 ><P
148 > The settings of findlib.conf can be overridden by environment variables.
149 </P
150 ></DD
151 ></DL
152 ></DIV
153 >
154
155 Last but not least, several settings can also be passed as
156 command-line options, or by invoking the function
157 <TT
158 CLASS="LITERAL"
159 >Findlib.init</TT
160 >. </P
161 ></DIV
162 ><DIV
163 CLASS="REFSECT1"
164 ><A
165 NAME="AEN828"
166 ></A
167 ><H2
168 >findlib.conf</H2
169 ><P
170 >The directory containing findlib.conf is determined at build time (by
171 running the configure script), the fallback default is
172 <TT
173 CLASS="LITERAL"
174 >/usr/local/etc</TT
175 >. You can set a different location by
176 changing the environment variable <TT
177 CLASS="LITERAL"
178 >OCAMLFIND_CONF</TT
179 >
180 which must contain the absolute path of findlib.conf.</P
181 ><P
182 >The file has the same syntax as <A
183 HREF="r700.html#META"
184 ><TT
185 CLASS="LITERAL"
186 >META</TT
187 ></A
188 >, i.e. it consists of a
189 number of lines with the format
190
191 <PRE
192 CLASS="PROGRAMLISTING"
193 ><TT
194 CLASS="REPLACEABLE"
195 ><I
196 >variable</I
197 ></TT
198 > = "<TT
199 CLASS="REPLACEABLE"
200 ><I
201 >value</I
202 ></TT
203 >"</PRE
204 ></P
205 ><P
206 >Here is the list of allowed variables:
207
208 <P
209 ></P
210 ><DIV
211 CLASS="VARIABLELIST"
212 ><DL
213 ><DT
214 ><TT
215 CLASS="LITERAL"
216 >path</TT
217 ></DT
218 ><DD
219 ><P
220 > The search path for META files/package directories. The variable
221 enumerates directories which are separated by colons (Windows:
222 semicolons), and these directories are tried in turn to find a certain
223 package. More exactly, if d is such a directory and p the searched
224 package, the search algorithm will first check whether d/p/META
225 exists. In this case, this META file is taken, and d/p is the package
226 directory. Second, the algorithm tries d/META.p, but the package
227 directory must be specified in this META.p file by a
228 <TT
229 CLASS="LITERAL"
230 >directory</TT
231 > directive.
232 </P
233 ><P
234 > Note that the first found META file is taken, so the order of the
235 directories in the search path counts.
236 </P
237 ><P
238 > This variable is required.
239 </P
240 ><P
241 > Example:
242
243 <PRE
244 CLASS="PROGRAMLISTING"
245 >path = "/usr/local/lib/ocaml/site-lib:/usr/lib/ocaml/site-lib"</PRE
246 >
247 </P
248 ></DD
249 ></DL
250 ></DIV
251 >
252
253
254 <P
255 ></P
256 ><DIV
257 CLASS="VARIABLELIST"
258 ><DL
259 ><DT
260 ><TT
261 CLASS="LITERAL"
262 >destdir</TT
263 ></DT
264 ><DD
265 ><P
266 > This variable determines the location where <TT
267 CLASS="LITERAL"
268 >ocamlfind
269 install</TT
270 > puts the packages by default: If d is this
271 directory, and p the package to install, a new subdirectory d/p will
272 be created containing all the files of the package.
273 </P
274 ><P
275 >Example:
276 <PRE
277 CLASS="PROGRAMLISTING"
278 >destdir = "/usr/local/lib/ocaml/site-lib"</PRE
279 >
280 </P
281 ><P
282 > This variable is required.
283 </P
284 ></DD
285 ></DL
286 ></DIV
287 >
288
289
290 <P
291 ></P
292 ><DIV
293 CLASS="VARIABLELIST"
294 ><DL
295 ><DT
296 ><TT
297 CLASS="LITERAL"
298 >metadir</TT
299 ></DT
300 ><DD
301 ><P
302 > If set, the command <TT
303 CLASS="LITERAL"
304 >ocamlfind install</TT
305 > will put the
306 META files of packages into this directory (files are named META.p
307 where p=package name); otherwise the META files are put into the
308 package directories like any other file.
309 </P
310 ><P
311 >Example:
312 <PRE
313 CLASS="PROGRAMLISTING"
314 >metadir = "/var/lib/findlib/metaregistry"</PRE
315 >
316 </P
317 ><P
318 > This variable is optional. It is not used by default.
319 </P
320 ></DD
321 ></DL
322 ></DIV
323 >
324
325
326 <P
327 ></P
328 ><DIV
329 CLASS="VARIABLELIST"
330 ><DL
331 ><DT
332 ><TT
333 CLASS="LITERAL"
334 >ocamlc</TT
335 >,
336 <TT
337 CLASS="LITERAL"
338 >ocamlopt</TT
339 >,
340 <TT
341 CLASS="LITERAL"
342 >ocamlcp</TT
343 >,
344 <TT
345 CLASS="LITERAL"
346 >ocamlmktop</TT
347 >,
348 <TT
349 CLASS="LITERAL"
350 >ocamldoc</TT
351 >,
352 <TT
353 CLASS="LITERAL"
354 >ocamldep</TT
355 >,
356 <TT
357 CLASS="LITERAL"
358 >ocamlbrowser</TT
359 ></DT
360 ><DD
361 ><P
362 > If you want to call other executables than "ocamlc", "ocamlopt",
363 "ocamlcp", "ocamlmktop", "ocamldoc", "ocamldep", and
364 "ocamlbrowser", you can
365 set the names of
366 the executables here. The command <TT
367 CLASS="LITERAL"
368 >ocamlfind</TT
369 > looks
370 into these four variables to determine the names of the compilers to
371 call.
372 </P
373 ><P
374 >Example:
375 <PRE
376 CLASS="PROGRAMLISTING"
377 >ocamlc = "ocamlc.opt"
378 ocamlopt = "ocamlopt.opt"
379 ocamlcp = "ocamlcp.opt"
380 ocamlmktop = "ocamlmktop.opt"</PRE
381 >
382 </P
383 ><P
384 > This variable is optional. It is not used by default.
385 </P
386 ></DD
387 ></DL
388 ></DIV
389 >
390
391 <P
392 ></P
393 ><DIV
394 CLASS="VARIABLELIST"
395 ><DL
396 ><DT
397 ><TT
398 CLASS="LITERAL"
399 >stdlib</TT
400 ></DT
401 ><DD
402 ><P
403 > This variable determines the location of the standard library. This must
404 be the same directory for which the O'Caml compilers are configured.
405 </P
406 ><P
407 > This variable is optional. It is not recommend to set this variable
408 unless you know what you are doing!
409 </P
410 ></DD
411 ></DL
412 ></DIV
413 >
414
415 <P
416 ></P
417 ><DIV
418 CLASS="VARIABLELIST"
419 ><DL
420 ><DT
421 ><TT
422 CLASS="LITERAL"
423 >ldconf</TT
424 ></DT
425 ><DD
426 ><P
427 > This variable determines the location of the ld.conf file. This must
428 be the same file the O'Caml compilers read in; it is updated by
429 ocamlfind when installing and removing packages. You can set this
430 variable to the special value "<TT
431 CLASS="LITERAL"
432 >ignore</TT
433 >" to disable
434 the automatic modification of the ld.conf file.
435 </P
436 ><P
437 > If not set, the ld.conf file is assumed to reside in the O'Caml
438 standard library directory.
439 </P
440 ><P
441 > This variable is optional. It is not recommended to set this variable
442 unless you know what you are doing!
443 </P
444 ></DD
445 ></DL
446 ></DIV
447 ></P
448 ><P
449 >Toolchains: It is possible to have variants of the original configuration.
450 These variants are called "toolchains" because they are intended to
451 select different compilers, e.g. patched compilers. In order to
452 set a variable for a certain toolchain, use the syntax
453
454 <PRE
455 CLASS="PROGRAMLISTING"
456 ><TT
457 CLASS="REPLACEABLE"
458 ><I
459 >variable</I
460 ></TT
461 >(<TT
462 CLASS="REPLACEABLE"
463 ><I
464 >toolchain</I
465 ></TT
466 >) = "<TT
467 CLASS="REPLACEABLE"
468 ><I
469 >value</I
470 ></TT
471 >"</PRE
472 >
473
474 For example:
475
476 <PRE
477 CLASS="PROGRAMLISTING"
478 >ocamlc(mypatch) = "ocamlc-mypatch"</PRE
479 >
480
481 When the toolchain "mypatch" is selected, this compiler will be used instead
482 of the standard one.</P
483 ><P
484 >In order to switch to a certain toolchain, use the -toolchain
485 option of <A
486 HREF="r17.html#OCAMLFIND"
487 >ocamlfind</A
488 >.</P
489 ></DIV
490 ><DIV
491 CLASS="REFSECT1"
492 ><A
493 NAME="AEN911"
494 ></A
495 ><H2
496 >Environment</H2
497 ><P
498 >A number of environment variables modifies the behaviour of
499 findlib/ocamlfind:
500
501 <P
502 ></P
503 ><DIV
504 CLASS="VARIABLELIST"
505 ><DL
506 ><DT
507 ><TT
508 CLASS="LITERAL"
509 >OCAMLFIND_CONF</TT
510 ></DT
511 ><DD
512 ><P
513 > This variable overrides the location of the configuration file
514 findlib.conf. It must contain the absolute path name of this file.
515 </P
516 ></DD
517 ></DL
518 ></DIV
519 >
520
521 <P
522 ></P
523 ><DIV
524 CLASS="VARIABLELIST"
525 ><DL
526 ><DT
527 ><TT
528 CLASS="LITERAL"
529 >OCAMLPATH</TT
530 ></DT
531 ><DD
532 ><P
533 > This variable may contain an additional search path for package
534 directories. It is treated as if the directories were prepended to
535 the configuration variable <TT
536 CLASS="LITERAL"
537 >path</TT
538 >.
539 </P
540 ></DD
541 ></DL
542 ></DIV
543 >
544
545 <P
546 ></P
547 ><DIV
548 CLASS="VARIABLELIST"
549 ><DL
550 ><DT
551 ><TT
552 CLASS="LITERAL"
553 >OCAMLFIND_DESTDIR</TT
554 ></DT
555 ><DD
556 ><P
557 > This variable overrides the configuration variable
558 <TT
559 CLASS="LITERAL"
560 >destdir</TT
561 >.
562 </P
563 ></DD
564 ></DL
565 ></DIV
566 >
567
568 <P
569 ></P
570 ><DIV
571 CLASS="VARIABLELIST"
572 ><DL
573 ><DT
574 ><TT
575 CLASS="LITERAL"
576 >OCAMLFIND_METADIR</TT
577 ></DT
578 ><DD
579 ><P
580 > This variable overrides the configuration variable
581 <TT
582 CLASS="LITERAL"
583 >metadir</TT
584 >.
585 </P
586 ></DD
587 ></DL
588 ></DIV
589 >
590
591 <P
592 ></P
593 ><DIV
594 CLASS="VARIABLELIST"
595 ><DL
596 ><DT
597 ><TT
598 CLASS="LITERAL"
599 >OCAMLFIND_COMMANDS</TT
600 ></DT
601 ><DD
602 ><P
603 > This variable overrides the configuration variables
604 <TT
605 CLASS="LITERAL"
606 >ocamlc</TT
607 >, <TT
608 CLASS="LITERAL"
609 >ocamlopt</TT
610 >,
611 <TT
612 CLASS="LITERAL"
613 >ocamlcp</TT
614 >, <TT
615 CLASS="LITERAL"
616 >ocamlmktop</TT
617 >,
618 <TT
619 CLASS="LITERAL"
620 >ocamldoc</TT
621 >, <TT
622 CLASS="LITERAL"
623 >ocamldep</TT
624 >, and/or
625 <TT
626 CLASS="LITERAL"
627 >ocamlbrowser</TT
628 >.
629 Its value must conform to the syntax
630
631 <PRE
632 CLASS="PROGRAMLISTING"
633 >ocamlc=<TT
634 CLASS="REPLACEABLE"
635 ><I
636 >name</I
637 ></TT
638 > ocamlopt=<TT
639 CLASS="REPLACEABLE"
640 ><I
641 >name</I
642 ></TT
643 > ocamlcp=<TT
644 CLASS="REPLACEABLE"
645 ><I
646 >name</I
647 ></TT
648 > ocamlmktop=<TT
649 CLASS="REPLACEABLE"
650 ><I
651 >name</I
652 ></TT
653 > ocamldoc=<TT
654 CLASS="REPLACEABLE"
655 ><I
656 >name</I
657 ></TT
658 > ocamldep=<TT
659 CLASS="REPLACEABLE"
660 ><I
661 >name</I
662 ></TT
663 > ocamlbrowser=<TT
664 CLASS="REPLACEABLE"
665 ><I
666 >name</I
667 ></TT
668 ></PRE
669 >
670 </P
671 ><P
672 >Example:
673 <PRE
674 CLASS="PROGRAMLISTING"
675 >ocamlc=ocamlc-3.00 ocamlopt=ocamlopt-3.00 ocamlcp=ocamlcp-3.00 ocamlmktop=ocamlmktop-3.00</PRE
676 >
677 </P
678 ></DD
679 ></DL
680 ></DIV
681 >
682
683 <P
684 ></P
685 ><DIV
686 CLASS="VARIABLELIST"
687 ><DL
688 ><DT
689 ><TT
690 CLASS="LITERAL"
691 >CAMLLIB</TT
692 > or <TT
693 CLASS="LITERAL"
694 >OCAMLLIB</TT
695 ></DT
696 ><DD
697 ><P
698 > This variable overrides the configuration variable
699 <TT
700 CLASS="LITERAL"
701 >stdlib</TT
702 >.
703 </P
704 ></DD
705 ></DL
706 ></DIV
707 >
708
709 <P
710 ></P
711 ><DIV
712 CLASS="VARIABLELIST"
713 ><DL
714 ><DT
715 ><TT
716 CLASS="LITERAL"
717 >OCAMLFIND_LDCONF</TT
718 ></DT
719 ><DD
720 ><P
721 > This variable overrides the configuration variable
722 <TT
723 CLASS="LITERAL"
724 >ldconf</TT
725 >.
726 </P
727 ></DD
728 ></DL
729 ></DIV
730 >
731
732 <P
733 ></P
734 ><DIV
735 CLASS="VARIABLELIST"
736 ><DL
737 ><DT
738 ><TT
739 CLASS="LITERAL"
740 >OCAMLFIND_IGNORE_DUPS_IN</TT
741 ></DT
742 ><DD
743 ><P
744 > This variable instructs findlib not to emit warnings that packages
745 or module occur several times. The variable must be set to the
746 directory where the packages reside that are to be ignored for this
747 warning.
748 </P
749 ></DD
750 ></DL
751 ></DIV
752 >
753 &#13;</P
754 ></DIV
755 ><DIV
756 CLASS="NAVFOOTER"
757 ><HR
758 ALIGN="LEFT"
759 WIDTH="100%"><TABLE
760 SUMMARY="Footer navigation table"
761 WIDTH="100%"
762 BORDER="0"
763 CELLPADDING="0"
764 CELLSPACING="0"
765 ><TR
766 ><TD
767 WIDTH="33%"
768 ALIGN="left"
769 VALIGN="top"
770 ><A
771 HREF="r700.html"
772 ACCESSKEY="P"
773 >Prev</A
774 ></TD
775 ><TD
776 WIDTH="34%"
777 ALIGN="center"
778 VALIGN="top"
779 ><A
780 HREF="index.html"
781 ACCESSKEY="H"
782 >Home</A
783 ></TD
784 ><TD
785 WIDTH="33%"
786 ALIGN="right"
787 VALIGN="top"
788 ><A
789 HREF="r985.html"
790 ACCESSKEY="N"
791 >Next</A
792 ></TD
793 ></TR
794 ><TR
795 ><TD
796 WIDTH="33%"
797 ALIGN="left"
798 VALIGN="top"
799 >META</TD
800 ><TD
801 WIDTH="34%"
802 ALIGN="center"
803 VALIGN="top"
804 ><A
805 HREF="p698.html"
806 ACCESSKEY="U"
807 >Up</A
808 ></TD
809 ><TD
810 WIDTH="33%"
811 ALIGN="right"
812 VALIGN="top"
813 >site-lib</TD
814 ></TR
815 ></TABLE
816 ></DIV
817 ></BODY
818 ></HTML
819 >
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
1 <HTML
2 ><HEAD
3 ><TITLE
4 >findlib.conf</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
8 REL="HOME"
9 TITLE="The findlib Reference Manual"
10 HREF="index.html"><LINK
11 REL="UP"
12 TITLE="Files"
13 HREF="p698.html"><LINK
14 REL="PREVIOUS"
15 TITLE="META"
16 HREF="r700.html"><LINK
17 REL="NEXT"
18 TITLE="site-lib"
19 HREF="r994.html"></HEAD
20 ><BODY
21 CLASS="REFENTRY"
22 BGCOLOR="#FFFFFF"
23 TEXT="#000000"
24 LINK="#0000FF"
25 VLINK="#840084"
26 ALINK="#0000FF"
27 ><DIV
28 CLASS="NAVHEADER"
29 ><TABLE
30 SUMMARY="Header navigation table"
31 WIDTH="100%"
32 BORDER="0"
33 CELLPADDING="0"
34 CELLSPACING="0"
35 ><TR
36 ><TH
37 COLSPAN="3"
38 ALIGN="center"
39 >The findlib Reference Manual</TH
40 ></TR
41 ><TR
42 ><TD
43 WIDTH="10%"
44 ALIGN="left"
45 VALIGN="bottom"
46 ><A
47 HREF="r700.html"
48 ACCESSKEY="P"
49 >Prev</A
50 ></TD
51 ><TD
52 WIDTH="80%"
53 ALIGN="center"
54 VALIGN="bottom"
55 ></TD
56 ><TD
57 WIDTH="10%"
58 ALIGN="right"
59 VALIGN="bottom"
60 ><A
61 HREF="r994.html"
62 ACCESSKEY="N"
63 >Next</A
64 ></TD
65 ></TR
66 ></TABLE
67 ><HR
68 ALIGN="LEFT"
69 WIDTH="100%"></DIV
70 ><H1
71 ><A
72 NAME="AEN798"
73 ></A
74 >findlib.conf</H1
75 ><DIV
76 CLASS="REFNAMEDIV"
77 ><A
78 NAME="FINDLIB.CONF"
79 ></A
80 ><H2
81 >Name</H2
82 >findlib.conf&nbsp;--&nbsp;[Configuration of findlib/ocamlfind]</DIV
83 ><DIV
84 CLASS="REFSECT1"
85 ><A
86 NAME="AEN806"
87 ></A
88 ><H2
89 >GENERAL</H2
90 ><P
91 >There are three possibilities to configure the findlib library:
92
93 <P
94 ></P
95 ><DIV
96 CLASS="VARIABLELIST"
97 ><DL
98 ><DT
99 >Build time:</DT
100 ><DD
101 ><P
102 > Before findlib is compiled, a "configure" script is invoked to figure
103 out the settings that are most likely to work on the system. Most
104 settings are simply entered into text files and can easily be changed
105 after installation. The following properties cannot be changed later
106 because they are compiled into the resulting binaries:
107
108 <P
109 ></P
110 ><UL
111 ><LI
112 ><P
113 > The default location of the configuration file findlib.conf. However,
114 you can set a different location by the environment variable
115 <TT
116 CLASS="LITERAL"
117 >OCAMLFIND_CONF</TT
118 >.
119 </P
120 ></LI
121 ><LI
122 ><P
123 > Whether the installed O'Caml version supports autolinking or not.
124 </P
125 ></LI
126 ></UL
127 >
128 </P
129 ></DD
130 ><DT
131 >Configuration file findlib.conf:</DT
132 ><DD
133 ><P
134 > An initial version of this file is generated by the configure script,
135 but you are free to modify it later. Most important, this file
136 contains the system-wide search path used to look up packages, and the
137 default location where to install new packages.
138 </P
139 ><P
140 > All files with the suffix ".conf" found in the directory
141 findlib.conf.d are also scanned for parameters.
142 </P
143 ></DD
144 ><DT
145 >Environment variables:</DT
146 ><DD
147 ><P
148 > The settings of findlib.conf can be overridden by environment variables.
149 </P
150 ></DD
151 ></DL
152 ></DIV
153 >
154
155 Last but not least, several settings can also be passed as
156 command-line options, or by invoking the function
157 <TT
158 CLASS="LITERAL"
159 >Findlib.init</TT
160 >. </P
161 ></DIV
162 ><DIV
163 CLASS="REFSECT1"
164 ><A
165 NAME="AEN830"
166 ></A
167 ><H2
168 >findlib.conf</H2
169 ><P
170 >The directory containing findlib.conf is determined at build time (by
171 running the configure script), the fallback default is
172 <TT
173 CLASS="LITERAL"
174 >/usr/local/etc</TT
175 >. You can set a different location by
176 changing the environment variable <TT
177 CLASS="LITERAL"
178 >OCAMLFIND_CONF</TT
179 >
180 which must contain the absolute path of findlib.conf.</P
181 ><P
182 >The file has the same syntax as <A
183 HREF="r700.html#META"
184 ><TT
185 CLASS="LITERAL"
186 >META</TT
187 ></A
188 >, i.e. it consists of a
189 number of lines with the format
190
191 <PRE
192 CLASS="PROGRAMLISTING"
193 ><TT
194 CLASS="REPLACEABLE"
195 ><I
196 >variable</I
197 ></TT
198 > = "<TT
199 CLASS="REPLACEABLE"
200 ><I
201 >value</I
202 ></TT
203 >"</PRE
204 ></P
205 ><P
206 >Here is the list of allowed variables:
207
208 <P
209 ></P
210 ><DIV
211 CLASS="VARIABLELIST"
212 ><DL
213 ><DT
214 ><TT
215 CLASS="LITERAL"
216 >path</TT
217 ></DT
218 ><DD
219 ><P
220 > The search path for META files/package directories. The variable
221 enumerates directories which are separated by colons (Windows:
222 semicolons), and these directories are tried in turn to find a certain
223 package. More exactly, if d is such a directory and p the searched
224 package, the search algorithm will first check whether d/p/META
225 exists. In this case, this META file is taken, and d/p is the package
226 directory. Second, the algorithm tries d/META.p, but the package
227 directory must be specified in this META.p file by a
228 <TT
229 CLASS="LITERAL"
230 >directory</TT
231 > directive.
232 </P
233 ><P
234 > Note that the first found META file is taken, so the order of the
235 directories in the search path counts.
236 </P
237 ><P
238 > This variable is required.
239 </P
240 ><P
241 > Example:
242
243 <PRE
244 CLASS="PROGRAMLISTING"
245 >path = "/usr/local/lib/ocaml/site-lib:/usr/lib/ocaml/site-lib"</PRE
246 >
247 </P
248 ></DD
249 ></DL
250 ></DIV
251 >
252
253
254 <P
255 ></P
256 ><DIV
257 CLASS="VARIABLELIST"
258 ><DL
259 ><DT
260 ><TT
261 CLASS="LITERAL"
262 >destdir</TT
263 ></DT
264 ><DD
265 ><P
266 > This variable determines the location where <TT
267 CLASS="LITERAL"
268 >ocamlfind
269 install</TT
270 > puts the packages by default: If d is this
271 directory, and p the package to install, a new subdirectory d/p will
272 be created containing all the files of the package.
273 </P
274 ><P
275 >Example:
276 <PRE
277 CLASS="PROGRAMLISTING"
278 >destdir = "/usr/local/lib/ocaml/site-lib"</PRE
279 >
280 </P
281 ><P
282 > This variable is required.
283 </P
284 ></DD
285 ></DL
286 ></DIV
287 >
288
289
290 <P
291 ></P
292 ><DIV
293 CLASS="VARIABLELIST"
294 ><DL
295 ><DT
296 ><TT
297 CLASS="LITERAL"
298 >metadir</TT
299 ></DT
300 ><DD
301 ><P
302 > If set, the command <TT
303 CLASS="LITERAL"
304 >ocamlfind install</TT
305 > will put the
306 META files of packages into this directory (files are named META.p
307 where p=package name); otherwise the META files are put into the
308 package directories like any other file.
309 </P
310 ><P
311 >Example:
312 <PRE
313 CLASS="PROGRAMLISTING"
314 >metadir = "/var/lib/findlib/metaregistry"</PRE
315 >
316 </P
317 ><P
318 > This variable is optional. It is not used by default.
319 </P
320 ></DD
321 ></DL
322 ></DIV
323 >
324
325
326 <P
327 ></P
328 ><DIV
329 CLASS="VARIABLELIST"
330 ><DL
331 ><DT
332 ><TT
333 CLASS="LITERAL"
334 >ocamlc</TT
335 >,
336 <TT
337 CLASS="LITERAL"
338 >ocamlopt</TT
339 >,
340 <TT
341 CLASS="LITERAL"
342 >ocamlcp</TT
343 >,
344 <TT
345 CLASS="LITERAL"
346 >ocamlmktop</TT
347 >,
348 <TT
349 CLASS="LITERAL"
350 >ocamldoc</TT
351 >,
352 <TT
353 CLASS="LITERAL"
354 >ocamldep</TT
355 >,
356 <TT
357 CLASS="LITERAL"
358 >ocamlbrowser</TT
359 ></DT
360 ><DD
361 ><P
362 > If you want to call other executables than "ocamlc", "ocamlopt",
363 "ocamlcp", "ocamlmktop", "ocamldoc", "ocamldep", and
364 "ocamlbrowser", you can
365 set the names of
366 the executables here. The command <TT
367 CLASS="LITERAL"
368 >ocamlfind</TT
369 > looks
370 into these four variables to determine the names of the compilers to
371 call.
372 </P
373 ><P
374 >Example:
375 <PRE
376 CLASS="PROGRAMLISTING"
377 >ocamlc = "ocamlc.opt"
378 ocamlopt = "ocamlopt.opt"
379 ocamlcp = "ocamlcp.opt"
380 ocamlmktop = "ocamlmktop.opt"</PRE
381 >
382 </P
383 ><P
384 > This variable is optional. It is not used by default.
385 </P
386 ></DD
387 ></DL
388 ></DIV
389 >
390
391 <P
392 ></P
393 ><DIV
394 CLASS="VARIABLELIST"
395 ><DL
396 ><DT
397 ><TT
398 CLASS="LITERAL"
399 >stdlib</TT
400 ></DT
401 ><DD
402 ><P
403 > This variable determines the location of the standard library. This must
404 be the same directory for which the O'Caml compilers are configured.
405 </P
406 ><P
407 > This variable is optional. It is not recommend to set this variable
408 unless you know what you are doing!
409 </P
410 ></DD
411 ></DL
412 ></DIV
413 >
414
415 <P
416 ></P
417 ><DIV
418 CLASS="VARIABLELIST"
419 ><DL
420 ><DT
421 ><TT
422 CLASS="LITERAL"
423 >ldconf</TT
424 ></DT
425 ><DD
426 ><P
427 > This variable determines the location of the ld.conf file. This must
428 be the same file the O'Caml compilers read in; it is updated by
429 ocamlfind when installing and removing packages. You can set this
430 variable to the special value "<TT
431 CLASS="LITERAL"
432 >ignore</TT
433 >" to disable
434 the automatic modification of the ld.conf file.
435 </P
436 ><P
437 > If not set, the ld.conf file is assumed to reside in the O'Caml
438 standard library directory.
439 </P
440 ><P
441 > This variable is optional. It is not recommended to set this variable
442 unless you know what you are doing!
443 </P
444 ></DD
445 ></DL
446 ></DIV
447 ></P
448 ><P
449 >Toolchains: It is possible to have variants of the original configuration.
450 These variants are called "toolchains" because they are intended to
451 select different compilers, e.g. patched compilers. In order to
452 set a variable for a certain toolchain, use the syntax
453
454 <PRE
455 CLASS="PROGRAMLISTING"
456 ><TT
457 CLASS="REPLACEABLE"
458 ><I
459 >variable</I
460 ></TT
461 >(<TT
462 CLASS="REPLACEABLE"
463 ><I
464 >toolchain</I
465 ></TT
466 >) = "<TT
467 CLASS="REPLACEABLE"
468 ><I
469 >value</I
470 ></TT
471 >"</PRE
472 >
473
474 For example:
475
476 <PRE
477 CLASS="PROGRAMLISTING"
478 >ocamlc(mypatch) = "ocamlc-mypatch"</PRE
479 >
480
481 When the toolchain "mypatch" is selected, this compiler will be used instead
482 of the standard one.</P
483 ><P
484 >In order to switch to a certain toolchain, use the -toolchain
485 option of <A
486 HREF="r17.html#OCAMLFIND"
487 >ocamlfind</A
488 >.</P
489 ></DIV
490 ><DIV
491 CLASS="REFSECT1"
492 ><A
493 NAME="AEN913"
494 ></A
495 ><H2
496 >Environment</H2
497 ><P
498 >A number of environment variables modifies the behaviour of
499 findlib/ocamlfind:
500
501 <P
502 ></P
503 ><DIV
504 CLASS="VARIABLELIST"
505 ><DL
506 ><DT
507 ><TT
508 CLASS="LITERAL"
509 >OCAMLFIND_CONF</TT
510 ></DT
511 ><DD
512 ><P
513 > This variable overrides the location of the configuration file
514 findlib.conf. It must contain the absolute path name of this file.
515 </P
516 ></DD
517 ></DL
518 ></DIV
519 >
520
521 <P
522 ></P
523 ><DIV
524 CLASS="VARIABLELIST"
525 ><DL
526 ><DT
527 ><TT
528 CLASS="LITERAL"
529 >OCAMLFIND_TOOLCHAIN</TT
530 ></DT
531 ><DD
532 ><P
533 > This variable sets the currently selected toolchain when
534 a <TT
535 CLASS="LITERAL"
536 >-toolchain</TT
537 > option is not passed
538 on the command line.
539 </P
540 ></DD
541 ></DL
542 ></DIV
543 >
544
545 <P
546 ></P
547 ><DIV
548 CLASS="VARIABLELIST"
549 ><DL
550 ><DT
551 ><TT
552 CLASS="LITERAL"
553 >OCAMLPATH</TT
554 ></DT
555 ><DD
556 ><P
557 > This variable may contain an additional search path for package
558 directories. It is treated as if the directories were prepended to
559 the configuration variable <TT
560 CLASS="LITERAL"
561 >path</TT
562 >.
563 </P
564 ></DD
565 ></DL
566 ></DIV
567 >
568
569 <P
570 ></P
571 ><DIV
572 CLASS="VARIABLELIST"
573 ><DL
574 ><DT
575 ><TT
576 CLASS="LITERAL"
577 >OCAMLFIND_DESTDIR</TT
578 ></DT
579 ><DD
580 ><P
581 > This variable overrides the configuration variable
582 <TT
583 CLASS="LITERAL"
584 >destdir</TT
585 >.
586 </P
587 ></DD
588 ></DL
589 ></DIV
590 >
591
592 <P
593 ></P
594 ><DIV
595 CLASS="VARIABLELIST"
596 ><DL
597 ><DT
598 ><TT
599 CLASS="LITERAL"
600 >OCAMLFIND_METADIR</TT
601 ></DT
602 ><DD
603 ><P
604 > This variable overrides the configuration variable
605 <TT
606 CLASS="LITERAL"
607 >metadir</TT
608 >.
609 </P
610 ></DD
611 ></DL
612 ></DIV
613 >
614
615 <P
616 ></P
617 ><DIV
618 CLASS="VARIABLELIST"
619 ><DL
620 ><DT
621 ><TT
622 CLASS="LITERAL"
623 >OCAMLFIND_COMMANDS</TT
624 ></DT
625 ><DD
626 ><P
627 > This variable overrides the configuration variables
628 <TT
629 CLASS="LITERAL"
630 >ocamlc</TT
631 >, <TT
632 CLASS="LITERAL"
633 >ocamlopt</TT
634 >,
635 <TT
636 CLASS="LITERAL"
637 >ocamlcp</TT
638 >, <TT
639 CLASS="LITERAL"
640 >ocamlmktop</TT
641 >,
642 <TT
643 CLASS="LITERAL"
644 >ocamldoc</TT
645 >, <TT
646 CLASS="LITERAL"
647 >ocamldep</TT
648 >, and/or
649 <TT
650 CLASS="LITERAL"
651 >ocamlbrowser</TT
652 >.
653 Its value must conform to the syntax
654
655 <PRE
656 CLASS="PROGRAMLISTING"
657 >ocamlc=<TT
658 CLASS="REPLACEABLE"
659 ><I
660 >name</I
661 ></TT
662 > ocamlopt=<TT
663 CLASS="REPLACEABLE"
664 ><I
665 >name</I
666 ></TT
667 > ocamlcp=<TT
668 CLASS="REPLACEABLE"
669 ><I
670 >name</I
671 ></TT
672 > ocamlmktop=<TT
673 CLASS="REPLACEABLE"
674 ><I
675 >name</I
676 ></TT
677 > ocamldoc=<TT
678 CLASS="REPLACEABLE"
679 ><I
680 >name</I
681 ></TT
682 > ocamldep=<TT
683 CLASS="REPLACEABLE"
684 ><I
685 >name</I
686 ></TT
687 > ocamlbrowser=<TT
688 CLASS="REPLACEABLE"
689 ><I
690 >name</I
691 ></TT
692 ></PRE
693 >
694 </P
695 ><P
696 >Example:
697 <PRE
698 CLASS="PROGRAMLISTING"
699 >ocamlc=ocamlc-3.00 ocamlopt=ocamlopt-3.00 ocamlcp=ocamlcp-3.00 ocamlmktop=ocamlmktop-3.00</PRE
700 >
701 </P
702 ></DD
703 ></DL
704 ></DIV
705 >
706
707 <P
708 ></P
709 ><DIV
710 CLASS="VARIABLELIST"
711 ><DL
712 ><DT
713 ><TT
714 CLASS="LITERAL"
715 >CAMLLIB</TT
716 > or <TT
717 CLASS="LITERAL"
718 >OCAMLLIB</TT
719 ></DT
720 ><DD
721 ><P
722 > This variable overrides the configuration variable
723 <TT
724 CLASS="LITERAL"
725 >stdlib</TT
726 >.
727 </P
728 ></DD
729 ></DL
730 ></DIV
731 >
732
733 <P
734 ></P
735 ><DIV
736 CLASS="VARIABLELIST"
737 ><DL
738 ><DT
739 ><TT
740 CLASS="LITERAL"
741 >OCAMLFIND_LDCONF</TT
742 ></DT
743 ><DD
744 ><P
745 > This variable overrides the configuration variable
746 <TT
747 CLASS="LITERAL"
748 >ldconf</TT
749 >.
750 </P
751 ></DD
752 ></DL
753 ></DIV
754 >
755
756 <P
757 ></P
758 ><DIV
759 CLASS="VARIABLELIST"
760 ><DL
761 ><DT
762 ><TT
763 CLASS="LITERAL"
764 >OCAMLFIND_IGNORE_DUPS_IN</TT
765 ></DT
766 ><DD
767 ><P
768 > This variable instructs findlib not to emit warnings that packages
769 or module occur several times. The variable must be set to the
770 directory where the packages reside that are to be ignored for this
771 warning.
772 </P
773 ></DD
774 ></DL
775 ></DIV
776 >
777 &#13;</P
778 ></DIV
779 ><DIV
780 CLASS="NAVFOOTER"
781 ><HR
782 ALIGN="LEFT"
783 WIDTH="100%"><TABLE
784 SUMMARY="Footer navigation table"
785 WIDTH="100%"
786 BORDER="0"
787 CELLPADDING="0"
788 CELLSPACING="0"
789 ><TR
790 ><TD
791 WIDTH="33%"
792 ALIGN="left"
793 VALIGN="top"
794 ><A
795 HREF="r700.html"
796 ACCESSKEY="P"
797 >Prev</A
798 ></TD
799 ><TD
800 WIDTH="34%"
801 ALIGN="center"
802 VALIGN="top"
803 ><A
804 HREF="index.html"
805 ACCESSKEY="H"
806 >Home</A
807 ></TD
808 ><TD
809 WIDTH="33%"
810 ALIGN="right"
811 VALIGN="top"
812 ><A
813 HREF="r994.html"
814 ACCESSKEY="N"
815 >Next</A
816 ></TD
817 ></TR
818 ><TR
819 ><TD
820 WIDTH="33%"
821 ALIGN="left"
822 VALIGN="top"
823 >META</TD
824 ><TD
825 WIDTH="34%"
826 ALIGN="center"
827 VALIGN="top"
828 ><A
829 HREF="p698.html"
830 ACCESSKEY="U"
831 >Up</A
832 ></TD
833 ><TD
834 WIDTH="33%"
835 ALIGN="right"
836 VALIGN="top"
837 >site-lib</TD
838 ></TR
839 ></TABLE
840 ></DIV
841 ></BODY
842 ></HTML
843 >
+0
-401
doc/ref-html/r985.html less more
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
1 <HTML
2 ><HEAD
3 ><TITLE
4 >site-lib</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
8 REL="HOME"
9 TITLE="The findlib Reference Manual"
10 HREF="index.html"><LINK
11 REL="UP"
12 TITLE="Files"
13 HREF="p698.html"><LINK
14 REL="PREVIOUS"
15 TITLE="findlib.conf"
16 HREF="r796.html"><LINK
17 REL="NEXT"
18 TITLE="Library"
19 HREF="p1043.html"></HEAD
20 ><BODY
21 CLASS="REFENTRY"
22 BGCOLOR="#FFFFFF"
23 TEXT="#000000"
24 LINK="#0000FF"
25 VLINK="#840084"
26 ALINK="#0000FF"
27 ><DIV
28 CLASS="NAVHEADER"
29 ><TABLE
30 SUMMARY="Header navigation table"
31 WIDTH="100%"
32 BORDER="0"
33 CELLPADDING="0"
34 CELLSPACING="0"
35 ><TR
36 ><TH
37 COLSPAN="3"
38 ALIGN="center"
39 >The findlib Reference Manual</TH
40 ></TR
41 ><TR
42 ><TD
43 WIDTH="10%"
44 ALIGN="left"
45 VALIGN="bottom"
46 ><A
47 HREF="r796.html"
48 ACCESSKEY="P"
49 >Prev</A
50 ></TD
51 ><TD
52 WIDTH="80%"
53 ALIGN="center"
54 VALIGN="bottom"
55 ></TD
56 ><TD
57 WIDTH="10%"
58 ALIGN="right"
59 VALIGN="bottom"
60 ><A
61 HREF="p1043.html"
62 ACCESSKEY="N"
63 >Next</A
64 ></TD
65 ></TR
66 ></TABLE
67 ><HR
68 ALIGN="LEFT"
69 WIDTH="100%"></DIV
70 ><H1
71 ><A
72 NAME="AEN985"
73 ></A
74 >site-lib</H1
75 ><DIV
76 CLASS="REFNAMEDIV"
77 ><A
78 NAME="SITE-LIB"
79 ></A
80 ><H2
81 >Name</H2
82 >site-lib&nbsp;--&nbsp;[Location of package directories]</DIV
83 ><DIV
84 CLASS="REFSYNOPSISDIV"
85 ><A
86 NAME="AEN993"
87 ></A
88 ><H2
89 >STANDARD LAYOUT</H2
90 ><PRE
91 CLASS="SYNOPSIS"
92 >...somewhere in the filesystem hierarchy...
93 |
94 \
95 site-lib
96 |
97 +- (optional) stublibs
98 +- (optional) postinstall
99 +- (optional) postremove
100 |
101 +- <TT
102 CLASS="REPLACEABLE"
103 ><I
104 >package1</I
105 ></TT
106 >
107 | |
108 | +- META
109 | +- <TT
110 CLASS="REPLACEABLE"
111 ><I
112 >archive files</I
113 ></TT
114 >
115 | +- <TT
116 CLASS="REPLACEABLE"
117 ><I
118 >interface definitions</I
119 ></TT
120 >
121 |
122 +- <TT
123 CLASS="REPLACEABLE"
124 ><I
125 >package2</I
126 ></TT
127 >
128 +
129 :
130 :
131 \
132 <TT
133 CLASS="REPLACEABLE"
134 ><I
135 >packageN</I
136 ></TT
137 ></PRE
138 ></DIV
139 ><DIV
140 CLASS="REFSECT1"
141 ><A
142 NAME="AEN1001"
143 ></A
144 ><H2
145 >DESCRIPTION</H2
146 ><P
147 >Every installation of "findlib" has a default location for package
148 directories, which is normally a directory called "site-lib". The
149 location can be set by the configuration variables
150 <TT
151 CLASS="LITERAL"
152 >path</TT
153 > (used to look up packages), and
154 <TT
155 CLASS="LITERAL"
156 >destdir</TT
157 > (used to install new packages);
158 see <A
159 HREF="r796.html#FINDLIB.CONF"
160 >findlib.conf</A
161 >.</P
162 ><P
163 >The name of a package is the name of the package directory. For
164 example, if <TT
165 CLASS="LITERAL"
166 >destdir=/usr/local/lib/ocaml/site-lib</TT
167 >, the
168 package p will be installed in the subdirectory
169 <TT
170 CLASS="LITERAL"
171 >/usr/local/lib/ocaml/site-lib/p</TT
172 >. This subdirectory
173 must contain the META file and all other files belonging to the package.
174 Package names must not contain the '.' character.</P
175 ><P
176 >The variable <TT
177 CLASS="LITERAL"
178 >destdir</TT
179 > specifies the directory for
180 new packages. You can only have one such directory at a time; but of
181 course you can change this directory in findlib.conf. The command
182 <TT
183 CLASS="LITERAL"
184 >ocamlfind install</TT
185 > puts new packages into this
186 directory; it is recommended to use this command for installation
187 because it ensures that the directory layout is right.</P
188 ><P
189 >For searching packages, findlib uses (only) the variable
190 <TT
191 CLASS="LITERAL"
192 >path</TT
193 > which may name several locations to look at.</P
194 ><P
195 >For systems with DLL support another directory may exist: stublibs.
196 If present, findlib will install DLLs into this directory that is
197 shared by all packages at the same site-lib location. Findlib remembers
198 which DLL belongs to which package by special files with the suffix
199 ".owner"; e.g. for the DLL "dllpcre.so" there is another file
200 "dllpcre.so.owner" containing the string "pcre", so findlib knows
201 that the package "pcre" owns this DLL. It is not possible that a DLL
202 is owned by several packages.</P
203 ><P
204 >If the stublibs directory does not exist, DLLs are installed regularly
205 in the package directories like any other file.</P
206 ><P
207 >For special needs, a postinstall and/or a postremove script may be
208 installed in the site-lib directory. These scripts are invoked after
209 installation or removal of a package, respectively.</P
210 ></DIV
211 ><DIV
212 CLASS="REFSECT1"
213 ><A
214 NAME="AEN1018"
215 ></A
216 ><H2
217 >ALTERNATE LAYOUT</H2
218 ><P
219 >&#13;<PRE
220 CLASS="PROGRAMLISTING"
221 >...somewhere in the filesystem hierarchy...
222 |
223 \
224 site-lib
225 |
226 +- (optional) stublibs
227 +- (optional) postinstall
228 +- (optional) postremove
229 |
230 +- <TT
231 CLASS="REPLACEABLE"
232 ><I
233 >package1</I
234 ></TT
235 >
236 | |
237 | +- <TT
238 CLASS="REPLACEABLE"
239 ><I
240 >archive files</I
241 ></TT
242 >
243 | +- <TT
244 CLASS="REPLACEABLE"
245 ><I
246 >interface definitions</I
247 ></TT
248 >
249 |
250 +- <TT
251 CLASS="REPLACEABLE"
252 ><I
253 >package2</I
254 ></TT
255 >
256 +
257 :
258 :
259 \
260 : <TT
261 CLASS="REPLACEABLE"
262 ><I
263 >packageN</I
264 ></TT
265 >
266 |
267 \
268 metaregistry
269 |
270 +- META.package1
271 +- META.package2
272 +
273 :
274 \
275 META.packageN</PRE
276 ></P
277 ><P
278 >This is an alternate directory layout collecting all META files in one
279 directory. You can configure this layout by setting
280 <TT
281 CLASS="LITERAL"
282 >path</TT
283 > to the absolute location of
284 <TT
285 CLASS="LITERAL"
286 >metaregistry</TT
287 >. Findlib recognizes that there are
288 META files in this directory and uses them; it is not necessary to
289 include <TT
290 CLASS="LITERAL"
291 >site-lib</TT
292 > into the <TT
293 CLASS="LITERAL"
294 >path</TT
295 >.</P
296 ><P
297 >In order to work, the META files must contain a
298 <TT
299 CLASS="LITERAL"
300 >directory</TT
301 > directive pointing to the corresponding
302 package directory that resides below <TT
303 CLASS="LITERAL"
304 >site-lib</TT
305 >.</P
306 ><P
307 >The command <TT
308 CLASS="LITERAL"
309 >ocamlfind install</TT
310 > copes with this
311 layout, too. The variable <TT
312 CLASS="LITERAL"
313 >destdir</TT
314 > must contain the
315 absolute location of <TT
316 CLASS="LITERAL"
317 >site-lib</TT
318 >, and the variable
319 <TT
320 CLASS="LITERAL"
321 >metadir</TT
322 > must contain the absolute location of
323 <TT
324 CLASS="LITERAL"
325 >metaregistry</TT
326 >. Note that <TT
327 CLASS="LITERAL"
328 >ocamlfind
329 install</TT
330 > automatically adds a <TT
331 CLASS="LITERAL"
332 >directory</TT
333 >
334 directive to the META file, so you need not do it manually.</P
335 ></DIV
336 ><DIV
337 CLASS="NAVFOOTER"
338 ><HR
339 ALIGN="LEFT"
340 WIDTH="100%"><TABLE
341 SUMMARY="Footer navigation table"
342 WIDTH="100%"
343 BORDER="0"
344 CELLPADDING="0"
345 CELLSPACING="0"
346 ><TR
347 ><TD
348 WIDTH="33%"
349 ALIGN="left"
350 VALIGN="top"
351 ><A
352 HREF="r796.html"
353 ACCESSKEY="P"
354 >Prev</A
355 ></TD
356 ><TD
357 WIDTH="34%"
358 ALIGN="center"
359 VALIGN="top"
360 ><A
361 HREF="index.html"
362 ACCESSKEY="H"
363 >Home</A
364 ></TD
365 ><TD
366 WIDTH="33%"
367 ALIGN="right"
368 VALIGN="top"
369 ><A
370 HREF="p1043.html"
371 ACCESSKEY="N"
372 >Next</A
373 ></TD
374 ></TR
375 ><TR
376 ><TD
377 WIDTH="33%"
378 ALIGN="left"
379 VALIGN="top"
380 >findlib.conf</TD
381 ><TD
382 WIDTH="34%"
383 ALIGN="center"
384 VALIGN="top"
385 ><A
386 HREF="p698.html"
387 ACCESSKEY="U"
388 >Up</A
389 ></TD
390 ><TD
391 WIDTH="33%"
392 ALIGN="right"
393 VALIGN="top"
394 >Library</TD
395 ></TR
396 ></TABLE
397 ></DIV
398 ></BODY
399 ></HTML
400 >
0 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
1 <HTML
2 ><HEAD
3 ><TITLE
4 >site-lib</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
8 REL="HOME"
9 TITLE="The findlib Reference Manual"
10 HREF="index.html"><LINK
11 REL="UP"
12 TITLE="Files"
13 HREF="p698.html"><LINK
14 REL="PREVIOUS"
15 TITLE="findlib.conf"
16 HREF="r798.html"><LINK
17 REL="NEXT"
18 TITLE="Library"
19 HREF="p1052.html"></HEAD
20 ><BODY
21 CLASS="REFENTRY"
22 BGCOLOR="#FFFFFF"
23 TEXT="#000000"
24 LINK="#0000FF"
25 VLINK="#840084"
26 ALINK="#0000FF"
27 ><DIV
28 CLASS="NAVHEADER"
29 ><TABLE
30 SUMMARY="Header navigation table"
31 WIDTH="100%"
32 BORDER="0"
33 CELLPADDING="0"
34 CELLSPACING="0"
35 ><TR
36 ><TH
37 COLSPAN="3"
38 ALIGN="center"
39 >The findlib Reference Manual</TH
40 ></TR
41 ><TR
42 ><TD
43 WIDTH="10%"
44 ALIGN="left"
45 VALIGN="bottom"
46 ><A
47 HREF="r798.html"
48 ACCESSKEY="P"
49 >Prev</A
50 ></TD
51 ><TD
52 WIDTH="80%"
53 ALIGN="center"
54 VALIGN="bottom"
55 ></TD
56 ><TD
57 WIDTH="10%"
58 ALIGN="right"
59 VALIGN="bottom"
60 ><A
61 HREF="p1052.html"
62 ACCESSKEY="N"
63 >Next</A
64 ></TD
65 ></TR
66 ></TABLE
67 ><HR
68 ALIGN="LEFT"
69 WIDTH="100%"></DIV
70 ><H1
71 ><A
72 NAME="AEN994"
73 ></A
74 >site-lib</H1
75 ><DIV
76 CLASS="REFNAMEDIV"
77 ><A
78 NAME="SITE-LIB"
79 ></A
80 ><H2
81 >Name</H2
82 >site-lib&nbsp;--&nbsp;[Location of package directories]</DIV
83 ><DIV
84 CLASS="REFSYNOPSISDIV"
85 ><A
86 NAME="AEN1002"
87 ></A
88 ><H2
89 >STANDARD LAYOUT</H2
90 ><PRE
91 CLASS="SYNOPSIS"
92 >...somewhere in the filesystem hierarchy...
93 |
94 \
95 site-lib
96 |
97 +- (optional) stublibs
98 +- (optional) postinstall
99 +- (optional) postremove
100 |
101 +- <TT
102 CLASS="REPLACEABLE"
103 ><I
104 >package1</I
105 ></TT
106 >
107 | |
108 | +- META
109 | +- <TT
110 CLASS="REPLACEABLE"
111 ><I
112 >archive files</I
113 ></TT
114 >
115 | +- <TT
116 CLASS="REPLACEABLE"
117 ><I
118 >interface definitions</I
119 ></TT
120 >
121 |
122 +- <TT
123 CLASS="REPLACEABLE"
124 ><I
125 >package2</I
126 ></TT
127 >
128 +
129 :
130 :
131 \
132 <TT
133 CLASS="REPLACEABLE"
134 ><I
135 >packageN</I
136 ></TT
137 ></PRE
138 ></DIV
139 ><DIV
140 CLASS="REFSECT1"
141 ><A
142 NAME="AEN1010"
143 ></A
144 ><H2
145 >DESCRIPTION</H2
146 ><P
147 >Every installation of "findlib" has a default location for package
148 directories, which is normally a directory called "site-lib". The
149 location can be set by the configuration variables
150 <TT
151 CLASS="LITERAL"
152 >path</TT
153 > (used to look up packages), and
154 <TT
155 CLASS="LITERAL"
156 >destdir</TT
157 > (used to install new packages);
158 see <A
159 HREF="r798.html#FINDLIB.CONF"
160 >findlib.conf</A
161 >.</P
162 ><P
163 >The name of a package is the name of the package directory. For
164 example, if <TT
165 CLASS="LITERAL"
166 >destdir=/usr/local/lib/ocaml/site-lib</TT
167 >, the
168 package p will be installed in the subdirectory
169 <TT
170 CLASS="LITERAL"
171 >/usr/local/lib/ocaml/site-lib/p</TT
172 >. This subdirectory
173 must contain the META file and all other files belonging to the package.
174 Package names must not contain the '.' character.</P
175 ><P
176 >The variable <TT
177 CLASS="LITERAL"
178 >destdir</TT
179 > specifies the directory for
180 new packages. You can only have one such directory at a time; but of
181 course you can change this directory in findlib.conf. The command
182 <TT
183 CLASS="LITERAL"
184 >ocamlfind install</TT
185 > puts new packages into this
186 directory; it is recommended to use this command for installation
187 because it ensures that the directory layout is right.</P
188 ><P
189 >For searching packages, findlib uses (only) the variable
190 <TT
191 CLASS="LITERAL"
192 >path</TT
193 > which may name several locations to look at.</P
194 ><P
195 >For systems with DLL support another directory may exist: stublibs.
196 If present, findlib will install DLLs into this directory that is
197 shared by all packages at the same site-lib location. Findlib remembers
198 which DLL belongs to which package by special files with the suffix
199 ".owner"; e.g. for the DLL "dllpcre.so" there is another file
200 "dllpcre.so.owner" containing the string "pcre", so findlib knows
201 that the package "pcre" owns this DLL. It is not possible that a DLL
202 is owned by several packages.</P
203 ><P
204 >If the stublibs directory does not exist, DLLs are installed regularly
205 in the package directories like any other file.</P
206 ><P
207 >For special needs, a postinstall and/or a postremove script may be
208 installed in the site-lib directory. These scripts are invoked after
209 installation or removal of a package, respectively.</P
210 ></DIV
211 ><DIV
212 CLASS="REFSECT1"
213 ><A
214 NAME="AEN1027"
215 ></A
216 ><H2
217 >ALTERNATE LAYOUT</H2
218 ><P
219 >&#13;<PRE
220 CLASS="PROGRAMLISTING"
221 >...somewhere in the filesystem hierarchy...
222 |
223 \
224 site-lib
225 |
226 +- (optional) stublibs
227 +- (optional) postinstall
228 +- (optional) postremove
229 |
230 +- <TT
231 CLASS="REPLACEABLE"
232 ><I
233 >package1</I
234 ></TT
235 >
236 | |
237 | +- <TT
238 CLASS="REPLACEABLE"
239 ><I
240 >archive files</I
241 ></TT
242 >
243 | +- <TT
244 CLASS="REPLACEABLE"
245 ><I
246 >interface definitions</I
247 ></TT
248 >
249 |
250 +- <TT
251 CLASS="REPLACEABLE"
252 ><I
253 >package2</I
254 ></TT
255 >
256 +
257 :
258 :
259 \
260 : <TT
261 CLASS="REPLACEABLE"
262 ><I
263 >packageN</I
264 ></TT
265 >
266 |
267 \
268 metaregistry
269 |
270 +- META.package1
271 +- META.package2
272 +
273 :
274 \
275 META.packageN</PRE
276 ></P
277 ><P
278 >This is an alternate directory layout collecting all META files in one
279 directory. You can configure this layout by setting
280 <TT
281 CLASS="LITERAL"
282 >path</TT
283 > to the absolute location of
284 <TT
285 CLASS="LITERAL"
286 >metaregistry</TT
287 >. Findlib recognizes that there are
288 META files in this directory and uses them; it is not necessary to
289 include <TT
290 CLASS="LITERAL"
291 >site-lib</TT
292 > into the <TT
293 CLASS="LITERAL"
294 >path</TT
295 >.</P
296 ><P
297 >In order to work, the META files must contain a
298 <TT
299 CLASS="LITERAL"
300 >directory</TT
301 > directive pointing to the corresponding
302 package directory that resides below <TT
303 CLASS="LITERAL"
304 >site-lib</TT
305 >.</P
306 ><P
307 >The command <TT
308 CLASS="LITERAL"
309 >ocamlfind install</TT
310 > copes with this
311 layout, too. The variable <TT
312 CLASS="LITERAL"
313 >destdir</TT
314 > must contain the
315 absolute location of <TT
316 CLASS="LITERAL"
317 >site-lib</TT
318 >, and the variable
319 <TT
320 CLASS="LITERAL"
321 >metadir</TT
322 > must contain the absolute location of
323 <TT
324 CLASS="LITERAL"
325 >metaregistry</TT
326 >. Note that <TT
327 CLASS="LITERAL"
328 >ocamlfind
329 install</TT
330 > automatically adds a <TT
331 CLASS="LITERAL"
332 >directory</TT
333 >
334 directive to the META file, so you need not do it manually.</P
335 ></DIV
336 ><DIV
337 CLASS="NAVFOOTER"
338 ><HR
339 ALIGN="LEFT"
340 WIDTH="100%"><TABLE
341 SUMMARY="Footer navigation table"
342 WIDTH="100%"
343 BORDER="0"
344 CELLPADDING="0"
345 CELLSPACING="0"
346 ><TR
347 ><TD
348 WIDTH="33%"
349 ALIGN="left"
350 VALIGN="top"
351 ><A
352 HREF="r798.html"
353 ACCESSKEY="P"
354 >Prev</A
355 ></TD
356 ><TD
357 WIDTH="34%"
358 ALIGN="center"
359 VALIGN="top"
360 ><A
361 HREF="index.html"
362 ACCESSKEY="H"
363 >Home</A
364 ></TD
365 ><TD
366 WIDTH="33%"
367 ALIGN="right"
368 VALIGN="top"
369 ><A
370 HREF="p1052.html"
371 ACCESSKEY="N"
372 >Next</A
373 ></TD
374 ></TR
375 ><TR
376 ><TD
377 WIDTH="33%"
378 ALIGN="left"
379 VALIGN="top"
380 >findlib.conf</TD
381 ><TD
382 WIDTH="34%"
383 ALIGN="center"
384 VALIGN="top"
385 ><A
386 HREF="p698.html"
387 ACCESSKEY="U"
388 >Up</A
389 ></TD
390 ><TD
391 WIDTH="33%"
392 ALIGN="right"
393 VALIGN="top"
394 >Library</TD
395 ></TR
396 ></TABLE
397 ></DIV
398 ></BODY
399 ></HTML
400 >
408408 \&
409409 are also available (e.g. @otherpkg/cmd). Additional arguments can be\c
410410 \&
411 specified on the ocamlfind command line with the -ppxopt option.\c
411 specified on the ocamlfind command line with the -ppxopt option\c
412 \&
413 or the "ppxopt" variable.\c
414 .RE
415 .ft R
416 .sp
417 .RS "7m"
418 .ft R
419 \&\h'-3m'\z\(bu\h'3m'\c
420 .ft R
421 The variable "ppxopt" is a set of options that are added to the ppx\c
422 \&
423 rewriter invocation. The contents of the variable consists of one or\c
424 \&
425 several whitespace-separated parts. Every part consists of several\c
426 \&
427 comma-separated subparts; the first subpart indicates the package\c
428 \&
429 that contains the ppx rewriter invocation, the rest contain the options\c
430 \&
431 to be appended. If the option is a path relative to the current directory\c
432 \&
433 (e.g. ./foo.cma), the path is expanded relative to the package directory.\c
434 \&
435 The special forms as defined for "archive" are also available\c
436 \&
437 (e.g. @otherpkg/foo.cma).\c
412438 .RE
413439 .ft R
414440 .PP
540540 .ft R
541541 .RS "2m"
542542 .ft R
543 OCAMLFIND_TOOLCHAIN\c
544 .RE
545 .ft R
546 .sp
547 .RS "7m"
548 .ft R
549 .ft R
550 This variable sets the currently selected toolchain when\c
551 \&
552 \& a
553 -toolchain\c
554 \& option is not passed\c
555 \&
556 \& on the command line.\c
557 \&
558 \&
559 .RE
560 .ft R
561 .PP
562 .ft R
563 .ft R
564 .RS "2m"
565 .ft R
543566 OCAMLPATH\c
544567 .RE
545568 .ft R
314314
315315 <variablelist>
316316 <varlistentry>
317 <term><literal>OCAMLFIND_TOOLCHAIN</literal></term>
318 <listitem><para>
319 This variable sets the currently selected toolchain when
320 a <literal>-toolchain</literal> option is not passed
321 on the command line.
322 </para>
323 </listitem>
324 </varlistentry>
325 </variablelist>
326
327 <variablelist>
328 <varlistentry>
317329 <term><literal>OCAMLPATH</literal></term>
318330 <listitem><para>
319331 This variable may contain an additional search path for package
267267 relative to the current directory (e.g. ./cmd), the command is expected
268268 in the package directory. The special forms as defined for "archive"
269269 are also available (e.g. @otherpkg/cmd). Additional arguments can be
270 specified on the ocamlfind command line with the -ppxopt option.
270 specified on the ocamlfind command line with the -ppxopt option
271 or the "ppxopt" variable.
272 </para>
273 </listitem>
274
275 <listitem>
276 <para>
277 The variable "ppxopt" is a set of options that are added to the ppx
278 rewriter invocation. The contents of the variable consists of one or
279 several whitespace-separated parts. Every part consists of several
280 comma-separated subparts; the first subpart indicates the package
281 that contains the ppx rewriter invocation, the rest contain the options
282 to be appended. If the option is a path relative to the current directory
283 (e.g. ./foo.cma), the path is expanded relative to the package directory.
284 The special forms as defined for "archive" are also available
285 (e.g. @otherpkg/foo.cma).
271286 </para>
272287 </listitem>
273288
13851385 relative to the current directory (e.g. ./cmd), the command is expected
13861386 in the package directory. The special forms as defined for "archive"
13871387 are also available (e.g. @otherpkg/cmd). Additional arguments can be
1388 specified on the ocamlfind command line with the -ppxopt option.</PARA></LISTITEM></ITEMIZEDLIST><PARA
1388 specified on the ocamlfind command line with the -ppxopt option
1389 or the "ppxopt" variable.</PARA></LISTITEM><LISTITEM
1390 ><PARA
1391 >The variable "ppxopt" is a set of options that are added to the ppx
1392 rewriter invocation. The contents of the variable consists of one or
1393 several whitespace-separated parts. Every part consists of several
1394 comma-separated subparts; the first subpart indicates the package
1395 that contains the ppx rewriter invocation, the rest contain the options
1396 to be appended. If the option is a path relative to the current directory
1397 (e.g. ./foo.cma), the path is expanded relative to the package directory.
1398 The special forms as defined for "archive" are also available
1399 (e.g. @otherpkg/foo.cma).</PARA></LISTITEM></ITEMIZEDLIST><PARA
13891400 >It is possible to define additional variables but there is currently
13901401 no software interpreting them.</PARA></REFSECT1><REFSECT1
13911402 ><TITLE
17121723 ><PARA
17131724 > This variable overrides the location of the configuration file
17141725 findlib.conf. It must contain the absolute path name of this file.
1726 </PARA></LISTITEM></VARLISTENTRY></VARIABLELIST>
1727
1728 <VARIABLELIST
1729 ><VARLISTENTRY
1730 ><TERM
1731 ><LITERAL
1732 MOREINFO="NONE"
1733 >OCAMLFIND_TOOLCHAIN</LITERAL></TERM><LISTITEM
1734 ><PARA
1735 > This variable sets the currently selected toolchain when
1736 a <LITERAL
1737 MOREINFO="NONE"
1738 >-toolchain</LITERAL> option is not passed
1739 on the command line.
17151740 </PARA></LISTITEM></VARLISTENTRY></VARIABLELIST>
17161741
17171742 <VARIABLELIST
0 Toploop.preprocess_phrase;;
6969 -e 's;@SYSTEM@;$(SYSTEM);g' \
7070 >findlib_config.ml
7171
72 topfind.ml: topfind.ml.in
73 if [ "$(ENABLE_TOPFIND_PPXOPT)" = "true" ]; then \
74 cp topfind.ml.in topfind.ml; \
75 else \
76 sed -e '/PPXOPT_BEGIN/,/PPXOPT_END/{d}' topfind.ml.in \
77 > topfind.ml ; \
78 fi
79
80 topfind.cmo: topfind.cmi
81 topfind.cmx: topfind.cmi
82
7283 topfind: topfind_rd$(OCAML_REMOVE_DIRECTORY).p
7384 USE_CYGPATH="$(USE_CYGPATH)"; \
7485 export USE_CYGPATH; \
8192
8293 clean:
8394 rm -f *.cmi *.cmo *.cma *.cmx *.a *.o *.cmxa \
84 fl_meta.ml findlib_config.ml findlib.mml topfind \
95 fl_meta.ml findlib_config.ml findlib.mml topfind.ml topfind \
8596 ocamlfind$(EXEC_SUFFIX) ocamlfind_opt$(EXEC_SUFFIX)
86 #rm -f ocaml_args.ml
8797
8898 install: all
8999 mkdir -p "$(prefix)$(OCAML_SITELIB)/$(NAME)"
117127
118128 # Some 'make' implementations require that .SUFFIXES must occur before
119129 # the first suffix rule. (E.g. AIX)
120 .SUFFIXES: .mll .cmo .cmi .cmx .ml .mli .mml
130 .SUFFIXES: .mll .cmo .cmi .cmx .ml .mli .mml
121131 # .src
122132
123133 .mml.cmo:
0 (* $Id: findlib.ml 225 2014-07-15 22:44:36Z gerd $
0 (* $Id: findlib.ml 241 2014-10-14 09:55:08Z gerd $
11 * ----------------------------------------------------------------------
22 *
33 *)
135135
136136 let config_preds =
137137 match toolchain with
138 | None -> []
138 | None -> (try [Sys.getenv "OCAMLFIND_TOOLCHAIN"] with Not_found -> [])
139139 | Some p -> [p] in
140140
141141 let sys_ocamlc, sys_ocamlopt, sys_ocamlcp, sys_ocamloptp, sys_ocamlmklib,
0 (* $Id: frontend.ml 231 2014-09-06 18:03:16Z gerd $
0 (* $Id: frontend.ml 239 2014-10-14 09:39:42Z gerd $
11 * ----------------------------------------------------------------------
22 *
33 *)
550550 package_deep_ancestors predicates packages in
551551
552552 let ppx_opts =
553 List.map
553 List.map
554554 (fun opt ->
555555 match Fl_split.in_words opt with
556556 | pkg :: ((_ :: _) as opts) ->
558558 try ignore(package_directory pkg); true
559559 with No_such_package _ -> false in
560560 if not exists then
561 failwith ("The package named in -ppxopt does not exist: " ^
561 failwith ("The package named in -ppxopt does not exist: " ^
562562 pkg);
563563 pkg, opts
564 | _ ->
564 | _ ->
565565 failwith "-ppxopt must include package name, e.g. -ppxopt \"foo,-name bar\""
566566 )
567567 ppx_opts in
568568
569 let meta_ppx_opts =
570 List.concat
571 (List.map
572 (fun pname ->
573 try
574 let opts = package_property predicates pname "ppxopt" in
575 (* Split by whitespace to get (package,options) combinations.
576 Then, split by commas to get individual options. *)
577 List.map
578 (fun opts ->
579 match Fl_split.in_words opts with
580 | pkg :: ((_ :: _) as opts) ->
581 let exists =
582 try ignore(package_directory pkg); true
583 with No_such_package _ -> false in
584 if not exists then
585 failwith ("The package named in ppxopt variable does not exist: " ^
586 pkg ^ " (from " ^ pname ^ ")");
587 let base = package_directory pname in
588 pkg, List.map (resolve_path ~base ~explicit:true) opts
589 | _ ->
590 failwith ("ppxopt variable must include package name, e.g. " ^
591 "ppxopt=\"foo,-name bar\" (from " ^ pname ^ ")")
592 )
593 (Fl_split.in_words_ws opts)
594 with Not_found -> []
595 )
596 ppx_packages
597 ) in
598
569599 List.flatten
570 (List.map
600 (List.map
571601 (fun pname ->
572602 let base = package_directory pname in
573603 let options =
574 try List.assoc pname ppx_opts
575 with Not_found -> [] in
604 try
605 List.concat
606 (List.map (fun (_, opts) -> opts)
607 (List.filter (fun (pname', _) -> pname' = pname)
608 (meta_ppx_opts @ ppx_opts)))
609 with Not_found -> []
610 in
576611 try
577612 let preprocessor =
578613 resolve_path
579 ~base ~explicit:true
614 ~base ~explicit:true
580615 (package_property predicates pname "ppx") in
581616 ["-ppx"; String.concat " " (preprocessor :: options)]
582617 with Not_found -> []
+0
-279
src/findlib/topfind.ml less more
0 (* $Id: topfind.ml 225 2014-07-15 22:44:36Z gerd $
1 * ----------------------------------------------------------------------
2 *
3 *)
4
5 let predicates = ref [];;
6 let forbidden = ref [];;
7 let loaded = ref [];;
8 let directories = ref [ Findlib.ocaml_stdlib() ];;
9
10
11 (* Note: Sys.interactive is always _true_ during toploop startup.
12 * When a script is executed, it is set to false just before the
13 * script starts. This is important for ocamlmktop-generated toploops:
14 * For initialization code linked into the toploop, Sys.interactive
15 * is _true_. It is set to false just before the script starts.
16 *)
17
18 let real_toploop =
19 !Sys.interactive;;
20
21 let log = ref (if real_toploop then prerr_endline else ignore)
22
23 let rec remove_dups l =
24 match l with
25 x :: l' ->
26 if List.mem x l' then remove_dups l' else x::remove_dups l'
27 | [] -> []
28 ;;
29
30 let add_predicates pl =
31 predicates := remove_dups (pl @ !predicates);;
32
33 let syntax s =
34 add_predicates [ "syntax"; s ];;
35
36 let standard_syntax () = syntax "camlp4o";;
37 let revised_syntax () = syntax "camlp4r";;
38
39
40 let add_dir d =
41 let d = Fl_split.norm_dir d in
42 if not (List.mem d !directories) then begin
43 Topdirs.dir_directory d;
44 directories := d :: !directories;
45 !log (d ^ ": added to search path")
46 end
47 ;;
48
49
50 let load pkglist =
51 List.iter
52 (fun pkg ->
53 let _stdlibdir = Findlib.ocaml_stdlib() in
54 if not (List.mem pkg !loaded) then begin
55 (* Determine the package directory: *)
56 let d = Findlib.package_directory pkg in
57 add_dir d;
58 (* Leave pkg out if mentioned in !forbidden *)
59 if not (List.mem pkg !forbidden) then begin
60 (* Determine the 'archive' property: *)
61 let archive =
62 try Findlib.package_property !predicates pkg "archive"
63 with
64 Not_found -> ""
65 in
66 (* Split the 'archive' property and load the files: *)
67 let archives = Fl_split.in_words archive in
68 List.iter
69 (fun arch ->
70 let arch' = Findlib.resolve_path ~base:d arch in
71 !log (arch' ^ ": loaded");
72 Topdirs.dir_load
73 Format.std_formatter arch')
74 archives;
75 (* Determine the 'ppx' property: *)
76 let ppx =
77 try
78 Some(Findlib.resolve_path
79 ~base:d ~explicit:true
80 (Findlib.package_property !predicates pkg "ppx")
81 )
82 with Not_found -> None
83 in
84 (* Feed the 'ppx' property into the toplevel. To remain compatible
85 with pre-4.01 OCaml, construct and execute a phrase instead of directly
86 altering Clflags. *)
87 match ppx with
88 | Some ppx ->
89 begin try
90 match Hashtbl.find Toploop.directive_table "ppx" with
91 | Toploop.Directive_string fn ->
92 fn ppx; !log (ppx ^ ": activated")
93 | _ -> assert false
94 with Not_found ->
95 failwith "Package defines a ppx preprocessor, but OCaml does not support \
96 the #ppx directive. Use OCaml >=4.02."
97 end
98 | None -> ()
99 end;
100 (* The package is loaded: *)
101 loaded := pkg :: !loaded
102 end)
103 pkglist
104 ;;
105
106
107 let load_deeply pkglist =
108 (* Get the sorted list of ancestors *)
109 let eff_pkglist =
110 Findlib.package_deep_ancestors !predicates pkglist in
111 (* Load the packages in turn: *)
112 load eff_pkglist
113 ;;
114
115
116 let don't_load pkglist =
117 forbidden := remove_dups (pkglist @ !forbidden);
118 List.iter
119 (fun pkg ->
120 let _d = Findlib.package_directory pkg in
121 ()
122 )
123 pkglist
124 ;;
125
126
127 let don't_load_deeply pkglist =
128 (* Check if packages exist: *)
129 List.iter
130 (fun pkg ->
131 let _ = Findlib.package_directory pkg in ()
132 )
133 pkglist;
134 (* Get the sorted list of ancestors *)
135 let eff_pkglist =
136 Findlib.package_deep_ancestors !predicates pkglist in
137 (* Add this to the list of forbidden packages: *)
138 don't_load eff_pkglist
139 ;;
140
141
142 let reset() =
143 loaded := []
144 ;;
145
146
147 let have_mt_support() =
148 Findlib.package_property [] "threads" "type_of_threads" = "posix"
149 ;;
150
151
152 let load_mt_support() =
153 (* Load only if package "threads" is not yet loaded. *)
154 if not(List.mem "threads" !loaded) then (
155 (* This works only for POSIX threads. *)
156 if have_mt_support() then (
157 add_predicates ["mt"; "mt_posix"];
158 add_dir (Filename.concat (Findlib.ocaml_stdlib()) "threads");
159 load_deeply ["unix"];
160 load_deeply ["threads"];
161 )
162 else (
163 failwith "It is not possible to load support for vmthreads dynamically. Use\n
164 'ocamlfind ocamlmktop -o vmtop -package threads,findlib -linkpkg -vmthread'\n
165 to create a toploop with integrated vmthreads library."
166 )
167 )
168 ;;
169
170
171 let list_packages() =
172 Findlib.list_packages stdout;
173 flush stdout
174 ;;
175
176
177 let protect f arg =
178 try
179 let _ = f arg in ()
180 with
181 Failure s ->
182 print_endline s
183 | Fl_package_base.No_such_package(pkg, reason) ->
184 print_endline ("No such package: " ^ pkg ^
185 (if reason <> "" then " - " ^ reason else ""))
186 | Fl_package_base.Package_loop pkg ->
187 print_endline ("Package requires itself: " ^ pkg)
188 ;;
189
190
191 (* Add "#require" directive: *)
192
193 Hashtbl.add
194 Toploop.directive_table
195 "require"
196 (Toploop.Directive_string
197 (fun s ->
198 protect load_deeply (Fl_split.in_words s)
199 ))
200 ;;
201
202 (* Add "#predicates" directive: *)
203 Hashtbl.add
204 Toploop.directive_table
205 "predicates"
206 (Toploop.Directive_string
207 (fun s ->
208 protect add_predicates (Fl_split.in_words s)
209 ))
210 ;;
211
212
213 (* Add "#camlp4o" directive: *)
214
215 Hashtbl.add
216 Toploop.directive_table
217 "camlp4o"
218 (Toploop.Directive_none
219 (fun () ->
220 protect (fun () ->
221 standard_syntax();
222 load_deeply ["camlp4"]) ()
223 ))
224 ;;
225
226 (* Add "#camlp4r" directive: *)
227
228 Hashtbl.add
229 Toploop.directive_table
230 "camlp4r"
231 (Toploop.Directive_none
232 (fun () ->
233 protect (fun () ->
234 revised_syntax();
235 load_deeply ["camlp4"]) ()
236 ))
237 ;;
238
239
240 (* Add "#list" directive: *)
241
242 Hashtbl.add
243 Toploop.directive_table
244 "list"
245 (Toploop.Directive_none
246 (fun () ->
247 protect list_packages ()
248 ))
249 ;;
250
251
252 (* Add "#thread" directive: *)
253
254 Hashtbl.add
255 Toploop.directive_table
256 "thread"
257 (Toploop.Directive_none
258 (fun () ->
259 protect load_mt_support ()
260 ))
261 ;;
262
263
264 let announce() =
265 if real_toploop then begin
266 (* Assume we are in a toploop and not a script *)
267 let msg_thread =
268 " #thread;; to enable threads\n" in
269 print_endline
270 ("Findlib has been successfully loaded. Additional directives:\n" ^
271 " #require \"package\";; to load a package\n" ^
272 " #list;; to list the available packages\n" ^
273 " #camlp4o;; to load camlp4 (standard syntax)\n" ^
274 " #camlp4r;; to load camlp4 (revised syntax)\n" ^
275 " #predicates \"p,q,...\";; to set these predicates\n" ^
276 " Topfind.reset();; to force that packages will be reloaded\n" ^
277 (if have_mt_support() then msg_thread else ""))
278 end ;;
0 (* $Id: topfind.ml.in 239 2014-10-14 09:39:42Z gerd $
1 * ----------------------------------------------------------------------
2 *
3 *)
4
5 let predicates = ref [];;
6 let forbidden = ref [];;
7 let loaded = ref [];;
8 let directories = ref [ Findlib.ocaml_stdlib() ];;
9
10
11 (* Note: Sys.interactive is always _true_ during toploop startup.
12 * When a script is executed, it is set to false just before the
13 * script starts. This is important for ocamlmktop-generated toploops:
14 * For initialization code linked into the toploop, Sys.interactive
15 * is _true_. It is set to false just before the script starts.
16 *)
17
18 let real_toploop =
19 !Sys.interactive;;
20
21 let log = ref (if real_toploop then prerr_endline else ignore)
22
23 let rec remove_dups l =
24 match l with
25 x :: l' ->
26 if List.mem x l' then remove_dups l' else x::remove_dups l'
27 | [] -> []
28 ;;
29
30 let add_predicates pl =
31 predicates := remove_dups (pl @ !predicates);;
32
33 let syntax s =
34 add_predicates [ "syntax"; s ];;
35
36 let standard_syntax () = syntax "camlp4o";;
37 let revised_syntax () = syntax "camlp4r";;
38
39
40 let add_dir d =
41 let d = Fl_split.norm_dir d in
42 if not (List.mem d !directories) then begin
43 Topdirs.dir_directory d;
44 directories := d :: !directories;
45 !log (d ^ ": added to search path")
46 end
47 ;;
48
49 let exec_string s =
50 let l = Lexing.from_string s in
51 let ph = !Toploop.parse_toplevel_phrase l in
52 (* PPXOPT_BEGIN *)
53 let ph = Toploop.preprocess_phrase Format.err_formatter ph in
54 (* PPXOPT_END *)
55 let fmt = Format.make_formatter (fun _ _ _ -> ()) (fun _ -> ()) in
56 try
57 Toploop.execute_phrase false fmt ph
58 with
59 _ -> false
60 ;;
61
62 let load pkglist =
63 List.iter
64 (fun pkg ->
65 let _stdlibdir = Findlib.ocaml_stdlib() in
66 if not (List.mem pkg !loaded) then begin
67 (* Determine the package directory: *)
68 let d = Findlib.package_directory pkg in
69 add_dir d;
70 (* Leave pkg out if mentioned in !forbidden *)
71 if not (List.mem pkg !forbidden) then begin
72 (* Determine the 'archive' property: *)
73 let archive =
74 try Findlib.package_property !predicates pkg "archive"
75 with
76 Not_found -> ""
77 in
78 (* Split the 'archive' property and load the files: *)
79 let archives = Fl_split.in_words archive in
80 List.iter
81 (fun arch ->
82 let arch' = Findlib.resolve_path ~base:d arch in
83 !log (arch' ^ ": loaded");
84 Topdirs.dir_load
85 Format.std_formatter arch')
86 archives;
87 (* Determine the 'ppx' property: *)
88 let ppx =
89 try
90 Some(Findlib.resolve_path
91 ~base:d ~explicit:true
92 (Findlib.package_property !predicates pkg "ppx")
93 )
94 with Not_found -> None
95 and ppxopts =
96 try
97 List.map
98 (fun opt ->
99 match Fl_split.in_words opt with
100 | pkg :: opts ->
101 pkg,
102 List.map
103 (Findlib.resolve_path ~base:d ~explicit:true) opts
104 | _ -> assert false)
105 (Fl_split.in_words_ws
106 (Findlib.package_property !predicates pkg "ppxopt"))
107 with Not_found -> [] in
108 (* Feed the 'ppx' property into the toplevel. To remain compatible
109 with pre-4.01 OCaml, construct and execute a phrase instead of directly
110 altering Clflags. *)
111 begin match ppx with
112 | Some ppx ->
113
114
115 begin try
116 match Hashtbl.find Toploop.directive_table "ppx" with
117 | Toploop.Directive_string fn ->
118 fn ppx; !log (ppx ^ ": activated")
119 | _ -> assert false
120 with Not_found ->
121 failwith "Package defines a ppx preprocessor, but OCaml is too old. \
122 Use OCaml >= 4.02.0 for ppx support."
123 end
124 | None -> ()
125 end;
126 (* Feed the 'ppxopt' property into the toplevel. *)
127 match ppxopts with
128 | [] -> ()
129 | _ ->
130 (* PPXOPT_BEGIN *)
131 List.iter
132 (fun (pkg, opts) ->
133 ignore (exec_string ("[@@@findlib.ppxopt " ^
134 (String.concat ", "
135 (List.map (Printf.sprintf "%S") (pkg :: opts))) ^
136 "];;"));
137 !log (pkg ^ ": " ^ (String.concat " " opts) ^
138 ": option added"))
139 ppxopts
140 (*
141 (* PPXOPT_END *)
142 failwith "Package defines a ppx preprocessor option, but OCaml is too old. \
143 Use OCaml >=4.02.1 for ppxopt support."
144 (* PPXOPT_BEGIN *)
145 *)
146 (* PPXOPT_END *)
147 end;
148 (* The package is loaded: *)
149 loaded := pkg :: !loaded
150 end)
151 pkglist
152 ;;
153
154
155 let load_deeply pkglist =
156 (* Get the sorted list of ancestors *)
157 let eff_pkglist =
158 Findlib.package_deep_ancestors !predicates pkglist in
159 (* Load the packages in turn: *)
160 load eff_pkglist
161 ;;
162
163
164 let don't_load pkglist =
165 forbidden := remove_dups (pkglist @ !forbidden);
166 List.iter
167 (fun pkg ->
168 let _d = Findlib.package_directory pkg in
169 ()
170 )
171 pkglist
172 ;;
173
174
175 let don't_load_deeply pkglist =
176 (* Check if packages exist: *)
177 List.iter
178 (fun pkg ->
179 let _ = Findlib.package_directory pkg in ()
180 )
181 pkglist;
182 (* Get the sorted list of ancestors *)
183 let eff_pkglist =
184 Findlib.package_deep_ancestors !predicates pkglist in
185 (* Add this to the list of forbidden packages: *)
186 don't_load eff_pkglist
187 ;;
188
189
190 let reset() =
191 loaded := []
192 ;;
193
194
195 let have_mt_support() =
196 Findlib.package_property [] "threads" "type_of_threads" = "posix"
197 ;;
198
199
200 let load_mt_support() =
201 (* Load only if package "threads" is not yet loaded. *)
202 if not(List.mem "threads" !loaded) then (
203 (* This works only for POSIX threads. *)
204 if have_mt_support() then (
205 add_predicates ["mt"; "mt_posix"];
206 add_dir (Filename.concat (Findlib.ocaml_stdlib()) "threads");
207 load_deeply ["unix"];
208 load_deeply ["threads"];
209 )
210 else (
211 failwith "It is not possible to load support for vmthreads dynamically. Use\n
212 'ocamlfind ocamlmktop -o vmtop -package threads,findlib -linkpkg -vmthread'\n
213 to create a toploop with integrated vmthreads library."
214 )
215 )
216 ;;
217
218
219 let list_packages() =
220 Findlib.list_packages stdout;
221 flush stdout
222 ;;
223
224
225 let protect f arg =
226 try
227 let _ = f arg in ()
228 with
229 Failure s ->
230 print_endline s
231 | Fl_package_base.No_such_package(pkg, reason) ->
232 print_endline ("No such package: " ^ pkg ^
233 (if reason <> "" then " - " ^ reason else ""))
234 | Fl_package_base.Package_loop pkg ->
235 print_endline ("Package requires itself: " ^ pkg)
236 ;;
237
238
239 (* Add "#require" directive: *)
240
241 Hashtbl.add
242 Toploop.directive_table
243 "require"
244 (Toploop.Directive_string
245 (fun s ->
246 protect load_deeply (Fl_split.in_words s)
247 ))
248 ;;
249
250 (* Add "#predicates" directive: *)
251 Hashtbl.add
252 Toploop.directive_table
253 "predicates"
254 (Toploop.Directive_string
255 (fun s ->
256 protect add_predicates (Fl_split.in_words s)
257 ))
258 ;;
259
260
261 (* Add "#camlp4o" directive: *)
262
263 Hashtbl.add
264 Toploop.directive_table
265 "camlp4o"
266 (Toploop.Directive_none
267 (fun () ->
268 protect (fun () ->
269 standard_syntax();
270 load_deeply ["camlp4"]) ()
271 ))
272 ;;
273
274 (* Add "#camlp4r" directive: *)
275
276 Hashtbl.add
277 Toploop.directive_table
278 "camlp4r"
279 (Toploop.Directive_none
280 (fun () ->
281 protect (fun () ->
282 revised_syntax();
283 load_deeply ["camlp4"]) ()
284 ))
285 ;;
286
287
288 (* Add "#list" directive: *)
289
290 Hashtbl.add
291 Toploop.directive_table
292 "list"
293 (Toploop.Directive_none
294 (fun () ->
295 protect list_packages ()
296 ))
297 ;;
298
299
300 (* Add "#thread" directive: *)
301
302 Hashtbl.add
303 Toploop.directive_table
304 "thread"
305 (Toploop.Directive_none
306 (fun () ->
307 protect load_mt_support ()
308 ))
309 ;;
310
311
312 let announce() =
313 if real_toploop then begin
314 (* Assume we are in a toploop and not a script *)
315 let msg_thread =
316 " #thread;; to enable threads\n" in
317 print_endline
318 ("Findlib has been successfully loaded. Additional directives:\n" ^
319 " #require \"package\";; to load a package\n" ^
320 " #list;; to list the available packages\n" ^
321 " #camlp4o;; to load camlp4 (standard syntax)\n" ^
322 " #camlp4r;; to load camlp4 (revised syntax)\n" ^
323 " #predicates \"p,q,...\";; to set these predicates\n" ^
324 " Topfind.reset();; to force that packages will be reloaded\n" ^
325 (if have_mt_support() then msg_thread else ""))
326 end ;;