R: fix Darwin build

Merged manually from https://github.com/NixOS/nixpkgs/pull/10623.
This commit is contained in:
Asko Soukka 2015-06-29 03:42:31 +03:00 committed by Peter Simons
parent 26f80d7a6f
commit a225a650bf
4 changed files with 34 additions and 11 deletions

View file

@ -1,7 +1,7 @@
{ stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt
, libjpeg, libpng, libtiff, ncurses, pango, pcre, perl, readline, tcl
, texLive, tk, xz, zlib, less, texinfo, graphviz, icu, pkgconfig, bison
, imake, which, jdk, openblas, curl
{ stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt, libjpeg, libpng
, libtiff, ncurses, pango, pcre, perl, readline, tcl, texLive, tk, xz, zlib
, less, texinfo, graphviz, icu, pkgconfig, bison, imake, which, jdk, openblas
, curl, Cocoa, Foundation, cf-private, libobjc, tzdata
, withRecommendedPackages ? true
}:
@ -14,10 +14,11 @@ stdenv.mkDerivation rec {
};
buildInputs = [ bzip2 gfortran libX11 libXmu libXt
libXt libjpeg libpng libtiff ncurses pango pcre perl readline tcl
texLive tk xz zlib less texinfo graphviz icu pkgconfig bison imake
which jdk openblas curl
];
libXt libjpeg libpng libtiff ncurses pango pcre perl readline
texLive xz zlib less texinfo graphviz icu pkgconfig bison imake
which jdk openblas curl ]
++ stdenv.lib.optionals (!stdenv.isDarwin) [ tcl tk ]
++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa Foundation cf-private libobjc ];
patches = [ ./no-usr-local-search-paths.patch ];
@ -48,10 +49,23 @@ stdenv.mkDerivation rec {
LDFLAGS="-L${gfortran.cc}/lib"
RANLIB=$(type -p ranlib)
R_SHELL="${stdenv.shell}"
'' + stdenv.lib.optionalString stdenv.isDarwin ''
--without-tcltk
--without-aqua
--disable-R-framework
CC="clang"
CXX="clang++"
OBJC="clang"
'' + ''
)
echo "TCLLIBPATH=${tk}/lib" >>etc/Renviron.in
'';
postConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
sed -i 's|/usr/share/zoneinfo|${tzdata}/share/zoneinfo|g' src/library/base/R/datetime.R
sed -i 's|getenv("R_SHARE_DIR")|"${tzdata}/share"|g' src/extra/tzone/localtime.c
'';
installTargets = [ "install" "install-info" "install-pdf" ];
doCheck = true;

View file

@ -5,7 +5,10 @@
let
inherit (pkgs) fetchurl stdenv lib;
buildRPackage = pkgs.callPackage ./generic-builder.nix { inherit R; };
buildRPackage = pkgs.callPackage ./generic-builder.nix {
inherit R;
inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa Foundation;
};
# Generates package templates given per-repository settings
#

View file

@ -1,10 +1,14 @@
{ stdenv, R, xvfb_run, utillinux }:
{ stdenv, R, libcxx, xvfb_run, utillinux, Cocoa, Foundation }:
{ name, buildInputs ? [], ... } @ attrs:
stdenv.mkDerivation ({
buildInputs = buildInputs ++ [R] ++
stdenv.lib.optionals attrs.requireX [utillinux xvfb_run];
stdenv.lib.optionals attrs.requireX [utillinux xvfb_run] ++
stdenv.lib.optionals stdenv.isDarwin [Cocoa Foundation];
NIX_CFLAGS_COMPILE =
stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
configurePhase = ''
runHook preConfigure

View file

@ -9078,6 +9078,8 @@ let
};
openblas = openblasCompat;
withRecommendedPackages = false;
inherit (darwin.apple_sdk.frameworks) Cocoa Foundation;
inherit (darwin) cf-private libobjc;
};
rWrapper = callPackage ../development/r-modules/wrapper.nix {