[ChakraCore] Add Linux support (#18476)

* [ChakraCore] Add Linux support

* Fix

* x-add-version

* Update ci.baseline.txt

* Update portfile.cmake

* Do not emit error if VCPKG_BUILD_TYPE is undefined

* Update ports/chakracore/portfile.cmake

Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com>

* Update ports/chakracore/portfile.cmake

Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com>

* Update ports/chakracore/portfile.cmake

Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com>

* Update ports/chakracore/portfile.cmake

Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com>

* Update ports/chakracore/portfile.cmake

Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com>

* Add missing space

* Add quotes to variables

* Update the baseline version

* Fix Windows build

* vcpkg x-add-version chakracore

Co-authored-by: Phoebe <20694052+PhoebeHui@users.noreply.github.com>
This commit is contained in:
Leonid Pospelov 2021-07-23 08:58:17 +03:00 committed by GitHub
parent aaeca7b000
commit cdd51899f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 173 additions and 77 deletions

View File

@ -0,0 +1,13 @@
diff --git a/lib/Common/Memory/RecyclerObjectGraphDumper.cpp b/lib/Common/Memory/RecyclerObjectGraphDumper.cpp
index 0885df3fb..12bdfb96e 100644
--- a/lib/Common/Memory/RecyclerObjectGraphDumper.cpp
+++ b/lib/Common/Memory/RecyclerObjectGraphDumper.cpp
@@ -58,7 +58,7 @@ void RecyclerObjectGraphDumper::BeginDumpObject(void * objectAddress)
{
Assert(false);
this->dumpObjectTypeInfo = nullptr;
- this->dumpObjectIsArray = nullptr;
+ this->dumpObjectIsArray = 0;
}
}
#endif

View File

