Skip to content

Building and installing HHVM on Gentoo

Alex Guzman edited this page Aug 11, 2016 · 16 revisions

There's a community-maintained Portage overlay containing an HHVM ebuild. Adding this overlay will let you install HHVM through Gentoo's package manager.

Update repositories and install git

If not already installed, install git.

sudo emerge --sync
sudo emerge dev-vcs/git

Download and include portage overlay

If you have layman installed, adding the overlay is fairly straightforward:

sudo layman -S
sudo layman -a hhvm

Otherwise, go ahead and create the local overlay.

sudo mkdir -p /usr/local/portage/hhvm
sudo git clone https://github.com/reanimus/hhvm-overlay.git /usr/local/portage/hhvm --depth=1

# If you have /etc/portage/repos.conf/ set up
sudo cat >>/etc/portage/repos.conf/hhvm.conf <<EOF
[hhvm]
location = /usr/local/portage/hhvm
masters = gentoo
auto-sync = no
EOF

# If you're using the old PORTDIR_OVERLAY method in make.conf
sudo cat >>/etc/portage/make.conf <<EOF
PORTDIR_OVERLAY="/usr/local/portage/hhvm \$PORTDIR_OVERLAY"
EOF

Add necessary keywords

sudo cat >>/etc/portage/package.keywords/hhvm <<EOF
dev-libs/libdwarf ~amd64
dev-php/hhvm ~amd64
EOF

If you want to use the latest version of HHVM (git master), you should add it to the unmasked package list:

sudo cat >>/etc/portage/package.unmask/hhvm <<EOF
=dev-php/hhvm-9999
EOF

Add necessary USE flags

Some of these may be unnecessary, depending on your system's USE flags/profile. These are required when using the base amd64 profile.

sudo cat >>/etc/portage/package.use/hhvm <<EOF
net-libs/c-client kerberos
dev-libs/jemalloc stats
dev-libs/boost context
sys-devel/binutils static-libs
EOF

Build and install HHVM with all dependencies

Hint: Having enough memory can prevent some errors (RAM + swap >= 8 GiB)

sudo emerge -av hhvm

Adding HHVM server to default runlevel

sudo rc-update add hhvm default

Starting HHVM server

sudo /etc/init.d/hhvm start
Clone this wiki locally