2023-03-15 16:39:30 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, coreutils
|
|
|
|
, libxml2
|
|
|
|
, lto ? !stdenv.isDarwin
|
|
|
|
, makeWrapper
|
|
|
|
, openssl
|
|
|
|
, pcre2
|
|
|
|
, pony-corral
|
|
|
|
, python3
|
|
|
|
, substituteAll
|
|
|
|
, which
|
|
|
|
, z3
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
stdenv.mkDerivation (rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "ponyc";
|
2023-03-15 16:39:30 +00:00
|
|
|
version = "0.54.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ponylang";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-qFPubqGfK0WCun6QA1OveyDJj7Wf6SQpky7pEb7qsf4=";
|
2020-10-07 09:15:18 +00:00
|
|
|
fetchSubmodules = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-06-06 07:54:09 +00:00
|
|
|
ponygbenchmark = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "benchmark";
|
2023-05-24 13:37:59 +00:00
|
|
|
rev = "v1.8.0";
|
|
|
|
hash = "sha256-pUW9YVaujs/y00/SiPqDgK4wvVsaM7QUp/65k0t7Yr0=";
|
2020-10-07 09:15:18 +00:00
|
|
|
};
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
nativeBuildInputs = [ cmake makeWrapper which python3 ];
|
2021-01-15 22:18:51 +00:00
|
|
|
buildInputs = [ libxml2 z3 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
# Sandbox disallows network access, so disabling problematic networking tests
|
|
|
|
patches = [
|
|
|
|
./disable-tests.patch
|
|
|
|
(substituteAll {
|
|
|
|
src = ./make-safe-for-sandbox.patch;
|
2022-01-13 20:06:32 +00:00
|
|
|
googletest = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "googletest";
|
2023-03-15 16:39:30 +00:00
|
|
|
# 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=";
|
2020-10-07 09:15:18 +00:00
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
mkdir -p source/build/build_libs/gbenchmark-prefix/src
|
2021-06-06 07:54:09 +00:00
|
|
|
cp -r "$ponygbenchmark"/ source/build/build_libs/gbenchmark-prefix/src/benchmark
|
|
|
|
chmod -R u+w source/build/build_libs/gbenchmark-prefix/src/benchmark
|
2020-10-07 09:15:18 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
dontConfigure = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace packages/process/_test.pony \
|
|
|
|
--replace '"/bin/' '"${coreutils}/bin/' \
|
|
|
|
--replace '=/bin' "${coreutils}/bin"
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace src/libponyc/pkg/package.c \
|
|
|
|
--replace "/usr/local/lib" "" \
|
|
|
|
--replace "/opt/local/lib" ""
|
2020-10-07 09:15:18 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
preBuild = ''
|
|
|
|
make libs build_flags=-j$NIX_BUILD_CORES
|
|
|
|
make configure build_flags=-j$NIX_BUILD_CORES
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PONYC_VERSION=${version}"
|
|
|
|
"prefix=${placeholder "out"}"
|
2023-03-15 16:39:30 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin ([ "bits=64" ] ++ lib.optional (!lto) "lto=no");
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=redundant-move" "-Wno-error=implicit-fallthrough" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
installPhase = "make config=release prefix=$out "
|
2023-03-15 16:39:30 +00:00
|
|
|
+ lib.optionalString stdenv.isDarwin ("bits=64 " + (lib.optionalString (!lto) "lto=no "))
|
2020-04-24 23:36:52 +00:00
|
|
|
+ '' install
|
|
|
|
wrapProgram $out/bin/ponyc \
|
|
|
|
--prefix PATH ":" "${stdenv.cc}/bin" \
|
|
|
|
--set-default CC "$CC" \
|
2021-02-17 17:02:09 +00:00
|
|
|
--prefix PONYPATH : "${lib.makeLibraryPath [ pcre2 openssl (placeholder "out") ]}"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Stripping breaks linking for ponyc
|
|
|
|
dontStrip = true;
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
passthru.tests.pony-corral = pony-corral;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Pony is an Object-oriented, actor-model, capabilities-secure, high performance programming language";
|
|
|
|
homepage = "https://www.ponylang.org";
|
|
|
|
license = licenses.bsd2;
|
2023-03-30 22:05:00 +00:00
|
|
|
maintainers = with maintainers; [ kamilchm patternspandemic redvers ];
|
2023-03-08 16:32:21 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
})
|