Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / localhost / Installation
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
6 <title>Installation</title>
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
9
10
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
13 /*<![CDATA[*/
14 asciidoc.install();
15 /*]]>*/
16 </script>
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
18 </head>
19 <body class="article">
20 <div id="banner">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
23 </div>
24 </div>
25 <div id="header">
26 <h1>Installation</h1>
27 </div>
28 <div id="content">
29 <div id="preamble">
30 <div class="sectionbody">
31 <div class="paragraph"><p>MLton runs on a variety of platforms and is distributed in both source and
32 binary form.</p></div>
33 <div class="paragraph"><p>A <span class="monospaced">.tgz</span> or <span class="monospaced">.tbz</span> binary package can be extracted at any location, yielding
34 <span class="monospaced">README.adoc</span> (this file), <span class="monospaced">CHANGELOG.adoc</span>, <span class="monospaced">LICENSE</span>, <span class="monospaced">Makefile</span>, <span class="monospaced">bin/</span>,
35 <span class="monospaced">lib/</span>, and <span class="monospaced">share/</span>. The compiler and tools can be executed in-place (e.g.,
36 <span class="monospaced">./bin/mlton</span>).</p></div>
37 <div class="paragraph"><p>A small set of <span class="monospaced">Makefile</span> variables can be used to customize the binary package
38 via <span class="monospaced">make update</span>:</p></div>
39 <div class="ulist"><ul>
40 <li>
41 <p>
42 <span class="monospaced">CC</span>: Specify C compiler. Can be used for alternative tools (e.g.,
43 <span class="monospaced">CC=clang</span> or <span class="monospaced">CC=gcc-7</span>).
44 </p>
45 </li>
46 <li>
47 <p>
48 <span class="monospaced">WITH_GMP_DIR</span>, <span class="monospaced">WITH_GMP_INC_DIR</span>, <span class="monospaced">WITH_GMP_LIB_DIR</span>: Specify GMP include
49 and library paths, if not on default search paths. (If <span class="monospaced">WITH_GMP_DIR</span> is
50 set, then <span class="monospaced">WITH_GMP_INC_DIR</span> defaults to <span class="monospaced">$(WITH_GMP_DIR)/include</span> and
51 <span class="monospaced">WITH_GMP_LIB_DIR</span> defaults to <span class="monospaced">$(WITH_GMP_DIR)/lib</span>.)
52 </p>
53 </li>
54 </ul></div>
55 <div class="paragraph"><p>For example:</p></div>
56 <div class="listingblock">
57 <div class="content"><div class="highlight"><pre><span class="n">$</span><span class="w"> </span><span class="n">make</span><span class="w"> </span><span class="n">CC</span><span class="p">=</span><span class="n">clang</span><span class="w"> </span><span class="n">WITH_GMP_DIR=/opt/gmp</span><span class="w"> </span><span class="n">update</span><span class="w"></span>
58 </pre></div></div></div>
59 <div class="paragraph"><p>On typical platforms, installing MLton (after optionally performing
60 <span class="monospaced">make update</span>) to <span class="monospaced">/usr/local</span> can be accomplished via:</p></div>
61 <div class="listingblock">
62 <div class="content"><div class="highlight"><pre><span class="n">$</span><span class="w"> </span><span class="n">make</span><span class="w"> </span><span class="n">install</span><span class="w"></span>
63 </pre></div></div></div>
64 <div class="paragraph"><p>A small set of <span class="monospaced">Makefile</span> variables can be used to customize the installation:</p></div>
65 <div class="ulist"><ul>
66 <li>
67 <p>
68 <span class="monospaced">PREFIX</span>: Specify the installation prefix.
69 </p>
70 </li>
71 <li>
72 <p>
73 <span class="monospaced">CC</span>: Specify C compiler. Can be used for alternative tools (e.g.,
74 <span class="monospaced">CC=clang</span> or <span class="monospaced">CC=gcc-7</span>).
75 </p>
76 </li>
77 <li>
78 <p>
79 <span class="monospaced">WITH_GMP_DIR</span>, <span class="monospaced">WITH_GMP_INC_DIR</span>, <span class="monospaced">WITH_GMP_LIB_DIR</span>: Specify GMP include
80 and library paths, if not on default search paths. (If <span class="monospaced">WITH_GMP_DIR</span> is
81 set, then <span class="monospaced">WITH_GMP_INC_DIR</span> defaults to <span class="monospaced">$(WITH_GMP_DIR)/include</span> and
82 <span class="monospaced">WITH_GMP_LIB_DIR</span> defaults to <span class="monospaced">$(WITH_GMP_DIR)/lib</span>.)
83 </p>
84 </li>
85 </ul></div>
86 <div class="paragraph"><p>For example:</p></div>
87 <div class="listingblock">
88 <div class="content"><div class="highlight"><pre><span class="n">$</span><span class="w"> </span><span class="n">make</span><span class="w"> </span><span class="n">PREFIX=/opt/mlton</span><span class="w"> </span><span class="n">install</span><span class="w"></span>
89 </pre></div></div></div>
90 <div class="paragraph"><p>Installation of MLton creates the following files and directories.</p></div>
91 <div class="ulist"><ul>
92 <li>
93 <p>
94 <span class="monospaced"><em>prefix</em>/bin/mllex</span>
95 </p>
96 <div class="paragraph"><p>The <a href="MLLex">MLLex</a> lexer generator.</p></div>
97 </li>
98 <li>
99 <p>
100 <span class="monospaced"><em>prefix</em>/bin/mlnlffigen</span>
101 </p>
102 <div class="paragraph"><p>The <a href="MLNLFFI">ML-NLFFI</a> tool.</p></div>
103 </li>
104 <li>
105 <p>
106 <span class="monospaced"><em>prefix</em>/bin/mlprof</span>
107 </p>
108 <div class="paragraph"><p>A <a href="Profiling">Profiling</a> tool.</p></div>
109 </li>
110 <li>
111 <p>
112 <span class="monospaced"><em>prefix</em>/bin/mlton</span>
113 </p>
114 <div class="paragraph"><p>A script to call the compiler. This script may be moved anywhere,
115 however, it makes use of files in <span class="monospaced"><em>prefix</em>/lib/mlton</span>.</p></div>
116 </li>
117 <li>
118 <p>
119 <span class="monospaced"><em>prefix</em>/bin/mlyacc</span>
120 </p>
121 <div class="paragraph"><p>The <a href="MLYacc">MLYacc</a> parser generator.</p></div>
122 </li>
123 <li>
124 <p>
125 <span class="monospaced"><em>prefix</em>/lib/mlton</span>
126 </p>
127 <div class="paragraph"><p>Directory containing libraries and include files needed during compilation.</p></div>
128 </li>
129 <li>
130 <p>
131 <span class="monospaced"><em>prefix</em>/share/man/man1/{mllex,mlnlffigen,mlprof,mlton,mlyacc}.1</span>
132 </p>
133 <div class="paragraph"><p>Man pages.</p></div>
134 </li>
135 <li>
136 <p>
137 <span class="monospaced"><em>prefix</em>/share/doc/mlton</span>
138 </p>
139 <div class="paragraph"><p>Directory containing the user guide for MLton, mllex, and mlyacc, as
140 well as example SML programs (in the <span class="monospaced">examples</span> directory), and license
141 information.</p></div>
142 </li>
143 </ul></div>
144 </div>
145 </div>
146 <div class="sect1">
147 <h2 id="_hello_world">Hello, World!</h2>
148 <div class="sectionbody">
149 <div class="paragraph"><p>Once you have installed MLton, create a file called <span class="monospaced">hello-world.sml</span>
150 with the following contents.</p></div>
151 <div class="listingblock">
152 <div class="content monospaced">
153 <pre>print "Hello, world!\n";</pre>
154 </div></div>
155 <div class="paragraph"><p>Now create an executable, <span class="monospaced">hello-world</span>, with the following command.</p></div>
156 <div class="listingblock">
157 <div class="content monospaced">
158 <pre>mlton hello-world.sml</pre>
159 </div></div>
160 <div class="paragraph"><p>You can now run <span class="monospaced">hello-world</span> to verify that it works. There are more
161 small examples in <span class="monospaced"><em>prefix</em>/share/doc/mlton/examples</span>.</p></div>
162 </div>
163 </div>
164 <div class="sect1">
165 <h2 id="_installation_on_cygwin">Installation on Cygwin</h2>
166 <div class="sectionbody">
167 <div class="paragraph"><p>When installing the Cygwin <span class="monospaced">tgz</span>, you should use Cygwin&#8217;s <span class="monospaced">bash</span> and
168 <span class="monospaced">tar</span>. The use of an archiving tool that is not aware of Cygwin&#8217;s
169 mounts will put the files in the wrong place.</p></div>
170 </div>
171 </div>
172 </div>
173 <div id="footnotes"><hr></div>
174 <div id="footer">
175 <div id="footer-text">
176 </div>
177 <div id="footer-badges">
178 </div>
179 </div>
180 </body>
181 </html>