2021-02-15 21:32:07 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchurl, makeWrapper, pcre2, coreutils, which, openssl, libxml2, cmake, z3, substituteAll,
|
2016-10-07 20:17:08 +01:00
|
|
|
cc ? stdenv.cc, lto ? !stdenv.isDarwin }:
|
2015-10-25 10:08:02 +00:00
|
|
|
|
2020-09-28 22:40:58 +01:00
|
|
|
stdenv.mkDerivation (rec {
|
2019-03-24 23:08:24 +00:00
|
|
|
pname = "ponyc";
|
2021-02-15 21:32:07 +00:00
|
|
|
version = "0.38.3";
|
2015-10-25 10:08:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2016-07-27 16:51:19 +01:00
|
|
|
owner = "ponylang";
|
2019-03-24 23:08:24 +00:00
|
|
|
repo = pname;
|
2016-10-07 20:17:08 +01:00
|
|
|
rev = version;
|
2021-02-15 21:32:07 +00:00
|
|
|
sha256 = "14kivmyphi7gbd7mgd4cnsiwl4cl7wih8kwzh7n79s2s4c5hj4ak";
|
2020-09-28 22:40:58 +01:00
|
|
|
|
|
|
|
# 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;
|
2015-10-25 10:08:02 +00:00
|
|
|
};
|
|
|
|
|
2020-09-28 22:40:58 +01:00
|
|
|
ponygbenchmark = fetchurl {
|
2021-02-16 18:57:07 +00:00
|
|
|
url = "https://github.com/google/benchmark/archive/v1.5.0.tar.gz";
|
2020-09-28 22:40:58 +01:00
|
|
|
sha256 = "06i2cr4rj126m1zfz0x1rbxv1mw1l7a11mzal5kqk56cdrdicsiw";
|
|
|
|
name = "v1.5.0.tar.gz";
|
|
|
|
};
|
|
|
|
|
2020-12-31 07:48:55 +00:00
|
|
|
nativeBuildInputs = [ cmake makeWrapper which ];
|
|
|
|
buildInputs = [ libxml2 z3 ];
|
2016-10-07 20:17:08 +01:00
|
|
|
propagatedBuildInputs = [ cc ];
|
2015-10-25 10:08:02 +00:00
|
|
|
|
2020-09-28 22:40:58 +01:00
|
|
|
# Sandbox disallows network access, so disabling problematic networking tests
|
|
|
|
patches = [
|
|
|
|
./disable-tests.patch
|
|
|
|
(substituteAll {
|
|
|
|
src = ./make-safe-for-sandbox.patch;
|
|
|
|
googletest = fetchurl {
|
2021-02-16 18:57:07 +00:00
|
|
|
url = "https://github.com/google/googletest/archive/release-1.8.1.tar.gz";
|
2020-09-28 22:40:58 +01:00
|
|
|
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
|
|
|
|
'';
|
2015-10-25 10:08:02 +00:00
|
|
|
|
2020-09-28 22:40:58 +01:00
|
|
|
dontConfigure = true;
|
2016-10-07 20:17:08 +01:00
|
|
|
|
2020-09-28 22:40:58 +01:00
|
|
|
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
|
2019-08-13 15:29:41 +01:00
|
|
|
|
2020-09-28 22:40:58 +01:00
|
|
|
substituteInPlace packages/process/_test.pony \
|
|
|
|
--replace '"/bin/' '"${coreutils}/bin/' \
|
|
|
|
--replace '=/bin' "${coreutils}/bin"
|
2016-10-07 20:17:08 +01:00
|
|
|
substituteInPlace src/libponyc/pkg/package.c \
|
2019-03-02 08:08:34 +00:00
|
|
|
--replace "/usr/local/lib" "" \
|
2016-10-07 20:17:08 +01:00
|
|
|
--replace "/opt/local/lib" ""
|
2020-09-28 22:40:58 +01:00
|
|
|
'';
|
2016-10-07 20:17:08 +01:00
|
|
|
|
|
|
|
|
2020-09-28 22:40:58 +01:00
|
|
|
preBuild = ''
|
|
|
|
make libs build_flags=-j$NIX_BUILD_CORES
|
|
|
|
make configure build_flags=-j$NIX_BUILD_CORES
|
2015-10-25 10:08:02 +00:00
|
|
|
'';
|
|
|
|
|
2020-09-28 22:40:58 +01:00
|
|
|
makeFlags = [
|
|
|
|
"PONYC_VERSION=${version}"
|
|
|
|
"prefix=${placeholder "out"}"
|
|
|
|
]
|
2021-01-22 11:25:31 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ "bits=64" ]
|
|
|
|
++ lib.optionals (stdenv.isDarwin && (!lto)) [ "lto=no" ];
|
2016-07-27 16:51:19 +01:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2020-09-28 22:40:58 +01:00
|
|
|
NIX_CFLAGS_COMPILE = [ "-Wno-error=redundant-move" "-Wno-error=implicit-fallthrough" ];
|
2015-10-25 10:08:02 +00:00
|
|
|
|
2021-01-24 09:19:10 +00:00
|
|
|
installPhase = "make config=release prefix=$out "
|
|
|
|
+ lib.optionalString stdenv.isDarwin "bits=64 "
|
|
|
|
+ lib.optionalString (stdenv.isDarwin && (!lto)) "lto=no "
|
2016-10-07 20:17:08 +01:00
|
|
|
+ '' install
|
2018-01-11 02:16:01 +00:00
|
|
|
|
|
|
|
wrapProgram $out/bin/ponyc \
|
|
|
|
--prefix PATH ":" "${stdenv.cc}/bin" \
|
|
|
|
--set-default CC "$CC" \
|
2021-02-15 21:32:07 +00:00
|
|
|
--prefix PONYPATH : "${lib.makeLibraryPath [ pcre2 openssl (placeholder "out") ]}"
|
2015-10-25 10:08:02 +00:00
|
|
|
'';
|
|
|
|
|
2016-10-07 20:17:08 +01:00
|
|
|
# Stripping breaks linking for ponyc
|
|
|
|
dontStrip = true;
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2015-10-25 10:08:02 +00:00
|
|
|
description = "Pony is an Object-oriented, actor-model, capabilities-secure, high performance programming language";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.ponylang.org";
|
2017-03-21 12:12:24 +00:00
|
|
|
license = licenses.bsd2;
|
2020-11-09 08:42:27 +00:00
|
|
|
maintainers = with maintainers; [ kamilchm patternspandemic redvers ];
|
2018-01-23 19:41:57 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
2015-10-25 10:08:02 +00:00
|
|
|
};
|
2016-10-07 20:17:08 +01:00
|
|
|
})
|