From a78c6490d70d7b7ebb0b2ba593dcbba2af7ab631 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 23 Feb 2014 23:44:11 +0100 Subject: mingw-w64: Update to new upstream version 3.1.0. Signed-off-by: aszlig --- pkgs/os-specific/windows/mingw-w64/default.nix | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'pkgs') diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index c358565c4551..0d7beb532fe7 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -1,23 +1,15 @@ {stdenv, fetchurl, binutilsCross ? null, gccCross ? null, onlyHeaders ? 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"; -- cgit v1.2.3 From ba8b0e8af9e0ced255cd974101c349ca9d787b89 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 00:28:46 +0100 Subject: binutils-cross: Remove unreferenced package. This package wasn't imported by anything in the package tree and also isn't used for cross-builds. So in order to avoid confusion, it's better to remove it as it is outdated as well. Signed-off-by: aszlig --- .../tools/misc/binutils-cross/builder.sh | 26 ---------------------- .../tools/misc/binutils-cross/default.nix | 13 ----------- 2 files changed, 39 deletions(-) delete mode 100644 pkgs/development/tools/misc/binutils-cross/builder.sh delete mode 100644 pkgs/development/tools/misc/binutils-cross/default.nix (limited to 'pkgs') diff --git a/pkgs/development/tools/misc/binutils-cross/builder.sh b/pkgs/development/tools/misc/binutils-cross/builder.sh deleted file mode 100644 index 29d3b3779b6a..000000000000 --- a/pkgs/development/tools/misc/binutils-cross/builder.sh +++ /dev/null @@ -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 diff --git a/pkgs/development/tools/misc/binutils-cross/default.nix b/pkgs/development/tools/misc/binutils-cross/default.nix deleted file mode 100644 index 7d77baced373..000000000000 --- a/pkgs/development/tools/misc/binutils-cross/default.nix +++ /dev/null @@ -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; -} -- cgit v1.2.3 From 60a2fc1fec78f2653b3ef71b24ec8ae72b99d38b Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 01:07:57 +0100 Subject: openssl: Fix Windows compat in cert-file.patch. In Windows there is no get(e)uid() call available, so the build fails. The patch now checks whether OPENSSL_SYS_WINDOWS is defined and only uses those calls if _not_ on Windows. Signed-off-by: aszlig --- pkgs/development/libraries/openssl/cert-file.patch | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/openssl/cert-file.patch b/pkgs/development/libraries/openssl/cert-file.patch index 6b7a60e90267..26b51c0295e0 100644 --- a/pkgs/development/libraries/openssl/cert-file.patch +++ b/pkgs/development/libraries/openssl/cert-file.patch @@ -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 #include -@@ -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; -- cgit v1.2.3 From 92c59d37a7e7567567e5e84c7747818850e69d0b Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 02:22:57 +0100 Subject: gcc-cross-wrapper: Enable dontStrip in setup hook. At least for x86_64-w64-mingw32, it doesn't make sense to use the native strip tool for stripping of symbols. To the contrary it results in unusable archive files. Signed-off-by: aszlig --- pkgs/build-support/gcc-cross-wrapper/setup-hook.sh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkgs') diff --git a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh index a7be09283ee0..433d36ced434 100644 --- a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh +++ b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh @@ -75,6 +75,9 @@ fi # 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" -- cgit v1.2.3 From 423be7712bb710f10f2eb8198bae97e5aeb5f1fe Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 02:25:46 +0100 Subject: bzip2/cross: Patch out erroneous path separator. Not sure why this even got into the upstream release, as _all_ other includes use forward slashes. Signed-off-by: aszlig --- pkgs/tools/compression/bzip2/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'pkgs') diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix index a431cd30a21f..55fca6ca3cb9 100644 --- a/pkgs/tools/compression/bzip2/default.nix +++ b/pkgs/tools/compression/bzip2/default.nix @@ -14,6 +14,7 @@ stdenv.mkDerivation { crossAttrs = { patchPhase = '' + sed -i -e '//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/' \ -- cgit v1.2.3 From 4fde72c7d64c78de2e41ba91153cebb907e63100 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 04:43:00 +0100 Subject: mingw-w64: Fix typo in preConfigure hook. D'oh, no wonder the headers are of almost the same size as the main package. Signed-off-by: aszlig --- pkgs/os-specific/windows/mingw-w64/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index 0d7beb532fe7..f1c509a50984 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation (rec { } // (if onlyHeaders then { name = name + "-headers"; - preConfingure = '' + preConfigure = '' cd mingw-w64-headers ''; configureFlags = "--without-crt --host=x86_64-w64-mingw32"; -- cgit v1.2.3 From 44cfba79509f6dd98ae306f62f2cc3183bbd1ab1 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 04:44:43 +0100 Subject: mingw-w64-pthreads: Create based on mingw-w64. The winpthreads library is part of the same source package, so let's just override the name and the source directory. Signed-off-by: aszlig --- pkgs/os-specific/windows/mingw-w64/default.nix | 10 +++++++++- pkgs/top-level/all-packages.nix | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index f1c509a50984..c5b6017aae4d 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -1,4 +1,7 @@ -{stdenv, fetchurl, binutilsCross ? null, gccCross ? null, onlyHeaders ? false}: +{ stdenv, fetchurl, binutilsCross ? null, gccCross ? null +, onlyHeaders ? false +, onlyPthreads ? false +}: let name = "mingw-w64-3.1.0"; @@ -17,6 +20,11 @@ stdenv.mkDerivation (rec { cd mingw-w64-headers ''; configureFlags = "--without-crt --host=x86_64-w64-mingw32"; +} else if onlyPthreads then { + name = name + "-pthreads"; + preConfigure = '' + cd mingw-w64-libraries/winpthreads + ''; } else { buildInputs = [ gccCross binutilsCross ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 64f2bb688c4a..133ef21060c7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7191,6 +7191,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; }; -- cgit v1.2.3 From d0142e9b09ef8a30a26d4aad922c78bf8c83a7b7 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 05:01:29 +0100 Subject: pcre/cross: Enable support for winpthreads. That way we're able to build with the JIT compiler enabled. Signed-off-by: aszlig --- pkgs/development/libraries/pcre/default.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix index 51279701d4a5..067c3af43871 100644 --- a/pkgs/development/libraries/pcre/default.nix +++ b/pkgs/development/libraries/pcre/default.nix @@ -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.config == "x86_64-w64-mingw32") { + 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 ]; }; } -- cgit v1.2.3 From b9bc42d0f33e5490e8e1fbbf6048f2fc641bc546 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 05:46:04 +0100 Subject: glew/cross: Fix building with mingw-w64. This also cleans up the package expression a bit and we no longer directly override the phases (except patchPhase). Also for cross-builds we're using the stock mingw target and pass CC, LD and STRIP to make, because the mingw-w64 targets of the upstream package are outdated. Signed-off-by: aszlig --- pkgs/development/libraries/glew/default.nix | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix index ef81f210d39f..b79fa97047b9 100644 --- a/pkgs/development/libraries/glew/default.nix +++ b/pkgs/development/libraries/glew/default.nix @@ -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,33 @@ 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 ''; -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" + "STRIP=" + ] ++ optional (stdenv.cross.config == "x86_64-w64-mingw32") "SYSTEM=mingw"; + meta = { description = "An OpenGL extension loading library for C(++)"; homepage = http://glew.sourceforge.net/; -- cgit v1.2.3 From fbc307a18322c42db500aaebeaa21e0e93e82162 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 05:55:29 +0100 Subject: SDL/cross: Fix building with mingw-w64. This is to make sure that we don't get Xlibs or alsa in cross builds, because those aren't available on non-Linux/Unix platforms. Also, until we don't have the DirectX SDK packaged, let's disable it during cross builds. Signed-off-by: aszlig --- pkgs/development/libraries/SDL/default.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix index e58397fa9a5b..0df130b11fb1 100644 --- a/pkgs/development/libraries/SDL/default.nix +++ b/pkgs/development/libraries/SDL/default.nix @@ -19,7 +19,7 @@ let --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 ""} + ${if attrs.alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""} ''; in stdenv.mkDerivation rec { @@ -32,20 +32,24 @@ 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 ] ++ + nativeBuildInputs = [ pkgconfig audiofile ] ++ 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 = configureFlagsFun { inherit alsaLib alsaSupport; }; crossAttrs = { - configureFlags = configureFlagsFun { alsaLib = alsaLib.crossDrv; }; + configureFlags = configureFlagsFun { + alsaSupport = stdenv.cross.config != "x86_64-w64-mingw32"; + alsaLib = alsaLib.crossDrv; + } + "--disable-directx"; }; passthru = {inherit openglSupport;}; -- cgit v1.2.3 From 4f69722ee55cd1a685da069e6683f1af9eae645b Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 24 Feb 2014 06:46:07 +0100 Subject: lua52/cross: Allow to cross-compile to mingw-w64. Signed-off-by: aszlig --- pkgs/development/interpreters/lua-5/5.2.nix | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix index 70ab0c3bdf8b..609c6b3e404a 100644 --- a/pkgs/development/interpreters/lua-5/5.2.nix +++ b/pkgs/development/interpreters/lua-5/5.2.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { sha256 = "004zyh9p3lpvbwhyhlmrw6wwcia5abx84q4h2brkn4zdypipvmiz"; }; - buildInputs = [ readline ]; + nativeBuildInputs = [ readline ]; patches = [ dsoPatch ]; @@ -49,6 +49,29 @@ stdenv.mkDerivation rec { EOF ''; + crossAttrs = let + isMingwW64 = stdenv.cross.config == "x86_64-w64-mingw32"; + 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} + ${stdenv.lib.optionals isMingwW64 "mingw"} + ) + '' + stdenv.lib.optionalString isMingwW64 '' + installFlagsArray=( + TO_BIN="lua.exe luac.exe" + TO_LIB="liblua.a lua52.dll" + INSTALL_DATA="cp -d" + ) + ''; + }; + meta = { homepage = "http://www.lua.org"; description = "Powerful, fast, lightweight, embeddable scripting language"; -- cgit v1.2.3 From c5ab2bfd258501cbe5f440089039aff8e7595e3c Mon Sep 17 00:00:00 2001 From: aszlig Date: Thu, 27 Feb 2014 18:28:32 +0100 Subject: gcc-cross-wrapper: Explicitly add LD program name. This is because autoconf is passing -print-prog-name=ld to the cross-gcc, which in turn assumes a FHS compliant filesystem hierarchy and searches ../../../../$crossConfig/bin/ld for the correct ld. Of course, this won't work on Nix, hence we're explicitly passing the correct LD program name. Signed-off-by: aszlig --- pkgs/build-support/gcc-cross-wrapper/setup-hook.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkgs') diff --git a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh index 433d36ced434..497047a73b10 100644 --- a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh +++ b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh @@ -70,6 +70,8 @@ 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. -- cgit v1.2.3 From ae0b5d6813362492e744b1ac10e21309bb4e238b Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 3 Mar 2014 22:22:12 +0100 Subject: libgcrypt/cross: Fix build for mingw-w64. Especially for the 64bit mingw target, because libgcrypt contains protected mode assembly. Also, this adds gettext to the crossAttrs of libgpg-error, because it tries to regenerate the MO files. Signed-off-by: aszlig --- pkgs/development/libraries/libgcrypt/1.6.nix | 6 ++++++ pkgs/development/libraries/libgpg-error/default.nix | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/libgcrypt/1.6.nix b/pkgs/development/libraries/libgcrypt/1.6.nix index ea981f7ed127..9dc8b8a23179 100644 --- a/pkgs/development/libraries/libgcrypt/1.6.nix +++ b/pkgs/development/libraries/libgcrypt/1.6.nix @@ -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"; diff --git a/pkgs/development/libraries/libgpg-error/default.nix b/pkgs/development/libraries/libgpg-error/default.nix index da142a957ad7..8ce9a10701ec 100644 --- a/pkgs/development/libraries/libgpg-error/default.nix +++ b/pkgs/development/libraries/libgpg-error/default.nix @@ -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 = { -- cgit v1.2.3 From e64b342fa8fda783a7247e0469943ce728498004 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 3 Mar 2014 22:31:18 +0100 Subject: Use mingw-w64 for 32bit Windows builds as well. Mingw(32) is rather poorly maintaned and has quite a lot of bugs. And because our Windows cross builds were also poorly maintained and most of the cross-tests were broken as well, I'm just taking this step and try to switch to mingw-w64 for everything "cross Windows". Signed-off-by: aszlig --- pkgs/development/compilers/gcc/4.6/default.nix | 6 ++---- pkgs/development/compilers/gcc/4.8/default.nix | 6 ++---- pkgs/development/interpreters/lua-5/5.2.nix | 6 +++--- pkgs/development/libraries/SDL/default.nix | 2 +- pkgs/development/libraries/glew/default.nix | 2 +- pkgs/development/libraries/pcre/default.nix | 2 +- pkgs/development/libraries/qt-4.x/4.8/default.nix | 3 +-- pkgs/os-specific/windows/mingw-w64/default.nix | 2 +- pkgs/top-level/all-packages.nix | 8 ++------ pkgs/top-level/release-cross.nix | 11 +++++------ 10 files changed, 19 insertions(+), 29 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/compilers/gcc/4.6/default.nix b/pkgs/development/compilers/gcc/4.6/default.nix index 3ed0f7ad0e6d..af1113226980 100644 --- a/pkgs/development/compilers/gcc/4.6/default.nix +++ b/pkgs/development/compilers/gcc/4.6/default.nix @@ -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. diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index aea525933234..e2c887c368f5 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -175,10 +175,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. diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix index 609c6b3e404a..b8fcbe5f242a 100644 --- a/pkgs/development/interpreters/lua-5/5.2.nix +++ b/pkgs/development/interpreters/lua-5/5.2.nix @@ -50,7 +50,7 @@ stdenv.mkDerivation rec { ''; crossAttrs = let - isMingwW64 = stdenv.cross.config == "x86_64-w64-mingw32"; + isMingw = stdenv.cross.libc == "msvcrt"; in { configurePhase = '' makeFlagsArray=( @@ -61,9 +61,9 @@ stdenv.mkDerivation rec { RANLIB=${stdenv.cross.config}-ranlib V=${majorVersion} R=${version} - ${stdenv.lib.optionals isMingwW64 "mingw"} + ${stdenv.lib.optionals isMingw "mingw"} ) - '' + stdenv.lib.optionalString isMingwW64 '' + '' + stdenv.lib.optionalString isMingw '' installFlagsArray=( TO_BIN="lua.exe luac.exe" TO_LIB="liblua.a lua52.dll" diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix index 0df130b11fb1..56ac04bebe62 100644 --- a/pkgs/development/libraries/SDL/default.nix +++ b/pkgs/development/libraries/SDL/default.nix @@ -47,7 +47,7 @@ stdenv.mkDerivation rec { crossAttrs = { configureFlags = configureFlagsFun { - alsaSupport = stdenv.cross.config != "x86_64-w64-mingw32"; + alsaSupport = stdenv.cross.libc != "msvcrt"; alsaLib = alsaLib.crossDrv; } + "--disable-directx"; }; diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix index b79fa97047b9..32083f96dfd1 100644 --- a/pkgs/development/libraries/glew/default.nix +++ b/pkgs/development/libraries/glew/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { "CC=${stdenv.cross.config}-gcc" "LD=${stdenv.cross.config}-gcc" "STRIP=" - ] ++ optional (stdenv.cross.config == "x86_64-w64-mingw32") "SYSTEM=mingw"; + ] ++ optional (stdenv.cross.libc == "msvcrt") "SYSTEM=mingw"; meta = { description = "An OpenGL extension loading library for C(++)"; diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix index 067c3af43871..7138c44da643 100644 --- a/pkgs/development/libraries/pcre/default.nix +++ b/pkgs/development/libraries/pcre/default.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { # XXX: test failure on Cygwin # we are running out of stack on both freeBSDs on Hydra - crossAttrs = optionalAttrs (stdenv.cross.config == "x86_64-w64-mingw32") { + crossAttrs = optionalAttrs (stdenv.cross.libc == "msvcrt") { buildInputs = [ windows.mingw_w64_pthreads.crossDrv ]; }; diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix index 16bd1ee65d2e..1bd027f52986 100644 --- a/pkgs/development/libraries/qt-4.x/4.8/default.nix +++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix @@ -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 diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index c5b6017aae4d..bf15b208e1a7 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -19,7 +19,7 @@ stdenv.mkDerivation (rec { preConfigure = '' cd mingw-w64-headers ''; - configureFlags = "--without-crt --host=x86_64-w64-mingw32"; + configureFlags = "--without-crt"; } else if onlyPthreads then { name = name + "-pthreads"; preConfigure = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 133ef21060c7..952fe59734de 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2419,9 +2419,7 @@ let 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 isMingw then windows.mingw_w64_headers else null; in wrapGCCCross { gcc = forceNativeDrv (lib.addMetaAttrs { hydraPlatforms = []; } ( @@ -4235,9 +4233,7 @@ 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 throw "Unknown libc"; libcCross = assert crossSystem != null; libcCrossChooser crossSystem.libc; diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix index 6871567ca8d1..cef3d2dffbdb 100644 --- a/pkgs/top-level/release-cross.nix +++ b/pkgs/top-level/release-cross.nix @@ -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 -- cgit v1.2.3 From a3cf381435345d25d9deeab8f5684d937cfc83e1 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 3 Mar 2014 22:36:43 +0100 Subject: SDL/cross: Drop --disable-directx. This is no longer needed, because we've already fixed the dynamic cross-linker. Signed-off-by: aszlig --- pkgs/development/libraries/SDL/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix index 56ac04bebe62..89646f2e3e39 100644 --- a/pkgs/development/libraries/SDL/default.nix +++ b/pkgs/development/libraries/SDL/default.nix @@ -49,7 +49,7 @@ stdenv.mkDerivation rec { configureFlags = configureFlagsFun { alsaSupport = stdenv.cross.libc != "msvcrt"; alsaLib = alsaLib.crossDrv; - } + "--disable-directx"; + }; }; passthru = {inherit openglSupport;}; -- cgit v1.2.3 From 5e565754abcfcb726510e2f6c205b5b6bd0e091f Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 02:57:48 +0100 Subject: Add new package "xpwn" from @dborca's fork. This really hase some nice utilities for coping with HFS+ and DMG format. We're going to use it for extracting the xcode DMG, but it could be used for more, even generating DMGs. The reason I'm using the fork instead of the repository from @planetbeing is thet the fork contains a few fixes, especially for dealing with symlinks in HFS+ images. Signed-off-by: aszlig --- pkgs/development/mobile/xpwn/default.nix | 28 ++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/development/mobile/xpwn/default.nix (limited to 'pkgs') diff --git a/pkgs/development/mobile/xpwn/default.nix b/pkgs/development/mobile/xpwn/default.nix new file mode 100644 index 000000000000..b248107141f5 --- /dev/null +++ b/pkgs/development/mobile/xpwn/default.nix @@ -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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6cd584e6f1f8..9ab8331bce99 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3825,6 +3825,8 @@ let xmlindent = callPackage ../development/web/xmlindent {}; + xpwn = callPackage ../development/mobile/xpwn {}; + xxdiff = callPackage ../development/tools/misc/xxdiff { bison = bison2; }; -- cgit v1.2.3 From 83dd414ca221a8aff18a03b3ef9716fe0ca7d06d Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 03:39:33 +0100 Subject: Add new package for Apple's XCode. This package provides the SDK and standard library needed for cross-compiling to Mac US X. We're using xpwn here to extract the DMG. Also, this version (XCode 5.0.2) only contains the SDKs for version 10.9 and 10.8, so we might need to add requireFile directives for older versions as well. Signed-off-by: aszlig --- pkgs/os-specific/darwin/xcode/default.nix | 37 +++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 39 insertions(+) create mode 100644 pkgs/os-specific/darwin/xcode/default.nix (limited to 'pkgs') diff --git a/pkgs/os-specific/darwin/xcode/default.nix b/pkgs/os-specific/darwin/xcode/default.nix new file mode 100644 index 000000000000..671e73a0fa52 --- /dev/null +++ b/pkgs/os-specific/darwin/xcode/default.nix @@ -0,0 +1,37 @@ +{ stdenv, requireFile, xpwn }: + +stdenv.mkDerivation rec { + name = "xcode-${version}"; + version = "5.0.2"; + + src = requireFile { + name = "xcode_${version}.dmg"; + url = meta.homepage; + sha256 = "0mrligqkfqwx8cy883pxm4w5w7a17nfh227zdspfll23r9agf32k"; + }; + + phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; + + 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=MacOSX10.9.sdk"; + + installPhase = '' + ensureDir "$out/share/sysroot" + cp -a * "$out/share/sysroot/" + ln -s "$out/usr/lib" "$out/lib" + ln -s "$out/usr/include" "$out/include" + ''; + + meta = { + homepage = "https://developer.apple.com/downloads/"; + description = "Apple's XCode SDK"; + license = stdenv.lib.licenses.unfree; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9ab8331bce99..93caa5c7796b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6546,6 +6546,8 @@ let cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; + darwin.xcode = callPackage ../os-specific/darwin/xcode { }; + devicemapper = lvm2; dmidecode = callPackage ../os-specific/linux/dmidecode { }; -- cgit v1.2.3 From dd10bb3181928bac42e5213125887d62555d6a3a Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 03:57:48 +0100 Subject: Add a cross-platform port of cctools. This basically is binutils for Mac OS X, but ported to work on (GNU/)Linux and FreeBSD. And it's up-to-date as well! I'm mentioning this, because it was quite hard to find a recent port of it and I just accidentally stumbled on it while trying to do the port by myself. So thanks to @tpoechtrager for doing this. Also, I've added two more patches, which essentially are: * ld-rpath-nonfinal: This allows -rpath to be used for linking non-final builds, which was allowed for earlier versions of cctools and got a check for that in more recent versions. * ld-ignore-rpath-link: Ignores the -rpath-link option, because the cross-wrapper uses it in different places. Unfortunately, the cctools linker doesn't support it, so we might need to implement this later if it's possible (I'm not a Mach-O man^H^H^Hexpert). Signed-off-by: aszlig --- pkgs/os-specific/darwin/cctools-port/default.nix | 55 ++++++++++++++++++++++ .../darwin/cctools-port/ld-ignore-rpath-link.patch | 16 +++++++ .../darwin/cctools-port/ld-rpath-nonfinal.patch | 31 ++++++++++++ pkgs/top-level/all-packages.nix | 8 +++- 4 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/darwin/cctools-port/default.nix create mode 100644 pkgs/os-specific/darwin/cctools-port/ld-ignore-rpath-link.patch create mode 100644 pkgs/os-specific/darwin/cctools-port/ld-rpath-nonfinal.patch (limited to 'pkgs') diff --git a/pkgs/os-specific/darwin/cctools-port/default.nix b/pkgs/os-specific/darwin/cctools-port/default.nix new file mode 100644 index 000000000000..0d40409a9944 --- /dev/null +++ b/pkgs/os-specific/darwin/cctools-port/default.nix @@ -0,0 +1,55 @@ +{ stdenv, cross, fetchurl, autoconf, automake, libtool +, libcxx, llvm, clang, openssl, libuuid +}: + +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 + ]; + + 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 < 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: diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 93caa5c7796b..dfe977678ffd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6546,7 +6546,13 @@ let cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; - darwin.xcode = callPackage ../os-specific/darwin/xcode { }; + darwin = { + cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port { + cross = assert crossSystem != null; crossSystem; + }); + + xcode = callPackage ../os-specific/darwin/xcode {}; + }; devicemapper = lvm2; -- cgit v1.2.3 From 9a0a85827c3bc903d7c82f251fa129e91f457e85 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 04:10:34 +0100 Subject: gcc-4.8: Hook in cross-darwin libc and binutils. Let's finally hook everything into the existing cross-building infrastructure. We're using --with-sysroot instead of --with-headers here, because the XCode SDK contains references to /usr/lib. I've tried to patch those references, but unfortunately (at least with install_name_tool) it isn't possible to change those refernces in stub dylibs. So after bugging @tpoechtrager with annoying questions (thanks again), I think my initial approach (patching the SDK itself and/or regenerating the dylib stubs) was way to complicated so I ended up with this implementation. Also, I've added a condition to binutilsCross to use cctools if the libc is set to libSystem. This might need some cleanups someday, mainly to figure out how to properly bridge cctools and binutils. So, as an example on how to cross-compile GNU Hello to Darwin, you can use something like this: (import { crossSystem = { config = "x86_64-apple-darwin13"; arch = "x86_64"; libc = "libSystem"; platform = {}; }; }).hello.crossDrv Signed-off-by: aszlig --- pkgs/development/compilers/gcc/4.8/default.nix | 10 ++++++++-- pkgs/top-level/all-packages.nix | 17 +++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index aea525933234..8a8a80c090ad 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dfe977678ffd..f65d493b9d6a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2430,8 +2430,10 @@ let gccCrossStageStatic = let isMingw = (stdenv.cross.libc == "msvcrt"); isMingw64 = isMingw && stdenv.cross.config == "x86_64-w64-mingw32"; + isDarwin = stdenv.cross.libc == "libSystem"; libcCross1 = if isMingw64 then windows.mingw_w64_headers else - if isMingw then windows.mingw_headers1 else null; + if isMingw then windows.mingw_headers1 else + if isDarwin then darwin.xcode else null; in wrapGCCCross { gcc = forceNativeDrv (lib.addMetaAttrs { hydraPlatforms = []; } ( @@ -3452,11 +3454,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 { }; @@ -4249,6 +4253,7 @@ let 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 == "libSystem" then darwin.xcode else throw "Unknown libc"; libcCross = assert crossSystem != null; libcCrossChooser crossSystem.libc; -- cgit v1.2.3 From 46e90f76c6d73a8ecd33cb8e3bfaff50b20f32e0 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 21:36:43 +0100 Subject: tzdata: Provide lib as an additional output. We're already using tzcode inside tzdata, so let's make it available as an output here. The reason we need it is in order to compile OpenCFLite. Signed-off-by: aszlig --- pkgs/data/misc/tzdata/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/data/misc/tzdata/default.nix b/pkgs/data/misc/tzdata/default.nix index da043da09678..57b1dddbda55 100644 --- a/pkgs/data/misc/tzdata/default.nix +++ b/pkgs/data/misc/tzdata/default.nix @@ -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 = { -- cgit v1.2.3 From a9ef42f33ca4ea209c810ee42bf801eb485c68ad Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 21:41:56 +0100 Subject: gcc-4.8: Add ObjC and ObjC++ support for Darwin. Cross-compiling stuff against Mac OS X's CoreFoundation won't work without ObjC support, and we don't want to compile commandline utilities only, right? Signed-off-by: aszlig --- pkgs/development/compilers/gcc/4.8/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'pkgs') diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 8a8a80c090ad..92bfdb683bb5 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -352,6 +352,7 @@ stdenv.mkDerivation ({ ++ optional langAda "ada" ++ optional langVhdl "vhdl" ++ optional langGo "go" + ++ optionals crossDarwin [ "objc" "obj-c++" ] ) ) } -- cgit v1.2.3 From c0d55fcc6ab1ac2c634e2b518440b26378b7abd7 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 21:46:09 +0100 Subject: xcode: Provide the commandline toolchain as well. This toolchain contains Mach-O binaries and might not be useful in the first place, but there are programs like dsymutil, where Apple didn't release the source code, so we need a Mach-O loader... Signed-off-by: aszlig --- pkgs/os-specific/darwin/xcode/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'pkgs') diff --git a/pkgs/os-specific/darwin/xcode/default.nix b/pkgs/os-specific/darwin/xcode/default.nix index 671e73a0fa52..5c8e7a3ef6c1 100644 --- a/pkgs/os-specific/darwin/xcode/default.nix +++ b/pkgs/os-specific/darwin/xcode/default.nix @@ -11,6 +11,7 @@ stdenv.mkDerivation rec { }; phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; + outputs = [ "out" "toolchain" ]; unpackCmd = let basePath = "Xcode.app/Contents/Developer/Platforms/MacOSX.platform"; @@ -25,8 +26,15 @@ stdenv.mkDerivation rec { installPhase = '' ensureDir "$out/share/sysroot" cp -a * "$out/share/sysroot/" - ln -s "$out/usr/lib" "$out/lib" - ln -s "$out/usr/include" "$out/include" + 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 = { -- cgit v1.2.3 From 53a267e535381e33e7c6f0eabda56a8b04027e36 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 21:59:26 +0100 Subject: darwin: Add new package opencflite. This provides a port of Mac OS X's CoreFoundation and is needed if we want to be able to run dsymutil using maloader. Signed-off-by: aszlig --- pkgs/os-specific/darwin/opencflite/default.nix | 21 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 pkgs/os-specific/darwin/opencflite/default.nix (limited to 'pkgs') diff --git a/pkgs/os-specific/darwin/opencflite/default.nix b/pkgs/os-specific/darwin/opencflite/default.nix new file mode 100644 index 000000000000..a2408bfc5c8a --- /dev/null +++ b/pkgs/os-specific/darwin/opencflite/default.nix @@ -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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f65d493b9d6a..514f5c24b32d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6556,6 +6556,8 @@ let cross = assert crossSystem != null; crossSystem; }); + opencflite = callPackage ../os-specific/darwin/opencflite {}; + xcode = callPackage ../os-specific/darwin/xcode {}; }; -- cgit v1.2.3 From 45cd9994bc01641d0ed9ed9691cfdfa15fb87a54 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:02:46 +0100 Subject: darwin: Add new package maloader. This is the mentioned Mach-O loader that we're yoing to use to execute Apple's proprietary binaries. Signed-off-by: aszlig --- pkgs/os-specific/darwin/maloader/default.nix | 36 ++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 6 ++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/darwin/maloader/default.nix (limited to 'pkgs') diff --git a/pkgs/os-specific/darwin/maloader/default.nix b/pkgs/os-specific/darwin/maloader/default.nix new file mode 100644 index 000000000000..f5bfe890735c --- /dev/null +++ b/pkgs/os-specific/darwin/maloader/default.nix @@ -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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 514f5c24b32d..c6ea2cbc3fee 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6551,11 +6551,15 @@ let cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; - darwin = { + darwin = rec { cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port { cross = assert crossSystem != null; crossSystem; }); + maloader = callPackage ../os-specific/darwin/maloader { + inherit opencflite; + }; + opencflite = callPackage ../os-specific/darwin/opencflite {}; xcode = callPackage ../os-specific/darwin/xcode {}; -- cgit v1.2.3 From 3940b219882f873314cd36c261cf807e94fa5f3b Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:08:51 +0100 Subject: cctools-port: Pass through wrapped XCToolchain. At the moment, this includes only dyldinfo, dwarfdump and dsymutil, but we'll see whether we need more of these utilities later. Tho reason those are wrapped in cctools-port is because it is the binutils used to cross-compile for Mac OS X. Signed-off-by: aszlig --- pkgs/os-specific/darwin/cctools-port/default.nix | 11 ++++++++++- pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/os-specific/darwin/cctools-port/default.nix b/pkgs/os-specific/darwin/cctools-port/default.nix index 0d40409a9944..cdc259c1e2a0 100644 --- a/pkgs/os-specific/darwin/cctools-port/default.nix +++ b/pkgs/os-specific/darwin/cctools-port/default.nix @@ -1,5 +1,6 @@ { stdenv, cross, fetchurl, autoconf, automake, libtool , libcxx, llvm, clang, openssl, libuuid +, maloader, makeWrapper, xctoolchain }: stdenv.mkDerivation rec { @@ -13,7 +14,7 @@ stdenv.mkDerivation rec { }; buildInputs = [ - autoconf automake libtool libcxx llvm clang openssl libuuid + autoconf automake libtool libcxx llvm clang openssl libuuid makeWrapper ]; patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch ]; @@ -47,6 +48,14 @@ stdenv.mkDerivation rec { "--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)"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c6ea2cbc3fee..9109e1e59522 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6554,6 +6554,8 @@ let 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 { -- cgit v1.2.3 From 745c4779305490816682bb95b319923d27c4a8fe Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:17:04 +0100 Subject: lua5.2/cross: Fix build for Darwin. The ld from cctools doesn't like the -soname argument, so let's strip it off for now until we have a binutils <-> cctools bridge. Signed-off-by: aszlig --- pkgs/development/interpreters/lua-5/5.2.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'pkgs') diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix index 70ab0c3bdf8b..c496d14083e7 100644 --- a/pkgs/development/interpreters/lua-5/5.2.nix +++ b/pkgs/development/interpreters/lua-5/5.2.nix @@ -49,6 +49,30 @@ stdenv.mkDerivation rec { EOF ''; + crossAttrs = let + 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} + ${stdenv.lib.optionalString isDarwin '' + AR="${stdenv.cross.config}-ar rcu" + macosx + ''} + ) + ''; + } // 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"; -- cgit v1.2.3 From 3d73bf6c57d9406accfdbe89a46f38c492364ec3 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:22:21 +0100 Subject: glew/cross: Fix build for Darwin. The Makefile still contained calls to install with the -s (strip) option, which we don't want because it uses the native strip utility and we're going to crossStrip in fixupPhase later anyway. Signed-off-by: aszlig --- pkgs/development/libraries/glew/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pkgs') diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix index ef81f210d39f..1106a0139497 100644 --- a/pkgs/development/libraries/glew/default.nix +++ b/pkgs/development/libraries/glew/default.nix @@ -1,5 +1,7 @@ { stdenv, fetchurl, mesa_glu, x11, libXmu, libXi }: +with stdenv.lib; + stdenv.mkDerivation rec { name = "glew-1.10.0"; @@ -14,6 +16,9 @@ stdenv.mkDerivation rec { patchPhase = '' sed -i 's|lib64|lib|' config/Makefile.linux + ${optionalString (stdenv ? cross) '' + sed -i -e 's/\(INSTALL.*\)-s/\1/' Makefile + ''} ''; buildPhase = "make all"; @@ -25,6 +30,13 @@ buildPhase = "make all"; 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 == "libSystem") "SYSTEM=darwin"; + meta = { description = "An OpenGL extension loading library for C(++)"; homepage = http://glew.sourceforge.net/; -- cgit v1.2.3 From 30962765e07336eecfe959d5834f8d4eecc56df4 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:27:54 +0100 Subject: openssl/cross: Fix build for Darwin. This is just a minor fix, because when using "darwin64-x86_64-cc" for config.openssl.system, the OpenSSL build scripts try to compile with $prefix-cc, which is not available with the gcc-cross-wrapper. Signed-off-by: aszlig --- pkgs/development/libraries/openssl/default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkgs') diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix index 7d7ccacd14ad..4dd63078d667 100644 --- a/pkgs/development/libraries/openssl/default.nix +++ b/pkgs/development/libraries/openssl/default.nix @@ -91,6 +91,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 = { -- cgit v1.2.3 From 8c053312b5633c0e180edff68335b3652cc5c6df Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 10 Mar 2014 22:30:13 +0100 Subject: zlib/cross: Fix build for Darwin. Provide the correct cross ranlib, because native ranlib will fail. Signed-off-by: aszlig --- pkgs/development/libraries/zlib/default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkgs') diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix index 0d4abaf25e0a..37675e4a5bca 100644 --- a/pkgs/development/libraries/zlib/default.nix +++ b/pkgs/development/libraries/zlib/default.nix @@ -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