mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
ponyc: 0.54.0 -> 0.58.6
This commit is contained in:
parent
cd43d68671
commit
c353cd7f44
@ -10,6 +10,8 @@
|
||||
, pcre2
|
||||
, pony-corral
|
||||
, python3
|
||||
# Not really used for anything real, just at build time.
|
||||
, git
|
||||
, substituteAll
|
||||
, which
|
||||
, z3
|
||||
@ -19,40 +21,39 @@
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
pname = "ponyc";
|
||||
version = "0.54.0";
|
||||
version = "0.58.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ponylang";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
hash = "sha256-qFPubqGfK0WCun6QA1OveyDJj7Wf6SQpky7pEb7qsf4=";
|
||||
hash = "sha256-cCZo/lOvSvF19SGQ9BU2J3EBKHF9PgRBhuUVBkggF9I=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
ponygbenchmark = fetchFromGitHub {
|
||||
benchmarkRev = "1.7.1";
|
||||
benchmark = fetchFromGitHub {
|
||||
owner = "google";
|
||||
repo = "benchmark";
|
||||
rev = "v1.8.0";
|
||||
hash = "sha256-pUW9YVaujs/y00/SiPqDgK4wvVsaM7QUp/65k0t7Yr0=";
|
||||
rev = "v${benchmarkRev}";
|
||||
hash = "sha256-gg3g/0Ki29FnGqKv9lDTs5oA9NjH23qQ+hTdVtSU+zo=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake makeWrapper which python3 ]
|
||||
googletestRev = "1.12.1";
|
||||
googletest = fetchFromGitHub {
|
||||
owner = "google";
|
||||
repo = "googletest";
|
||||
rev = "release-${googletestRev}";
|
||||
hash = "sha256-W+OxRTVtemt2esw4P7IyGWXOonUN5ZuscjvzqkYvZbM=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake makeWrapper which python3 git ]
|
||||
++ lib.optionals (stdenv.hostPlatform.isDarwin) [ cctools ];
|
||||
buildInputs = [ libxml2 z3 ];
|
||||
|
||||
# Sandbox disallows network access, so disabling problematic networking tests
|
||||
patches = [
|
||||
./disable-tests.patch
|
||||
(substituteAll {
|
||||
src = ./make-safe-for-sandbox.patch;
|
||||
googletest = fetchFromGitHub {
|
||||
owner = "google";
|
||||
repo = "googletest";
|
||||
# GoogleTest follows Abseil Live at Head philosophy, use latest commit from main branch as often as possible.
|
||||
rev = "1a727c27aa36c602b24bf170a301aec8686b88e8"; # unstable-2023-03-07
|
||||
hash = "sha256-/FWBSxZESwj/QvdNK5BI2EfonT64DP1eGBZR4O8uJww=";
|
||||
};
|
||||
})
|
||||
# Sandbox disallows network access, so disabling problematic networking tests
|
||||
./disable-networking-tests.patch
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
(substituteAll {
|
||||
src = ./fix-darwin-build.patch;
|
||||
@ -61,20 +62,25 @@ stdenv.mkDerivation (rec {
|
||||
];
|
||||
|
||||
postUnpack = ''
|
||||
mkdir -p source/build/build_libs/gbenchmark-prefix/src
|
||||
cp -r "$ponygbenchmark"/ source/build/build_libs/gbenchmark-prefix/src/benchmark
|
||||
chmod -R u+w source/build/build_libs/gbenchmark-prefix/src/benchmark
|
||||
mkdir -p $NIX_BUILD_TOP/deps
|
||||
tar -C "$benchmark" -cf $NIX_BUILD_TOP/deps/benchmark-${benchmarkRev}.tar .
|
||||
tar -C "$googletest" -cf $NIX_BUILD_TOP/deps/googletest-${googletestRev}.tar .
|
||||
'';
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace packages/process/_test.pony \
|
||||
--replace '"/bin/' '"${coreutils}/bin/' \
|
||||
--replace '=/bin' "${coreutils}/bin"
|
||||
--replace-fail '"/bin/' '"${coreutils}/bin/' \
|
||||
--replace-fail '=/bin' "${coreutils}/bin"
|
||||
substituteInPlace src/libponyc/pkg/package.c \
|
||||
--replace "/usr/local/lib" "" \
|
||||
--replace "/opt/local/lib" ""
|
||||
--replace-fail "/usr/local/lib" "" \
|
||||
--replace-fail "/opt/local/lib" ""
|
||||
|
||||
# Replace downloads with local copies.
|
||||
substituteInPlace lib/CMakeLists.txt \
|
||||
--replace-fail "https://github.com/google/benchmark/archive/v${benchmarkRev}.tar.gz" "$NIX_BUILD_TOP/deps/benchmark-${benchmarkRev}.tar" \
|
||||
--replace-fail "https://github.com/google/googletest/archive/release-${googletestRev}.tar.gz" "$NIX_BUILD_TOP/deps/googletest-${googletestRev}.tar"
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
|
@ -1,21 +1,17 @@
|
||||
diff --git a/src/libponyc/codegen/genexe.c b/src/libponyc/codegen/genexe.c
|
||||
index 42a68251..b37958ab 100644
|
||||
index 9ae3ff16..fdfe2bc5 100644
|
||||
--- a/src/libponyc/codegen/genexe.c
|
||||
+++ b/src/libponyc/codegen/genexe.c
|
||||
@@ -296,13 +296,13 @@ static bool link_exe(compile_t* c, ast_t* program,
|
||||
@@ -296,10 +296,10 @@ static bool link_exe(compile_t* c, ast_t* program,
|
||||
char* ld_cmd = (char*)ponyint_pool_alloc_size(ld_len);
|
||||
|
||||
snprintf(ld_cmd, ld_len,
|
||||
#if defined(PLATFORM_IS_ARM)
|
||||
- "%s -execute -arch %.*s "
|
||||
+ "%s -execute "
|
||||
#else
|
||||
- "%s -execute -no_pie -arch %.*s "
|
||||
+ "%s -execute -no_pie "
|
||||
#endif
|
||||
"-o %s %s %s %s "
|
||||
- "-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem %s",
|
||||
- "-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem %s -platform_version macos '" STR(PONY_OSX_PLATFORM) "' '0.0.0'",
|
||||
- linker, (int)arch_len, c->opt->triple, file_exe, file_o,
|
||||
+ "-L@libSystem@/lib -lSystem %s",
|
||||
+ "-L@libSystem@/lib -lSystem %s -platform_version macos '" STR(PONY_OSX_PLATFORM) "' '0.0.0'",
|
||||
+ linker, file_exe, file_o,
|
||||
lib_args, ponyrt, sanitizer_arg
|
||||
);
|
||||
|
@ -1,116 +0,0 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
|
||||
index 129e26e6..d25bdf9d 100644
|
||||
--- a/lib/CMakeLists.txt
|
||||
+++ b/lib/CMakeLists.txt
|
||||
@@ -32,14 +32,14 @@ endif()
|
||||
|
||||
set(PONYC_GBENCHMARK_URL https://github.com/google/benchmark/archive/v1.7.1.tar.gz)
|
||||
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 -DBENCHMARK_ENABLE_WERROR=OFF -DCMAKE_CXX_FLAGS=${PONY_PIC_FLAG} --no-warn-unused-cli
|
||||
)
|
||||
|
||||
set(PONYC_GOOGLETEST_URL https://github.com/google/googletest/archive/release-1.12.1.tar.gz)
|
||||
|
||||
ExternalProject_Add(googletest
|
||||
- URL ${PONYC_GOOGLETEST_URL}
|
||||
+ URL @googletest@
|
||||
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
|
||||
)
|
||||
|
||||
@@ -52,82 +52,6 @@ install(TARGETS blake2
|
||||
COMPONENT library
|
||||
)
|
||||
|
||||
-find_package(Git)
|
||||
-
|
||||
-set(LLVM_DESIRED_HASH "1f9140064dfbfb0bbda8e51306ea51080b2f7aac")
|
||||
-set(PATCHES_DESIRED_HASH "3e16c097794cb669a8f6a0bd7600b440205ac5c29a6135750c2e83263eb16a95")
|
||||
-
|
||||
-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 "needed_if_no_patches")
|
||||
- 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 MATCHES "${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 CACHE BOOL "ponyc specific override of LLVM cache entry")
|
||||
--
|
||||
2.39.2
|
||||
|
Loading…
Reference in New Issue
Block a user