Merge 'mingw-w64' and 'darwin' into cross-win-osx.

Both branches have quite a lot in common, so it's time for a merge and
do the cleanups with respect to both implementations and also generalize
both implementations as much as possible.

This also closes #1876.

Conflicts:
	pkgs/development/interpreters/lua-5/5.2.nix
	pkgs/development/libraries/SDL/default.nix
	pkgs/development/libraries/glew/default.nix
	pkgs/top-level/all-packages.nix
This commit is contained in:
aszlig 2014-03-12 10:16:51 +01:00
commit c7bac81c66
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961
33 changed files with 487 additions and 119 deletions

View File

@ -26,6 +26,10 @@ if test -z "$nativeLibc"; then
fi
fi
if [ -n "$osxMinVersion" ]; then
cflagsCompile="$cflagsCompile -mmacosx-version-min=$osxMinVersion"
fi
echo "$cflagsCompile -B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
echo "-L$libc/lib -rpath $libc/lib -rpath-link $libc/lib" > $out/nix-support/libc-ldflags

View File

@ -46,6 +46,7 @@ stdenv.mkDerivation {
addFlags = ./add-flags;
inherit nativeTools nativeLibc nativePrefix gcc libc binutils;
crossConfig = if cross != null then cross.config else null;
osxMinVersion = cross.osxMinVersion or null;
gccLibs = if gcc != null then gccLibs else null;
name = chosenName;
langC = if nativeTools then true else gcc.langC;

View File

@ -70,11 +70,16 @@ fi
if test "$dontSetConfigureCross" != "1"; then
configureFlags="$configureFlags --build=$system --host=$crossConfig"
# This is because -print-prog-name tries to search FHS paths.
configureFlags="$configureFlags LD=$crossConfig-ld"
fi
# Disabling the tests when cross compiling, as usually the tests are meant for
# native compilations.
doCheck=""
# Don't strip foreign binaries with native "strip" tool.
dontStrip=1
# Add the output as an rpath.
if test "$NIX_NO_SELF_RPATH" != "1"; then
export NIX_CROSS_LDFLAGS="-rpath $out/lib -rpath-link $out/lib $NIX_CROSS_LDFLAGS"

View File

@ -17,13 +17,17 @@ stdenv.mkDerivation rec {
];
sourceRoot = ".";
outputs = [ "out" "lib" ];
makeFlags = "TOPDIR=$(out) TZDIR=$(out)/share/zoneinfo ETCDIR=$(TMPDIR)/etc LIBDIR=$(TMPDIR)/lib MANDIR=$(TMPDIR)/man AWK=awk";
makeFlags = "TOPDIR=$(out) TZDIR=$(out)/share/zoneinfo ETCDIR=$(TMPDIR)/etc LIBDIR=$(lib)/lib MANDIR=$(TMPDIR)/man AWK=awk";
postInstall =
''
mv $out/share/zoneinfo-posix $out/share/zoneinfo/posix
mv $out/share/zoneinfo-leaps $out/share/zoneinfo/right
ensureDir "$lib/include"
cp tzfile.h "$lib/include/tzfile.h"
'';
meta = {

View File

@ -159,10 +159,8 @@ let version = "4.6.3";
# In any case, mingw32 g++ linking is broken by default with shared libs,
# unless adding "-lsupc++" to any linking command. I don't know why.
" --disable-shared" +
(if cross.config == "x86_64-w64-mingw32" then
# To keep ABI compatibility with upstream mingw-w64
" --enable-fully-dynamic-string"
else "")
# To keep ABI compatibility with upstream mingw-w64
" --enable-fully-dynamic-string"
else (if cross.libc == "uclibc" then
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.

View File

@ -117,7 +117,8 @@ let version = "4.8.2";
withMode;
/* Cross-gcc settings */
crossMingw = (cross != null && cross.libc == "msvcrt");
crossMingw = cross != null && cross.libc == "msvcrt";
crossDarwin = cross != null && cross.libc == "libSystem";
crossConfigureFlags = let
gccArch = stdenv.cross.gcc.arch or null;
gccCpu = stdenv.cross.gcc.cpu or null;
@ -161,7 +162,12 @@ let version = "4.8.2";
" --disable-shared" +
" --disable-decimal-float" # libdecnumber requires libc
else
" --with-headers=${libcCross}/include" +
(if crossDarwin then
" --with-sysroot=${libcCross}/share/sysroot" +
" --with-as=${binutilsCross}/bin/${cross.config}-as" +
" --with-ld=${binutilsCross}/bin/${cross.config}-ld"
else
" --with-headers=${libcCross}/include") +
" --enable-__cxa_atexit" +
" --enable-long-long" +
(if crossMingw then
@ -175,10 +181,8 @@ let version = "4.8.2";
# In any case, mingw32 g++ linking is broken by default with shared libs,
# unless adding "-lsupc++" to any linking command. I don't know why.
" --disable-shared" +
(if cross.config == "x86_64-w64-mingw32" then
# To keep ABI compatibility with upstream mingw-w64
" --enable-fully-dynamic-string"
else "")
# To keep ABI compatibility with upstream mingw-w64
" --enable-fully-dynamic-string"
else (if cross.libc == "uclibc" then
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
@ -346,6 +350,7 @@ stdenv.mkDerivation ({
++ optional langAda "ada"
++ optional langVhdl "vhdl"
++ optional langGo "go"
++ optionals crossDarwin [ "objc" "obj-c++" ]
)
)
}

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
sha256 = "004zyh9p3lpvbwhyhlmrw6wwcia5abx84q4h2brkn4zdypipvmiz";
};
buildInputs = [ readline ];
nativeBuildInputs = [ readline ];
patches = [ dsoPatch ];
@ -49,6 +49,37 @@ stdenv.mkDerivation rec {
EOF
'';
crossAttrs = let
isMingw = stdenv.cross.libc == "msvcrt";
isDarwin = stdenv.cross.libc == "libSystem";
in {
configurePhase = ''
makeFlagsArray=(
INSTALL_TOP=$out
INSTALL_MAN=$out/share/man/man1
CC=${stdenv.cross.config}-gcc
STRIP=:
RANLIB=${stdenv.cross.config}-ranlib
V=${majorVersion}
R=${version}
${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin ''
AR="${stdenv.cross.config}-ar rcu"
macosx
''}
)
'' + stdenv.lib.optionalString isMingw ''
installFlagsArray=(
TO_BIN="lua.exe luac.exe"
TO_LIB="liblua.a lua52.dll"
INSTALL_DATA="cp -d"
)
'';
} // stdenv.lib.optionalAttrs isDarwin {
postPatch = ''
sed -i -e 's/-Wl,-soname[^ ]* *//' src/Makefile
'';
};
meta = {
homepage = "http://www.lua.org";
description = "Powerful, fast, lightweight, embeddable scripting language";

View File

@ -7,21 +7,13 @@
# OSS is no longer supported, for it's much crappier than ALSA and
# PulseAudio.
assert alsaSupport || pulseaudioSupport;
assert !(stdenv ? cross) -> alsaSupport || pulseaudioSupport;
assert openglSupport -> (mesa != null && x11Support);
assert x11Support -> (x11 != null && libXrandr != null);
assert alsaSupport -> alsaLib != null;
assert pulseaudioSupport -> pulseaudio != null;
let
configureFlagsFun = attrs: ''
--disable-oss --disable-video-x11-xme
--disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared
--disable-osmesa-shared
${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""}
'';
in
stdenv.mkDerivation rec {
version = "1.2.15";
name = "SDL-${version}";
@ -32,20 +24,46 @@ stdenv.mkDerivation rec {
};
# Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
propagatedBuildInputs = stdenv.lib.optionals x11Support [ x11 libXrandr ] ++
propagatedNativeBuildInputs =
stdenv.lib.optionals x11Support [ x11 libXrandr ] ++
stdenv.lib.optional pulseaudioSupport pulseaudio;
buildInputs = [ pkgconfig audiofile ] ++
buildInputs = let
notMingw = !(stdenv ? cross) || stdenv.cross.libc != "msvcrt";
in stdenv.lib.optional notMingw audiofile;
nativeBuildInputs = [ pkgconfig ] ++
stdenv.lib.optional openglSupport [ mesa ] ++
stdenv.lib.optional alsaSupport alsaLib;
# XXX: By default, SDL wants to dlopen() PulseAudio, in which case
# we must arrange to add it to its RPATH; however, `patchelf' seems
# to fail at doing this, hence `--disable-pulseaudio-shared'.
configureFlags = configureFlagsFun { inherit alsaLib; };
configureFlags = [
"--disable-oss"
"--disable-video-x11-xme"
"--disable-x11-shared"
"--disable-alsa-shared"
"--enable-rpath"
"--disable-pulseaudio-shared"
"--disable-osmesa-shared"
] ++ stdenv.lib.optionals (stdenv ? cross) ([
"--without-x"
] ++ stdenv.lib.optional alsaSupport "--with-alsa-prefix=${alsaLib}/lib");
crossAttrs = {
configureFlags = configureFlagsFun { alsaLib = alsaLib.crossDrv; };
crossAttrs =stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") {
patches = let
f = rev: sha256: fetchurl {
url = "http://hg.libsdl.org/SDL/raw-rev/${rev}";
inherit sha256;
};
in [
(f "e9466ead70e5" "0ygir3k83d0vxp7s3k48jn3j8n2bnv9wm6613wpx3ybnjrxabrip")
(f "bbfb41c13a87" "17v29ybjifvka19m8qf14rjc43nfdwk9v9inaizznarhb17amlnv")
];
postPatch = ''
sed -i -e 's/ *-fpascal-strings//' configure
'';
};
passthru = {inherit openglSupport;};

View File

@ -3,7 +3,7 @@
stdenv.mkDerivation rec {
name = "audiofile-0.3.6";
buildInputs = stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
nativeBuildInputs = stdenv.lib.optional stdenv.isLinux alsaLib;
src = fetchurl {
url = "http://audiofile.68k.org/${name}.tar.gz";

View File

@ -1,5 +1,7 @@
{ stdenv, fetchurl, mesa_glu, x11, libXmu, libXi }:
with stdenv.lib;
stdenv.mkDerivation rec {
name = "glew-1.10.0";
@ -8,23 +10,38 @@ stdenv.mkDerivation rec {
sha256 = "01zki46dr5khzlyywr3cg615bcal32dazfazkf360s1znqh17i4r";
};
buildInputs = [ x11 libXmu libXi ];
propagatedBuildInputs = [ mesa_glu ]; # GL/glew.h includes GL/glu.h
nativeBuildInputs = [ x11 libXmu libXi ];
propagatedNativeBuildInputs = [ mesa_glu ]; # GL/glew.h includes GL/glu.h
patchPhase = ''
sed -i 's|lib64|lib|' config/Makefile.linux
${optionalString (stdenv ? cross) ''
sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile
''}
'';
buildPhase = "make all";
installPhase = ''
GLEW_DEST=$out make install.all
buildFlags = [ "all" ];
installFlags = [ "install.all" ];
preInstall = ''
export GLEW_DEST="$out"
'';
postInstall = ''
mkdir -pv $out/share/doc/glew
mkdir -p $out/lib/pkgconfig
cp glew*.pc $out/lib/pkgconfig
cp -r README.txt LICENSE.txt doc $out/share/doc/glew
'';
crossAttrs.makeFlags = [
"CC=${stdenv.cross.config}-gcc"
"LD=${stdenv.cross.config}-gcc"
"AR=${stdenv.cross.config}-ar"
"STRIP="
] ++ optional (stdenv.cross.libc == "msvcrt") "SYSTEM=mingw"
++ optional (stdenv.cross.libc == "libSystem") "SYSTEM=darwin";
meta = {
description = "An OpenGL extension loading library for C(++)";
homepage = http://glew.sourceforge.net/;

View File

@ -24,6 +24,12 @@ stdenv.mkDerivation rec {
make check
'';
crossAttrs = let
isCross64 = stdenv.cross.config == "x86_64-w64-mingw32";
in stdenv.lib.optionalAttrs isCross64 {
configureFlags = [ "--disable-asm" "--disable-padlock-support" ];
};
meta = {
description = "GNU Libgcrypt, a general-pupose cryptographic library";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, bash }:
{ stdenv, fetchurl, bash, gettext }:
stdenv.mkDerivation (rec {
name = "libgpg-error-1.12";
@ -8,6 +8,10 @@ stdenv.mkDerivation (rec {
sha256 = "0pz58vr12qihq2f0bypjxsb6cf6ajq5258fmfm8s6lvwm3b9xz6a";
};
# If architecture-dependant MO files aren't available, they're generated
# during build, so we need gettext for cross-builds.
crossAttrs.buildInputs = [ gettext ];
doCheck = true;
meta = {

View File

@ -1,6 +1,6 @@
{ stdenv, fetchurl, zlib, xz }:
assert zlib != null;
assert !(stdenv ? cross) -> zlib != null;
stdenv.mkDerivation rec {
name = "libpng-1.2.50";
@ -16,6 +16,11 @@ stdenv.mkDerivation rec {
passthru = { inherit zlib; };
crossAttrs = stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") {
propagatedBuildInputs = [];
passthru = {};
};
meta = {
description = "The official reference implementation for the PNG file format";
homepage = http://www.libpng.org/pub/png/libpng.html;

View File

@ -12,7 +12,7 @@ diff -ru -x '*~' openssl-1.0.0e-orig/crypto/x509/x509_def.c openssl-1.0.0e/crypt
#include "cryptlib.h"
#include <openssl/crypto.h>
#include <openssl/x509.h>
@@ -71,7 +75,19 @@
@@ -71,7 +75,25 @@
{ return(X509_CERT_DIR); }
const char *X509_get_default_cert_file(void)
@ -23,9 +23,15 @@ diff -ru -x '*~' openssl-1.0.0e-orig/crypto/x509/x509_def.c openssl-1.0.0e/crypt
+ if (!init) {
+ init = 1;
+ char * s = getenv("OPENSSL_X509_CERT_FILE");
+ if (s && getuid() == geteuid()) {
+ strncpy(buf, s, sizeof(buf));
+ buf[sizeof(buf) - 1] = 0;
+ if (s) {
+#ifndef OPENSSL_SYS_WINDOWS
+ if (getuid() == geteuid()) {
+#endif
+ strncpy(buf, s, sizeof(buf));
+ buf[sizeof(buf) - 1] = 0;
+#ifndef OPENSSL_SYS_WINDOWS
+ }
+#endif
+ }
+ }
+ return buf;

View File

@ -8,7 +8,9 @@ let
(throw "openssl needs its platform name cross building" null)
stdenv.cross;
patchesCross = isCross:
patchesCross = isCross: let
isDarwin = stdenv.isDarwin || (isCross && stdenv.cross.libc == "libSystem");
in
[ # Allow the location of the X509 certificate file (the CA
# bundle) to be set through the environment variable
# OPENSSL_X509_CERT_FILE. This is necessary because the
@ -29,7 +31,7 @@ let
./kfreebsd-gnu.patch
]
++ stdenv.lib.optional stdenv.isDarwin ./darwin-arch.patch;
++ stdenv.lib.optional isDarwin ./darwin-arch.patch;
in
@ -91,6 +93,8 @@ stdenv.mkDerivation {
rm $out/bin/c_rehash $out/ssl/misc/CA.pl $out/ssl/misc/tsget
'';
configureScript = "./Configure";
} // stdenv.lib.optionalAttrs (opensslCrossSystem == "darwin64-x86_64-cc") {
CC = "gcc";
};
meta = {

View File

@ -1,4 +1,8 @@
{ stdenv, fetchurl, unicodeSupport ? true, cplusplusSupport ? true }:
{ stdenv, fetchurl, unicodeSupport ? true, cplusplusSupport ? true
, windows ? null
}:
with stdenv.lib;
stdenv.mkDerivation rec {
name = "pcre-8.34";
@ -16,12 +20,16 @@ stdenv.mkDerivation rec {
--enable-jit
${if unicodeSupport then "--enable-unicode-properties" else ""}
${if !cplusplusSupport then "--disable-cpp" else ""}
'' + stdenv.lib.optionalString stdenv.isDarwin "CXXFLAGS=-O0";
'' + optionalString stdenv.isDarwin "CXXFLAGS=-O0";
doCheck = with stdenv; !(isCygwin || isFreeBSD);
# XXX: test failure on Cygwin
# we are running out of stack on both freeBSDs on Hydra
crossAttrs = optionalAttrs (stdenv.cross.libc == "msvcrt") {
buildInputs = [ windows.mingw_w64_pthreads.crossDrv ];
};
meta = {
homepage = "http://www.pcre.org/";
description = "A library for Perl Compatible Regular Expressions";
@ -35,7 +43,7 @@ stdenv.mkDerivation rec {
PCRE library is free, even for building proprietary software.
'';
platforms = stdenv.lib.platforms.all;
maintainers = [ stdenv.lib.maintainers.simons ];
platforms = platforms.all;
maintainers = [ maintainers.simons ];
};
}

View File

@ -148,8 +148,7 @@ stdenv.mkDerivation rec {
'';
crossAttrs = let
isMingw = stdenv.cross.config == "i686-pc-mingw32" ||
stdenv.cross.config == "x86_64-w64-mingw32";
isMingw = stdenv.cross.libc == "msvcrt";
in {
# I've not tried any case other than i686-pc-mingw32.
# -nomake tools: it fails linking some asian language symbols

View File

@ -36,6 +36,8 @@ stdenv.mkDerivation rec {
"-f" "win32/Makefile.gcc"
"PREFIX=${stdenv.cross.config}-"
] ++ (if static then [] else [ "SHARED_MODE=1" ]);
} // stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") {
makeFlags = [ "RANLIB=${stdenv.cross.config}-ranlib" ];
};
# zlib doesn't like the automatic --disable-shared from the Cygwin stdenv.

View File

@ -0,0 +1,28 @@
{ stdenv, fetchgit, cmake, zlib, libpng, bzip2, libusb, openssl }:
stdenv.mkDerivation {
name = "xpwn-0.5.8git";
src = fetchgit {
url = "git://github.com/dborca/xpwn.git";
rev = "4534da88d4e8a32cdc9da9b5326e2cc482c95ef0";
sha256 =
"1h1ak40fg5bym0hifpii9q2hqdp2m387cwfzb4bl6qq36xpkd6wv";
};
preConfigure = ''
sed -r -i \
-e 's/(install.*TARGET.*DESTINATION )\.\)/\1bin)/' \
-e 's!(install.*(FILE|DIR).*DESTINATION )([^)]*)!\1share/xpwn/\3!' \
*/CMakeLists.txt
sed -i -e '/install/d' CMakeLists.txt
'';
buildInputs = [ cmake zlib libpng bzip2 libusb openssl ];
meta = {
homepage = "http://planetbeing.lighthouseapp.com/projects/15246-xpwn";
description = "Custom NOR firmware loader/IPSW generator for the iPhone";
license = stdenv.lib.licenses.gpl3Plus;
};
}

View File

@ -26,7 +26,13 @@ stdenv.mkDerivation rec {
patches =
# Don't search in non-Nix locations such as /usr, but do search in
# Nixpkgs' Glibc.
optional (stdenv ? glibc) ./search-path.patch;
optional (stdenv ? glibc) ./search-path.patch ++
optional (stdenv ? cross) (fetchurl {
name = "fix-darwin-cross-compile.patch";
url = "http://public.kitware.com/Bug/file_download.php?"
+ "file_id=4981&type=bug";
sha256 = "16acmdr27adma7gs9rs0dxdiqppm15vl3vv3agy7y8s94wyh4ybv";
});
buildInputs = [ curl expat zlib bzip2 libarchive ]
++ optional useNcurses ncurses

View File

@ -1,26 +0,0 @@
source $stdenv/setup
if test $cross = "arm-linux" ; then
configureFlags="--target=arm-linux"
elif test $cross = "mips-linux" ; then
configureFlags="--target=mips-linux"
elif test $cross = "mipsel-linux" ; then
configureFlags="--target=mipsel-linux"
elif test $cross = "sparc-linux" ; then
configureFlags="--target=sparc-linux"
elif test $cross = "powerpc-linux" ; then
configureFlags="--target=powerpc-linux"
elif test $cross = "ppc-linux" ; then
configureFlags="--target=powerpc-linux"
fi
patchConfigure() {
# Clear the default library search path.
if test "$noSysDirs" = "1"; then
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
fi
}
preConfigure=patchConfigure
genericBuild

View File

@ -1,13 +0,0 @@
{stdenv, fetchurl, noSysDirs, cross}:
stdenv.mkDerivation {
name = "binutils-2.16.1";
builder = ./builder.sh;
src = fetchurl {
url = http://ftp.nluug.nl/gnu/binutils/binutils-2.16.1.tar.bz2;
md5 = "6a9d529efb285071dad10e1f3d2b2967";
};
inherit noSysDirs;
#configureFlags = if cross=="arm-linux" then "--target=arm-linux" else if cross=="mips-linux" then "--target=mips-linux" else if cross=="sparc-linux" then "--target=sparc-linux";
inherit cross;
}

View File

@ -0,0 +1,64 @@
{ stdenv, cross, fetchurl, autoconf, automake, libtool
, libcxx, llvm, clang, openssl, libuuid
, maloader, makeWrapper, xctoolchain
}:
stdenv.mkDerivation rec {
name = "cctools-port-${version}";
version = "845";
src = fetchurl {
url = "https://github.com/tpoechtrager/cctools-port/archive/"
+ "cctools-${version}-ld64-136-1.tar.gz";
sha256 = "06pg6h1g8avgx4j6cfykdpggf490li796gzhhyqn27jsagli307i";
};
buildInputs = [
autoconf automake libtool libcxx llvm clang openssl libuuid makeWrapper
];
patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch ];
enableParallelBuilding = true;
postPatch = ''
patchShebangs tools
sed -i -e 's/which/type -P/' tools/*.sh
sed -i -e 's|clang++|& -I${libcxx}/include/c++/v1|' cctools/autogen.sh
# Workaround for https://www.sourceware.org/bugzilla/show_bug.cgi?id=11157
cat > cctools/include/unistd.h <<EOF
#ifdef __block
# undef __block
# include_next "unistd.h"
# define __block __attribute__((__blocks__(byref)))
#else
# include_next "unistd.h"
#endif
EOF
'';
preConfigure = ''
cd cctools
sh autogen.sh
'';
configureFlags = [
"CXXFLAGS=-I${libcxx}/include/c++/v1"
"--target=${cross.config}"
];
postInstall = ''
for tool in dyldinfo dwarfdump dsymutil; do
makeWrapper "${maloader}/bin/ld-mac" "$out/bin/${cross.config}-$tool" \
--add-flags "${xctoolchain}/bin/$tool"
ln -s "$out/bin/${cross.config}-$tool" "$out/bin/$tool"
done
'';
meta = {
homepage = "http://www.opensource.apple.com/source/cctools/";
description = "Mac OS X Compiler Tools (cross-platform port)";
license = stdenv.lib.licenses.apsl20;
};
}

View File

@ -0,0 +1,16 @@
diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp
index 2565518..9250016 100644
--- a/cctools/ld64/src/ld/Options.cpp
+++ b/cctools/ld64/src/ld/Options.cpp
@@ -2522,6 +2522,11 @@ void Options::parse(int argc, const char* argv[])
throw "missing argument to -rpath";
fRPaths.push_back(path);
}
+ else if ( strcmp(arg, "-rpath-link") == 0 ) {
+ const char* path = argv[++i];
+ if ( path == NULL )
+ throw "missing argument to -rpath-link";
+ }
else if ( strcmp(arg, "-read_only_stubs") == 0 ) {
fReadOnlyx86Stubs = true;
}

View File

@ -0,0 +1,31 @@
diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp
index 9250016..91d54ec 100644
--- a/cctools/ld64/src/ld/Options.cpp
+++ b/cctools/ld64/src/ld/Options.cpp
@@ -4175,23 +4175,9 @@ void Options::checkIllegalOptionCombinations()
throw "-r and -dead_strip cannot be used together";
// can't use -rpath unless targeting 10.5 or later
- if ( fRPaths.size() > 0 ) {
- if ( !minOS(ld::mac10_5, ld::iOS_2_0) )
- throw "-rpath can only be used when targeting Mac OS X 10.5 or later";
- switch ( fOutputKind ) {
- case Options::kDynamicExecutable:
- case Options::kDynamicLibrary:
- case Options::kDynamicBundle:
- break;
- case Options::kStaticExecutable:
- case Options::kObjectFile:
- case Options::kDyld:
- case Options::kPreload:
- case Options::kKextBundle:
- throw "-rpath can only be used when creating a dynamic final linked image";
- }
- }
-
+ if ( fRPaths.size() > 0 && !minOS(ld::mac10_5, ld::iOS_2_0) )
+ throw "-rpath can only be used when targeting Mac OS X 10.5 or later";
+
if ( fPositionIndependentExecutable ) {
switch ( fOutputKind ) {
case Options::kDynamicExecutable:

View File

@ -0,0 +1,36 @@
{ stdenv, fetchgit, opencflite, clang, libcxx }:
stdenv.mkDerivation {
name = "maloader-0git";
src = fetchgit {
url = "git://github.com/shinh/maloader.git";
rev = "5f220393e0b7b9ad0cf1aba0e89df2b42a1f0442";
sha256 = "07j9b7n0grrbxxyn2h8pnk6pa8b370wq5z5zwbds8dlhi7q37rhn";
};
postPatch = ''
sed -i \
-e '/if.*loadLibMac.*mypath/s|mypath|"'"$out/lib/"'"|' \
-e 's|libCoreFoundation\.so|${opencflite}/lib/&|' \
ld-mac.cc
'';
NIX_CFLAGS_COMPILE = "-I${libcxx}/include/c++/v1";
buildInputs = [ clang libcxx ];
buildFlags = [ "USE_LIBCXX=1" "release" ];
installPhase = ''
install -vD libmac.so "$out/lib/libmac.so"
for bin in extract macho2elf ld-mac; do
install -vD "$bin" "$out/bin/$bin"
done
'';
meta = {
description = "Mach-O loader for Linux";
homepage = "https://github.com/shinh/maloader";
license = stdenv.lib.licenses.bsd2;
};
}

View File

@ -0,0 +1,21 @@
{ stdenv, fetchurl, icu, libuuid, tzdata }:
stdenv.mkDerivation rec {
name = "opencflite-${version}";
version = "476.19.0";
src = fetchurl {
url = "mirror://sourceforge/opencflite/${name}.tar.gz";
sha256 = "0jgmzs0ycl930hmzcvx0ykryik56704yw62w394q1q3xw5kkjn9v";
};
configureFlags = [ "--with-uuid=${libuuid}" ];
buildInputs = [ icu tzdata.lib ];
enableParallelBuilding = true;
meta = {
description = "Cross platform port of the OS X CoreFoundation";
homepage = "http://sourceforge.net/projects/opencflite/";
license = stdenv.lib.licenses.apsl20;
};
}

View File

@ -0,0 +1,52 @@
{ stdenv, requireFile, xpwn }:
with stdenv.lib;
let
osxVersion = "10.9";
in stdenv.mkDerivation rec {
name = "xcode-${version}";
version = "5.1";
src = requireFile {
name = "xcode_${version}.dmg";
url = meta.homepage;
sha256 = "0zkggbmsfc5w53j1ncbpayvnn1vzpyzyjjjzhawq1jjfq465bfvh";
};
phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ];
outputs = [ "out" "toolchain" ];
unpackCmd = let
basePath = "Xcode.app/Contents/Developer/Platforms/MacOSX.platform";
sdkPath = "${basePath}/Developer/SDKs";
in ''
${xpwn}/bin/dmg extract "$curSrc" main.hfs > /dev/null
${xpwn}/bin/hfsplus main.hfs extractall "${sdkPath}" > /dev/null
'';
setSourceRoot = "sourceRoot=MacOSX${osxVersion}.sdk";
patches = optional (osxVersion == "10.9") ./gcc-fix-enum-attributes.patch;
installPhase = ''
ensureDir "$out/share/sysroot"
cp -a * "$out/share/sysroot/"
ln -s "$out/share/sysroot/usr/lib" "$out/lib"
ln -s "$out/share/sysroot/usr/include" "$out/include"
ensureDir "$toolchain"
pushd "$toolchain"
${xpwn}/bin/hfsplus "$(dirs +1)/../main.hfs" extractall \
Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr \
> /dev/null
popd
'';
meta = {
homepage = "https://developer.apple.com/downloads/";
description = "Apple's XCode SDK";
license = stdenv.lib.licenses.unfree;
};
}

View File

@ -0,0 +1,13 @@
diff --git a/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h b/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h
index fa0c290..7da7e0c 100644
--- a/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h
+++ b/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h
@@ -13,7 +13,7 @@ typedef NS_ENUM(NSInteger, NSUserNotificationActivationType) {
NSUserNotificationActivationTypeNone = 0,
NSUserNotificationActivationTypeContentsClicked = 1,
NSUserNotificationActivationTypeActionButtonClicked = 2,
- NSUserNotificationActivationTypeReplied NS_AVAILABLE(10_9, NA) = 3
+ NSUserNotificationActivationTypeReplied = 3
} NS_ENUM_AVAILABLE(10_8, NA);
NS_CLASS_AVAILABLE(10_8, NA)

View File

@ -1,30 +1,30 @@
{stdenv, fetchurl, binutilsCross ? null, gccCross ? null, onlyHeaders ? false}:
{ stdenv, fetchurl, binutilsCross ? null, gccCross ? null
, onlyHeaders ? false
, onlyPthreads ? false
}:
let
name = "mingw-w64-2.0.3";
name = "mingw-w64-3.1.0";
in
stdenv.mkDerivation (rec {
inherit name;
src = fetchurl {
url = "mirror://sourceforge/mingw-w64/mingw-w64-v2.0.3.tar.gz";
sha256 = "043jk6z90f9pxs9kfn6ckh2vlnbgcv6yfbp5ybahrj3z58dcijp5";
url = "mirror://sourceforge/mingw-w64/mingw-w64-v3.1.0.tar.bz2";
sha256 = "1lhpw381gc59w8b1r9zzdwa9cdi2wx6qx7s6rvajapmbw7ksgrzc";
};
# I don't know what's that $host directory about, I put the
# files inside include as usual.
postInstall = ''
rmdir $out/include
mv $out/x86_64-w64-mingw32/* $out
rm -R $out/x86_64-w64-mingw32
'';
} //
(if onlyHeaders then {
name = name + "-headers";
preConfingure = ''
preConfigure = ''
cd mingw-w64-headers
'';
configureFlags = "--without-crt --host=x86_64-w64-mingw32";
configureFlags = "--without-crt";
} else if onlyPthreads then {
name = name + "-pthreads";
preConfigure = ''
cd mingw-w64-libraries/winpthreads
'';
} else {
buildInputs = [ gccCross binutilsCross ];

View File

@ -14,6 +14,7 @@ stdenv.mkDerivation {
crossAttrs = {
patchPhase = ''
sed -i -e '/<sys\\stat\.h>/s|\\|/|' bzip2.c
sed -i -e 's/CC=gcc/CC=${stdenv.cross.config}-gcc/' \
-e 's/AR=ar/AR=${stdenv.cross.config}-ar/' \
-e 's/RANLIB=ranlib/RANLIB=${stdenv.cross.config}-ranlib/' \

View File

@ -2448,10 +2448,10 @@ let
gcc_realCross = gcc48_realCross;
gccCrossStageStatic = let
isMingw = (stdenv.cross.libc == "msvcrt");
isMingw64 = isMingw && stdenv.cross.config == "x86_64-w64-mingw32";
libcCross1 = if isMingw64 then windows.mingw_w64_headers else
if isMingw then windows.mingw_headers1 else null;
libcCross1 =
if stdenv.cross.libc == "msvcrt" then windows.mingw_w64_headers
else if stdenv.cross.libc == "libSystem" then darwin.xcode
else null;
in
wrapGCCCross {
gcc = forceNativeDrv (lib.addMetaAttrs { hydraPlatforms = []; } (
@ -3474,11 +3474,13 @@ let
gold = false;
});
binutilsCross = lowPrio (forceNativeDrv (import ../development/tools/misc/binutils {
inherit stdenv fetchurl zlib;
noSysDirs = true;
cross = assert crossSystem != null; crossSystem;
}));
binutilsCross =
if crossSystem != null && crossSystem.libc == "libSystem" then darwin.cctools
else lowPrio (forceNativeDrv (import ../development/tools/misc/binutils {
inherit stdenv fetchurl zlib;
noSysDirs = true;
cross = assert crossSystem != null; crossSystem;
}));
bison2 = callPackage ../development/tools/parsing/bison/2.x.nix { };
bison3 = callPackage ../development/tools/parsing/bison/3.x.nix { };
@ -3851,6 +3853,8 @@ let
xmlindent = callPackage ../development/web/xmlindent {};
xpwn = callPackage ../development/mobile/xpwn {};
xxdiff = callPackage ../development/tools/misc/xxdiff {
bison = bison2;
};
@ -4272,9 +4276,8 @@ let
# We can choose:
libcCrossChooser = name : if name == "glibc" then glibcCross
else if name == "uclibc" then uclibcCross
else if name == "msvcrt" && stdenv.cross.config == "x86_64-w64-mingw32" then
windows.mingw_w64
else if name == "msvcrt" then windows.mingw_headers3
else if name == "msvcrt" then windows.mingw_w64
else if name == "libSystem" then darwin.xcode
else throw "Unknown libc";
libcCross = assert crossSystem != null; libcCrossChooser crossSystem.libc;
@ -6571,6 +6574,22 @@ let
cramfsswap = callPackage ../os-specific/linux/cramfsswap { };
darwin = rec {
cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port {
cross = assert crossSystem != null; crossSystem;
inherit maloader;
xctoolchain = xcode.toolchain;
});
maloader = callPackage ../os-specific/darwin/maloader {
inherit opencflite;
};
opencflite = callPackage ../os-specific/darwin/opencflite {};
xcode = callPackage ../os-specific/darwin/xcode {};
};
devicemapper = lvm2;
dmidecode = callPackage ../os-specific/linux/dmidecode { };
@ -7245,6 +7264,10 @@ let
onlyHeaders = true;
};
mingw_w64_pthreads = callPackage ../os-specific/windows/mingw-w64 {
onlyPthreads = true;
};
pthreads = callPackage ../os-specific/windows/pthread-w32 {
mingw_headers = mingw_headers3;
};

View File

@ -140,11 +140,11 @@ in {
crossUltraSparcLinux = mapTestOnCross crossSystem basic;
}) // (
/* Test some cross builds on mingw32 */
/* Test some cross builds on 32 bit mingw-w64 */
let
crossSystem = {
config = "i686-pc-mingw32";
arch = "x86";
config = "i686-w64-mingw32";
arch = "x86"; # Irrelevant
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {};
};
@ -161,11 +161,10 @@ in {
};
}) // (
/* Test some cross builds on mingw-w64 */
/* Test some cross builds on 64 bit mingw-w64 */
let
crossSystem = {
# That's the triplet they use in the mingw-w64 docs,
# and it's relevant for nixpkgs conditions.
# That's the triplet they use in the mingw-w64 docs.
config = "x86_64-w64-mingw32";
arch = "x86_64"; # Irrelevant
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain