diff options
-rw-r--r-- | .SRCINFO | 71 | ||||
-rw-r--r-- | PKGBUILD | 167 | ||||
-rw-r--r-- | clang-force-libstdc++.patch | 53 | ||||
-rw-r--r-- | hhvm.install | 11 | ||||
-rw-r--r-- | hhvm.tmpfile | 1 | ||||
-rw-r--r-- | hhvm@.service | 13 | ||||
-rw-r--r-- | mcrouter-explicit-initialize-const-variable.patch | 13 | ||||
-rw-r--r-- | server.ini | 15 | ||||
-rw-r--r-- | systemd-server.conf | 3 | ||||
-rw-r--r-- | use-libstdc++.patch | 24 |
10 files changed, 371 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..bb4e166bcfdd --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,71 @@ +pkgbase = hhvm-git + pkgdesc = Virtual Machine, Runtime, and JIT for PHP + pkgver = 20150613 + pkgrel = 1 + url = http://hhvm.com + install = hhvm.install + arch = x86_64 + license = PHP + makedepends = git + makedepends = cmake + makedepends = gcc + makedepends = boost + makedepends = python2 + makedepends = pfff-git + makedepends = ocaml-findlib + makedepends = gperf + depends = boost-libs + depends = fribidi + depends = google-glog + depends = imagemagick + depends = intel-tbb + depends = jemalloc + depends = libdwarf + depends = libedit + depends = libmcrypt + depends = libmemcached + depends = libvpx + depends = libxslt + depends = libyaml + depends = mysql + depends = oniguruma + depends = php + depends = sqlite + depends = unixodbc + backup = etc/hhvm/server.ini + backup = etc/hhvm/systemd-server.conf + source = git+https://github.com/facebook/hhvm + source = git+https://github.com/hhvm/hhvm-third-party + source = git+https://github.com/facebook/folly + source = git+https://github.com/facebook/fbthrift + source = git+https://github.com/facebook/squangle + source = git+https://github.com/facebook/proxygen + source = git+https://github.com/facebook/mcrouter + source = git+https://github.com/google/re2 + source = git+https://github.com/webscalesql/webscalesql-5.6 + source = hhvm.tmpfile + source = hhvm@.service + source = server.ini + source = systemd-server.conf + source = fix_latomic_check.patch::https://github.com/facebook/hhvm/pull/5397.patch + source = clang-force-libstdc++.patch + source = mcrouter-explicit-initialize-const-variable.patch + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = c049b53f5ca7f8384d3b0a9d257018770b3a171f3b7ae8865cbb2c402a26b5e9 + sha256sums = dddf4325926a41b3f1b5a41a1a42364ee463ab627f9d9b05ccf7c4660af3a51c + sha256sums = bca85e0445f3e26df65876c52e507aec8146cd31cce12c82846b55705529caed + sha256sums = 66ae41fb6ef07dd02a9c959ab6b6e07bcb1d17b0c164a091fc5ecd9dc7967cd0 + sha256sums = cca20abfc2742062d77ae448942bc2feea4073c41198a4fe8db93620cc6fea76 + sha256sums = a8173502536c6f8e3af5d2cfaf73214b1869e1e780a842f915e8e657083a515a + sha256sums = b06ebfdb3cff48a379ea18433d74258a18d686a6ceec188661fff120a9babe0b + +pkgname = hhvm-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..ed8f803ee052 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,167 @@ +# Maintainer: Yen Chi Hsuan <yan12125 at gmail dot com> +# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com> +# Contributor: James Miller <james@pocketrent.com> + +_pkgname=hhvm +_github_addr=facebook/hhvm +pkgname=${_pkgname}-git +pkgver=20150613 +pkgrel=1 +pkgdesc="Virtual Machine, Runtime, and JIT for PHP" +arch=('x86_64') +url="http://hhvm.com" +license=('PHP') +depends=('boost-libs' + 'fribidi' + 'google-glog' + 'imagemagick' + 'intel-tbb' + 'jemalloc' + 'libdwarf' + 'libedit' + 'libmcrypt' + 'libmemcached' + 'libvpx' + 'libxslt' + 'libyaml' + 'mysql' + 'oniguruma' + 'php' + 'sqlite' + 'unixodbc') +# curl included in php +# gd is bundled in hphp/runtime/ext/gd/libgd +# libxml2 included in libxslt +# pcre included in lots of packages +makedepends=('git' 'cmake' 'gcc' 'boost' 'python2' 'pfff-git' 'ocaml-findlib' 'gperf') +source=("git+https://github.com/$_github_addr" #1 + "git+https://github.com/hhvm/hhvm-third-party" + "git+https://github.com/facebook/folly" + "git+https://github.com/facebook/fbthrift" + "git+https://github.com/facebook/squangle" + "git+https://github.com/facebook/proxygen" #6 + "git+https://github.com/facebook/mcrouter" + "git+https://github.com/google/re2" + "git+https://github.com/webscalesql/webscalesql-5.6" #9 + 'hhvm.tmpfile' + 'hhvm@.service' + 'server.ini' + 'systemd-server.conf' + 'fix_latomic_check.patch'::'https://github.com/facebook/hhvm/pull/5397.patch' + 'clang-force-libstdc++.patch' + 'mcrouter-explicit-initialize-const-variable.patch') +backup=('etc/hhvm/server.ini' 'etc/hhvm/systemd-server.conf') +sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' + 'SKIP' 'SKIP' 'SKIP' 'SKIP' + 'c049b53f5ca7f8384d3b0a9d257018770b3a171f3b7ae8865cbb2c402a26b5e9' + 'dddf4325926a41b3f1b5a41a1a42364ee463ab627f9d9b05ccf7c4660af3a51c' + 'bca85e0445f3e26df65876c52e507aec8146cd31cce12c82846b55705529caed' + '66ae41fb6ef07dd02a9c959ab6b6e07bcb1d17b0c164a091fc5ecd9dc7967cd0' + 'cca20abfc2742062d77ae448942bc2feea4073c41198a4fe8db93620cc6fea76' + 'a8173502536c6f8e3af5d2cfaf73214b1869e1e780a842f915e8e657083a515a' + 'b06ebfdb3cff48a379ea18433d74258a18d686a6ceec188661fff120a9babe0b') + +install=hhvm.install + +_EXTRA_COMPONENTS=('hackificator' 'remove_soft_types') + +pkgver() { + cd "${srcdir}/${_pkgname}" + git log -1 --format='%cd' --date=short | tr -d -- '-' +} + +prepare() { + cd "${srcdir}/${_pkgname}" + patch -p1 -i ../fix_latomic_check.patch + patch -p1 -i ../clang-force-libstdc++.patch + + git submodule init + git config submodule.third-party.url "${srcdir}/hhvm-third-party" + git submodule update + + cd third-party + git submodule init + git config submodule.folly.url "${srcdir}/folly" + git config submodule.mcrouter/src.url "${srcdir}/mcrouter" + git config submodule.proxygen/src.url "${srcdir}/proxygen" + git config submodule.re2/src.url "${srcdir}/re2" + git config submodule.squangle/squangle.url "${srcdir}/squangle" + git config submodule.thrift/src.url "${srcdir}/fbthrift" + git config submodule.webscalesqlclient/webscalesql-5.6.url "${srcdir}/webscalesql-5.6" + git submodule update + + cd "${srcdir}/${_pkgname}/third-party/mcrouter/src" + patch -p1 -i ../../../../mcrouter-explicit-initialize-const-variable.patch +} + +build() { + cd "${srcdir}/${_pkgname}" + msg2 "Building hhvm" + + # Force hardcoded MySQL unix domain socket path here + # becuase the server may not be running when building + # The path listed here is copied from PKGBUILD of extra/mariadb + # If you use a custom path setting in my.cnf, please change it + + CC=clang CXX=clang++ \ + cmake \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_PREFIX_PATH="$srcdir" \ + -DMYSQL_UNIX_SOCK_ADDR=/run/mysqld/mysqld.sock \ + -DCLANG_FORCE_LIBSTDCXX=ON \ + . + + make + + cd "${srcdir}/${_pkgname}/hphp/hack/tools" + msg2 "Building extra components" + + msg2 "hardening-wrapper leads to build failures. See FS#42748" + + for tool in "${_EXTRA_COMPONENTS[@]}" + do + pushd "$tool" + make clean + make depend + make + popd + done + + pushd augmented_types + make clean + make + popd +} + +check() { + msg2 "Make sure to enable posix.so and sysvmsg.so in php.ini for correct testing" + + cd "${srcdir}/${_pkgname}/hphp/test" + ./run --threads 2 quick +} + +package() { + cd "${srcdir}/${_pkgname}" + make DESTDIR="$pkgdir/" install + + msg2 "Install extra components" + cd "${srcdir}/${_pkgname}/hphp/hack/bin/tools" + for tool in * + do + install -Dm755 "${tool}" "${pkgdir}/usr/bin/${tool}" + done + + cd "${srcdir}/${_pkgname}/hphp/hack/tools/augmented_types/_build" + install -Dm755 augmented_types.native "${pkgdir}/usr/bin/augmented_types" + + cd "${srcdir}" + install -Dm644 hhvm.tmpfile "${pkgdir}/usr/lib/tmpfiles.d/hhvm.conf" + install -Dm644 hhvm@.service "${pkgdir}/usr/lib/systemd/system/hhvm@.service" + install -Dm644 server.ini "${pkgdir}/etc/hhvm/server.ini" + install -Dm644 systemd-server.conf "${pkgdir}/etc/hhvm/systemd-server.conf" + + install -Ddm755 -o http "${pkgdir}/var/log/hhvm" + install -Ddm755 -o http "${pkgdir}/var/lib/hhvm" +} diff --git a/clang-force-libstdc++.patch b/clang-force-libstdc++.patch new file mode 100644 index 000000000000..abaf104b7680 --- /dev/null +++ b/clang-force-libstdc++.patch @@ -0,0 +1,53 @@ +diff --git a/CMake/FollySetup.cmake b/CMake/FollySetup.cmake +index 4d9fbd8..5170883 100644 +--- a/CMake/FollySetup.cmake ++++ b/CMake/FollySetup.cmake +@@ -46,5 +46,7 @@ if(CYGWIN) + endif() + + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +- add_definitions("-DFOLLY_USE_LIBCPP=1") ++ if(NOT CLANG_FORCE_LIBSTDCXX) ++ add_definitions("-DFOLLY_USE_LIBCPP=1") ++ endif() + endif() +diff --git a/CMake/HPHPCompiler.cmake b/CMake/HPHPCompiler.cmake +index 31d8309..60bc9d8 100644 +--- a/CMake/HPHPCompiler.cmake ++++ b/CMake/HPHPCompiler.cmake +@@ -29,6 +29,13 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + endif() + set(LLVM_OPT "${LLVM_OPT} --param=ssp-buffer-size=4 -pie -fPIC") + endif() ++ ++ if(CLANG_FORCE_LIBSTDCXX) ++ set(CLANG_STDLIB "libstdc++") ++ else() ++ set(CLANG_STDLIB "libc++") ++ endif() ++ + set(CMAKE_C_FLAGS_DEBUG "-g") + set(CMAKE_CXX_FLAGS_DEBUG "-g") + set(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") +@@ -38,7 +45,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LLVM_OPT} -w") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11 -stdlib=libc++ -fno-omit-frame-pointer -Woverloaded-virtual -Wno-deprecated -Wno-strict-aliasing -Wno-write-strings -Wno-invalid-offsetof -fno-operator-names -Wno-error=array-bounds -Wno-error=switch -Werror=format-security -Wno-unused-result -Wno-sign-compare -Wno-attributes -Wno-maybe-uninitialized -Wno-mismatched-tags -Wno-unknown-warning-option -Wno-return-type-c-linkage -Qunused-arguments ${LLVM_OPT}") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11 -stdlib=${CLANG_STDLIB} -fno-omit-frame-pointer -Woverloaded-virtual -Wno-deprecated -Wno-strict-aliasing -Wno-write-strings -Wno-invalid-offsetof -fno-operator-names -Wno-error=array-bounds -Wno-error=switch -Werror=format-security -Wno-unused-result -Wno-sign-compare -Wno-attributes -Wno-maybe-uninitialized -Wno-mismatched-tags -Wno-unknown-warning-option -Wno-return-type-c-linkage -Qunused-arguments ${LLVM_OPT}") + # using GCC + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion OUTPUT_VARIABLE GCC_VERSION) +diff --git a/CMake/Options.cmake b/CMake/Options.cmake +index 055c52d..1e79ef4 100644 +--- a/CMake/Options.cmake ++++ b/CMake/Options.cmake +@@ -12,6 +12,8 @@ option(ENABLE_FULL_SETLINE "Enable full setline function for debugger and code-c + + option(USE_JEMALLOC "Use jemalloc" ON) + ++option(CLANG_FORCE_LIBSTDCXX "Force libstdc++ when building against Clang/LLVM" OFF) ++ + option(USE_TCMALLOC "Use tcmalloc (if jemalloc is not used)" ON) + option(USE_GOOGLE_HEAP_PROFILER "Use Google heap profiler" OFF) + option(USE_GOOGLE_CPU_PROFILER "Use Google cpu profiler" OFF) diff --git a/hhvm.install b/hhvm.install new file mode 100644 index 000000000000..6f322339526a --- /dev/null +++ b/hhvm.install @@ -0,0 +1,11 @@ +post_install() { + if [[ ! -d run/hhvm ]]; then + usr/bin/systemd-tmpfiles --create hhvm.conf + fi + + echo Run 'systemctl start hhvm@server.service' to start the server. +} + +post_upgrade() { + post_install +} diff --git a/hhvm.tmpfile b/hhvm.tmpfile new file mode 100644 index 000000000000..a3ae0eea66ca --- /dev/null +++ b/hhvm.tmpfile @@ -0,0 +1 @@ +d /run/hhvm 755 http root diff --git a/hhvm@.service b/hhvm@.service new file mode 100644 index 000000000000..ee30f6caa4cf --- /dev/null +++ b/hhvm@.service @@ -0,0 +1,13 @@ +[Unit] +Description=HHVM FastCGI application server +After=syslog.target network.target + +[Service] +EnvironmentFile=/etc/hhvm/systemd-%I.conf + +PIDFile=/run/hhvm/hhvm-%I.pid +PrivateTmp=true +ExecStart=/usr/bin/hhvm --mode server --config=/etc/hhvm/%I.ini --user ${User} -vPidFile=/run/hhvm/hhvm-%I.pid + +[Install] +WantedBy=multi-user.target diff --git a/mcrouter-explicit-initialize-const-variable.patch b/mcrouter-explicit-initialize-const-variable.patch new file mode 100644 index 000000000000..4912f2dbf0f0 --- /dev/null +++ b/mcrouter-explicit-initialize-const-variable.patch @@ -0,0 +1,13 @@ +diff --git a/mcrouter/lib/config/ConfigPreprocessor.cpp b/mcrouter/lib/config/ConfigPreprocessor.cpp +index aa182f1..d4b7004 100644 +--- a/mcrouter/lib/config/ConfigPreprocessor.cpp ++++ b/mcrouter/lib/config/ConfigPreprocessor.cpp +@@ -161,7 +161,7 @@ size_t unescapeUntil(StringPiece from, string& to, char c) { + + } // namespace + +-const ConfigPreprocessor::Context ConfigPreprocessor::emptyContext_; ++const ConfigPreprocessor::Context ConfigPreprocessor::emptyContext_ = {}; + + ///////////////////////////////Macro//////////////////////////////////////////// + diff --git a/server.ini b/server.ini new file mode 100644 index 000000000000..82dd04c03913 --- /dev/null +++ b/server.ini @@ -0,0 +1,15 @@ +; Only basic setttins +; See http://docs.hhvm.com/manual/en/ini.php for more information + +hhvm.server.type = fastcgi +hhvm.server.port = 9000 +hhvm.server.source_root = /srv/http +hhvm.admin_server.port = 9001 + +; Logging settings +hhvm.log.level = Verbose +hhvm.log.use_log_file = true +hhvm.log.file = /var/log/hhvm/error.log + +; Miscellaneous +hhvm.repo.central.path = /var/lib/hhvm/hhvm.hhbc diff --git a/systemd-server.conf b/systemd-server.conf new file mode 100644 index 000000000000..c8b5a68d9ecd --- /dev/null +++ b/systemd-server.conf @@ -0,0 +1,3 @@ +PidFile=/run/hhvm/hhvm-server.pid +User=http +Group=http diff --git a/use-libstdc++.patch b/use-libstdc++.patch new file mode 100644 index 000000000000..9e5077a7616c --- /dev/null +++ b/use-libstdc++.patch @@ -0,0 +1,24 @@ +diff --git a/CMake/FollySetup.cmake b/CMake/FollySetup.cmake +index 4d9fbd8..acb08e0 100644 +--- a/CMake/FollySetup.cmake ++++ b/CMake/FollySetup.cmake +@@ -46,5 +46,5 @@ if(CYGWIN) + endif() + + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +- add_definitions("-DFOLLY_USE_LIBCPP=1") ++# add_definitions("-DFOLLY_USE_LIBCPP=1") + endif() +diff --git a/CMake/HPHPCompiler.cmake b/CMake/HPHPCompiler.cmake +index 31d8309..6a51574 100644 +--- a/CMake/HPHPCompiler.cmake ++++ b/CMake/HPHPCompiler.cmake +@@ -38,7 +38,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LLVM_OPT} -w") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11 -stdlib=libc++ -fno-omit-frame-pointer -Woverloaded-virtual -Wno-deprecated -Wno-strict-aliasing -Wno-write-strings -Wno-invalid-offsetof -fno-operator-names -Wno-error=array-bounds -Wno-error=switch -Werror=format-security -Wno-unused-result -Wno-sign-compare -Wno-attributes -Wno-maybe-uninitialized -Wno-mismatched-tags -Wno-unknown-warning-option -Wno-return-type-c-linkage -Qunused-arguments ${LLVM_OPT}") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++11 -stdlib=libstdc++ -fno-omit-frame-pointer -Woverloaded-virtual -Wno-deprecated -Wno-strict-aliasing -Wno-write-strings -Wno-invalid-offsetof -fno-operator-names -Wno-error=array-bounds -Wno-error=switch -Werror=format-security -Wno-unused-result -Wno-sign-compare -Wno-attributes -Wno-maybe-uninitialized -Wno-mismatched-tags -Wno-unknown-warning-option -Wno-return-type-c-linkage -Qunused-arguments ${LLVM_OPT}") + # using GCC + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion OUTPUT_VARIABLE GCC_VERSION) |