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