@ -1,72 +1,150 @@
vcpkg_fail_port_install(ON_TARGET osx linux uwp ON_CRT_LINKAGE static ON_LIBRARY_LINKAGE static)
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Microsoft/ChakraCore
REF 63c5099027ebb4547c802d62c2d2a6a39ee7eff6 # v1.11.22
SHA512 5de915db48f5a125d4e0e112671ad7447212e6c0165d6c634a855a1d334f0bd2f7c015ba8c58d55225dd75d4c6687e6807987b8354b82405eb87944b46313062
HEAD_REF master
)
find_path(COR_H_PATH cor.h)
if(COR_H_PATH MATCHES "NOTFOUND")
message(FATAL_ERROR "Could not find <cor.h>. Ensure the NETFXSDK is installed.")
endif()
get_filename_component(NETFXSDK_PATH "${COR_H_PATH}/../.." ABSOLUTE)
set(BUILDTREE_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
file(REMOVE_RECURSE ${BUILDTREE_PATH})
file(COPY ${SOURCE_PATH}/ DESTINATION ${BUILDTREE_PATH})
set(CHAKRA_RUNTIME_LIB "static_library") # ChakraCore only supports static CRT linkage
vcpkg_build_msbuild(
PROJECT_PATH ${BUILDTREE_PATH}/Build/Chakra.Core.sln
OPTIONS
"/p:DotNetSdkRoot=${NETFXSDK_PATH}/"
"/p:CustomBeforeMicrosoftCommonTargets=${CMAKE_CURRENT_LIST_DIR}/no-warning-as-error.props"
"/p:RuntimeLib=${CHAKRA_RUNTIME_LIB}"
)
file(INSTALL
${BUILDTREE_PATH}/lib/jsrt/ChakraCore.h
${BUILDTREE_PATH}/lib/jsrt/ChakraCommon.h
${BUILDTREE_PATH}/lib/jsrt/ChakraCommonWindows.h
${BUILDTREE_PATH}/lib/jsrt/ChakraDebug.h
DESTINATION ${CURRENT_PACKAGES_DIR}/include
)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(INSTALL
${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_debug/ChakraCore.dll
${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_debug/ChakraCore.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
)
file(INSTALL
${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_debug/Chakracore.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(INSTALL
${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/ChakraCore.dll
${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/ChakraCore.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/bin
)
file(INSTALL
${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/Chakracore.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
)
file(INSTALL
${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/ch.exe
${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/GCStress.exe
${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/rl.exe
DESTINATION ${CURRENT_PACKAGES_DIR}/tools/chakracore)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/chakracore)
endif()
vcpkg_copy_pdbs()
file(INSTALL
${SOURCE_PATH}/LICENSE.txt
DESTINATION ${CURRENT_PACKAGES_DIR}/share/ChakraCore RENAME copyright)
vcpkg_fail_port_install(ON_TARGET osx uwp)
if(WIN32)
vcpkg_fail_port_install(ON_CRT_LINKAGE static ON_LIBRARY_LINKAGE static)
endif()
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Microsoft/ChakraCore
REF 385409ee4b634b860e090606a28acbc99f4d2567
SHA512 ef47db988c4ddd77fa87f4c5e1ac91d9f6b31b35aa6934d8b2863ee1274776d90a2b85dbad51eef069c96777d3cd7729349b89f23eda8c61b4cb637150bead71
HEAD_REF master
PATCHES
fix-debug-linux-build.patch
)
if(WIN32)
find_path(COR_H_PATH cor.h)
if(COR_H_PATH MATCHES "NOTFOUND")
message(FATAL_ERROR "Could not find <cor.h>. Ensure the NETFXSDK is installed.")
endif()
get_filename_component(NETFXSDK_PATH "${COR_H_PATH}/../.." ABSOLUTE)
endif()
set(BUILDTREE_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
file(REMOVE_RECURSE ${BUILDTREE_PATH})
file(COPY ${SOURCE_PATH}/ DESTINATION ${BUILDTREE_PATH})
if(WIN32)
set(CHAKRA_RUNTIME_LIB "static_library") # ChakraCore only supports static CRT linkage
vcpkg_build_msbuild(
PROJECT_PATH "${BUILDTREE_PATH}/Build/Chakra.Core.sln"
OPTIONS
"/p:DotNetSdkRoot=${NETFXSDK_PATH}/"
"/p:CustomBeforeMicrosoftCommonTargets=${CMAKE_CURRENT_LIST_DIR}/no-warning-as-error.props"
"/p:RuntimeLib=${CHAKRA_RUNTIME_LIB}"
)
else()
if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(CHAKRACORE_TARGET_ARCH amd64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
set(CHAKRACORE_TARGET_ARCH x86)
endif()
if (VCPKG_TARGET_IS_LINUX)
message(WARNING "${PORT} requires Clang from the system package manager, this can be installed on Ubuntu systems via sudo apt install clang")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
list(APPEND configs "debug")
execute_process(
COMMAND bash "build.sh" "--arch=${CHAKRACORE_TARGET_ARCH}" "--debug"
WORKING_DIRECTORY "${BUILDTREE_PATH}"
OUTPUT_VARIABLE CHAKRA_BUILD_SH_OUT
ERROR_VARIABLE CHAKRA_BUILD_SH_ERR
RESULT_VARIABLE CHAKRA_BUILD_SH_RES
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
list(APPEND configs "release")
execute_process(
COMMAND bash "build.sh" "--arch=${CHAKRACORE_TARGET_ARCH}"
WORKING_DIRECTORY "${BUILDTREE_PATH}"
OUTPUT_VARIABLE CHAKRA_BUILD_SH_OUT
ERROR_VARIABLE CHAKRA_BUILD_SH_ERR
RESULT_VARIABLE CHAKRA_BUILD_SH_RES
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
)
endif()
endif()
file(INSTALL
"${BUILDTREE_PATH}/lib/Jsrt/ChakraCore.h"
"${BUILDTREE_PATH}/lib/Jsrt/ChakraCommon.h"
"${BUILDTREE_PATH}/lib/Jsrt/ChakraDebug.h"
DESTINATION "${CURRENT_PACKAGES_DIR}/include"
)
if(WIN32)
file(INSTALL
"${BUILDTREE_PATH}/lib/Jsrt/ChakraCommonWindows.h"
"${BUILDTREE_PATH}/lib/Jsrt/ChakraCoreWindows.h"
DESTINATION "${CURRENT_PACKAGES_DIR}/include"
)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(INSTALL
"${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_debug/ChakraCore.dll"
"${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_debug/ChakraCore.pdb"
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin"
)
file(INSTALL
"${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_debug/Chakracore.lib"
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib"
)
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(INSTALL
"${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/ChakraCore.dll"
"${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/ChakraCore.pdb"
DESTINATION "${CURRENT_PACKAGES_DIR}/bin"
)
file(INSTALL
"${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/Chakracore.lib"
DESTINATION "${CURRENT_PACKAGES_DIR}/lib"
)
file(INSTALL
"${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/ch.exe"
"${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/GCStress.exe"
"${BUILDTREE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/rl.exe"
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/chakracore"
)
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/chakracore")
endif()
else()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(out_file libChakraCore.so)
else()
set(out_file lib/libChakraCoreStatic.a)
endif()
set(destination_dir_debug "${CURRENT_PACKAGES_DIR}/debug/bin")
set(destination_dir_release "${CURRENT_PACKAGES_DIR}/bin")
set(out_dir_debug "${BUILDTREE_PATH}/out/Debug")
set(out_dir_release "${BUILDTREE_PATH}/out/Release")
foreach(config ${configs})
file(INSTALL
${out_dir_${config}}/${out_file}
DESTINATION ${destination_dir_${config}}
)
endforeach()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(INSTALL
"${out_dir_release}/ch"
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/chakracore"
)
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/chakracore")
endif()
endif()
vcpkg_copy_pdbs()
file(INSTALL
"${SOURCE_PATH}/LICENSE.txt"
DESTINATION "${CURRENT_PACKAGES_DIR}/share/chakracore"
RENAME copyright
)

View File

@ -1,8 +1,7 @@
{
"name": "chakracore",
"version-string": "1.11.22",
"port-version": 1,
"version-string": "2021-04-22",
"description": "Core part of the Chakra Javascript engine",
"homepage": "https://github.com/Microsoft/ChakraCore",
"supports": "windows & !uwp & !static"
"supports": "!osx & !uwp & (linux | !static)"
}

View File

@ -100,6 +100,7 @@ cfitsio:arm-uwp=fail
cfitsio:x64-uwp=fail
cgicc:arm-uwp=fail
cgicc:x64-uwp=fail
chakracore:x64-linux=skip
# DCMTK currently has a vendored copy of libcharls.a, which causes conflicts with charls (TODO: use charls' copy)
charls:arm64-windows=skip
charls:arm-uwp=skip

View File

@ -1221,8 +1221,8 @@
"port-version": 0
},
"chakracore": {
"baseline": "1.11.22",
"port-version": 1
"baseline": "2021-04-22",
"port-version": 0
},
"charls": {
"baseline": "2.2.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "0aa775c085b114b0ec67ea23ee99ece252d9e498",
"version-string": "2021-04-22",
"port-version": 0
},
{
"git-tree": "89c6f3a1c86e3849e7f58941ab165af8da0b2f25",
"version-string": "1.11.22",