| | | |
Offset 162, 8 lines modified | Offset 162, 513 lines modified |
162 | ·····*·If·the·execution·of·the·program·is·very·fast·on·typical·application | 162 | ·····*·If·the·execution·of·the·program·is·very·fast·on·typical·application |
163 | ·······cases·then·the·program·contained·in·the·package·should·be·compiled | 163 | ·······cases·then·the·program·contained·in·the·package·should·be·compiled |
164 | ·······to·bytecode.·Typical·examples·are·hevea,·or·headache.·See·the | 164 | ·······to·bytecode.·Typical·examples·are·hevea,·or·headache.·See·the |
165 | ·······section·on·bytecode·packages. | 165 | ·······section·on·bytecode·packages. |
166 | ·····*·Only·in·special·cases,·for·instance·when·both·versions·provide | 166 | ·····*·Only·in·special·cases,·for·instance·when·both·versions·provide |
167 | ·······different·features,·should·a·package·contain·programs·both·compiled | 167 | ·······different·features,·should·a·package·contain·programs·both·compiled |
168 | ·······to·bytecode·and·native·code.·See·the·section·on·combined·bytecode | 168 | ·······to·bytecode·and·native·code.·See·the·section·on·combined·bytecode |
169 | ·······and·native·code·p | 169 | ·······and·native·code·packages. |
| |
| 170 | Overview·of·the·OCaml·compilers |
| |
| 171 | Bytecode·and·native·code·compilers |
| |
| 172 | ···The·ocaml-native-compilers·package·contains·the·OCaml·compiler |
| 173 | ···executables·built·in·native·mode:·ocamlc.opt,·which·produces·bytecode, |
| 174 | ···and·ocamlopt.opt,·which·produces·native·code.·Since·the·OCaml·compilers |
| 175 | ···are·themselves·written·in·OCaml·this·package·exists·only·on |
| 176 | ···architectures·where·compilation·to·native·code·is·supported. |
| |
| 177 | ···The·ocaml·package·contains·the·OCaml·compiler·executables·built·in |
| 178 | ···bytecode·mode:·ocamlc,·which·produces·bytecode,·and·on·architectures |
| 179 | ···where·compilation·to·native·code·is·supported·the·compiler·ocamlopt, |
| 180 | ···which·produces·native·code.·It·is·important·to·understand·that·on |
| 181 | ···architectures·where·compilation·to·native·code·is·supported·both |
| 182 | ···packages·contain·compilers·from·OCaml·to·both·bytecode·and·native·code, |
| 183 | ···the·difference·lies·in·the·nature·(installation·size·and·execution |
| 184 | ···speed)·of·the·compiler·executables. |
| |
| 185 | ···Table·1.1.·OCaml·compilers |
| 186 | ····································Compiles·to·bytecode·Compiles·to·native·code |
| 187 | ·Compiler·executable·in·bytecode····ocamlc···············ocamlopt |
| 188 | ·Compiler·executable·in·native·code·ocamlc.opt···········ocamlopt.opt |
| |
| 189 | ···See·the·section·called·“Bytecode·and·native·code”·on·a·discussion |
| 190 | ···whether·to·produce·native·code·or·bytecode. |
| |
| 191 | Files·used·and·produced·by·the·OCaml·compilers |
| |
| 192 | ···The·OCaml·toolchain·can·produce·or·use·the·following·kind·of·files: |
| 193 | ·····*·pure·bytecode·executables·(they·can·be·recognized·since·they·start |
| 194 | ·······with·the·shebang·line·#!/usr/bin/ocamlrun) |
| 195 | ·····*·bytecode·executables·linked·in·custom·mode.·They·are·generated·by |
| 196 | ·······ocamlc·when·the·-custom·flag·is·given·at·link·time.·Those |
| 197 | ·······executables·are·in·ELF·format·and·include·both·the·final·bytecode |
| 198 | ·······and·the·bytecode·interpreter.·The·strip·command·should·never·be |
| 199 | ·······invoked·on·them·since·it·will·remove·the·bytecode·part.·Bytecode |
| 200 | ·······executables·linked·in·custom·mode·are·depreciated·and·should·be |
| 201 | ·······avoided. |
| 202 | ·····*·native·executables·(in·ELF·format) |
| 203 | ·····*·bytecode·libraries·(*.cma,·*.a) |
| 204 | ·····*·native·libraries·(*.cmxa) |
| 205 | ·····*·shared·libraries·(for·C·bindings)·(dll*.so,·lib*.so) |
| 206 | ·····*·static·libraries·(for·C·bindings)·(lib*.a) |
| 207 | ·····*·bytecode·object·files·(*.cmo) |
| 208 | ·····*·native·object·files·(*.cmx,·*.o) |
| 209 | ·····*·native·plugin·object·files·(*.cmxs) |
| 210 | ·····*·configuration·files·for·handling·libraries·with·ocamlfind·(META) |
| |
| 211 | Building·packages·using·OCaml |
| |
| 212 | Findlib·and·ocamlfind |
| |
| 213 | ···The·Debian·OCaml·Task·Force·has·chosen·to·fully·support·the·findlib |
| 214 | ···library.·This·is·a·suite·of·tools·and·libraries·that·help·to·manage |
| 215 | ···OCaml·libraries.·This·software·is·not·specific·to·Debian·and·works·on |
| 216 | ···all·platforms·where·OCaml·is·available.·Through·the·years,·this·has |
| 217 | ···become·the·de·facto·standard·when·relying·on·external·libraries.·The |
| 218 | ···main·frontend·is·called·ocamlfind·and·provided·by·the·package |
| 219 | ···ocaml-findlib. |
| |
| 220 | ···Even·though·compiling·OCaml·projects·in·Debian·is·still·possible |
| 221 | ···without·ocamlfind·it·is·highly·recommended·to·use·it. |
| |
| 222 | The·OCaml·system·in·Debian |
| |
| 223 | ···There·are·three·categories·of·OCaml·packages·in·Debian: |
| 224 | ·····*·Development·packages·contain·OCaml·objects·required·for·the |
| 225 | ·······development·or·compilation·of·OCaml·programs,·or·specifically·for |
| 226 | ·······the·creation·of·Debian·packages·containing·OCaml·programs. |
| 227 | ·····*·Runtime·packages·contain·OCaml·objects·necessary·to·run·compiled |
| 228 | ·······programs.·A·runtime·package·is·always·associated·with·a·development |
| 229 | ·······package. |
| 230 | ·····*·Simple·binary·packages·contain·everything·that·does·not·fall·into |
| 231 | ·······the·two·former·categories.·This·includes·bytecode·and·native |
| 232 | ·······executable·of·application·programs,·documentation,·etc. |
| |
| 233 | ···The·ocaml·package·depends·on·all·the·basic·packages·needed·to·develop |
| 234 | ···programs·with·OCaml.·Here·is·the·list·of·binary·packages·into·which·the |
| 235 | ···OCaml·system·is·organized: |
| 236 | ····1.·The·ocaml·package·contain·the·compiler·and·its·libraries.·It·can·be |
| 237 | ·······considered·as·a·development·package. |
| 238 | ····2.·The·ocaml-native-compilers·package·contains·the·OCaml·compilers |
| 239 | ·······built·in·native·mode·(ocamlc.opt·and·ocamlopt.opt). |
| |
| 240 | Note |
| 241 | ·······The·compilers·themselves·are·built·in·native·mode,·nonetheless, |
| 242 | ·······both·compilers·for·compiling·toward·bytecode·and·native·code·are |
| 243 | ·······contained·in·this·package. |
| 244 | ····3.·The·ocaml-base·package·contains·the·interpreter·and·runtime |
| 245 | ·······libraries·needed·by·bytecode·programs·compiled·with·OCaml·(in |
| 246 | ·······particular,·it·contains·the·ocamlrun·program).·It·can·be·considered |
| 247 | ·······as·the·runtime·package·associated·to·ocaml. |
| |
| 248 | Note |
| 249 | ·······ocaml-base·contains·also·OCaml·interface·objects·*.cmi,·which·are |
| 250 | ·······normally·only·in·development·packages·because·they·are·needed·to |
| 251 | ·······run·the·ocaml·toplevel·from·the·package·ocaml-interp. |
| 252 | ····4.·The·ocaml-interp·package·contains·the·toplevel·system·for·OCaml |
| 253 | ·······(ocaml)·which·provides·for·an·interactive·interpreter·of·the |
| 254 | ·······language. |
| 255 | ····5.·The·ocaml-mode·package·contains·the·OCaml·Emacs·mode.·This·is·the |
| 256 | ·······original·Emacs·mode·provided·with·the·OCaml·upstream·distribution, |
| 257 | ·······not·to·be·confused·with·the·tuareg·Emacs·mode·which·is·in·the |
| 258 | ·······package·tuareg-mode. |
| 259 | ····6.·The·ocaml-source·package·contains·the·sources·of·the·OCaml |
| 260 | ·······compiler. |
| 261 | ····7.·The·ocaml-compiler-libs·package·contains·some·internal·libraries·of |
| 262 | ·······the·OCaml·compiler·(needed·only·in·very·rare·cases,·e.g.·for |
| 263 | ·······developing·languages·which·reuse·OCaml·internals). |
| |
| 264 | ···Since·libraries·produced·by·OCaml·are·binary·incompatible·when·compiled |
| 265 | ···with·different·releases·of·OCaml,·versioned·virtual·packages·are·also |
| 266 | ···provided·by·packages·at·items·(1),·(2),·(6)·and·(7): |
| 267 | ···ocaml-[ocaml-version],·etc. |
| |
| 268 | Choosing·the·right·build·dependencies |
| |
Max diff block lines reached; -1/25175 bytes (-0.00%) of diff not shown.
|