2023-03-07 20:45:32 +00:00
From e26ae067644ea780f050fb900bd850027bb86456 Mon Sep 17 00:00:00 2001
From: superherointj <5861043+superherointj@users.noreply.github.com>
Date: Tue, 7 Mar 2023 14:59:31 -0300
Subject: [PATCH] make-safe-for-sandbox.patch
---
lib/CMakeLists.txt | 80 ++--------------------------------------------
1 file changed, 2 insertions(+), 78 deletions(-)
2022-03-05 17:59:13 +00:00
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
2023-03-07 20:45:32 +00:00
index 129e26e6..d25bdf9d 100644
2022-03-05 17:59:13 +00:00
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
2023-03-07 20:45:32 +00:00
@@ -32,14 +32,14 @@ endif()
2020-09-28 21:40:58 +00:00
2023-03-07 20:45:32 +00:00
set(PONYC_GBENCHMARK_URL https://github.com/google/benchmark/archive/v1.7.1.tar.gz)
2020-09-28 21:40:58 +00:00
ExternalProject_Add(gbenchmark
2021-07-07 18:42:40 +00:00
- URL ${PONYC_GBENCHMARK_URL}
2021-10-01 18:56:49 +00:00
+ SOURCE_DIR gbenchmark-prefix/src/benchmark
2023-03-07 20:45:32 +00:00
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${PONYC_LIBS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DBENCHMARK_ENABLE_WERROR=OFF -DCMAKE_CXX_FLAGS=${PONY_PIC_FLAG} --no-warn-unused-cli
2020-09-28 21:40:58 +00:00
)
2023-03-07 20:45:32 +00:00
set(PONYC_GOOGLETEST_URL https://github.com/google/googletest/archive/release-1.12.1.tar.gz)
2022-03-05 17:59:13 +00:00
2020-09-28 21:40:58 +00:00
ExternalProject_Add(googletest
2022-03-05 17:59:13 +00:00
- URL ${PONYC_GOOGLETEST_URL}
2021-10-01 18:56:49 +00:00
+ URL @googletest@
2022-03-05 17:59:13 +00:00
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${PONYC_LIBS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_CXX_FLAGS=${PONY_PIC_FLAG} -Dgtest_force_shared_crt=ON --no-warn-unused-cli
2020-09-28 21:40:58 +00:00
)
2023-03-07 20:45:32 +00:00
@@ -52,82 +52,6 @@ install(TARGETS blake2
2020-09-28 21:40:58 +00:00
COMPONENT library
)
-find_package(Git)
-
2023-03-07 20:45:32 +00:00
-set(LLVM_DESIRED_HASH "1f9140064dfbfb0bbda8e51306ea51080b2f7aac")
-set(PATCHES_DESIRED_HASH "3e16c097794cb669a8f6a0bd7600b440205ac5c29a6135750c2e83263eb16a95")
2020-09-28 21:40:58 +00:00
-
-if(GIT_FOUND)
- if(EXISTS "${PROJECT_SOURCE_DIR}/../.git")
- # Update submodules as needed
- option(GIT_SUBMODULE "Check submodules during build" ON)
- if(GIT_SUBMODULE)
- message(STATUS "Updating submodules...")
2021-06-02 22:22:06 +00:00
- execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive --depth 1
2020-09-28 21:40:58 +00:00
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE git_submod_result)
- #message("git_submod_result ${git_submod_result}")
- if(NOT git_submod_result EQUAL "0")
2021-06-02 22:22:06 +00:00
- message(FATAL_ERROR "git submodule update --init --recursive --depth 1 failed with ${git_submod_result}, please checkout submodules")
2020-09-28 21:40:58 +00:00
- endif()
-
- # we check to make sure the submodule hash matches
- # the reason the submodule hash is in this file is to be able to use this file as a key for caching the libs in CI
- execute_process(COMMAND ${GIT_EXECUTABLE} submodule status
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- OUTPUT_VARIABLE git_submod_output)
- #message("git_submod_output ${git_submod_output}")
- string(FIND "${git_submod_output}" "${LLVM_DESIRED_HASH}" LLVM_SUBMOD_POS)
- if(LLVM_SUBMOD_POS EQUAL "-1")
- message(FATAL_ERROR "Expecting the lib/llvm/src submodule to be at hash '${LLVM_DESIRED_HASH}'; found '${git_submod_output}'; update the LLVM_DESIRED_HASH variable in lib/CMakeLists.txt if you've updated the submodule.")
- endif()
- endif()
- endif()
-
- # Apply patches
- message("Applying patches...")
- file(GLOB PONY_LLVM_PATCHES "${PROJECT_SOURCE_DIR}/llvm/patches/*.diff")
-
- # check to see if the patch hashes match
2021-10-01 18:56:49 +00:00
- message("Checking patches ${PONY_LLVM_PATCHES}")
2022-03-05 17:59:13 +00:00
- set(PATCHES_ACTUAL_HASH "needed_if_no_patches")
2020-09-28 21:40:58 +00:00
- foreach (PATCH ${PONY_LLVM_PATCHES})
2021-10-01 18:56:49 +00:00
- file(STRINGS ${PATCH} patch_file NEWLINE_CONSUME)
- string(REPLACE "\n" " " patch_file ${patch_file})
- string(SHA256 patch_file_hash ${patch_file})
- # message("${PATCH}: '${patch_file_hash}'")
- string(CONCAT PATCHES_ACTUAL_HASH ${PATCHES_ACTUAL_HASH} ${patch_file_hash})
- # message("concat is '${PATCHES_ACTUAL_HASH}'")
2020-09-28 21:40:58 +00:00
- endforeach()
- string(SHA256 PATCHES_ACTUAL_HASH ${PATCHES_ACTUAL_HASH})
2021-10-01 18:56:49 +00:00
- # message("Desired hash ${PATCHES_DESIRED_HASH}")
- # message("Actual hash ${PATCHES_ACTUAL_HASH}")
2022-03-05 17:59:13 +00:00
- if(NOT PATCHES_ACTUAL_HASH MATCHES "${PATCHES_DESIRED_HASH}")
- message(FATAL_ERROR "Patch hash actual '${PATCHES_ACTUAL_HASH}' does not match desired '${PATCHES_DESIRED_HASH}'")
2020-09-28 21:40:58 +00:00
- endif()
-
- foreach (PATCH ${PONY_LLVM_PATCHES})
- message(" Checking ${PATCH}")
- execute_process(COMMAND ${GIT_EXECUTABLE} apply --check -p 1 --ignore-whitespace --whitespace=nowarn ${PATCH}
- WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/llvm/src"
- ERROR_VARIABLE _err_out
- RESULT_VARIABLE git_apply_check_result)
- if(git_apply_check_result EQUAL "0")
- message(" Applying ${PATCH}")
- execute_process(COMMAND ${GIT_EXECUTABLE} apply -p 1 --ignore-whitespace --whitespace=nowarn ${PATCH}
- WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/llvm/src"
- RESULT_VARIABLE git_apply_result)
- if(NOT git_apply_result EQUAL "0")
- message(FATAL_ERROR "Unable to apply ${PATCH}")
- endif()
- else()
- message(" Already applied ${PATCH}")
- endif()
- endforeach()
-else()
- message(FATAL_ERROR "Git not found!")
-endif()
-
2021-10-01 18:56:49 +00:00
message("Building targets: ${LLVM_TARGETS_TO_BUILD}")
2023-03-07 20:45:32 +00:00
set(LLVM_ENABLE_BINDINGS OFF CACHE BOOL "ponyc specific override of LLVM cache entry")
--
2.39.2