1{ stdenv, fetchgit, cmake, pkgconfig, boost, libunwind, libmemcached
2, pcre, libevent, gd, curl, libxml2, icu, flex, bison, openssl, zlib, php
3, expat, libcap, oniguruma, libdwarf, libmcrypt, tbb, gperftools, glog, libkrb5
4, bzip2, openldap, readline, libelf, uwimap, binutils, cyrus_sasl, pam, libpng
5, libxslt, freetype, gdb, git, perl, mysql, gmp, libyaml, libedit
6, libvpx, imagemagick, fribidi, gperf, which, ocamlPackages
7}:
8
9stdenv.mkDerivation rec {
10 name = "hhvm-${version}";
11 version = "3.23.2";
12
13 # use git version since we need submodules
14 src = fetchgit {
15 url = "https://github.com/facebook/hhvm.git";
16 rev = "HHVM-${version}";
17 sha256 = "1nic49j8nghx82lgvz0b95r78sqz46qaaqv4nx48p8yrj9ysnd7i";
18 fetchSubmodules = true;
19 };
20
21 buildInputs =
22 [ cmake pkgconfig boost libunwind mysql.connector-c libmemcached pcre gdb git perl
23 libevent gd curl libxml2 icu flex bison openssl zlib php expat libcap
24 oniguruma libdwarf libmcrypt tbb gperftools bzip2 openldap readline
25 libelf uwimap binutils cyrus_sasl pam glog libpng libxslt libkrb5
26 gmp libyaml libedit libvpx imagemagick fribidi gperf which
27 ocamlPackages.ocaml ocamlPackages.ocamlbuild
28 ];
29
30 patches = [
31 ./flexible-array-members-gcc6.patch
32 ];
33
34 enableParallelBuilding = true;
35 dontUseCmakeBuildDir = true;
36 NIX_LDFLAGS = "-lpam -L${pam}/lib";
37
38 # work around broken build system
39 NIX_CFLAGS_COMPILE = "-I${freetype.dev}/include/freetype2";
40
41 # the cmake package does not handle absolute CMAKE_INSTALL_INCLUDEDIR correctly
42 # (setting it to an absolute path causes include files to go to $out/$out/include,
43 # because the absolute path is interpreted with root at $out).
44 cmakeFlags = "-DCMAKE_INSTALL_INCLUDEDIR=include";
45
46 prePatch = ''
47 substituteInPlace ./configure \
48 --replace "/usr/bin/env bash" ${stdenv.shell}
49 substituteInPlace ./third-party/ocaml/CMakeLists.txt \
50 --replace "/bin/bash" ${stdenv.shell}
51 perl -pi -e 's/([ \t(])(isnan|isinf)\(/$1std::$2(/g' \
52 hphp/runtime/base/*.cpp \
53 hphp/runtime/ext/std/*.cpp \
54 hphp/runtime/ext_zend_compat/php-src/main/*.cpp \
55 hphp/runtime/ext_zend_compat/php-src/main/*.h
56 sed '1i#include <functional>' -i third-party/mcrouter/src/mcrouter/lib/cycles/Cycles.h
57 patchShebangs .
58 '';
59
60 meta = {
61 description = "High-performance JIT compiler for PHP/Hack";
62 homepage = "http://hhvm.com";
63 license = "PHP/Zend";
64 platforms = [ "x86_64-linux" ];
65 maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
66 };
67}