mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Update Copybara config to add files from #83
PiperOrigin-RevId: 355587833 Change-Id: I40579d1d5a16a32a7228f440e6cca8862e2ee504
This commit is contained in:
parent
492cd11273
commit
11bb2c7fe2
72
cmake/abseil-cpp.cmake
Normal file
72
cmake/abseil-cpp.cmake
Normal file
|
@ -0,0 +1,72 @@
|
|||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(workdir "${CMAKE_BINARY_DIR}/_deps/absl-populate")
|
||||
|
||||
set(SAPI_ABSL_GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
|
||||
CACHE STRING "")
|
||||
set(SAPI_ABSL_GIT_TAG 4fd9a1ec5077daac14eeee05df931d658ec0b7b8
|
||||
CACHE STRING "") # 2020-11-19
|
||||
set(SAPI_ABSL_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/absl-src" CACHE STRING "")
|
||||
set(SAPI_ABSL_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/absl-build" CACHE STRING "")
|
||||
|
||||
file(WRITE "${workdir}/CMakeLists.txt" "\
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(absl-populate NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(absl
|
||||
GIT_REPOSITORY \"${SAPI_ABSL_GIT_REPOSITORY}\"
|
||||
GIT_TAG \"${SAPI_ABSL_GIT_TAG}\"
|
||||
SOURCE_DIR \"${SAPI_ABSL_SOURCE_DIR}\"
|
||||
BINARY_DIR \"${SAPI_ABSL_BINARY_DIR}\"
|
||||
CONFIGURE_COMMAND \"\"
|
||||
BUILD_COMMAND \"\"
|
||||
INSTALL_COMMAND \"\"
|
||||
TEST_COMMAND \"\"
|
||||
)
|
||||
")
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
set(_sapi_saved_CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD})
|
||||
set(_sapi_saved_BUILD_TESTING ${BUILD_TESTING})
|
||||
|
||||
set(CMAKE_CXX_STANDARD ${SAPI_CXX_STANDARD})
|
||||
set(ABSL_USE_GOOGLETEST_HEAD OFF CACHE BOOL "" FORCE)
|
||||
set(ABSL_RUN_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(BUILD_TESTING OFF) # Avoid errors when re-configuring SAPI
|
||||
set(ABSL_CXX_STANDARD ${SAPI_CXX_STANDARD} CACHE STRING "" FORCE)
|
||||
set(ABSL_ENABLE_INSTALL ON CACHE BOOL "" FORCE)
|
||||
|
||||
add_subdirectory("${SAPI_ABSL_SOURCE_DIR}"
|
||||
"${SAPI_ABSL_BINARY_DIR}" EXCLUDE_FROM_ALL)
|
||||
|
||||
if(_sapi_saved_BUILD_TESTING)
|
||||
set(BUILD_TESTING "${_sapi_saved_BUILD_TESTING}")
|
||||
endif()
|
||||
if(_sapi_saved_CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD "${_sapi_saved_CMAKE_CXX_STANDARD}")
|
||||
endif()
|
61
cmake/benchmark.cmake
Normal file
61
cmake/benchmark.cmake
Normal file
|
@ -0,0 +1,61 @@
|
|||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(workdir "${CMAKE_BINARY_DIR}/_deps/benchmark-populate")
|
||||
|
||||
set(SAPI_BENCHMARK_GIT_REPOSITORY https://github.com/google/benchmark.git
|
||||
CACHE STRING "")
|
||||
set(SAPI_BENCHMARK_GIT_TAG 56898e9a92fba537671d5462df9c5ef2ea6a823a
|
||||
CACHE STRING "") # 2020-04-23
|
||||
set(SAPI_BENCHMARK_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/benchmark-src"
|
||||
CACHE STRING "")
|
||||
set(SAPI_BENCHMARK_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/benchmark-build"
|
||||
CACHE STRING "")
|
||||
|
||||
file(WRITE "${workdir}/CMakeLists.txt" "\
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(benchmark-populate NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(benchmark
|
||||
GIT_REPOSITORY \"${SAPI_BENCHMARK_GIT_REPOSITORY}\"
|
||||
GIT_TAG \"${SAPI_BENCHMARK_GIT_TAG}\"
|
||||
SOURCE_DIR \"${SAPI_BENCHMARK_SOURCE_DIR}\"
|
||||
BINARY_DIR \"${SAPI_BENCHMARK_BINARY_DIR}\"
|
||||
CONFIGURE_COMMAND \"\"
|
||||
BUILD_COMMAND \"\"
|
||||
INSTALL_COMMAND \"\"
|
||||
TEST_COMMAND \"\"
|
||||
)
|
||||
")
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
set(BENCHMARK_ENABLE_TESTING OFF)
|
||||
set(BENCHMARK_ENABLE_EXCEPTIONS OFF)
|
||||
set(BENCHMARK_ENABLE_GTEST_TESTS OFF)
|
||||
|
||||
add_subdirectory("${SAPI_BENCHMARK_SOURCE_DIR}"
|
||||
"${SAPI_BENCHMARK_BINARY_DIR}" EXCLUDE_FROM_ALL)
|
63
cmake/gflags.cmake
Normal file
63
cmake/gflags.cmake
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(workdir "${CMAKE_BINARY_DIR}/_deps/gflags-populate")
|
||||
|
||||
set(SAPI_GFLAGS_GIT_REPOSITORY https://github.com/gflags/gflags.git
|
||||
CACHE STRING "")
|
||||
set(SAPI_GFLAGS_GIT_TAG addd749114fab4f24b7ea1e0f2f837584389e52c
|
||||
CACHE STRING "") # 2020-03-18
|
||||
set(SAPI_GFLAGS_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/gflags-src"
|
||||
CACHE STRING "")
|
||||
set(SAPI_GFLAGS_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/gflags-build"
|
||||
CACHE STRING "")
|
||||
|
||||
file(WRITE "${workdir}/CMakeLists.txt" "\
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(gflags-populate NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(gflags
|
||||
GIT_REPOSITORY \"${SAPI_GFLAGS_GIT_REPOSITORY}\"
|
||||
GIT_TAG \"${SAPI_GFLAGS_GIT_TAG}\"
|
||||
SOURCE_DIR \"${SAPI_GFLAGS_SOURCE_DIR}\"
|
||||
BINARY_DIR \"${SAPI_GFLAGS_BINARY_DIR}\"
|
||||
CONFIGURE_COMMAND \"\"
|
||||
BUILD_COMMAND \"\"
|
||||
INSTALL_COMMAND \"\"
|
||||
TEST_COMMAND \"\"
|
||||
)
|
||||
")
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
set(GFLAGS_IS_SUBPROJECT TRUE)
|
||||
set(GFLAGS_BUILD_SHARED_LIBS ${SAPI_ENABLE_SHARED_LIBS})
|
||||
set(GFLAGS_INSTALL_SHARED_LIBS ${SAPI_ENABLE_SHARED_LIBS})
|
||||
set(GFLAGS_INSTALL_HEADERS OFF) # TODO: Temporary off
|
||||
set(GFLAGS_BUILD_TESTING FALSE)
|
||||
|
||||
add_subdirectory("${SAPI_GFLAGS_SOURCE_DIR}"
|
||||
"${SAPI_GFLAGS_BINARY_DIR}" EXCLUDE_FROM_ALL)
|
92
cmake/glog.cmake
Normal file
92
cmake/glog.cmake
Normal file
|
@ -0,0 +1,92 @@
|
|||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Allows use target_link_libraries() with targets in other directories.
|
||||
if(POLICY CMP0079)
|
||||
cmake_policy(SET CMP0079 NEW)
|
||||
endif()
|
||||
|
||||
set(workdir "${CMAKE_BINARY_DIR}/_deps/glog-populate")
|
||||
|
||||
set(SAPI_GLOG_GIT_REPOSITORY https://github.com/google/glog.git CACHE STRING "")
|
||||
set(SAPI_GLOG_GIT_TAG 3ba8976592274bc1f907c402ce22558011d6fc5e
|
||||
CACHE STRING "") # 2020-02-16
|
||||
set(SAPI_GLOG_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/glog-src" CACHE STRING "")
|
||||
set(SAPI_GLOG_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/glog-build" CACHE STRING "")
|
||||
|
||||
file(WRITE "${workdir}/CMakeLists.txt" "\
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(glog-populate NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(glog
|
||||
GIT_REPOSITORY \"${SAPI_GLOG_GIT_REPOSITORY}\"
|
||||
GIT_TAG \"${SAPI_GLOG_GIT_TAG}\"
|
||||
SOURCE_DIR \"${SAPI_GLOG_SOURCE_DIR}\"
|
||||
BINARY_DIR \"${SAPI_GLOG_BINARY_DIR}\"
|
||||
CONFIGURE_COMMAND \"\"
|
||||
BUILD_COMMAND \"\"
|
||||
INSTALL_COMMAND \"\"
|
||||
TEST_COMMAND \"\"
|
||||
)
|
||||
")
|
||||
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
set(_sapi_saved_BUILD_TESTING ${BUILD_TESTING})
|
||||
|
||||
# Force gflags from subdirectory
|
||||
set(WITH_GFLAGS FALSE CACHE BOOL "" FORCE)
|
||||
set(HAVE_LIB_GFLAGS TRUE CACHE STRING "" FORCE)
|
||||
|
||||
set(WITH_UNWIND FALSE CACHE BOOL "" FORCE)
|
||||
set(UNWIND_LIBRARY FALSE)
|
||||
set(HAVE_PWD_H FALSE)
|
||||
|
||||
set(WITH_PKGCONFIG TRUE CACHE BOOL "" FORCE)
|
||||
|
||||
set(BUILD_TESTING FALSE)
|
||||
set(BUILD_SHARED_LIBS ${SAPI_ENABLE_SHARED_LIBS})
|
||||
|
||||
add_subdirectory("${SAPI_GLOG_SOURCE_DIR}"
|
||||
"${SAPI_GLOG_BINARY_DIR}" EXCLUDE_FROM_ALL)
|
||||
|
||||
target_include_directories(glog PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/_deps/gflags-build/include>
|
||||
$<BUILD_INTERFACE:${SAPI_GLOG_BINARY_DIR}>
|
||||
)
|
||||
add_library(gflags_nothreads STATIC IMPORTED)
|
||||
set_target_properties(gflags_nothreads PROPERTIES
|
||||
IMPORTED_LOCATION
|
||||
"${CMAKE_BINARY_DIR}/_deps/gflags-build/libgflags_nothreads.a")
|
||||
target_link_libraries(glog PRIVATE
|
||||
-Wl,--whole-archive
|
||||
gflags_nothreads
|
||||
-Wl,--no-whole-archive
|
||||
)
|
||||
|
||||
if(_sapi_saved_BUILD_TESTING)
|
||||
set(BUILD_TESTING "${_sapi_saved_BUILD_TESTING}")
|
||||
endif()
|
59
cmake/googletest.cmake
Normal file
59
cmake/googletest.cmake
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(workdir "${CMAKE_BINARY_DIR}/_deps/googletest-populate")
|
||||
|
||||
set(SAPI_GOOGLETEST_GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
CACHE STRING "")
|
||||
set(SAPI_GOOGLETEST_GIT_TAG dcc92d0ab6c4ce022162a23566d44f673251eee4
|
||||
CACHE STRING "") # 2020-04-16
|
||||
set(SAPI_GOOGLETEST_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/googletest-src"
|
||||
CACHE STRING "")
|
||||
set(SAPI_GOOGLETEST_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/googletest-build"
|
||||
CACHE STRING "")
|
||||
|
||||
file(WRITE "${workdir}/CMakeLists.txt" "\
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(googletest-populate NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(googletest
|
||||
GIT_REPOSITORY \"${SAPI_GOOGLETEST_GIT_REPOSITORY}\"
|
||||
GIT_TAG \"${SAPI_GOOGLETEST_GIT_TAG}\"
|
||||
SOURCE_DIR \"${SAPI_GOOGLETEST_SOURCE_DIR}\"
|
||||
BINARY_DIR \"${SAPI_GOOGLETEST_BINARY_DIR}\"
|
||||
CONFIGURE_COMMAND \"\"
|
||||
BUILD_COMMAND \"\"
|
||||
INSTALL_COMMAND \"\"
|
||||
TEST_COMMAND \"\"
|
||||
)
|
||||
")
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
|
||||
add_subdirectory("${SAPI_GOOGLETEST_SOURCE_DIR}"
|
||||
"${SAPI_GOOGLETEST_BINARY_DIR}" EXCLUDE_FROM_ALL)
|
128
cmake/libcap.cmake
Normal file
128
cmake/libcap.cmake
Normal file
|
@ -0,0 +1,128 @@
|
|||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(workdir "${CMAKE_BINARY_DIR}/_deps/libcap-populate")
|
||||
|
||||
set(SAPI_LIBCAP_URL
|
||||
https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.27.tar.gz
|
||||
CACHE STRING "")
|
||||
set(SAPI_LIBCAP_URL_HASH
|
||||
SHA256=260b549c154b07c3cdc16b9ccc93c04633c39f4fb6a4a3b8d1fa5b8a9c3f5fe8
|
||||
CACHE STRING "") # 2019-04-16
|
||||
set(SAPI_LIBCAP_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/libcap-src"
|
||||
CACHE STRING "")
|
||||
set(SAPI_LIBCAP_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/libcap-build"
|
||||
CACHE STRING "")
|
||||
|
||||
file(WRITE "${workdir}/CMakeLists.txt" "\
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(libcap-populate NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(libcap
|
||||
URL \"${SAPI_LIBCAP_URL}\"
|
||||
URL_HASH \"${SAPI_LIBCAP_URL_HASH}\"
|
||||
SOURCE_DIR \"${SAPI_LIBCAP_SOURCE_DIR}\"
|
||||
BINARY_DIR \"${SAPI_LIBCAP_BINARY_DIR}\"
|
||||
CONFIGURE_COMMAND \"\"
|
||||
BUILD_COMMAND \"\"
|
||||
INSTALL_COMMAND \"\"
|
||||
TEST_COMMAND \"\"
|
||||
)
|
||||
")
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
set(libcap_INCLUDE_DIR "${SAPI_LIBCAP_SOURCE_DIR}/libcap/include")
|
||||
|
||||
add_custom_command(OUTPUT ${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_names.list.h
|
||||
VERBATIM
|
||||
COMMAND # Use the same logic as libcap/Makefile
|
||||
sed -ne [=[/^#define[ \\t]CAP[_A-Z]\+[ \\t]\+[0-9]\+/{s/^#define \([^ \\t]*\)[ \\t]*\([^ \\t]*\)/\{\"\1\",\2\},/p;}]=]
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/include/uapi/linux/capability.h |
|
||||
tr [:upper:] [:lower:] > ${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_names.list.h
|
||||
)
|
||||
|
||||
if (CMAKE_CROSSCOMPILING AND BUILD_C_COMPILER)
|
||||
add_custom_command(OUTPUT ${SAPI_LIBCAP_SOURCE_DIR}/libcap/libcap_makenames
|
||||
VERBATIM
|
||||
# Use the same logic as libcap/Makefile
|
||||
COMMAND ${BUILD_C_COMPILER} ${BUILD_C_FLAGS}
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/_makenames.c
|
||||
-o ${SAPI_LIBCAP_SOURCE_DIR}/libcap/libcap_makenames
|
||||
DEPENDS ${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_names.list.h
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/_makenames.c
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT ${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_names.h
|
||||
COMMAND ${SAPI_LIBCAP_SOURCE_DIR}/libcap/libcap_makenames >
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_names.h
|
||||
DEPENDS ${SAPI_LIBCAP_SOURCE_DIR}/libcap/libcap_makenames
|
||||
)
|
||||
else()
|
||||
add_executable(libcap_makenames
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_names.list.h
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/_makenames.c
|
||||
)
|
||||
|
||||
target_include_directories(libcap_makenames PUBLIC
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/include
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/include/uapi
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT ${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_names.h
|
||||
COMMAND libcap_makenames > ${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_names.h
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(cap STATIC
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_alloc.c
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_extint.c
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_file.c
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_flag.c
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_names.h
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_proc.c
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/cap_text.c
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/include/uapi/linux/capability.h
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/libcap.h
|
||||
)
|
||||
add_library(libcap::libcap ALIAS cap)
|
||||
target_include_directories(cap PUBLIC
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/include
|
||||
${SAPI_LIBCAP_SOURCE_DIR}/libcap/include/uapi
|
||||
)
|
||||
target_compile_options(cap PRIVATE
|
||||
-Wno-tautological-compare
|
||||
-Wno-unused-result
|
||||
)
|
||||
target_compile_definitions(cap PRIVATE
|
||||
# Work around sys/xattr.h not declaring this
|
||||
-DXATTR_NAME_CAPS="\"security.capability\""
|
||||
)
|
||||
target_link_libraries(cap PRIVATE
|
||||
sapi::base
|
||||
)
|
121
cmake/libffi.cmake
Normal file
121
cmake/libffi.cmake
Normal file
|
@ -0,0 +1,121 @@
|
|||
# Copyright 2020 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(workdir "${CMAKE_BINARY_DIR}/_deps/libffi-populate")
|
||||
|
||||
set(SAPI_LIBFFI_URL
|
||||
https://github.com/libffi/libffi/releases/download/v3.3-rc2/libffi-3.3-rc2.tar.gz
|
||||
CACHE STRING "")
|
||||
set(SAPI_LIBFFI_URL_HASH
|
||||
SHA256=653ffdfc67fbb865f39c7e5df2a071c0beb17206ebfb0a9ecb18a18f63f6b263
|
||||
CACHE STRING "") # 2019-11-02
|
||||
set(SAPI_LIBFFI_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/libffi-src"
|
||||
CACHE STRING "")
|
||||
set(SAPI_LIBFFI_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/libffi-build"
|
||||
CACHE STRING "")
|
||||
|
||||
file(WRITE "${workdir}/CMakeLists.txt" "\
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(libffi-populate NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(libffi
|
||||
URL \"${SAPI_LIBFFI_URL}\"
|
||||
URL_HASH \"${SAPI_LIBFFI_URL_HASH}\"
|
||||
SOURCE_DIR \"${SAPI_LIBFFI_SOURCE_DIR}\"
|
||||
CONFIGURE_COMMAND ./configure
|
||||
--disable-dependency-tracking
|
||||
--disable-builddir
|
||||
${SAPI_THIRD_PARTY_CONFIGUREOPTS}
|
||||
BUILD_COMMAND \"\"
|
||||
INSTALL_COMMAND \"\"
|
||||
TEST_COMMAND \"\"
|
||||
BUILD_IN_SOURCE TRUE
|
||||
)
|
||||
")
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
set(libffi_INCLUDE_DIR ${SAPI_LIBFFI_SOURCE_DIR}/libffi/include)
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
list(APPEND _ffi_platform_srcs
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/x86/asmnames.h
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/x86/ffi.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/x86/ffi64.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/x86/ffiw64.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/x86/internal.h
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/x86/internal64.h
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/x86/sysv.S
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/x86/unix64.S
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/x86/win64.S
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64")
|
||||
list(APPEND _ffi_platform_srcs
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/powerpc/ffi.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/powerpc/ffi_linux64.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/powerpc/ffi_sysv.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/powerpc/linux64.S
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/powerpc/linux64_closure.S
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/powerpc/ppc_closure.S
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/powerpc/sysv.S
|
||||
# Textual headers
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/powerpc/ffi_powerpc.h
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/powerpc/asm.h
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
|
||||
list(APPEND _ffi_platform_srcs
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/aarch64/ffi.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/aarch64/internal.h
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/aarch64/sysv.S
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(ffi STATIC
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/fficonfig.h
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/include/ffi.h
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/include/ffi_cfi.h
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/include/ffi_common.h
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/include/ffitarget.h
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/closures.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/debug.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/java_raw_api.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/prep_cif.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/raw_api.c
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/src/types.c
|
||||
${_ffi_platform_srcs}
|
||||
)
|
||||
add_library(libffi::libffi ALIAS ffi)
|
||||
target_include_directories(ffi PUBLIC
|
||||
${SAPI_LIBFFI_SOURCE_DIR}
|
||||
${SAPI_LIBFFI_SOURCE_DIR}/include
|
||||
)
|
||||
target_compile_options(ffi PRIVATE
|
||||
-Wno-vla
|
||||
-Wno-unused-result
|
||||
)
|
||||
target_link_libraries(ffi PRIVATE
|
||||
sapi::base
|
||||
)
|
239
cmake/libunwind.cmake
Normal file
239
cmake/libunwind.cmake
Normal file
|
@ -0,0 +1,239 @@
|
|||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(workdir "${CMAKE_BINARY_DIR}/_deps/libunwind-populate")
|
||||
|
||||
set(SAPI_LIBUNWIND_URL
|
||||
https://github.com/libunwind/libunwind/releases/download/v1.2.1/libunwind-1.2.1.tar.gz
|
||||
CACHE STRING "")
|
||||
set(SAPI_LIBUNWIND_URL_HASH
|
||||
SHA256=3f3ecb90e28cbe53fba7a4a27ccce7aad188d3210bb1964a923a731a27a75acb
|
||||
CACHE STRING "")
|
||||
set(SAPI_LIBUNWIND_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/libunwind-src"
|
||||
CACHE STRING "")
|
||||
set(SAPI_LIBUNWIND_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/libunwind-build"
|
||||
CACHE STRING "")
|
||||
|
||||
file(WRITE "${workdir}/CMakeLists.txt" "\
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(libunwind-populate NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(libunwind
|
||||
URL \"${SAPI_LIBUNWIND_URL}\"
|
||||
URL_HASH \"${SAPI_LIBUNWIND_URL_HASH}\"
|
||||
SOURCE_DIR \"${SAPI_LIBUNWIND_SOURCE_DIR}\"
|
||||
CONFIGURE_COMMAND ./configure
|
||||
--disable-dependency-tracking
|
||||
--disable-documentation
|
||||
--disable-minidebuginfo
|
||||
--disable-shared
|
||||
--enable-ptrace
|
||||
${SAPI_THIRD_PARTY_CONFIGUREOPTS}
|
||||
BUILD_COMMAND \"\"
|
||||
INSTALL_COMMAND \"\"
|
||||
TEST_COMMAND \"\"
|
||||
BUILD_IN_SOURCE TRUE
|
||||
)
|
||||
")
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
set(_unwind_cpu "x86_64")
|
||||
list(APPEND _unwind_platform_srcs
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/Gcreate_addr_space.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/Gglobal.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/Ginit.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/Gos-linux.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/Gregs.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/Gresume.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/Gstash_frame.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/Gstep.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/is_fpreg.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/setcontext.S
|
||||
)
|
||||
list(APPEND _unwind_ptrace_srcs
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/Ginit_remote.c
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64")
|
||||
set(_unwind_cpu "ppc64")
|
||||
list(APPEND _unwind_platform_srcs
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ppc/Gis_signal_frame.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ppc64/Gcreate_addr_space.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ppc64/Gglobal.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ppc64/Ginit.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ppc64/Gregs.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ppc64/Gresume.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ppc64/Gstep.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ppc64/get_func_addr.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ppc64/is_fpreg.c
|
||||
)
|
||||
list(APPEND _unwind_ptrace_srcs
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ppc/Ginit_remote.c
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
|
||||
set(_unwind_cpu "aarch64")
|
||||
list(APPEND _unwind_platform_srcs
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/aarch64/Gcreate_addr_space.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/aarch64/Gglobal.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/aarch64/Ginit.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/aarch64/Gis_signal_frame.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/aarch64/Gregs.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/aarch64/Gresume.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/aarch64/Gstash_frame.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/aarch64/Gstep.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/aarch64/is_fpreg.c
|
||||
)
|
||||
list(APPEND _unwind_ptrace_srcs
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/aarch64/Ginit_remote.c
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm")
|
||||
set(_unwind_cpu "arm")
|
||||
list(APPEND _unwind_platform_srcs
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/Gcreate_addr_space.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/Gex_tables.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/Gglobal.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/Ginit.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/Gis_signal_frame.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/Gregs.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/Gresume.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/Gstash_frame.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/Gstep.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/is_fpreg.c
|
||||
)
|
||||
list(APPEND _unwind_ptrace_srcs
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/arm/Ginit_remote.c
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(unwind_ptrace_wrapped STATIC
|
||||
# internal_headers
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/compiler.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/config.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/dwarf.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/dwarf-eh.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/dwarf_i.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/libunwind.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/libunwind-common.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/libunwind-coredump.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/libunwind-dynamic.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/libunwind-ptrace.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/libunwind-x86_64.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/libunwind_i.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/mempool.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/remote.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/tdep-x86_64/dwarf-config.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/tdep-x86_64/libunwind_i.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/tdep/dwarf-config.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/tdep/libunwind_i.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/unwind.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/elf32.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/elf64.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/elfxx.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/os-linux.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/init.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/offsets.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/ucontext_i.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/x86_64/unwind_i.h
|
||||
# included_sources
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/elf64.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/elfxx.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/elfxx.c
|
||||
# sources_common
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/dwarf/Gexpr.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/dwarf/Gfde.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/dwarf/Gfind_proc_info-lsb.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/dwarf/Gfind_unwind_table.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/dwarf/Gparser.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/dwarf/Gpe.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/dwarf/Gstep.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/dwarf/global.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/Gdestroy_addr_space.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/Gdyn-extract.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/Gfind_dynamic_proc_info.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/Gget_accessors.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/Gget_proc_name.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/Gget_reg.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/Gput_dynamic_unwind_info.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/flush_cache.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/init.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/mempool.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/os-linux.c
|
||||
${_unwind_platform_srcs}
|
||||
# srcs
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/mi/Gdyn-remote.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_access_fpreg.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_access_mem.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_access_reg.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_accessors.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_create.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_destroy.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_elf.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_find_proc_info.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_get_dyn_info_list_addr.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_get_proc_name.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_internal.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_put_unwind_info.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_reg_offset.c
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src/ptrace/_UPT_resume.c
|
||||
# hdrs
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/config.h
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/libunwind.h
|
||||
# source_ptrace
|
||||
${_unwind_ptrace_srcs}
|
||||
)
|
||||
add_library(unwind::unwind_ptrace_wrapped ALIAS unwind_ptrace_wrapped)
|
||||
target_include_directories(unwind_ptrace_wrapped PUBLIC
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/tdep
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/include/tdep-${_unwind_cpu}
|
||||
${SAPI_LIBUNWIND_SOURCE_DIR}/src
|
||||
)
|
||||
target_compile_options(unwind_ptrace_wrapped PRIVATE
|
||||
-fno-common
|
||||
-Wno-cpp
|
||||
)
|
||||
target_compile_definitions(unwind_ptrace_wrapped
|
||||
PRIVATE -DHAVE_CONFIG_H
|
||||
-D_GNU_SOURCE
|
||||
-DNO_FRAME_POINTER
|
||||
PUBLIC -D_UPT_accessors=_UPT_accessors_wrapped
|
||||
-D_UPT_create=_UPT_create_wrapped
|
||||
-D_UPT_destroy=_UPT_destroy_wrapped
|
||||
|
||||
-D_U${_unwind_cpu}_create_addr_space=_U${_unwind_cpu}_create_addr_space_wrapped
|
||||
-D_U${_unwind_cpu}_destroy_addr_space=_U${_unwind_cpu}_destroy_addr_space_wrapped
|
||||
-D_U${_unwind_cpu}_get_proc_name=_U${_unwind_cpu}_get_proc_name_wrapped
|
||||
-D_U${_unwind_cpu}_get_reg=_U${_unwind_cpu}_get_reg_wrapped
|
||||
-D_U${_unwind_cpu}_init_remote=_U${_unwind_cpu}_init_remote_wrapped
|
||||
-D_U${_unwind_cpu}_step=_U${_unwind_cpu}_step_wrapped
|
||||
|
||||
-Dptrace=ptrace_wrapped
|
||||
)
|
||||
target_link_libraries(unwind_ptrace_wrapped PRIVATE
|
||||
sapi::base
|
||||
sandbox2::ptrace_hook
|
||||
)
|
34
cmake/modules/FindLibcap.cmake
Normal file
34
cmake/modules/FindLibcap.cmake
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# On Debian, install libcap-dev to use this module.
|
||||
|
||||
find_path(libcap_INCLUDE_DIR sys/capability.h)
|
||||
# Look for static library only.
|
||||
find_library(libcap_LIBRARY cap)
|
||||
mark_as_advanced(libcap_INCLUDE_DIR libcap_LIBRARY)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(libcap
|
||||
REQUIRED_VARS libcap_LIBRARY libcap_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if(libcap_FOUND AND NOT TARGET libcap::libcap)
|
||||
add_library(libcap::libcap UNKNOWN IMPORTED)
|
||||
set_target_properties(libcap::libcap PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${libcap_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${libcap_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
34
cmake/modules/FindLibffi.cmake
Normal file
34
cmake/modules/FindLibffi.cmake
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# On Debian, install libffi-dev to use this module.
|
||||
|
||||
find_path(libffi_INCLUDE_DIR ffitarget.h)
|
||||
# Look for static library only.
|
||||
find_library(libffi_LIBRARY ffi)
|
||||
mark_as_advanced(libffi_INCLUDE_DIR libffi_LIBRARY)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(libffi
|
||||
REQUIRED_VARS libffi_LIBRARY libffi_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if(libffi_FOUND AND NOT TARGET libffi::libffi)
|
||||
add_library(libffi::libffi UNKNOWN IMPORTED)
|
||||
set_target_properties(libffi::libffi PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${libffi_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${libffi_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
64
cmake/protobuf.cmake
Normal file
64
cmake/protobuf.cmake
Normal file
|
@ -0,0 +1,64 @@
|
|||
# Copyright 2019 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(workdir "${CMAKE_BINARY_DIR}/_deps/protobuf-populate")
|
||||
|
||||
set(SAPI_PROTOBUF_GIT_REPOSITORY
|
||||
https://github.com/protocolbuffers/protobuf.git
|
||||
CACHE STRING "")
|
||||
set(SAPI_PROTOBUF_GIT_TAG v3.11.4 CACHE STRING "") # 2020-02-14
|
||||
set(SAPI_PROTOBUF_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/protobuf-src"
|
||||
CACHE STRING "")
|
||||
set(SAPI_PROTOBUF_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/protobuf-build"
|
||||
CACHE STRING "")
|
||||
|
||||
file(WRITE "${workdir}/CMakeLists.txt" "\
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(protobuf-populate NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(protobuf
|
||||
GIT_REPOSITORY \"${SAPI_PROTOBUF_GIT_REPOSITORY}\"
|
||||
GIT_TAG \"${SAPI_PROTOBUF_GIT_TAG}\"
|
||||
GIT_SUBMODULES \"cmake\" # Workaround for CMake #20579
|
||||
SOURCE_DIR \"${SAPI_PROTOBUF_SOURCE_DIR}\"
|
||||
BINARY_DIR \"${SAPI_PROTOBUF_BINARY_DIR}\"
|
||||
CONFIGURE_COMMAND \"\"
|
||||
BUILD_COMMAND \"\"
|
||||
INSTALL_COMMAND \"\"
|
||||
TEST_COMMAND \"\"
|
||||
)
|
||||
")
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
set(protobuf_BUILD_TESTS FALSE CACHE BOOL "")
|
||||
set(protobuf_BUILD_SHARED_LIBS FALSE CACHE BOOL "")
|
||||
set(protobuf_WITH_ZLIB FALSE CACHE BOOL "")
|
||||
|
||||
add_subdirectory("${SAPI_PROTOBUF_SOURCE_DIR}/cmake"
|
||||
"${SAPI_PROTOBUF_BINARY_DIR}" EXCLUDE_FROM_ALL)
|
||||
get_property(Protobuf_INCLUDE_DIRS TARGET protobuf::libprotobuf
|
||||
PROPERTY INCLUDE_DIRECTORIES)
|
98
cmake/zlib.cmake
Normal file
98
cmake/zlib.cmake
Normal file
|
@ -0,0 +1,98 @@
|
|||
# Copyright 2020 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(workdir "${CMAKE_BINARY_DIR}/_deps/zlib-populate")
|
||||
|
||||
set(SAPI_ZLIB_URL https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz
|
||||
CACHE STRING "")
|
||||
set(SAPI_ZLIB_URL_HASH
|
||||
SHA256=c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
|
||||
CACHE STRING "") # 2020-04-23
|
||||
set(SAPI_ZLIB_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/zlib-src" CACHE STRING "")
|
||||
set(SAPI_ZLIB_BINARY_DIR "${CMAKE_BINARY_DIR}/_deps/zlib-build" CACHE STRING "")
|
||||
|
||||
file(WRITE "${workdir}/CMakeLists.txt" "\
|
||||
cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(zlib-populate NONE)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(zlib
|
||||
URL \"${SAPI_ZLIB_URL}\"
|
||||
URL_HASH \"${SAPI_ZLIB_URL_HASH}\"
|
||||
SOURCE_DIR \"${SAPI_ZLIB_SOURCE_DIR}\"
|
||||
BINARY_DIR \"${SAPI_ZLIB_BINARY_DIR}\"
|
||||
PATCH_COMMAND patch -p1
|
||||
< \"${SAPI_SOURCE_DIR}/sandboxed_api/bazel/external/zlib.patch\"
|
||||
CONFIGURE_COMMAND \"\"
|
||||
BUILD_COMMAND \"\"
|
||||
INSTALL_COMMAND \"\"
|
||||
TEST_COMMAND \"\"
|
||||
)
|
||||
")
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE error
|
||||
WORKING_DIRECTORY "${workdir}")
|
||||
if(error)
|
||||
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
|
||||
endif()
|
||||
|
||||
set(ZLIB_FOUND TRUE)
|
||||
set(ZLIB_INCLUDE_DIRS ${SAPI_ZLIB_SOURCE_DIR})
|
||||
|
||||
add_library(z STATIC
|
||||
${SAPI_ZLIB_SOURCE_DIR}/adler32.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/compress.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/crc32.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/crc32.h
|
||||
${SAPI_ZLIB_SOURCE_DIR}/deflate.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/deflate.h
|
||||
${SAPI_ZLIB_SOURCE_DIR}/gzclose.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/gzguts.h
|
||||
${SAPI_ZLIB_SOURCE_DIR}/gzlib.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/gzread.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/gzwrite.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/infback.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/inffast.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/inffast.h
|
||||
${SAPI_ZLIB_SOURCE_DIR}/inffixed.h
|
||||
${SAPI_ZLIB_SOURCE_DIR}/inflate.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/inflate.h
|
||||
${SAPI_ZLIB_SOURCE_DIR}/inftrees.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/inftrees.h
|
||||
${SAPI_ZLIB_SOURCE_DIR}/trees.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/trees.h
|
||||
${SAPI_ZLIB_SOURCE_DIR}/uncompr.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/zconf.h
|
||||
${SAPI_ZLIB_SOURCE_DIR}/zlib.h
|
||||
${SAPI_ZLIB_SOURCE_DIR}/zutil.c
|
||||
${SAPI_ZLIB_SOURCE_DIR}/zutil.h
|
||||
)
|
||||
add_library(ZLIB::ZLIB ALIAS z)
|
||||
target_include_directories(z PUBLIC
|
||||
${SAPI_ZLIB_SOURCE_DIR}
|
||||
)
|
||||
target_compile_options(z PRIVATE
|
||||
-w
|
||||
-Dverbose=-1
|
||||
)
|
||||
target_link_libraries(z PRIVATE
|
||||
sapi::base
|
||||
)
|
Loading…
Reference in New Issue
Block a user