ponyc: run through nixfmt

(cherry picked from commit f59267c1cc)
This commit is contained in:
Morgan Jones 2024-10-19 19:48:09 -07:00 committed by github-actions[bot]
parent 7b9ae1c56b
commit 7db4687ee2

View File

@ -1,22 +1,23 @@
{ lib {
, stdenv lib,
, fetchFromGitHub stdenv,
, cmake fetchFromGitHub,
, coreutils cmake,
, libxml2 coreutils,
, lto ? true libxml2,
, makeWrapper lto ? true,
, openssl makeWrapper,
, pcre2 openssl,
, pony-corral pcre2,
, python3 pony-corral,
# Not really used for anything real, just at build time. python3,
, git # Not really used for anything real, just at build time.
, substituteAll git,
, which substituteAll,
, z3 which,
, cctools z3,
, darwin cctools,
darwin,
}: }:
stdenv.mkDerivation (rec { stdenv.mkDerivation (rec {
@ -47,24 +48,35 @@ stdenv.mkDerivation (rec {
hash = "sha256-W+OxRTVtemt2esw4P7IyGWXOonUN5ZuscjvzqkYvZbM="; hash = "sha256-W+OxRTVtemt2esw4P7IyGWXOonUN5ZuscjvzqkYvZbM=";
}; };
nativeBuildInputs = [ cmake makeWrapper which python3 git ] nativeBuildInputs = [
++ lib.optionals (stdenv.hostPlatform.isDarwin) [ cctools ]; cmake
buildInputs = [ libxml2 z3 ]; makeWrapper
which
python3
git
] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ cctools ];
patches = [ buildInputs = [
# Sandbox disallows network access, so disabling problematic networking tests libxml2
./disable-networking-tests.patch z3
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
(substituteAll {
src = ./fix-darwin-build.patch;
libSystem = darwin.Libsystem;
})
]; ];
patches =
[
# Sandbox disallows network access, so disabling problematic networking tests
./disable-networking-tests.patch
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
(substituteAll {
src = ./fix-darwin-build.patch;
libSystem = darwin.Libsystem;
})
];
postUnpack = '' postUnpack = ''
mkdir -p $NIX_BUILD_TOP/deps mkdir -p $NIX_BUILD_TOP/deps
tar -C "$benchmark" -cf $NIX_BUILD_TOP/deps/benchmark-${benchmarkRev}.tar . tar -C "$benchmark" -cf $NIX_BUILD_TOP/deps/benchmark-$benchmarkRev.tar .
tar -C "$googletest" -cf $NIX_BUILD_TOP/deps/googletest-${googletestRev}.tar . tar -C "$googletest" -cf $NIX_BUILD_TOP/deps/googletest-$googletestRev.tar .
''; '';
dontConfigure = true; dontConfigure = true;
@ -79,8 +91,8 @@ stdenv.mkDerivation (rec {
# Replace downloads with local copies. # Replace downloads with local copies.
substituteInPlace lib/CMakeLists.txt \ 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/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" --replace-fail "https://github.com/google/googletest/archive/release-$googletestRev.tar.gz" "$NIX_BUILD_TOP/deps/googletest-$googletestRev.tar"
''; '';
preBuild = '' preBuild = ''
@ -93,20 +105,33 @@ stdenv.mkDerivation (rec {
"prefix=${placeholder "out"}" "prefix=${placeholder "out"}"
] ++ lib.optionals stdenv.hostPlatform.isDarwin ([ "bits=64" ] ++ lib.optional (!lto) "lto=no"); ] ++ lib.optionals stdenv.hostPlatform.isDarwin ([ "bits=64" ] ++ lib.optional (!lto) "lto=no");
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=redundant-move" "-Wno-error=implicit-fallthrough" ]; env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error=redundant-move"
"-Wno-error=implicit-fallthrough"
];
# make: *** [Makefile:222: test-full-programs-release] Killed: 9 # make: *** [Makefile:222: test-full-programs-release] Killed: 9
doCheck = !stdenv.hostPlatform.isDarwin; doCheck = !stdenv.hostPlatform.isDarwin;
installPhase = '' installPhase = ''
make config=release prefix=$out ${ makeArgs=(config=release prefix=$out)
lib.optionalString stdenv.hostPlatform.isDarwin ("bits=64 " + (lib.optionalString (!lto) "lto=no ")) '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
} install makeArgs+=(bits=64)
'' + lib.optionalString (stdenv.hostPlatform.isDarwin && !lto) ''
makeArgs+=(lto=no)
'' + ''
make "''${makeArgs[@]}" install
wrapProgram $out/bin/ponyc \ wrapProgram $out/bin/ponyc \
--prefix PATH ":" "${stdenv.cc}/bin" \ --prefix PATH ":" "${stdenv.cc}/bin" \
--set-default CC "$CC" \ --set-default CC "$CC" \
--prefix PONYPATH : "${lib.makeLibraryPath [ pcre2 openssl (placeholder "out") ]}" --prefix PONYPATH : "${
''; lib.makeLibraryPath [
pcre2
openssl
(placeholder "out")
]
}"
'';
# Stripping breaks linking for ponyc # Stripping breaks linking for ponyc
dontStrip = true; dontStrip = true;
@ -117,7 +142,16 @@ stdenv.mkDerivation (rec {
description = "Pony is an Object-oriented, actor-model, capabilities-secure, high performance programming language"; description = "Pony is an Object-oriented, actor-model, capabilities-secure, high performance programming language";
homepage = "https://www.ponylang.org"; homepage = "https://www.ponylang.org";
license = licenses.bsd2; license = licenses.bsd2;
maintainers = with maintainers; [ kamilchm patternspandemic redvers ]; maintainers = with maintainers; [
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; kamilchm
patternspandemic
redvers
];
platforms = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
}; };
}) })