R: fix Darwin build

Merged manually from https://github.com/NixOS/nixpkgs/pull/10623.
This commit is contained in:
Asko Soukka
2016-01-06 22:20:40 +01:00
committed by Peter Simons
parent 26f80d7a6f
commit a225a650bf
4 changed files with 34 additions and 11 deletions
+22 -8
View File
@@ -1,7 +1,7 @@
{ stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt { stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt, libjpeg, libpng
, libjpeg, libpng, libtiff, ncurses, pango, pcre, perl, readline, tcl , libtiff, ncurses, pango, pcre, perl, readline, tcl, texLive, tk, xz, zlib
, texLive, tk, xz, zlib, less, texinfo, graphviz, icu, pkgconfig, bison , less, texinfo, graphviz, icu, pkgconfig, bison, imake, which, jdk, openblas
, imake, which, jdk, openblas, curl , curl, Cocoa, Foundation, cf-private, libobjc, tzdata
, withRecommendedPackages ? true , withRecommendedPackages ? true
}: }:
@@ -14,10 +14,11 @@ stdenv.mkDerivation rec {
}; };
buildInputs = [ bzip2 gfortran libX11 libXmu libXt buildInputs = [ bzip2 gfortran libX11 libXmu libXt
libXt libjpeg libpng libtiff ncurses pango pcre perl readline tcl libXt libjpeg libpng libtiff ncurses pango pcre perl readline
texLive tk xz zlib less texinfo graphviz icu pkgconfig bison imake texLive xz zlib less texinfo graphviz icu pkgconfig bison imake
which jdk openblas curl 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 ]; patches = [ ./no-usr-local-search-paths.patch ];
@@ -48,10 +49,23 @@ stdenv.mkDerivation rec {
LDFLAGS="-L${gfortran.cc}/lib" LDFLAGS="-L${gfortran.cc}/lib"
RANLIB=$(type -p ranlib) RANLIB=$(type -p ranlib)
R_SHELL="${stdenv.shell}" 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 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" ]; installTargets = [ "install" "install-info" "install-pdf" ];
doCheck = true; doCheck = true;
+4 -1
View File
@@ -5,7 +5,10 @@
let let
inherit (pkgs) fetchurl stdenv lib; 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 # Generates package templates given per-repository settings
# #
@@ -1,10 +1,14 @@
{ stdenv, R, xvfb_run, utillinux }: { stdenv, R, libcxx, xvfb_run, utillinux, Cocoa, Foundation }:
{ name, buildInputs ? [], ... } @ attrs: { name, buildInputs ? [], ... } @ attrs:
stdenv.mkDerivation ({ stdenv.mkDerivation ({
buildInputs = buildInputs ++ [R] ++ 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 = '' configurePhase = ''
runHook preConfigure runHook preConfigure
+2
View File
@@ -9078,6 +9078,8 @@ let
}; };
openblas = openblasCompat; openblas = openblasCompat;
withRecommendedPackages = false; withRecommendedPackages = false;
inherit (darwin.apple_sdk.frameworks) Cocoa Foundation;
inherit (darwin) cf-private libobjc;
}; };
rWrapper = callPackage ../development/r-modules/wrapper.nix { rWrapper = callPackage ../development/r-modules/wrapper.nix {