summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2018-12-08 16:29:21 +0100
committerFrederik Rietdijk <fridh@fridh.nl>2018-12-08 16:29:21 +0100
commit3e950d584c8186239809e4d101e70e083ea9e9e0 (patch)
tree41c652b87e2ade3290a6632b1d2db11b11ef37b5 /pkgs/development/compilers
parentedc3559c1ae1cd1edeff11af52ae768359b38ba6 (diff)
parente0950ae9ad7e101c16ce8bbc28d566c75bb298fb (diff)
downloadnixpkgs-3e950d584c8186239809e4d101e70e083ea9e9e0.tar
nixpkgs-3e950d584c8186239809e4d101e70e083ea9e9e0.tar.gz
nixpkgs-3e950d584c8186239809e4d101e70e083ea9e9e0.tar.bz2
nixpkgs-3e950d584c8186239809e4d101e70e083ea9e9e0.tar.lz
nixpkgs-3e950d584c8186239809e4d101e70e083ea9e9e0.tar.xz
nixpkgs-3e950d584c8186239809e4d101e70e083ea9e9e0.tar.zst
nixpkgs-3e950d584c8186239809e4d101e70e083ea9e9e0.zip
Merge staging-next into master
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/go/1.11.nix125
-rw-r--r--pkgs/development/compilers/vala/default.nix14
2 files changed, 95 insertions, 44 deletions
diff --git a/pkgs/development/compilers/go/1.11.nix b/pkgs/development/compilers/go/1.11.nix
index ddf2eac36e1..5d4a8e84265 100644
--- a/pkgs/development/compilers/go/1.11.nix
+++ b/pkgs/development/compilers/go/1.11.nix
@@ -1,23 +1,29 @@
 { stdenv, fetchFromGitHub, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin
-, perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation }:
+, perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation
+, buildPackages, targetPackages }:
 
 let
 
   inherit (stdenv.lib) optionals optionalString;
 
-  clangHack = writeScriptBin "clang" ''
-    #!${stdenv.shell}
-    exec ${stdenv.cc}/bin/clang "$@" 2> >(sed '/ld: warning:.*ignoring unexpected dylib file/ d' 1>&2)
-  '';
-
   goBootstrap = runCommand "go-bootstrap" {} ''
     mkdir $out
-    cp -rf ${go_bootstrap}/* $out/
+    cp -rf ${buildPackages.go_bootstrap}/* $out/
     chmod -R u+w $out
     find $out -name "*.c" -delete
     cp -rf $out/bin/* $out/share/go/bin/
   '';
 
+  goarch = platform: {
+    "i686" = "386";
+    "x86_64" = "amd64";
+    "aarch64" = "arm64";
+    "arm" = "arm";
+    "armv5tel" = "arm";
+    "armv6l" = "arm";
+    "armv7l" = "arm";
+  }.${platform.parsed.cpu.name} or (throw "Unsupported system");
+
 in
 
 stdenv.mkDerivation rec {
@@ -31,13 +37,13 @@ stdenv.mkDerivation rec {
     sha256 = "0pk7pxfm3ij2ksdrg49jz501fr1d103zr4mjjwv821if9g279jc9";
   };
 
-  GOCACHE = "off";
-
   # perl is used for testing go vet
   nativeBuildInputs = [ perl which pkgconfig patch procps ];
   buildInputs = [ cacert pcre ]
     ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
     ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
+
+
   propagatedBuildInputs = optionals stdenv.isDarwin [ Security Foundation ];
 
   hardeningDisable = [ "all" ];
@@ -131,57 +137,94 @@ stdenv.mkDerivation rec {
     substituteInPlace "src/cmd/link/internal/ld/lib.go" --replace dsymutil ${llvm}/bin/llvm-dsymutil
   '';
 
-  GOOS = stdenv.hostPlatform.parsed.kernel.name;
-  GOARCH = {
-    "i686" = "386";
-    "x86_64" = "amd64";
-    "aarch64" = "arm64";
-    "arm" = "arm";
-    "armv5tel" = "arm";
-    "armv6l" = "arm";
-    "armv7l" = "arm";
-  }.${stdenv.hostPlatform.parsed.cpu.name} or (throw "Unsupported system");
+  GOOS = stdenv.targetPlatform.parsed.kernel.name;
+  GOARCH = goarch stdenv.targetPlatform;
+  # GOHOSTOS/GOHOSTARCH must match the building system, not the host system.
+  # Go will nevertheless build a for host system that we will copy over in
+  # the install phase.
+  GOHOSTOS = stdenv.buildPlatform.parsed.kernel.name;
+  GOHOSTARCH = goarch stdenv.buildPlatform;
+
+  # {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those
+  # to be different from CC/CXX
+  CC_FOR_TARGET = if (stdenv.hostPlatform != stdenv.targetPlatform) then
+      "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc"
+    else if (stdenv.buildPlatform != stdenv.targetPlatform) then
+      "${stdenv.cc.targetPrefix}cc"
+    else
+      null;
+  CXX_FOR_TARGET = if (stdenv.hostPlatform != stdenv.targetPlatform) then
+      "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++"
+    else if (stdenv.buildPlatform != stdenv.targetPlatform) then
+      "${stdenv.cc.targetPrefix}c++"
+    else
+      null;
+
   GOARM = toString (stdenv.lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);
   GO386 = 387; # from Arch: don't assume sse2 on i686
   CGO_ENABLED = 1;
-  GOROOT_BOOTSTRAP = "${goBootstrap}/share/go";
   # Hopefully avoids test timeouts on Hydra
   GO_TEST_TIMEOUT_SCALE = 3;
 
-  # The go build actually checks for CC=*/clang and does something different, so we don't
-  # just want the generic `cc` here.
-  CC = if stdenv.isDarwin then "clang" else "cc";
+  # Indicate that we are running on build infrastructure
+  # Some tests assume things like home directories and users exists
+  GO_BUILDER_NAME = "nix";
 
