summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2013-05-23 13:02:56 +0200
committerSébastien Dailly <sebastien@chimrod.com>2013-05-23 13:02:56 +0200
commitfd003f8ae807b8e0ddd06246995af736c7605d84 (patch)
treeae8b798af6bfd86696c22f2b54388f5e2692efc7
parent14dd601435ad55ca211f37606ed8443fe01c932e (diff)
New article on ocamlfind
-rw-r--r--content/Informatique/ocamlfind_en.rst63
-rw-r--r--content/Informatique/ocamlfind_fr.rst77
-rw-r--r--content/Perso/poker.rst2
-rw-r--r--content/images/ocaml/camel.jpgbin0 -> 3565 bytes
-rw-r--r--content/images/ocaml/camel_medium.jpgbin0 -> 15024 bytes
5 files changed, 141 insertions, 1 deletions
diff --git a/content/Informatique/ocamlfind_en.rst b/content/Informatique/ocamlfind_en.rst
new file mode 100644
index 0000000..292b19f
--- /dev/null
+++ b/content/Informatique/ocamlfind_en.rst
@@ -0,0 +1,63 @@
+.. -*- rst -*-
+.. -*- coding: utf-8 -*-
+
+============================
+A local repository for ocaml
+============================
+
+:date: 2013-05-23
+:tags: ocaml
+:summary: |summary|
+:logo: static/images/ocaml/camel.jpg
+:slug: un-depot-local-pour-ocaml
+:lang: en
+
+.. figure:: |filename|/images/ocaml/camel_medium.jpg
+ :figwidth: 150
+ :figclass: floatleft
+ :alt: Pavement
+
+ Image : `@Doug88888`_ (creativecommons_)
+
+.. _@Doug88888: http://www.flickr.com/photos/doug88888/3458057235/
+.. _creativecommons: http://creativecommons.org/licenses/by-nc-sa/2.0/deed.fr
+
+|summary|
+
+
+.. |summary| replace::
+ Today, ocaml is obsolete in the debian packages : the most of the
+ librairies are still linked with Ocaml3 althought Ocaml4 is out since
+ almost a year. When we need to develop with Ocaml4, we have to recompile
+ all the dependencies, but this implies to install them for the whole
+ system. But we can use a local repository with some findlib configuration.
+
+Findlib is now a required tool for an Ocaml project compilation. Each
+application uses now findlib for searching the dependencies, and the linking
+phase.
+
+We first need to create a local configuration in wich we write where to find
+the packages :
+
+
+.. code-block:: bash
+
+ destdir="/home/chimrod/ocaml/packages/"
+ path="/home/chimrod/ocaml/packages/:/usr/local/lib/ocaml/4.00.1:/usr/lib/ocaml:/usr/lib/ocaml/METAS"
+
+:destdir: is the path where we want to install the newly compiled packages.
+:path: is the path list where to find the packages.
+
+Of course, you need to replace `/home/chimrod/` by your own installation path.
+It must be an absolute path.
+
+The path to this file can be saved with the shell environnement ; we just need
+to reference it in the `.bashrc` file :
+
+.. code-block:: bash
+
+ export OCAMLFIND_CONF=/home/chimrod/ocaml/ocamlfind.conf
+
+That's now : each new package will now be installed in your packages directory,
+and the compilation will also look for this path for the required
+dependencies : you do not have to install the packages as root anymore.
diff --git a/content/Informatique/ocamlfind_fr.rst b/content/Informatique/ocamlfind_fr.rst
new file mode 100644
index 0000000..93edd40
--- /dev/null
+++ b/content/Informatique/ocamlfind_fr.rst
@@ -0,0 +1,77 @@
+.. -*- rst -*-
+.. -*- coding: utf-8 -*-
+
+=========================
+Un dépôt local pour ocaml
+=========================
+
+:date: 2013-05-23
+:tags: ocaml
+:summary: |summary|
+:logo: static/images/ocaml/camel.jpg
+:slug: un-depot-local-pour-ocaml
+:lang: fr
+
+.. figure:: |filename|/images/ocaml/camel_medium.jpg
+ :figwidth: 150
+ :figclass: floatleft
+ :alt: Pavement
+
+ Image : `@Doug88888`_ (creativecommons_)
+
+.. _@Doug88888: http://www.flickr.com/photos/doug88888/3458057235/
+.. _creativecommons: http://creativecommons.org/licenses/by-nc-sa/2.0/deed.fr
+
+|summary|
+
+
+.. |summary| replace::
+ Ocaml n'est pas à jour dans debian : l'ensemble des librairies sont encore
+ restées sur la version 3, alors qu'Ocaml4 est sorti depuis près d'un an. Il
+ peut être nécessaire de développer en utilisant ocaml4, mais on est alors
+ obligé de compiler soit même les dépendances, et les installer pour
+ l'ensemble du système, ce qui n'est pas souhaité, ni toujours possible
+ (problème de droits). Cette petite recette permet de se créer un dépôt
+ local en utilisant findlib.
+
+Findlib est devenu de facto une brique essentielle pour la gestion des
+librairies et les dépendances d'un projet. Aujourd'hui toute compilation
+utilise findlib pour rechercher les dépendances et faciliter la chaîne de
+compilation. La documentation_ du projet est assez dense, mais heureusement, il
+est très configurable.
+
+.. _documentation: http://projects.camlcity.org/projects/dl/findlib-1.3.3/doc/guide-html/index.html
+
+Nous allons commencer par nous créer un fichier de configuration local qui va
+indiquer où stocker nos librairies :
+
+.. code-block:: bash
+
+ destdir="/home/chimrod/ocaml/packages/"
+ path="/home/chimrod/ocaml/packages/:/usr/local/lib/ocaml/4.00.1:/usr/lib/ocaml:/usr/lib/ocaml/METAS"
+
+:destdir: correspond à l'emplacement d'installation des nouvelles librairies.
+:path: est l'ensemble des répertoires où chercher les dépendances. Ici
+ nous déclarons tout d'abord notre dépôt local avant de référencer
+ les répertoires système.
+
+Il faut bien sûr remplacer `/home/chimrod/` par le chemin sur votre
+installation : celui-ci doit être écrit en absolu pour le bon fonctionnement de
+findlib.
+
+Le répertoire de configuration peut être exporté via une variable shell, ce qui
+va nous faciliter la vie ; il ne nous reste plus qu'à référencer ce fichier de
+configuration dans notre environnement :
+
+.. code-block:: bash
+
+ export OCAMLFIND_CONF=/home/chimrod/ocaml/ocamlfind.conf
+
+Là encore, remplacer le chemin par celui qui est le votre sur votre système.
+
+On peut mettre cette chaîne dans le fichier `.bashrc` pour que le paramétrage
+soit pris en compte dans chaque session ouverte dans le terminal.
+
+Et le tour est joué : toutes nos nouvelles dépendances vont s'installer
+directement dans notre répertoire personnel, et nous n'avons plus besoin
+d'aller poluer le système avec nos compilation.
diff --git a/content/Perso/poker.rst b/content/Perso/poker.rst
index 8335bcf..c1fac9c 100644
--- a/content/Perso/poker.rst
+++ b/content/Perso/poker.rst
@@ -5,7 +5,7 @@
#############################
:date: 2013-04-19
-:tags: Programmation
+:tags: ocaml, Programmation
J'ai entrepris il y a quelques temps de mettre en place un moteur d'évaluation
des mains de poker. Je n'ai pas trouvé beaucoup de codes ou librairies
diff --git a/content/images/ocaml/camel.jpg b/content/images/ocaml/camel.jpg
new file mode 100644
index 0000000..3d3ce0f
--- /dev/null
+++ b/content/images/ocaml/camel.jpg
Binary files differ
diff --git a/content/images/ocaml/camel_medium.jpg b/content/images/ocaml/camel_medium.jpg
new file mode 100644
index 0000000..6ee53fb
--- /dev/null
+++ b/content/images/ocaml/camel_medium.jpg
Binary files differ