nixpkgs-suyu/pkgs/development/compilers/ponyc/make-safe-for-sandbox.patch
Redvers Davies 38aaa7d05c ponyc: 0.42.0 -> 0.44.0
* Fix MacOS version mismatch warnings when linking pony programs.
* Fix calculation of "is prime" for numbers > 1321.
* Prevent non-opaque structs from being used as behaviour parameters.
* Update to LLVM 12.0.1.
* Added FileMode.u32.
* Changes to Promises Library.
* Remove zlib from libponyc as a dependency.
* Fix compile-time crash related to Pony-specific Optimizations.
* Update FilePath constructors to allow a non-partial way to create a FilePath.

Updated googlebenchmark dependency to 1.5.4
Updated googletest to 1.10.0

Replaced a fetchurl call with a fetchFromGitHub call.
2021-10-08 17:03:44 -04:00

100 lines
4.8 KiB
Diff

--- a/lib/CMakeLists.txt.orig 2021-10-01 13:04:00.867762912 -0400
+++ a/lib/CMakeLists.txt 2021-10-01 13:06:21.220023453 -0400
@@ -15,12 +15,12 @@
endif()
ExternalProject_Add(gbenchmark
- URL ${PONYC_GBENCHMARK_URL}
+ SOURCE_DIR gbenchmark-prefix/src/benchmark
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
)
ExternalProject_Add(googletest
- URL https://github.com/google/googletest/archive/release-1.10.0.tar.gz
+ URL @googletest@
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
)
@@ -33,82 +33,6 @@
COMPONENT library
)
-find_package(Git)
-
-set(LLVM_DESIRED_HASH "fed41342a82f5a3a9201819a82bf7a48313e296b")
-set(PATCHES_DESIRED_HASH "3a655193262fd9b2e87340e096efcbd96726a07fe6dd42a263f3a4fc2dc0192e")
-
-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...")
- execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive --depth 1
- 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")
- message(FATAL_ERROR "git submodule update --init --recursive --depth 1 failed with ${git_submod_result}, please checkout submodules")
- 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
- message("Checking patches ${PONY_LLVM_PATCHES}")
- set(PATCHES_ACTUAL_HASH "")
- foreach (PATCH ${PONY_LLVM_PATCHES})
- 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}'")
- endforeach()
- string(SHA256 PATCHES_ACTUAL_HASH ${PATCHES_ACTUAL_HASH})
- # message("Desired hash ${PATCHES_DESIRED_HASH}")
- # message("Actual hash ${PATCHES_ACTUAL_HASH}")
- if(NOT PATCHES_ACTUAL_HASH EQUAL "${PATCHES_DESIRED_HASH}")
- message(FATAL_ERROR "Patch hash actual ${PATCHES_ACTUAL_HASH} does not match desired ${PATCHES_DESIRED_HASH}")
- 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()
-
message("Building targets: ${LLVM_TARGETS_TO_BUILD}")
set(LLVM_ENABLE_BINDINGS OFF)