Pass OS determination from CMake into gen-ext-hhvm.sh

Esse commit está contido em:
Sara Golemon
2013-07-10 17:51:12 -07:00
commit f9da9970d2
2 arquivos alterados com 19 adições e 13 exclusões
+9 -4
Ver Arquivo
@@ -3,13 +3,18 @@ set(CXX_SOURCES)
set(C_SOURCES)
set(CXX_HEADERS)
set(EXT_HHVM_ARCH "x64")
set(EXT_HHVM_OS "linux")
exec_program("uname -m" OUTPUT_VARIABLE UNAME_M)
if (UNAME_M STREQUAL "aarch64")
set(EXT_HHVM_ARCH "arm")
endif()
macro(EXT_HHVM_FILE SOURCES HEADERS REL EHHVM_ARCH)
if (APPLE)
set(EXT_HHVM_OS "darwin")
endif()
macro(EXT_HHVM_FILE SOURCES HEADERS REL EHHVM_OS EHHVM_ARCH)
set(f_SRC "${HPHP_HOME}/hphp/${REL}")
set(f_OBJ "${HPHP_HOME}/hphp/CMakeFiles/hphp_runtime_static.dir/${REL}.o")
list(APPEND ${SOURCES} "${f_SRC}.ext_hhvm.cpp")
@@ -17,7 +22,7 @@ macro(EXT_HHVM_FILE SOURCES HEADERS REL EHHVM_ARCH)
add_custom_command(OUTPUT "${f_SRC}.ext_hhvm.cpp" "${f_SRC}.ext_hhvm.h"
DEPENDS ${f_SRC} gen-ext-hhvm
COMMAND "${HPHP_HOME}/hphp/tools/bootstrap/gen-ext-hhvm.sh"
ARGS ${EHHVM_ARCH} ${f_OBJ}
ARGS ${EHHVM_OS} ${EHHVM_ARCH} ${f_OBJ}
"${f_SRC}.ext_hhvm.cpp" "${f_SRC}.ext_hhvm.h"
WORKING_DIRECTORY "${HPHP_HOME}/hphp/tools/bootstrap"
COMMENT "Generating ext_hhvm wrapper for ${REL}")
@@ -30,10 +35,10 @@ foreach (f ${files})
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_ARCH})
EXT_HHVM_FILE(CXX_SOURCES CXX_HEADERS ${f_REL} ${EXT_HHVM_OS} ${EXT_HHVM_ARCH})
endif()
endforeach()
EXT_HHVM_FILE(CXX_SOURCES CXX_HEADERS "runtime/base/builtin_functions.cpp" ${EXT_HHVM_ARCH})
EXT_HHVM_FILE(CXX_SOURCES CXX_HEADERS "runtime/base/builtin_functions.cpp" ${EXT_HHVM_OS} ${EXT_HHVM_ARCH})
foreach (dir ${RECURSIVE_SOURCE_SUBDIRS})
auto_sources(files "*.cpp" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}")
+10 -9
Ver Arquivo
@@ -1,17 +1,18 @@
#!/bin/sh
# $1 Machine architecture (currently: "x64" or "arm")
# $2 Object file to read symbols from
# $3 ext_hhvm.cpp source to generate
# $4 ext_hhvm.h header to generate
if [ "$OSTYPE" = "darwin"* ]; then
gobjdump --section=".text" --section="LC_SEGMENT..text.hot.built." -t $2 | \
# $1 Operating System (currently: "linux" or "darwin")
# $2 Machine architecture (currently: "x64" or "arm")
# $3 Object file to read symbols from
# $4 ext_hhvm.cpp source to generate
# $5 ext_hhvm.h header to generate
if [ "$1" = "darwin" ]; then
gobjdump --section=".text" --section="LC_SEGMENT..text.hot.built." -t $3 | \
awk '{ if ($2=="g") print $8 }' | \
$HPHP_HOME/hphp/tools/bootstrap/gen-ext-hhvm \
$1 $4 $3 $HPHP_HOME/hphp/system/idl/*.idl.json
$2 $5 $4 $HPHP_HOME/hphp/system/idl/*.idl.json
else
readelf -s -W $2 | grep 'FUNC.*GLOBAL' | \
readelf -s -W $3 | grep 'FUNC.*GLOBAL' | \
sed -e 's/^.*DEFAULT[0-9 ]*//' | \
$HPHP_HOME/hphp/tools/bootstrap/gen-ext-hhvm \
$1 $4 $3 $HPHP_HOME/hphp/system/idl/*.idl.json
$2 $5 $4 $HPHP_HOME/hphp/system/idl/*.idl.json
fi