From fdbc7448569a25a03a2d09f8def1f96a266362f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claes=20Wallin=20=28=E9=9F=8B=E5=98=89=E8=AA=A0=29?= Date: Mon, 5 Feb 2018 14:28:17 +0800 Subject: [PATCH] racket-minimal: build on darwin Technically, racket compiles and packages too, but it doesn't pass all tests yet, so the build fails. gcc7Stdenv is GCC 7 with the MacOS-specific adaptations retained. Building on MacOS with that works, but we should be using clang. I'm hoping that the next person wanting to override the compiler version in some other derivation sees that attribute and doesn't inadvertently break a MacOS build again. --- pkgs/development/interpreters/racket/default.nix | 9 +++++++-- pkgs/development/interpreters/racket/minimal.nix | 2 +- pkgs/top-level/all-packages.nix | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/development/interpreters/racket/default.nix b/pkgs/development/interpreters/racket/default.nix index 4a980ec418f0..e3aa3e8a6f5c 100644 --- a/pkgs/development/interpreters/racket/default.nix +++ b/pkgs/development/interpreters/racket/default.nix @@ -4,6 +4,7 @@ , libpng, libtool, mpfr, openssl, pango, poppler , readline, sqlite , disableDocs ? false +, CoreFoundation }: let @@ -47,9 +48,13 @@ stdenv.mkDerivation rec { FONTCONFIG_FILE = fontsConf; LD_LIBRARY_PATH = libPath; - NIX_LDFLAGS = stdenv.lib.optionalString stdenv.cc.isGNU "-lgcc_s"; + NIX_LDFLAGS = stdenv.lib.concatStringsSep " " [ + (stdenv.lib.optionalString (stdenv.cc.isGNU && ! stdenv.isDarwin) "-lgcc_s") + (stdenv.lib.optionalString stdenv.isDarwin "-framework CoreFoundation") + ]; - buildInputs = [ fontconfig libffi libtool makeWrapper sqlite ]; + buildInputs = [ fontconfig libffi libtool makeWrapper sqlite ] + ++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation ]; preConfigure = '' unset AR diff --git a/pkgs/development/interpreters/racket/minimal.nix b/pkgs/development/interpreters/racket/minimal.nix index 6bac9a0f3414..c63d0040cfee 100644 --- a/pkgs/development/interpreters/racket/minimal.nix +++ b/pkgs/development/interpreters/racket/minimal.nix @@ -14,6 +14,6 @@ racket.overrideAttrs (oldAttrs: rec { as well as libraries that live in collections. In particular, raco and the pkg library are still bundled. ''; - platforms = [ "x86_64-linux" "aarch64-linux" ]; + platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ]; }; }) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b643ab1f6eb6..75788ace0396 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5822,6 +5822,8 @@ with pkgs; extraBuildInputs = lib.optional hostPlatform.isDarwin clang.cc; }; + gcc7Stdenv = overrideCC gccStdenv gcc7; + wrapCCMulti = cc: if system == "x86_64-linux" then let # Binutils with glibc multi @@ -7102,7 +7104,8 @@ with pkgs; # racket 6.11 doesn't build with gcc6 + recent glibc: # https://github.com/racket/racket/pull/1886 # https://github.com/NixOS/nixpkgs/pull/31017#issuecomment-343574769 - stdenv = overrideCC stdenv gcc7; + stdenv = if stdenv.isDarwin then stdenv else gcc7Stdenv; + inherit (darwin.apple_sdk.frameworks) CoreFoundation; }; racket-minimal = callPackage ../development/interpreters/racket/minimal.nix { };