ponyc: update 0.38.1 (#98598)

Co-authored-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
This commit is contained in:
Redvers Davies
2020-09-28 17:40:58 -04:00
committed by GitHub
co-authored by Dmitry Kalinkin
parent 9630d5c07f
commit 046c6a7038
3 changed files with 160 additions and 38 deletions
+65 -37
View File
@@ -1,64 +1,92 @@
{ stdenv, fetchFromGitHub, llvm, makeWrapper, pcre2, coreutils, which, libressl, libxml2,
{ stdenv, fetchFromGitHub, fetchurl, makeWrapper, pcre2, coreutils, which, libressl, libxml2, cmake, z3, substituteAll,
cc ? stdenv.cc, lto ? !stdenv.isDarwin }:
stdenv.mkDerivation ( rec {
stdenv.mkDerivation (rec {
pname = "ponyc";
version = "0.33.2";
version = "0.38.1";
src = fetchFromGitHub {
owner = "ponylang";
repo = pname;
rev = version;
sha256 = "0jcdr1r3g8sm3q9fcc87d6x98fg581n6hb90hz7r08mzn4bwvysw";
sha256 = "1hk810k9h3bl641pgw91y4x2qw67rvbapx6p2pk9qz5p7nfcn7qh";
# Due to a bug in LLVM 9.x, ponyc has to include its own vendored patched
# LLVM. (The submodule is a specific tag in the LLVM source tree).
#
# The pony developers are currently working to get off 9.x as quickly
# as possible so hopefully in a few revisions this package build will
# become a lot simpler.
#
# https://reviews.llvm.org/rG9f4f237e29e7150dfcf04ae78fa287d2dc8d48e2
fetchSubmodules = true;
};
buildInputs = [ llvm makeWrapper which libxml2 ];
ponygbenchmark = fetchurl {
url = https://github.com/google/benchmark/archive/v1.5.0.tar.gz;
sha256 = "06i2cr4rj126m1zfz0x1rbxv1mw1l7a11mzal5kqk56cdrdicsiw";
name = "v1.5.0.tar.gz";
};
buildInputs = [ makeWrapper which libxml2 cmake z3 ];
propagatedBuildInputs = [ cc ];
# Disable problematic networking tests
patches = [ ./disable-tests.patch ];
# Sandbox disallows network access, so disabling problematic networking tests
patches = [
./disable-tests.patch
(substituteAll {
src = ./make-safe-for-sandbox.patch;
googletest = fetchurl {
url = https://github.com/google/googletest/archive/release-1.8.1.tar.gz;
sha256 = "17147961i01fl099ygxjx4asvjanwdd446nwbq9v8156h98zxwcv";
name = "release-1.8.1.tar.gz";
};
})
];
postUnpack = ''
mkdir -p source/build/build_libs/gbenchmark-prefix/src
tar -C source/build/build_libs/gbenchmark-prefix/src -zxvf "$ponygbenchmark"
mv source/build/build_libs/gbenchmark-prefix/src/benchmark-1.5.0 \
source/build/build_libs/gbenchmark-prefix/src/benchmark
'';
dontConfigure = true;
postPatch = ''
# Patching Vendor LLVM
patchShebangs --host build/build_libs/gbenchmark-prefix/src/benchmark/tools/*.py
patch -d lib/llvm/src/ -p1 < lib/llvm/patches/2020-09-01-is-trivially-copyable.diff
patch -d lib/llvm/src/ -p1 < lib/llvm/patches/2020-01-07-01-c-exports.diff
patch -d lib/llvm/src/ -p1 < lib/llvm/patches/2019-12-23-01-jit-eh-frames.diff
preBuild = ''
# Fix tests
substituteInPlace packages/process/_test.pony \
--replace '"/bin/' '"${coreutils}/bin/'
substituteInPlace packages/process/_test.pony \
--replace '"/bin/' '"${coreutils}/bin/' \
--replace '=/bin' "${coreutils}/bin"
# Disabling the stdlib tests
substituteInPlace Makefile-ponyc \
--replace 'test-ci: all check-version test-core test-stdlib-debug test-stdlib' 'test-ci: all check-version test-core'
# Remove impure system refs
substituteInPlace src/libponyc/pkg/package.c \
--replace "/usr/local/lib" "" \
--replace "/opt/local/lib" ""
for file in `grep -irl '/usr/local/opt/libressl/lib' ./*`; do
substituteInPlace $file --replace '/usr/local/opt/libressl/lib' "${stdenv.lib.getLib libressl}/lib"
done
export LLVM_CONFIG=${llvm}/bin/llvm-config
'' + stdenv.lib.optionalString ((!stdenv.isDarwin) && (!cc.isClang) && lto) ''
export LTO_PLUGIN=`find ${cc.cc}/ -name liblto_plugin.so`
'' + stdenv.lib.optionalString ((!stdenv.isDarwin) && (cc.isClang) && lto) ''
export LTO_PLUGIN=`find ${cc.cc}/ -name LLVMgold.so`
'';
makeFlags = [ "config=release" ] ++ stdenv.lib.optionals stdenv.isDarwin [ "bits=64" ]
++ stdenv.lib.optionals (stdenv.isDarwin && (!lto)) [ "lto=no" ];
preBuild = ''
make libs build_flags=-j$NIX_BUILD_CORES
make configure build_flags=-j$NIX_BUILD_CORES
'';
makeFlags = [
"PONYC_VERSION=${version}"
"prefix=${placeholder "out"}"
]
++ stdenv.lib.optionals stdenv.isDarwin [ "bits=64" ]
++ stdenv.lib.optionals (stdenv.isDarwin && (!lto)) [ "lto=no" ];
enableParallelBuilding = true;
doCheck = true;
checkTarget = "test-ci";
NIX_CFLAGS_COMPILE = [ "-Wno-error=redundant-move" ];
preCheck = ''
export PONYPATH="$out/lib:${stdenv.lib.makeLibraryPath [ pcre2 libressl ]}"
'';
NIX_CFLAGS_COMPILE = [ "-Wno-error=redundant-move" "-Wno-error=implicit-fallthrough" ];
installPhase = ''
make config=release prefix=$out ''
@@ -79,7 +107,7 @@ stdenv.mkDerivation ( rec {
description = "Pony is an Object-oriented, actor-model, capabilities-secure, high performance programming language";
homepage = "https://www.ponylang.org";
license = licenses.bsd2;
maintainers = with maintainers; [ doublec kamilchm patternspandemic ];
maintainers = with maintainers; [ doublec kamilchm patternspandemic redvers ];
platforms = [ "x86_64-linux" "x86_64-darwin" ];
};
})