-  configurePhase = ''
-    # Indicate that we are running on build infrastructure
-    # Some tests assume things like home directories and users exists
-    export GO_BUILDER_NAME=nix
+  GOROOT_BOOTSTRAP="${goBootstrap}/share/go";
 
-    mkdir -p $out/share/go/bin
-    export GOROOT=$out/share/go
-    export GOBIN=$GOROOT/bin
-    export PATH=$GOBIN:$PATH
+  postConfigure = ''
+    export GOCACHE=$TMPDIR/go-cache
+    # this is compiled into the binary
+    export GOROOT_FINAL=$out/share/go
+
+    export PATH=$(pwd)/bin:$PATH
+
+    # Independent from host/target, CC should produce code for the building system.
+    export CC=${buildPackages.stdenv.cc}/bin/cc
     ulimit -a
   '';
 
-  postConfigure = optionalString stdenv.isDarwin ''
-    export PATH=${clangHack}/bin:$PATH
+  postBuild = ''
+    (cd src && ./make.bash)
   '';
 
-  installPhase = ''
-    cp -r . $GOROOT
-    ( cd $GOROOT/src && ./all.bash )
+  doCheck = stdenv.hostPlatform == stdenv.targetPlatform;
+
+  checkPhase = ''
+    runHook preCheck
+    (cd src && ./run.bash --no-rebuild)
+    runHook postCheck
   '';
 
-  preFixup = ''
-    rm -r $out/share/go/pkg/bootstrap
-    rm -r $out/share/go/pkg/obj
-    ln -s $out/share/go/bin $out/bin
+  preInstall = ''
+    rm -r pkg/{bootstrap,obj}
+    # Contains the wrong perl shebang when cross compiling,
+    # since it is not used for anything we can deleted as well.
+    rm src/regexp/syntax/make_perl_groups.pl
+  '' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then ''
+    mv bin/*_*/* bin
+    rmdir bin/*_*
+    ${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
+      rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH}
+    ''}
+  '' else if (stdenv.hostPlatform != stdenv.targetPlatform) then ''
+    rm -rf bin/*_*
+    ${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) ''
+      rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH}
+    ''}
+  '' else "");
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $GOROOT_FINAL
+    cp -a bin pkg src lib misc api doc $GOROOT_FINAL
+    ln -s $GOROOT_FINAL/bin $out/bin
+    runHook postInstall
   '';
 
   setupHook = ./setup-hook.sh;
 
-  disallowedReferences = [ go_bootstrap ];
+  disallowedReferences = [ goBootstrap ];
 
   meta = with stdenv.lib; {
     branch = "1.11";
diff --git a/pkgs/development/compilers/vala/default.nix b/pkgs/development/compilers/vala/default.nix
index fb2d9fc535a..a721625b1f4 100644
--- a/pkgs/development/compilers/vala/default.nix
+++ b/pkgs/development/compilers/vala/default.nix
@@ -31,6 +31,8 @@ let
     ] ++ lib.optional (atLeast "0.38") graphviz
       ++ extraBuildInputs;
 
+    enableParallelBuilding = true;
+
     doCheck = false; # fails, requires dbus daemon
 
     meta = with stdenv.lib; {
@@ -64,9 +66,15 @@ in rec {
 
   vala_0_40 = generic {
     major   = "0.40";
-    minor   = "6";
-    sha256  = "1qjbwhifwwqbdg5zilvnwm4n76g8p7jwqs3fa0biw3rylzqm193d";
+    minor   = "11";
+    sha256  = "0xhm61kjdws167pafcji43s7icfvpq58lkbq3irb1jv3icjr3i8z";
+  };
+
+  vala_0_42 = generic {
+    major   = "0.42";
+    minor   = "3";
+    sha256  = "0zaq9009wqk5aah131m426a2ia0scwpjpl4npf8p7p43wv8kvisz";
   };
 
-  vala = vala_0_38;
+  vala = vala_0_42;
 }