Skip to content

Latest commit

 

History

History
75 lines (52 loc) · 3.34 KB

BUILDING.md

File metadata and controls

75 lines (52 loc) · 3.34 KB

Building Haxe from source

Obtaining the source

The Haxe compiler source files are hosted on GitHub under the HaxeFoundation account. The Haxe repository has several submodules, so cloning it should be done with the --recursive flag like so:

git clone --recursive https://github.com/HaxeFoundation/haxe.git

Alternatively, source .zip archives or tarballs can be obtained from the GitHub Haxe release overview. However, the git submodules are not included, so you will have to manually place the source code of submodules into appropriate sub-folders.

Setting up OCaml

The Haxe compiler is written in OCaml, so you have to set up an OCaml development environment. In addition, we make use of a number of OCaml libraries. We recommend using OPAM, which is an OCaml package manager that can also manage OCaml installations.

To install OPAM on Unix (e.g. Mac, Linux) systems, follow the instruction given by OPAM. On Windows, we recommend using the Cygwin/MinGW-based OPAM environment provided by fdopen, choose the 64-bit versions of everything.

The Haxe compiler requires OCaml version 4.02 or higher.

Installing dependencies

You need to install some native libraries as well as some OCaml libraries.

  • Native libraries
    • PCRE
    • zlib
    • Neko (for building haxelib)
  • OCaml libraries
    • listed in the opam file at the repository root

To install the native libraries, use the appropriate system package manager.

  • Mac OS X
  • Debian / Ubuntu
    • sudo apt install libpcre3-dev zlib1g-dev.
  • Windows (Cygwin)
    • Run the Cygwin setup-x86_64.exe against the Cygwin installation directory. Install make, git, zlib-devel, libpcre-devel, mingw64-x86_64-gcc-core, mingw64-x86_64-zlib, and mingw64-x86_64-pcre. You may need to select "Not Installed" in the dropdown list to see the packages. Copy zlib1.dll and libpcre-1.dll from path/to/cygwin/usr/x86_64-w64-mingw32/sys-root/mingw/bin to the checked out Haxe source directory.
    • Install Neko by either

To install the OCaml libraries, use OPAM as follows:

# pin the haxe package to the checked out Haxe source directory
opam pin add haxe path/to/haxe --no-action

# install the haxe package dependencies (as listed in the `opam` file)
opam install haxe --deps-only

Compile

In the checked out Haxe source directory,

# On Unix
make

# On Windows (Cygwin)
make -f Makefile.win

Install

Generally, you should remove any existing Haxe installation to avoid conflict. You should at least make sure that the HAXE_STD_PATH environment variable is not set.

To install the freshly built Haxe,

  • On Unix (e.g. Mac and Linux),
    sudo make install
  • On Windows, add the checked out Haxe source directory to the beginning of PATH.