summary refs log tree commit diff
path: root/pkgs/development/compilers/fpc/binary.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/fpc/binary.nix')
-rw-r--r--pkgs/development/compilers/fpc/binary.nix21
1 files changed, 19 insertions, 2 deletions
diff --git a/pkgs/development/compilers/fpc/binary.nix b/pkgs/development/compilers/fpc/binary.nix
index e7afa7c7698..e4c8a2358fc 100644
--- a/pkgs/development/compilers/fpc/binary.nix
+++ b/pkgs/development/compilers/fpc/binary.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, undmg, cpio, xar, lib }:
 
 stdenv.mkDerivation rec {
   pname = "fpc-binary";
@@ -20,9 +20,26 @@ stdenv.mkDerivation rec {
         url = "mirror://sourceforge/project/freepascal/Linux/${version}/fpc-${version}.aarch64-linux.tar";
         sha256 = "b39470f9b6b5b82f50fc8680a5da37d2834f2129c65c24c5628a80894d565451";
       }
+    else if stdenv.isDarwin then
+      fetchurl {
+        url = "mirror://sourceforge/project/freepascal/Mac%20OS%20X/${version}/fpc-${version}.intelarm64-macosx.dmg";
+        sha256 = "05d4510c8c887e3c68de20272abf62171aa5b2ef1eba6bce25e4c0bc41ba8b7d";
+      }
     else throw "Not supported on ${stdenv.hostPlatform.system}.";
 
-  builder = ./binary-builder.sh;
+
+  nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
+    undmg
+    xar
+    cpio
+  ];
+
+  builder =
+    if stdenv.hostPlatform.isLinux then
+      ./binary-builder.sh
+    else if stdenv.hostPlatform.isDarwin then
+      ./binary-builder-darwin.sh
+    else throw "Not supported on ${stdenv.hostPlatform}.";
 
   meta = {
     description = "Free Pascal Compiler from a binary distribution";