Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

182 lines (133 sloc) 8.22 kb

Getting Opa

At the time of this writing, Opa is available for MacOS X and Linux. A Windows port is in the works and Opa should also work on a number of other operating systems (e.g. BSD) but these platforms are not supported for the moment.

Installing Opa

The easiest solution for installing Opa is to download an installer from our website.

MacOS X

  • If you have not done so yet, install the XCode tools, provided by Apple with your copy of MacOS X. If you do not have XCode, you can either download the latest version from the Mac AppStore (paying) or download an older version from Apple’s website (free, registration required). In addition to general development utilities, this package provides some of the low-level, Mac-specific, tools used by Opa to produce server-side executables.

  • Download Opa for MacOS X.

  • Once the download is complete, if your browser does not open automatically the file you have just downloaded, go to your Download folder and open this file. This should open a new Finder window containing the Opa installer package.

  • Open the Opa installer package by double-clicking on it.

  • Follow the instructions on the screen. You will need the password of an administrative account.

  • Once the installation is complete, the Opa compiler will be installed in the directory

    /opt/mlstate

and symbolic links will be created in /usr/local/bin hence you should not have to modify your PATH variable to enjoy the Opa compiler and its tools.

Ubuntu Linux, Debian Linux

The following instructions are also valid for all Debian-based Linux distributions.

  • Download the Ubuntu Linux package.

  • Once the download is complete, your operating system will offer you to install Opa using a tool such as gdebi or kdebi.

  • Follow the instructions on the screen. You will need the password of an account with administrative rights.

  • Once the installation is complete, the Opa compiler will be installed in the directory

    /usr/bin

and the documentation and examples will be in

/usr/share/doc/opa

Other Linux distribution

To install Opa on Suse, Red Hat, Fedora and other distributions of Linux which do not use the .deb system, or if you do not have administrative rights on your machine, take the following steps:

  • Using your package manager, install packages:

    • libssl-devel

    • zlib1g-devel

  • Or, if these packages do not exist in your distribution, install whichever packages provide

    • library libssl.so

    • library libz.so

  • Download the Linux self-extracting package.

  • When prompted by your browser, choose to save the file in a temporary directory, for instance, /tmp.

  • To install as a user:

    • Set the execution permission on the downloaded program

    • Run it and follow the instructions on the screen

    • The compiler is installed by default in ~/mlstate-opa/bin

  • To install system-wide, open a terminal (if you are using KDE, the terminal is called Konsole)

    • In the terminal, write:

      sudo sh [complete path to the file you have just downloaded]
    • Follow the instructions on the screen

    • By default, the installation is done in /usr/local

  • This installation comes with an un-installation script, in [install prefix]/share/opa/uninstall.sh

Building Opa from the sources

Caution

Work in progress

Should you wish to work on an unsupported platform, or to contribute to Opa, you will need to build Opa from sources. This requires a bit more work than the installation, but you should have no major difficulties. You will need:

  • git (to download the source);

  • libgif 4.1 or later (dev version)

  • libjpeg 8b-1 or later (dev version)

  • libpng 1.2.44 or later (dev version)

  • libssl 0.9.8 or later (dev version)

  • libxft 2.2.0 or later (dev version)

  • m4

  • dblatex

  • java 1.5 or later

  • libx11 1.4.2 or later (dev version)

  • zlib 1.2.3.4 or later (dev version)

In addition, if you are using MacOS X, you will need:

  • GNU coreutils, part of MacPorts (free)

  • The XCode suite, provided by Apple with your copy of MacOS X. If you do not have XCode, you can either download the latest version from the Mac AppStore (paying) or download an older version from Apple’s website (free, registration required). This package provides some of the low-level, Mac-specific, tools used by Opa to produce server-side executables.

Once these dependencies are satisfied, take the following steps:

  • Grab the sources from github by entering in a terminal:

git clone git@github.com:MLstate/opalang.git
  • In the same terminal, enter

cd opalang
./configure --prefix=SOME_DIRECTORY
make
make install

(You may need root privileges). This will install Opa in directory SOME_DIRECTORY

Setting up your editor

The package you installed provides two Opa modes, one for Emacs and one for Vim.

Emacs

On MacOS-X, either you’re using Aquamacs and the package installation took care of it, or you should add the following line to your configuration file (which might be ~/.emacs).

;; MLstate
(autoload 'opa-mode "/Library/Application Support/Emacs/site-lisp/opa-mode/opa-mode.el" "OPA editing mode." t)
(add-to-list 'auto-mode-alist '("\\.opa$" . opa-mode))

On Linux, add the following lines to your configuration file:

;; MLstate
(autoload 'opa-mode "/usr/share/opa/emacs/opa-mode.el" "OPA editing mode." t)
(add-to-list 'auto-mode-alist '("\\.opa$" . opa-mode))
Tip

You may want to activate spell-checking on OPA comments and strings. To do so, type the command M-x flyspell-prog-mode within emacs.

And if you want this functionality activated each time you open an OPA file, you just need to add the following lines to your configuration file:

(defun enable_flyspell ()
  (ispell-change-dictionary "american")
  (flyspell-prog-mode)
)

;; Enable spell-checking on OPA comments and strings
(add-hook 'opa-mode-hook 'enable_flyspell)

Vim

If you are running Linux (resp. MacOS-X), copy files /usr/share/opa/vim/{ftdetect,syntax}/opa.vim (resp. /opt/mlstate/share/opa/vim/{ftdetect,syntax}/opa.vim) to your .vim directory, keeping the directory structure.

Tip

Instead of copying you can create a symbolic link. This will let you be automatically up-to-date with the latest mode every time you install a new version of Opa.

Other editors

Although we do not provide configuration files for other editors yet, we would be very happy to hear about it.

Jump to Line
Something went wrong with that request. Please try again.