Skip to content

Building & Installing

Et7f3 edited this page Jun 3, 2021 · 16 revisions

Building & Installing

Install esy

esy is like npm for native code. If you don't have it already, install it by running:

npm install -g esy

NOTE: Revery requires esy at version 0.6.0+

Building

  • git clone https://github.com/revery-ui/revery
  • cd revery
  • esy install
  • esy build

For macOS users

If your build takes too much time then you can pre-install some libraries:

  • brew install cmake
  • brew install libpng ragel

For Linux users

We use a version of esy-skia that require python2 or a binary called python but still v2. We haven't merged upstream where they require python3.

Install the following packages with your package manager of choice:

  • cmake
  • ragel

Depending on your distribution you may also need to install nasm. If you get failure because a .h is not found make sure to have installed the dev version of the package. For instance libfontconfig1-dev often it has -dev or -devel suffix.

For Ubuntu you may need these additional packages

If you haven't installed it already build-essential is required for some basic build tools.

  • libpng-dev
  • libbz2-dev
  • m4
  • xorg-dev
  • libglu1-mesa-dev
  • libharfbuzz-dev
  • libgtk-3-dev
  • libfontconfig1-dev
  • nasm
  • clang

NOTE: reason-fontkit (a dependency of revery) requires harfbuzz 1.7.7+. This means revery requires Ubuntu 18.10+ (or you can install libharfbuzz-dev@1.8.8 by adding 'cosmic' packages to your sources, but proceed with caution since you can break other packages this way)

NOTE: On more recent versions of Ubuntu, you may get a build error regarding libpangoft2. To fix this, first try adding the following to the root of your package.json:

  "resolutions": {
   "esy-harfbuzz": "github:Et7f3/esy-harfbuzz#4309597b403374fe65868e8971c114555c96c6e4"
  },

If this doesn't work, try deleting your ./_esy and ~/.esy directories and re-running esy install and esy build. If the error persists, feel free to open an issue.

For Fedora you may need these additional packages

If you haven't installed it already @development-tools is required for some basic build tools.

  • clang
  • libasan
  • libpng-devel
  • bzip2-devel
  • xorg-x11-server-devel
  • mesa-libGLU-devel
  • harfbuzz-devel
  • libXext-devel
  • fontconfig-devel
  • nasm
  • m4
  • libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel libXxf86vm-devel - Possibly needed on newer Fedora versions.
  • perl-Digest-SHA - Only if missing shasum.

NOTE: reason-fontkit (a dependency of revery) requires harfbuzz 1.7.7+. This means revery requires Fedora 29+

NOTE: Currently esy-skia requires Python 2 to install. If your version of Fedora lacks that, you may need to install python27.

For Archlinux you may need these additional packages assuming you have base and base-devel package.
  • libpng
  • libxcursor
  • libxi
  • libxinerama
  • libxrandr
  • harfbuzz
  • glu
  • gtk3
  • fontconfig (required by reason-font-manager might be removed in the next release)
  • nasm
  • clang

NOTE: if esy fail with shasum not found try to run with PATH=/usr/bin/core_perl:$PATH esy instead of esy. (You might get this error in docker).

(For unknown reason gtk3 is not found inside docker when we are a non-root user. I can't manage to install esy as root but it is not recommended through)

For Windows native

Revery depends on esy-skia which requires Microsoft Visual Studio 2017 VC Tools.

This can be installed in one of two ways:

  • NPM: npm install -g windows-build-tools
  • chocolately: choco install visualstudio2017buildtools visualstudio2017-workload-vctools -y

NOTE: esy requires building from an Administrator prompt (either cmd.exe or Powershell).

For Windows Subsystem for Linux (WSL)

Make sure to check the specific requirements for your Linux distribution, above.

NOTE: Hardware acceleration is not enabled by default in WSL (instead, WSL will fall-back to a software renderer). This is problematic for performance - for that reason, we recommend building and running Revery natively on Windows instead of with WSL. For more info see: (https://github.com/Microsoft/WSL/issues/637 and a potential workaround)

Running

Native Build

After building, you can run the example app by running:

  • esy '@examples' install
  • esy '@examples' run

Check out our examples to see how they work!

JavaScript Build

You can also build the example app for JavaScript by running:

  • esy '@js' install
  • esy '@js' run

And navigating your browser to the locally hosted URL.

Tests

Tests can be run with:

  • esy b dune runtest

Benchmarks

Benchmarks can be built & run with:

  • esy '@bench' run

Documentation

Documentation can be built & run with:

  • esy '@doc' run

NOTE: This will start an http-server at localhost; open a URL at the specified address to the view latest docs.