git.iko.soy/typeable/nixpkgs
on master help sign in
R: fix Darwin build

Merged manually from https://github.com/NixOS/nixpkgs/pull/10623.

commita225a650bf8659ee30c535d8160f3f5288284837 authorAsko Soukka <asko.soukka@iki.fi> dateMon 29 Jun 2015, 03:42 (11 years ago) parent26f80d7
4 files changed+34−11
pkgs/applications/science/math/R/default.nix+22−8 pkgs/development/r-modules/default.nix+4−1 pkgs/development/r-modules/generic-builder.nix+6−2 pkgs/top-level/all-packages.nix+2
pkgs/applications/science/math/R/default.nix+22−8
@@ -1,7 +1,7 @@
1−{ stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt
2−, libjpeg, libpng, libtiff, ncurses, pango, pcre, perl, readline, tcl
3−, texLive, tk, xz, zlib, less, texinfo, graphviz, icu, pkgconfig, bison
4−, imake, which, jdk, openblas, curl
1+{ stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt, libjpeg, libpng
2+, libtiff, ncurses, pango, pcre, perl, readline, tcl, texLive, tk, xz, zlib
3+, less, texinfo, graphviz, icu, pkgconfig, bison, imake, which, jdk, openblas
4+, curl, Cocoa, Foundation, cf-private, libobjc, tzdata
55, withRecommendedPackages ? true
66}:
77
@@ -14,10 +14,11 @@ stdenv.mkDerivation rec {
1414 };
1515
1616 buildInputs = [ bzip2 gfortran libX11 libXmu libXt
17− libXt libjpeg libpng libtiff ncurses pango pcre perl readline tcl
18− texLive tk xz zlib less texinfo graphviz icu pkgconfig bison imake
19− which jdk openblas curl
20− ];
17+ libXt libjpeg libpng libtiff ncurses pango pcre perl readline
18+ texLive xz zlib less texinfo graphviz icu pkgconfig bison imake
19+ which jdk openblas curl ]
20+ ++ stdenv.lib.optionals (!stdenv.isDarwin) [ tcl tk ]
21+ ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa Foundation cf-private libobjc ];
2122
2223 patches = [ ./no-usr-local-search-paths.patch ];
2324
@@ -48,10 +49,23 @@ stdenv.mkDerivation rec {
4849 LDFLAGS="-L${gfortran.cc}/lib"
4950 RANLIB=$(type -p ranlib)
5051 R_SHELL="${stdenv.shell}"
52+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
53+ --without-tcltk
54+ --without-aqua
55+ --disable-R-framework
56+ CC="clang"
57+ CXX="clang++"
58+ OBJC="clang"
59+ '' + ''
5160 )
5261 echo "TCLLIBPATH=${tk}/lib" >>etc/Renviron.in
5362 '';
5463
64+ postConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
65+ sed -i 's|/usr/share/zoneinfo|${tzdata}/share/zoneinfo|g' src/library/base/R/datetime.R
66+ sed -i 's|getenv("R_SHARE_DIR")|"${tzdata}/share"|g' src/extra/tzone/localtime.c
67+ '';
68+
5569 installTargets = [ "install" "install-info" "install-pdf" ];
5670
5771 doCheck = true;
pkgs/development/r-modules/default.nix+4−1
@@ -5,7 +5,10 @@
55let
66 inherit (pkgs) fetchurl stdenv lib;
77
8− buildRPackage = pkgs.callPackage ./generic-builder.nix { inherit R; };
8+ buildRPackage = pkgs.callPackage ./generic-builder.nix {
9+ inherit R;
10+ inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa Foundation;
11+ };
912
1013 # Generates package templates given per-repository settings
1114 #
pkgs/development/r-modules/generic-builder.nix+6−2
@@ -1,10 +1,14 @@
1−{ stdenv, R, xvfb_run, utillinux }:
1+{ stdenv, R, libcxx, xvfb_run, utillinux, Cocoa, Foundation }:
22
33{ name, buildInputs ? [], ... } @ attrs:
44
55stdenv.mkDerivation ({
66 buildInputs = buildInputs ++ [R] ++
7− stdenv.lib.optionals attrs.requireX [utillinux xvfb_run];
7+ stdenv.lib.optionals attrs.requireX [utillinux xvfb_run] ++
8+ stdenv.lib.optionals stdenv.isDarwin [Cocoa Foundation];
9+
10+ NIX_CFLAGS_COMPILE =
11+ stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
812
913 configurePhase = ''
1014 runHook preConfigure
pkgs/top-level/all-packages.nix+2
@@ -9078,6 +9078,8 @@ let
90789078 };
90799079 openblas = openblasCompat;
90809080 withRecommendedPackages = false;
9081+ inherit (darwin.apple_sdk.frameworks) Cocoa Foundation;
9082+ inherit (darwin) cf-private libobjc;
90819083 };
90829084
90839085 rWrapper = callPackage ../development/r-modules/wrapper.nix {