diff --git a/pkgs/development/compilers/ponyc/default.nix b/pkgs/development/compilers/ponyc/default.nix index f22fb6fece1a..c7008ec22a8a 100644 --- a/pkgs/development/compilers/ponyc/default.nix +++ b/pkgs/development/compilers/ponyc/default.nix @@ -13,6 +13,7 @@ , substituteAll , which , z3 +, darwin }: stdenv.mkDerivation (rec { @@ -34,7 +35,8 @@ stdenv.mkDerivation (rec { hash = "sha256-pUW9YVaujs/y00/SiPqDgK4wvVsaM7QUp/65k0t7Yr0="; }; - nativeBuildInputs = [ cmake makeWrapper which python3 ]; + nativeBuildInputs = [ cmake makeWrapper which python3 ] + ++ lib.optionals (stdenv.isDarwin) [ darwin.cctools ]; buildInputs = [ libxml2 z3 ]; # Sandbox disallows network access, so disabling problematic networking tests @@ -50,6 +52,11 @@ stdenv.mkDerivation (rec { hash = "sha256-/FWBSxZESwj/QvdNK5BI2EfonT64DP1eGBZR4O8uJww="; }; }) + ] ++ lib.optionals stdenv.isDarwin [ + (substituteAll { + src = ./fix-darwin-build.patch; + libSystem = darwin.Libsystem; + }) ]; postUnpack = '' @@ -81,7 +88,8 @@ stdenv.mkDerivation (rec { env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=redundant-move" "-Wno-error=implicit-fallthrough" ]; - doCheck = true; + # make: *** [Makefile:222: test-full-programs-release] Killed: 9 + doCheck = !stdenv.isDarwin; installPhase = "make config=release prefix=$out " + lib.optionalString stdenv.isDarwin ("bits=64 " + (lib.optionalString (!lto) "lto=no ")) @@ -102,6 +110,6 @@ stdenv.mkDerivation (rec { homepage = "https://www.ponylang.org"; license = licenses.bsd2; maintainers = with maintainers; [ kamilchm patternspandemic redvers ]; - platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ]; + platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; }; }) diff --git a/pkgs/development/compilers/ponyc/fix-darwin-build.patch b/pkgs/development/compilers/ponyc/fix-darwin-build.patch new file mode 100644 index 000000000000..2570145da8de --- /dev/null +++ b/pkgs/development/compilers/ponyc/fix-darwin-build.patch @@ -0,0 +1,22 @@ +diff --git a/src/libponyc/codegen/genexe.c b/src/libponyc/codegen/genexe.c +index 42a68251..b37958ab 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, + + 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", +- linker, (int)arch_len, c->opt->triple, file_exe, file_o, ++ "-L@libSystem@/lib -lSystem %s", ++ linker, file_exe, file_o, + lib_args, ponyrt, sanitizer_arg + ); +