Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / compilers / ponyc / make-safe-for-sandbox.patch
blobb07763a475d2261a04c450ce783743c4097f06d3
1 --- a/lib/CMakeLists.txt 2020-09-27 02:39:12.862940179 +0000
2 +++ b/lib/CMakeLists.txt 2020-09-27 02:39:16.451957865 +0000
3 @@ -10,12 +10,12 @@
4 endif()
6 ExternalProject_Add(gbenchmark
7 - URL https://github.com/google/benchmark/archive/v1.5.0.tar.gz
8 + SOURCE_DIR gbenchmark-prefix/src/benchmark
9 CMAKE_ARGS -DCMAKE_BUILD_TYPE=${PONYC_LIBS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DCMAKE_CXX_FLAGS=-fpic --no-warn-unused-cli
12 ExternalProject_Add(googletest
13 - URL https://github.com/google/googletest/archive/release-1.8.1.tar.gz
14 + URL @googletest@
15 CMAKE_ARGS -DCMAKE_BUILD_TYPE=${PONYC_LIBS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_CXX_FLAGS=-fpic -Dgtest_force_shared_crt=ON --no-warn-unused-cli
18 @@ -28,75 +28,6 @@
19 COMPONENT library
22 -find_package(Git)
24 -set(LLVM_DESIRED_HASH "c1a0a213378a458fbea1a5c77b315c7dce08fd05")
25 -set(PATCHES_DESIRED_HASH "9063f83d727bf042a1232420e168c1ea192bf6a2960d35e57123245b630eb923")
27 -if(GIT_FOUND)
28 - if(EXISTS "${PROJECT_SOURCE_DIR}/../.git")
29 - # Update submodules as needed
30 - option(GIT_SUBMODULE "Check submodules during build" ON)
31 - if(GIT_SUBMODULE)
32 - message(STATUS "Updating submodules...")
33 - execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
34 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
35 - RESULT_VARIABLE git_submod_result)
36 - #message("git_submod_result ${git_submod_result}")
37 - if(NOT git_submod_result EQUAL "0")
38 - message(FATAL_ERROR "git submodule update --init --recursive failed with ${git_submod_result}, please checkout submodules")
39 - endif()
41 - # we check to make sure the submodule hash matches
42 - # 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
43 - execute_process(COMMAND ${GIT_EXECUTABLE} submodule status
44 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
45 - OUTPUT_VARIABLE git_submod_output)
46 - #message("git_submod_output ${git_submod_output}")
47 - string(FIND "${git_submod_output}" "${LLVM_DESIRED_HASH}" LLVM_SUBMOD_POS)
48 - if(LLVM_SUBMOD_POS EQUAL "-1")
49 - 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.")
50 - endif()
51 - endif()
52 - endif()
54 - # Apply patches
55 - message("Applying patches...")
56 - file(GLOB PONY_LLVM_PATCHES "${PROJECT_SOURCE_DIR}/llvm/patches/*.diff")
58 - # check to see if the patch hashes match
59 - set(PATCHES_ACTUAL_HASH "")
60 - foreach (PATCH ${PONY_LLVM_PATCHES})
61 - file(SHA256 ${PATCH} patch_file_hash)
62 - string(CONCAT PATCHES_ACTUAL_HASH patch_file_hash)
63 - endforeach()
64 - string(SHA256 PATCHES_ACTUAL_HASH ${PATCHES_ACTUAL_HASH})
65 - if(NOT PATCHES_ACTUAL_HASH EQUAL "${PATCHES_DESIRED_HASH}")
66 - message(FATAL_ERROR "Patch hash actual ${PATCHES_ACTUAL_HASH} does not match desired ${PATCHES_DESIRED_HASH}")
67 - endif()
69 - foreach (PATCH ${PONY_LLVM_PATCHES})
70 - message(" Checking ${PATCH}")
71 - execute_process(COMMAND ${GIT_EXECUTABLE} apply --check -p 1 --ignore-whitespace --whitespace=nowarn ${PATCH}
72 - WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/llvm/src"
73 - ERROR_VARIABLE _err_out
74 - RESULT_VARIABLE git_apply_check_result)
75 - if(git_apply_check_result EQUAL "0")
76 - message(" Applying ${PATCH}")
77 - execute_process(COMMAND ${GIT_EXECUTABLE} apply -p 1 --ignore-whitespace --whitespace=nowarn ${PATCH}
78 - WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/llvm/src"
79 - RESULT_VARIABLE git_apply_result)
80 - if(NOT git_apply_result EQUAL "0")
81 - message(FATAL_ERROR "Unable to apply ${PATCH}")
82 - endif()
83 - else()
84 - message(" Already applied ${PATCH}")
85 - endif()
86 - endforeach()
87 -else()
88 - message(FATAL_ERROR "Git not found!")
89 -endif()
91 if (NOT DEFINED LLVM_TARGETS_TO_BUILD)
92 set(LLVM_TARGETS_TO_BUILD X86)
93 endif()