pure darwin stdenv

This commit is contained in:
Jude Taylor
2015-06-11 17:58:26 -07:00
parent 5e63669520
commit fa9c81f694
19 changed files with 435 additions and 132 deletions

View File

@@ -1,6 +1,6 @@
{ pkgs, newScope, stdenv, isl, fetchurl, overrideCC, wrapCC }:
let
callPackage = newScope (self // { inherit isl version fetch; });
callPackage = newScope (self // { inherit stdenv isl version fetch; });
version = "3.6.1";

View File

@@ -24,6 +24,17 @@ stdenv.mkDerivation rec {
++ lib.optional stdenv.isSunOS ./ld-shared.patch
++ lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
# There's an annoying bug on sandboxed Darwin in Perl's Cwd.pm where it looks for pwd
# in /bin/pwd and /usr/bin/pwd and then falls back on just "pwd" if it can't get them
# while at the same time erasing the PATH environment variable so it unconditionally
# fails. The code in question is guarded by a check for Mac OS, but the patch below
# doesn't have any runtime effect on other platforms.
postPatch = ''
pwd="$(type -P pwd)"
substituteInPlace dist/Cwd/Cwd.pm \
--replace "pwd_cmd = 'pwd'" "pwd_cmd = '$pwd'"
'';
# Build a thread-safe Perl with a dynamic libperls.o. We need the
# "installstyle" option to ensure that modules are put under
# $out/lib/perl5 - this is the general default, but because $out

View File

@@ -35,6 +35,17 @@ stdenv.mkDerivation rec {
++ optional stdenv.isSunOS ./ld-shared.patch
++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
# There's an annoying bug on sandboxed Darwin in Perl's Cwd.pm where it looks for pwd
# in /bin/pwd and /usr/bin/pwd and then falls back on just "pwd" if it can't get them
# while at the same time erasing the PATH environment variable so it unconditionally
# fails. The code in question is guarded by a check for Mac OS, but the patch below
# doesn't have any runtime effect on other platforms.
postPatch = ''
pwd="$(type -P pwd)"
substituteInPlace dist/PathTools/Cwd.pm \
--replace "pwd_cmd = 'pwd'" "pwd_cmd = '$pwd'"
'';
# Build a thread-safe Perl with a dynamic libperls.o. We need the
# "installstyle" option to ensure that modules are put under
# $out/lib/perl5 - this is the general default, but because $out

View File

@@ -62,6 +62,8 @@ let
for i in Lib/plat-*/regen; do
substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/
done
'' + optionalString stdenv.isDarwin ''
substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"'
'';
configureFlags = [
@@ -72,6 +74,8 @@ let
"--with-system-ffi"
"--with-system-expat"
"ac_cv_func_bind_textdomain_codeset=yes"
] ++ optionals stdenv.isDarwin [
"--disable-toolbox-glue"
];
postConfigure = if stdenv.isCygwin then ''

View File

@@ -19,7 +19,12 @@ stdenv.mkDerivation (rec {
"--with-included-gettext"
"--with-included-glib"
"--with-included-libcroco"
]);
])
# avoid retaining reference to CF during stdenv bootstrap
++ (stdenv.lib.optionals stdenv.isDarwin [
"gt_cv_func_CFPreferencesCopyAppValue=no"
"gt_cv_func_CFLocaleCopyCurrent=no"
]);
# On cross building, gettext supposes that the wchar.h from libc
# does not fulfill gettext needs, so it tries to work with its

View File

@@ -32,6 +32,11 @@ stdenv.mkDerivation {
configureFlags = "--disable-debug" +
stdenv.lib.optionalString stdenv.isDarwin " --enable-rpath";
# remove dependency on bootstrap-tools in early stdenv build
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
sed -i 's/INSTALL_CMD=.*install/INSTALL_CMD=install/' $out/lib/icu/${version}/pkgdata.inc
'';
enableParallelBuilding = true;
meta = with stdenv.lib; {

View File

@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
] else null;
postInstall = ''
sed -i ${stdenv.lib.optionalString (stdenv.isDarwin && stdenv.cc.nativeTools) "''"} s/-lncurses/-lncursesw/g $out/lib/pkgconfig/libedit.pc
sed -i s/-lncurses/-lncursesw/g $out/lib/pkgconfig/libedit.pc
'';
configureFlags = [ "--enable-widec" ];

View File

@@ -13,6 +13,13 @@ stdenv.mkDerivation (rec {
sha256 = "039agw5rqvqny92cpkrfn243x2gd4xn13hs3xi6isk55d2vqqr9n";
};
postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace configure \
--replace '/usr/bin/libtool' 'ar' \
--replace 'AR="libtool"' 'AR="ar"' \
--replace 'ARFLAGS="-o"' 'ARFLAGS="-r"'
'';
configureFlags = if static then "" else "--shared";
preConfigure = ''

View File

@@ -2,8 +2,6 @@
, cross ? null, gold ? true, bison ? null
}:
assert !stdenv.isDarwin;
let basename = "binutils-2.23.1"; in
with { inherit (stdenv.lib) optional optionals optionalString; };
@@ -56,7 +54,9 @@ stdenv.mkDerivation rec {
# As binutils takes part in the stdenv building, we don't want references
# to the bootstrap-tools libgcc (as uses to happen on arm/mips)
NIX_CFLAGS_COMPILE = "-static-libgcc";
NIX_CFLAGS_COMPILE = if stdenv.isDarwin
then "-Wno-string-plus-int -Wno-deprecated-declarations"
else "-static-libgcc";
configureFlags =
[ "--enable-shared" "--enable-deterministic-archives" ]