From 57250fc2cc23a0cf1001698246b0910adc053ecf Mon Sep 17 00:00:00 2001 From: Dan Peebles Date: Mon, 2 Mar 2015 23:20:35 -0500 Subject: [PATCH] Enable cgo on darwin --- pkgs/development/compilers/go/1.4.nix | 13 +++++++++---- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/go/1.4.nix b/pkgs/development/compilers/go/1.4.nix index 9acb399aa1b..e3d816f44e5 100644 --- a/pkgs/development/compilers/go/1.4.nix +++ b/pkgs/development/compilers/go/1.4.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl, fetchgit, bison, glibc, bash, coreutils, makeWrapper, tzdata, iana_etc, perl }: +{ stdenv, lib, fetchurl, fetchgit, bison, glibc, bash, coreutils, makeWrapper, tzdata, iana_etc, perl, Security }: let loader386 = "${glibc}/lib/ld-linux.so.2"; @@ -23,7 +23,9 @@ stdenv.mkDerivation { src = srcs.golang; # perl is used for testing go vet - buildInputs = [ bison bash makeWrapper perl ] ++ lib.optionals stdenv.isLinux [ glibc ] ; + buildInputs = [ bison bash makeWrapper perl ] + ++ lib.optionals stdenv.isLinux [ glibc ] + ++ lib.optionals stdenv.isDarwin [ Security ]; # I'm not sure what go wants from its 'src', but the go installation manual # describes an installation keeping the src. @@ -76,10 +78,13 @@ stdenv.mkDerivation { else throw "Unsupported system"; GOARM = stdenv.lib.optionalString (stdenv.system == "armv5tel-linux") "5"; GO386 = 387; # from Arch: don't assume sse2 on i686 - CGO_ENABLED = if stdenv.isDarwin then 0 else 1; + CGO_ENABLED = 1; + + # The go build actually checks for CC=*/clang and does something different, so we don't + # just want the generic `cc` here. + CC = if stdenv.isDarwin then "clang" else "cc"; installPhase = '' - export CC=cc mkdir -p "$out/bin" export GOROOT="$(pwd)/" export GOBIN="$out/bin" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9fcacf55c04..12dfc9d225d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3593,7 +3593,7 @@ let go_1_3 = callPackage ../development/compilers/go/1.3.nix { }; - go_1_4 = callPackage ../development/compilers/go/1.4.nix { }; + go_1_4 = callPackage ../development/compilers/go/1.4.nix { inherit (darwin) Security; }; go = go_1_4;