diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2017-06-23 20:24:27 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2017-06-23 20:24:27 -0400 |
commit | 87fab3d6a548fe4e10d84a8f3d8abdea65c2a9cd (patch) | |
tree | 8ccfb9bda2e3121ca35fbca93f2680c7c71a9d6e /pkgs/os-specific | |
parent | 56761c9b3d6f829a4f80e02d18fff30e8a6af1eb (diff) | |
parent | f43ae985a68e515197c57de5ab8413d63ae6ef1a (diff) | |
download | nixlib-87fab3d6a548fe4e10d84a8f3d8abdea65c2a9cd.tar nixlib-87fab3d6a548fe4e10d84a8f3d8abdea65c2a9cd.tar.gz nixlib-87fab3d6a548fe4e10d84a8f3d8abdea65c2a9cd.tar.bz2 nixlib-87fab3d6a548fe4e10d84a8f3d8abdea65c2a9cd.tar.lz nixlib-87fab3d6a548fe4e10d84a8f3d8abdea65c2a9cd.tar.xz nixlib-87fab3d6a548fe4e10d84a8f3d8abdea65c2a9cd.tar.zst nixlib-87fab3d6a548fe4e10d84a8f3d8abdea65c2a9cd.zip |
Merge some merged cross-compilation PRs into into staging
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r-- | pkgs/os-specific/darwin/ios-cross/default.nix | 37 | ||||
-rw-r--r-- | pkgs/os-specific/linux/busybox/default.nix | 21 | ||||
-rw-r--r-- | pkgs/os-specific/windows/mingw-w64/common.nix | 11 | ||||
-rw-r--r-- | pkgs/os-specific/windows/mingw-w64/default.nix | 39 | ||||
-rw-r--r-- | pkgs/os-specific/windows/mingw-w64/headers.nix | 13 | ||||
-rw-r--r-- | pkgs/os-specific/windows/mingw-w64/pthreads.nix | 13 |
6 files changed, 59 insertions, 75 deletions
diff --git a/pkgs/os-specific/darwin/ios-cross/default.nix b/pkgs/os-specific/darwin/ios-cross/default.nix index e5375ef60915..e0981d48c8c9 100644 --- a/pkgs/os-specific/darwin/ios-cross/default.nix +++ b/pkgs/os-specific/darwin/ios-cross/default.nix @@ -6,7 +6,7 @@ , stdenv , coreutils , gnugrep -, targetPlatform +, hostPlatform, targetPlatform }: /* As of this writing, known-good prefix/arch/simulator triples: @@ -28,14 +28,14 @@ let sdk = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhone${sdkType}.platform/Developer/SDKs/iPhone${sdkType}${sdkVer}.sdk"; - /* TODO: Properly integrate with gcc-cross-wrapper */ - wrapper = import ../../../build-support/cc-wrapper { - inherit stdenv coreutils gnugrep; +in (import ../../../build-support/cc-wrapper { + inherit stdenv coreutils gnugrep runCommand; nativeTools = false; nativeLibc = false; inherit binutils; libc = runCommand "empty-libc" {} "mkdir -p $out/{lib,include}"; - cc = clang; + inherit (clang) cc; + inherit hostPlatform targetPlatform; extraBuildCommands = '' if ! [ -d ${sdk} ]; then echo "You must have ${sdkVer} of the iPhone${sdkType} sdk installed at ${sdk}" >&2 @@ -49,27 +49,6 @@ let # Purposefully overwrite libc-ldflags-before, cctools ld doesn't know dynamic-linker and cc-wrapper doesn't do cross-compilation well enough to adjust echo "-arch ${arch} -L${sdk}/usr/lib ${lib.optionalString simulator "-L${sdk}/usr/lib/system "}-i${if simulator then "os_simulator" else "phoneos"}_version_min 7.0.0" > $out/nix-support/libc-ldflags-before ''; - }; -in { - cc = runCommand "${prefix}-cc" { passthru = { inherit sdkType sdkVer sdk; }; } '' - mkdir -p $out/bin - ln -sv ${wrapper}/bin/clang $out/bin/${prefix}-cc - mkdir -p $out/nix-support - echo ${llvm} > $out/nix-support/propagated-native-build-inputs - cat > $out/nix-support/setup-hook <<EOF - if test "\$dontSetConfigureCross" != "1"; then - configureFlags="\$configureFlags --host=${prefix}" - fi - EOF - fixupPhase - ''; - - binutils = runCommand "${prefix}-binutils" {} '' - mkdir -p $out/bin - ln -sv ${wrapper}/bin/ld $out/bin/${prefix}-ld - for prog in ar nm ranlib; do - ln -s ${binutils}/bin/$prog $out/bin/${prefix}-$prog - done - fixupPhase - ''; -} + }) // { + inherit sdkType sdkVer sdk; + } diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix index 4956f13950dd..e1ea8fa8fdd2 100644 --- a/pkgs/os-specific/linux/busybox/default.nix +++ b/pkgs/os-specific/linux/busybox/default.nix @@ -1,8 +1,9 @@ -{ stdenv, lib, fetchurl, glibc, musl +{ stdenv, lib, buildPackages, fetchurl , enableStatic ? false , enableMinimal ? false -, useMusl ? false +, useMusl ? false, musl , extraConfig ? "" +, buildPlatform, hostPlatform }: let @@ -71,20 +72,16 @@ stdenv.mkDerivation rec { ''; postConfigure = lib.optionalString useMusl '' - makeFlagsArray+=("CC=gcc -isystem ${musl}/include -B${musl}/lib -L${musl}/lib") + makeFlagsArray+=("CC=${stdenv.cc.prefix}gcc -isystem ${musl}/include -B${musl}/lib -L${musl}/lib") ''; - buildInputs = lib.optionals (enableStatic && !useMusl) [ stdenv.cc.libc stdenv.cc.libc.static ]; + nativeBuildInputs = lib.optional (hostPlatform != buildPlatform) buildPackages.stdenv.cc; - crossAttrs = { - extraCrossConfig = '' - CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cross.config}-" - ''; + buildInputs = lib.optionals (enableStatic && !useMusl) [ stdenv.cc.libc stdenv.cc.libc.static ]; - postConfigure = stdenv.lib.optionalString useMusl '' - makeFlagsArray+=("CC=$crossConfig-gcc -isystem ${musl.crossDrv}/include -B${musl.crossDrv}/lib -L${musl.crossDrv}/lib") - ''; - }; + extraCrossConfig = if hostPlatform == buildPlatform then null else '' + CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.prefix}" + ''; enableParallelBuilding = true; diff --git a/pkgs/os-specific/windows/mingw-w64/common.nix b/pkgs/os-specific/windows/mingw-w64/common.nix new file mode 100644 index 000000000000..ece2586dc806 --- /dev/null +++ b/pkgs/os-specific/windows/mingw-w64/common.nix @@ -0,0 +1,11 @@ +{ fetchurl }: + +rec { + version = "4.0.6"; + name = "mingw-w64-${version}"; + + src = fetchurl { + url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2"; + sha256 = "0p01vm5kx1ixc08402z94g1alip4vx66gjpvyi9maqyqn2a76h0c"; + }; +} diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix index 49612b0b4618..6e21826381b6 100644 --- a/pkgs/os-specific/windows/mingw-w64/default.nix +++ b/pkgs/os-specific/windows/mingw-w64/default.nix @@ -1,36 +1,7 @@ -{ stdenv, fetchurl, binutils ? null, gccCross ? null -, onlyHeaders ? false -, onlyPthreads ? false -}: - -let - version = "4.0.6"; - name = "mingw-w64-${version}"; -in -stdenv.mkDerivation ({ - inherit name; - - src = fetchurl { - url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2"; - sha256 = "0p01vm5kx1ixc08402z94g1alip4vx66gjpvyi9maqyqn2a76h0c"; - }; -} // -(if onlyHeaders then { - name = name + "-headers"; - preConfigure = '' - cd mingw-w64-headers - ''; - configureFlags = "--without-crt"; -} else if onlyPthreads then { - name = name + "-pthreads"; - preConfigure = '' - cd mingw-w64-libraries/winpthreads - ''; -} else { - buildInputs = [ gccCross binutils ]; - - crossConfig = gccCross.crossConfig; +{ stdenv, callPackage, windows }: +stdenv.mkDerivation { + inherit (callPackage ./common.nix {}) name src; + buildInputs = [ windows.mingw_w64_headers ]; dontStrip = true; -}) -) +} diff --git a/pkgs/os-specific/windows/mingw-w64/headers.nix b/pkgs/os-specific/windows/mingw-w64/headers.nix new file mode 100644 index 000000000000..03dbf712e2e5 --- /dev/null +++ b/pkgs/os-specific/windows/mingw-w64/headers.nix @@ -0,0 +1,13 @@ +{ stdenvNoCC, callPackage }: + +let + inherit (callPackage ./common.nix {}) name src; + +in stdenvNoCC.mkDerivation { + name = name + "-headers"; + inherit src; + + preConfigure = '' + cd mingw-w64-headers + ''; +} diff --git a/pkgs/os-specific/windows/mingw-w64/pthreads.nix b/pkgs/os-specific/windows/mingw-w64/pthreads.nix new file mode 100644 index 000000000000..c585ab54ff89 --- /dev/null +++ b/pkgs/os-specific/windows/mingw-w64/pthreads.nix @@ -0,0 +1,13 @@ +{ stdenvNoCC, callPackage }: + +let + inherit (callPackage ./common.nix {}) name src; + +in stdenvNoCC.mkDerivation { + name = name + "-pthreads"; + inherit src; + + preConfigure = '' + cd mingw-w64-libraries/winpthreads + ''; +} |