Allow building ext_zend_compat extensions
By default, zend source compatability remains disabled, however you can now explicitly request compilation of the infrastructure and the extensions it supports via: cmake -DENABLE_ZEND_COMPAT=ON . Note that CMake caches -D defines between runs, so a later call without ENABLE_ZEND_COMPAT will still retain the option enabled. Either explicitly set it to OFF, or delete CMakeCache.txt if switching between the two.
Esse commit está contido em:
+2
-12
@@ -32,18 +32,8 @@ hphp.log
|
|||||||
/hphp/hhvm/gen
|
/hphp/hhvm/gen
|
||||||
/hphp/hhvm/hhvm
|
/hphp/hhvm/hhvm
|
||||||
|
|
||||||
/hphp/runtime/ext/*.ext_hhvm.cpp
|
*.ext_hhvm.cpp
|
||||||
/hphp/runtime/ext/*.ext_hhvm.h
|
*.ext_hhvm.h
|
||||||
/hphp/runtime/ext/*/*.ext_hhvm.cpp
|
|
||||||
/hphp/runtime/ext/*/*.ext_hhvm.h
|
|
||||||
/hphp/runtime/ext/*/*/*.ext_hhvm.h
|
|
||||||
/hphp/runtime/ext/*/*/*.ext_hhvm.cpp
|
|
||||||
/hphp/runtime/ext_zend_compat/*/*.ext_hhvm.cpp
|
|
||||||
/hphp/runtime/ext_zend_compat/*/*.ext_hhvm.h
|
|
||||||
/hphp/runtime/ext_zend_compat/*/*/*.ext_hhvm.cpp
|
|
||||||
/hphp/runtime/ext_zend_compat/*/*/*.ext_hhvm.h
|
|
||||||
/hphp/runtime/base/builtin-functions.cpp.ext_hhvm.cpp
|
|
||||||
/hphp/runtime/base/builtin-functions.cpp.ext_hhvm.h
|
|
||||||
/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.cpp
|
/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.cpp
|
||||||
/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.h
|
/hphp/runtime/ext_hhvm/ext_hhvm_infotabs.h
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
option(ENABLE_ZEND_COMPAT "Enable Zend source compatability (beta)" OFF)
|
||||||
|
|
||||||
|
set(ZEND_COMPAT_PROJECTS)
|
||||||
|
set(ZEND_COMPAT_BUILD_DIRS)
|
||||||
|
set(ZEND_COMPAT_EXCLUDE_IDLS)
|
||||||
|
set(ZEND_COMPAT_LINK_LIBRARIES)
|
||||||
|
|
||||||
|
# Look for projects
|
||||||
|
set(EZC_DIR "${HPHP_HOME}/hphp/runtime/ext_zend_compat/")
|
||||||
|
file(GLOB ezc_projects RELATIVE ${EZC_DIR} "${EZC_DIR}/*")
|
||||||
|
foreach(ezc_project ${ezc_projects})
|
||||||
|
get_filename_component(ezc_name ${ezc_project} NAME)
|
||||||
|
if ((NOT ${ezc_name} STREQUAL "php-src") AND (IS_DIRECTORY "${EZC_DIR}/${ezc_name}"))
|
||||||
|
list(APPEND ZEND_COMPAT_PROJECTS ${ezc_name})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if (ENABLE_ZEND_COMPAT)
|
||||||
|
foreach(ezc_project ${ZEND_COMPAT_PROJECTS})
|
||||||
|
if (${ezc_project} STREQUAL "yaml")
|
||||||
|
find_package(LibYaml)
|
||||||
|
if (LibYaml_INCLUDE_DIRS)
|
||||||
|
list(APPEND ZEND_COMPAT_BUILD_DIRS "${EZC_DIR}/yaml")
|
||||||
|
include_directories(${LibYaml_INCLUDE_DIRS})
|
||||||
|
list(APPEND ZEND_COMPAT_LINK_LIBRARIES ${LibYaml_LIBRARIES})
|
||||||
|
else()
|
||||||
|
list(APPEND ZEND_COMPAT_EXCLUDE_IDLS "yaml.idl.json")
|
||||||
|
endif()
|
||||||
|
elseif (${ezc_project} STREQUAL "mongo")
|
||||||
|
include_directories("${EZC_DIR}/mongo/mcon")
|
||||||
|
list(APPEND ZEND_COMPAT_BUILD_DIRS "${EZC_DIR}/mongo")
|
||||||
|
else()
|
||||||
|
list(APPEND ZEND_COMPAT_BUILD_DIRS "${EZC_DIR}/${ezc_project}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if (ZEND_COMPAT_BUILD_DIRS)
|
||||||
|
list(APPEND ZEND_COMPAT_BUILD_DIRS "${EZC_DIR}/php-src")
|
||||||
|
include_directories("${EZC_DIR}/php-src")
|
||||||
|
include_directories("${EZC_DIR}/php-src/main")
|
||||||
|
include_directories("${EZC_DIR}/php-src/Zend")
|
||||||
|
include_directories("${EZC_DIR}/php-src/TSRM")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
foreach(ezc_project ${ZEND_COMPAT_PROJECTS})
|
||||||
|
list(APPEND ZEND_COMPAT_EXCLUDE_IDLS "${ezc_project}.idl.json")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# This is really ugly, but cmake's list(FIND)
|
||||||
|
# doesn't entirely work the way it should
|
||||||
|
macro(ZEND_COMPAT_STRIP_IDLS IDLS)
|
||||||
|
foreach(idl ${${IDLS}})
|
||||||
|
get_filename_component(idl_name ${idl} NAME)
|
||||||
|
foreach(f ${ARGV})
|
||||||
|
if (${idl_name} STREQUAL ${f})
|
||||||
|
list(REMOVE_ITEM ${IDLS} ${idl})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
if (LibYaml_LIBRARIES AND LibYaml_INCLUDE_DIRS)
|
||||||
|
set (LibYaml_FIND_QUIETLY TRUE)
|
||||||
|
endif (LibYaml_LIBRARIES AND LibYaml_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
find_path (LibYaml_INCLUDE_DIRS NAMES yaml.h)
|
||||||
|
find_library (LibYaml_LIBRARIES NAMES yaml)
|
||||||
|
|
||||||
|
include (FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibYaml DEFAULT_MSG
|
||||||
|
LibYaml_LIBRARIES
|
||||||
|
LibYaml_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
mark_as_advanced(LibYaml_INCLUDE_DIRS LibYaml_LIBRARIES)
|
||||||
@@ -38,6 +38,27 @@ function(auto_sources RETURN_VALUE PATTERN SOURCE_SUBDIRS)
|
|||||||
set(${RETURN_VALUE} ${${RETURN_VALUE}} PARENT_SCOPE)
|
set(${RETURN_VALUE} ${${RETURN_VALUE}} PARENT_SCOPE)
|
||||||
endfunction(auto_sources)
|
endfunction(auto_sources)
|
||||||
|
|
||||||
|
macro(HHVM_SELECT_SOURCES DIR)
|
||||||
|
auto_sources(files "*.cpp" "RECURSE" "${DIR}")
|
||||||
|
foreach(f ${files})
|
||||||
|
if (NOT (${f} MATCHES "(ext_hhvm|/(old-)?tests?/)"))
|
||||||
|
list(APPEND CXX_SOURCES ${f})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
auto_sources(files "*.c" "RECURSE" "${DIR}")
|
||||||
|
foreach(f ${files})
|
||||||
|
if (NOT (${f} MATCHES "(ext_hhvm|/(old-)?tests?/)"))
|
||||||
|
list(APPEND C_SOURCES ${f})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
auto_sources(files "*.S" "RECURSE" "${DIR}")
|
||||||
|
foreach(f ${files})
|
||||||
|
if (NOT (${f} MATCHES "(ext_hhvm|/(old-)?tests?/)"))
|
||||||
|
list(APPEND ASM_SOURCES ${f})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endmacro(HHVM_SELECT_SOURCES)
|
||||||
|
|
||||||
function(CONTAINS_STRING FILE SEARCH RETURN_VALUE)
|
function(CONTAINS_STRING FILE SEARCH RETURN_VALUE)
|
||||||
file(STRINGS ${FILE} FILE_CONTENTS REGEX ".*${SEARCH}.*")
|
file(STRINGS ${FILE} FILE_CONTENTS REGEX ".*${SEARCH}.*")
|
||||||
if (FILE_CONTENTS)
|
if (FILE_CONTENTS)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
include(HPHPSetup)
|
include(HPHPSetup)
|
||||||
include(FollySetup)
|
include(FollySetup)
|
||||||
|
include(ExtZendCompat)
|
||||||
|
|
||||||
# HHVM Build
|
# HHVM Build
|
||||||
SET(USE_HHVM TRUE)
|
SET(USE_HHVM TRUE)
|
||||||
|
|||||||
@@ -1,30 +1,16 @@
|
|||||||
set(RECURSIVE_SOURCE_SUBDIRS base debugger eval ext server vm)
|
set(RECURSIVE_SOURCE_SUBDIRS base debugger eval ext server vm)
|
||||||
foreach (dir ${RECURSIVE_SOURCE_SUBDIRS})
|
foreach (dir ${RECURSIVE_SOURCE_SUBDIRS})
|
||||||
auto_sources(files "*.cpp" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
|
HHVM_SELECT_SOURCES("${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
|
||||||
list(APPEND CXX_SOURCES ${files})
|
|
||||||
|
|
||||||
auto_sources(files "*.c" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
|
|
||||||
list(APPEND C_SOURCES ${files})
|
|
||||||
|
|
||||||
auto_sources(files "*.S" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
|
|
||||||
list(APPEND ASM_SOURCES ${files})
|
|
||||||
endforeach(dir ${RECURSIVE_SOURCE_SUBDIRS})
|
endforeach(dir ${RECURSIVE_SOURCE_SUBDIRS})
|
||||||
|
foreach (dir ${ZEND_COMPAT_BUILD_DIRS})
|
||||||
|
HHVM_SELECT_SOURCES("${dir}")
|
||||||
|
endforeach(dir ${ZEND_COMPAT_BUILD_DIRS})
|
||||||
|
|
||||||
if(NOT LINUX)
|
if(NOT LINUX)
|
||||||
add_definitions(-DNO_HARDWARE_COUNTERS)
|
add_definitions(-DNO_HARDWARE_COUNTERS)
|
||||||
list(REMOVE_ITEM CXX_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/vm/debug/elfwriter.cpp)
|
list(REMOVE_ITEM CXX_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/vm/debug/elfwriter.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# remove ext_hhvm, and anything in a test folder
|
|
||||||
foreach (file ${CXX_SOURCES})
|
|
||||||
if (${file} MATCHES "ext_hhvm")
|
|
||||||
list(REMOVE_ITEM CXX_SOURCES ${file})
|
|
||||||
endif()
|
|
||||||
if (${file} MATCHES "/test/")
|
|
||||||
list(REMOVE_ITEM CXX_SOURCES ${file})
|
|
||||||
endif()
|
|
||||||
endforeach(file ${CXX_SOURCES})
|
|
||||||
|
|
||||||
if(NOT ENABLE_FASTCGI)
|
if(NOT ENABLE_FASTCGI)
|
||||||
foreach (file ${CXX_SOURCES})
|
foreach (file ${CXX_SOURCES})
|
||||||
if (${file} MATCHES "/fastcgi/")
|
if (${file} MATCHES "/fastcgi/")
|
||||||
|
|||||||
@@ -28,20 +28,32 @@ macro(EXT_HHVM_FILE SOURCES HEADERS REL EHHVM_OS EHHVM_ARCH)
|
|||||||
COMMENT "Generating ext_hhvm wrapper for ${REL}")
|
COMMENT "Generating ext_hhvm wrapper for ${REL}")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
macro(EXT_HHVM_DIR SOURCES HEADERS DIR)
|
||||||
|
string(LENGTH "${HPHP_HOME}/hphp/runtime/" HPHP_DIR_LEN)
|
||||||
|
auto_sources(files "*.cpp" "RECURSE" "${DIR}")
|
||||||
|
foreach (f ${files})
|
||||||
|
if (NOT ${f} MATCHES "(.ext_hhvm.cpp|/(old-)?tests?/)")
|
||||||
|
string(LENGTH ${f} f_LEN)
|
||||||
|
math(EXPR f_REL_LEN "${f_LEN} - ${HPHP_DIR_LEN}")
|
||||||
|
string(SUBSTRING ${f} ${HPHP_DIR_LEN} ${f_REL_LEN} f_REL)
|
||||||
|
EXT_HHVM_FILE(${SOURCES} ${HEADERS} ${f_REL} ${EXT_HHVM_OS} ${EXT_HHVM_ARCH})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# Generate ext_hhvm stubs for ext/*.cpp
|
# Generate ext_hhvm stubs for ext/*.cpp
|
||||||
string(LENGTH "${HPHP_HOME}/hphp/runtime/" HPHP_DIR_LEN)
|
EXT_HHVM_DIR(CXX_SOURCES CXX_HEADERS "${HPHP_HOME}/hphp/runtime/ext")
|
||||||
auto_sources(files "*.cpp" "RECURSE" "${HPHP_HOME}/hphp/runtime/ext")
|
|
||||||
foreach (f ${files})
|
|
||||||
if (NOT ${f} MATCHES ".ext_hhvm.cpp")
|
|
||||||
string(LENGTH ${f} f_LEN)
|
|
||||||
math(EXPR f_REL_LEN "${f_LEN} - ${HPHP_DIR_LEN}")
|
|
||||||
string(SUBSTRING ${f} ${HPHP_DIR_LEN} ${f_REL_LEN} f_REL)
|
|
||||||
EXT_HHVM_FILE(CXX_SOURCES CXX_HEADERS ${f_REL} ${EXT_HHVM_OS} ${EXT_HHVM_ARCH})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
# ...and explicitly for builtin-functions.cpp
|
# ...and explicitly for builtin-functions.cpp
|
||||||
EXT_HHVM_FILE(CXX_SOURCES CXX_HEADERS "base/builtin-functions.cpp" ${EXT_HHVM_OS} ${EXT_HHVM_ARCH})
|
EXT_HHVM_FILE(CXX_SOURCES CXX_HEADERS "base/builtin-functions.cpp" ${EXT_HHVM_OS} ${EXT_HHVM_ARCH})
|
||||||
|
|
||||||
|
# Pick up relevant zend_ext_compat stubs
|
||||||
|
if (ZEND_COMPAT_BUILD_DIRS)
|
||||||
|
foreach (dir ${ZEND_COMPAT_BUILD_DIRS})
|
||||||
|
EXT_HHVM_DIR(CXX_SOURCES CXX_HEADERS ${dir})
|
||||||
|
endforeach()
|
||||||
|
list(APPEND CXX_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ext_zend_compat.cpp")
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
## ext_hhvm_infotabs
|
## ext_hhvm_infotabs
|
||||||
@@ -50,11 +62,8 @@ EXT_HHVM_FILE(CXX_SOURCES CXX_HEADERS "base/builtin-functions.cpp" ${EXT_HHVM_OS
|
|||||||
set(INFOTABS_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/ext_hhvm_infotabs.h")
|
set(INFOTABS_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/ext_hhvm_infotabs.h")
|
||||||
set(INFOTABS_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/ext_hhvm_infotabs.cpp")
|
set(INFOTABS_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/ext_hhvm_infotabs.cpp")
|
||||||
|
|
||||||
# Exclude ext_zend_compact stuff
|
|
||||||
auto_sources(HPHP_IDLS "*.idl.json" "RECURSE" "${HPHP_HOME}/hphp/system/idl")
|
auto_sources(HPHP_IDLS "*.idl.json" "RECURSE" "${HPHP_HOME}/hphp/system/idl")
|
||||||
foreach (zext calendar ftp gettext mongo oauth yaml)
|
ZEND_COMPAT_STRIP_IDLS(HPHP_IDLS ${ZEND_COMPAT_EXCLUDE_IDLS})
|
||||||
list(REMOVE_ITEM HPHP_IDLS "${HPHP_HOME}/hphp/system/idl/${zext}.idl.json")
|
|
||||||
endforeach ()
|
|
||||||
|
|
||||||
# Generate ext_hhvm_infotabs.h based on ext_hhvm files being generated
|
# Generate ext_hhvm_infotabs.h based on ext_hhvm files being generated
|
||||||
file(WRITE ${INFOTABS_HEADER} "")
|
file(WRITE ${INFOTABS_HEADER} "")
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ typedef unsigned long int uint32_t;
|
|||||||
#define ULong uint32_t
|
#define ULong uint32_t
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include "malloc.h"
|
#include "hphp/util/alloc.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#else
|
#else
|
||||||
#ifndef KR_headers
|
#ifndef KR_headers
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
auto_sources(IDL_SRCS "*.idl.json" "RECURSE" "${HPHP_HOME}/hphp/system/idl")
|
auto_sources(IDL_SRCS "*.idl.json" "RECURSE" "${HPHP_HOME}/hphp/system/idl")
|
||||||
foreach (zext calendar ftp gettext mongo oauth yaml)
|
ZEND_COMPAT_STRIP_IDLS(IDL_SRCS ${ZEND_COMPAT_EXCLUDE_IDLS})
|
||||||
list(REMOVE_ITEM IDL_SRCS "${HPHP_HOME}/hphp/system/idl/${zext}.idl.json")
|
|
||||||
endforeach ()
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT "class_map.cpp" "constants.h"
|
add_custom_command(OUTPUT "class_map.cpp" "constants.h"
|
||||||
DEPENDS ${IDL_SRCS} gen-class-map
|
DEPENDS ${IDL_SRCS} gen-class-map
|
||||||
|
|||||||
Referência em uma Nova Issue
Bloquear um usuário