diff options
Diffstat (limited to 'nixpkgs/pkgs/development/compilers')
13 files changed, 134 insertions, 46 deletions
diff --git a/nixpkgs/pkgs/development/compilers/blueprint/default.nix b/nixpkgs/pkgs/development/compilers/blueprint/default.nix index 1e5dea00f4c4..99b275db2aa6 100644 --- a/nixpkgs/pkgs/development/compilers/blueprint/default.nix +++ b/nixpkgs/pkgs/development/compilers/blueprint/default.nix @@ -44,7 +44,8 @@ stdenv.mkDerivation (finalAttrs: { xvfb-run ]; - doCheck = true; + # requires xvfb-run + doCheck = !stdenv.isDarwin; checkPhase = '' runHook preCheck @@ -65,6 +66,6 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://gitlab.gnome.org/jwestman/blueprint-compiler"; license = licenses.lgpl3Plus; maintainers = with maintainers; [ benediktbroich paveloom ranfdev ]; - platforms = platforms.linux; + platforms = platforms.unix; }; }) diff --git a/nixpkgs/pkgs/development/compilers/circt/default.nix b/nixpkgs/pkgs/development/compilers/circt/default.nix index 1f58859f8a4e..c6f787078b67 100644 --- a/nixpkgs/pkgs/development/compilers/circt/default.nix +++ b/nixpkgs/pkgs/development/compilers/circt/default.nix @@ -6,6 +6,7 @@ , git , fetchFromGitHub , ninja +, gitUpdater }: let @@ -13,12 +14,12 @@ let in stdenv.mkDerivation rec { pname = "circt"; - version = "1.53.0"; + version = "1.54.0"; src = fetchFromGitHub { owner = "llvm"; repo = "circt"; rev = "firtool-${version}"; - sha256 = "sha256-F3pGXZC4jSG9TV2sc5G9bQtKMY6xcPknwO0fqQ6uBoA="; + sha256 = "sha256-jHDQl6UJTyNGZ4PUTEiZCIN/RSRbBxlaVutkwrWbK9M="; fetchSubmodules = true; }; @@ -69,6 +70,10 @@ stdenv.mkDerivation rec { doCheck = true; checkTarget = "check-circt check-circt-integration"; + passthru.updateScript = gitUpdater { + rev-prefix = "firtool-"; + }; + meta = { description = "Circuit IR compilers and tools"; homepage = "https://circt.org/"; diff --git a/nixpkgs/pkgs/development/compilers/fasm/bin.nix b/nixpkgs/pkgs/development/compilers/fasm/bin.nix index d9f809c0a0ae..e894d2607bc0 100644 --- a/nixpkgs/pkgs/development/compilers/fasm/bin.nix +++ b/nixpkgs/pkgs/development/compilers/fasm/bin.nix @@ -3,11 +3,11 @@ stdenvNoCC.mkDerivation rec { pname = "fasm-bin"; - version = "1.73.30"; + version = "1.73.31"; src = fetchurl { url = "https://flatassembler.net/fasm-${version}.tgz"; - sha256 = "sha256-dRlQUaWIHbu+DwQBFh6Tf4o2u0LTRw/Ehp2hT9LC8QE="; + sha256 = "sha256-jzjLIayR+xulSGKhvQ9VxWhZC6qRZ/4IHSe3lD8LD+M="; }; installPhase = '' diff --git a/nixpkgs/pkgs/development/compilers/gcc/common/configure-flags.nix b/nixpkgs/pkgs/development/compilers/gcc/common/configure-flags.nix index 7d59eee55f25..cbe38f1127f3 100644 --- a/nixpkgs/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/nixpkgs/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -47,7 +47,7 @@ let # See https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500550903 disableBootstrap' = disableBootstrap && !langFortran && !langGo; - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) diff --git a/nixpkgs/pkgs/development/compilers/gcc/common/libgcc.nix b/nixpkgs/pkgs/development/compilers/gcc/common/libgcc.nix index 4ab6eb2b3b44..f3bf14e36f7e 100644 --- a/nixpkgs/pkgs/development/compilers/gcc/common/libgcc.nix +++ b/nixpkgs/pkgs/development/compilers/gcc/common/libgcc.nix @@ -8,6 +8,7 @@ , targetPlatform , hostPlatform , withoutTargetLibc +, libcCross }: assert !stdenv.targetPlatform.hasSharedLibraries -> !enableShared; @@ -19,7 +20,7 @@ drv: lib.pipe drv (pkg: pkg.overrideAttrs (previousAttrs: lib.optionalAttrs ( targetPlatform != hostPlatform && - (enableShared || targetPlatform.libc == "msvcrt") && + (enableShared || targetPlatform.isMinGW) && withoutTargetLibc ) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; @@ -31,7 +32,7 @@ drv: lib.pipe drv # nixpkgs did not add the "libgcc" output until gcc11. In theory # the following condition can be changed to `true`, but that has not # been tested. -lib.optional (lib.versionAtLeast version "11.0") +lib.optionals (lib.versionAtLeast version "11.0") (let targetPlatformSlash = @@ -39,11 +40,20 @@ lib.optional (lib.versionAtLeast version "11.0") then "" else "${targetPlatform.config}/"; + # If we are building a cross-compiler and the target libc provided + # to us at build time has a libgcc, use that instead of building a + # new one. This avoids having two separate (but identical) libgcc + # outpaths in the closure of most packages, which can be confusing. + useLibgccFromTargetLibc = + libcCross != null && + libcCross?passthru.libgcc; + enableLibGccOutput = (!stdenv.targetPlatform.isWindows || (with stdenv; targetPlatform == hostPlatform)) && !langJit && !stdenv.hostPlatform.isDarwin && - enableShared + enableShared && + !useLibgccFromTargetLibc ; # For some reason libgcc_s.so has major-version "2" on m68k but @@ -54,6 +64,14 @@ lib.optional (lib.versionAtLeast version "11.0") else "1"; in +[ + +(pkg: pkg.overrideAttrs (previousAttrs: lib.optionalAttrs useLibgccFromTargetLibc { + passthru = (previousAttrs.passthru or {}) // { + inherit (libcCross) libgcc; + }; +})) + (pkg: pkg.overrideAttrs (previousAttrs: lib.optionalAttrs ((!langC) || langJit || enableLibGccOutput) { outputs = previousAttrs.outputs ++ lib.optionals enableLibGccOutput [ "libgcc" ]; # This is a separate phase because gcc assembles its phase scripts @@ -143,5 +161,4 @@ in + '' patchelf --set-rpath "" $libgcc/lib/libgcc_s.so.${libgcc_s-version-major} ''); -})))) - +}))])) diff --git a/nixpkgs/pkgs/development/compilers/gcc/default.nix b/nixpkgs/pkgs/development/compilers/gcc/default.nix index f467aa32f7d1..fdc79b575515 100644 --- a/nixpkgs/pkgs/development/compilers/gcc/default.nix +++ b/nixpkgs/pkgs/development/compilers/gcc/default.nix @@ -115,7 +115,7 @@ let inherit version; patches = callFile ./patches {}; /* Cross-gcc settings (build == host != target) */ - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; @@ -450,7 +450,7 @@ ${""} done } )) ([ - (callPackage ./common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) + (callPackage ./common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared libcCross; }) ] ++ optionals atLeast11 [ (callPackage ./common/checksum.nix { inherit langC langCC; }) ]) diff --git a/nixpkgs/pkgs/development/compilers/ocaml/5.1.nix b/nixpkgs/pkgs/development/compilers/ocaml/5.1.nix new file mode 100644 index 000000000000..e11887809d4e --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/ocaml/5.1.nix @@ -0,0 +1,9 @@ +import ./generic.nix { + major_version = "5"; + minor_version = "1"; + patch_version = "0-rc3"; + src = fetchTarball { + url = "https://caml.inria.fr/pub/distrib/ocaml-5.1/ocaml-5.1.0~rc3.tar.xz"; + sha256 = "sha256:0cbvdcsq1qh70mm116dcgk6y7d4g4nrypzq20k7i6ww7am1563d3"; + }; +} diff --git a/nixpkgs/pkgs/development/compilers/rust/1_72.nix b/nixpkgs/pkgs/development/compilers/rust/1_72.nix index 077d8ac903fd..05e55d24a75a 100644 --- a/nixpkgs/pkgs/development/compilers/rust/1_72.nix +++ b/nixpkgs/pkgs/development/compilers/rust/1_72.nix @@ -57,4 +57,4 @@ import ./default.nix { rustcPatches = [ ]; } -(builtins.removeAttrs args [ "pkgsBuildTarget" "pkgsBuildBuild" "pkgsBuildHost" "llvmPackages_16" "llvm_16"]) +(builtins.removeAttrs args [ "pkgsBuildTarget" "pkgsBuildHost" "llvmPackages_16" "llvm_16"]) diff --git a/nixpkgs/pkgs/development/compilers/rust/cargo_cross.nix b/nixpkgs/pkgs/development/compilers/rust/cargo_cross.nix new file mode 100644 index 000000000000..ba7651e63bdb --- /dev/null +++ b/nixpkgs/pkgs/development/compilers/rust/cargo_cross.nix @@ -0,0 +1,14 @@ +{ runCommand, stdenv, lib, pkgsBuildBuild, makeShellWrapper, rustc, ... }: + +runCommand "${stdenv.targetPlatform.config}-cargo-${lib.getVersion pkgsBuildBuild.cargo}" { + # Use depsBuildBuild or it tries to use target-runtimeShell + depsBuildBuild = [ makeShellWrapper ]; + + inherit (pkgsBuildBuild.cargo) meta; +} '' + mkdir -p $out/bin + ln -s ${pkgsBuildBuild.cargo}/share $out/share + + makeWrapper "${pkgsBuildBuild.cargo}/bin/cargo" "$out/bin/cargo" \ + --prefix PATH : "${rustc}/bin" + '' diff --git a/nixpkgs/pkgs/development/compilers/rust/default.nix b/nixpkgs/pkgs/development/compilers/rust/default.nix index 77c8b3d592fa..90e921651f14 100644 --- a/nixpkgs/pkgs/development/compilers/rust/default.nix +++ b/nixpkgs/pkgs/development/compilers/rust/default.nix @@ -15,12 +15,15 @@ , buildPackages , newScope, callPackage , CoreFoundation, Security, SystemConfiguration +, pkgsBuildBuild , makeRustPlatform }: let # Use `import` to make sure no packages sneak in here. lib' = import ../../../build-support/rust/lib { inherit lib; }; + # Allow faster cross compiler generation by reusing Build artifacts + fastCross = (stdenv.buildPlatform == stdenv.hostPlatform) && (stdenv.hostPlatform != stdenv.targetPlatform); in { lib = lib'; @@ -48,7 +51,10 @@ in # Like `buildRustPackages`, but may also contain prebuilt binaries to # break cycle. Just like `bootstrapTools` for nixpkgs as a whole, # nothing in the final package set should refer to this. - bootstrapRustPackages = self.buildRustPackages.overrideScope (_: _: + bootstrapRustPackages = if fastCross + then pkgsBuildBuild.rustPackages + else + self.buildRustPackages.overrideScope (_: _: lib.optionalAttrs (stdenv.buildPlatform == stdenv.hostPlatform) (selectRustPackage buildPackages).packages.prebuilt); bootRustPlatform = makeRustPlatform bootstrapRustPackages; @@ -61,7 +67,7 @@ in version = rustcVersion; sha256 = rustcSha256; inherit enableRustcDev; - inherit llvmShared llvmSharedForBuild llvmSharedForHost llvmSharedForTarget llvmPackages; + inherit llvmShared llvmSharedForBuild llvmSharedForHost llvmSharedForTarget llvmPackages fastCross; patches = rustcPatches; @@ -72,11 +78,11 @@ in inherit Security; inherit (self.buildRustPackages) rustc; }; - cargo = self.callPackage ./cargo.nix { + cargo = if (!fastCross) then self.callPackage ./cargo.nix { # Use boot package set to break cycle rustPlatform = bootRustPlatform; inherit CoreFoundation Security; - }; + } else self.callPackage ./cargo_cross.nix {}; cargo-auditable = self.callPackage ./cargo-auditable.nix { }; cargo-auditable-cargo-wrapper = self.callPackage ./cargo-auditable-cargo-wrapper.nix { }; clippy = self.callPackage ./clippy.nix { diff --git a/nixpkgs/pkgs/development/compilers/rust/rustc.nix b/nixpkgs/pkgs/development/compilers/rust/rustc.nix index 53f7257ecfc5..869dd15df0be 100644 --- a/nixpkgs/pkgs/development/compilers/rust/rustc.nix +++ b/nixpkgs/pkgs/development/compilers/rust/rustc.nix @@ -15,6 +15,10 @@ , wezterm , firefox , thunderbird +# This only builds std for target and reuses the rustc from build. +, fastCross +, lndir +, makeWrapper }: let @@ -87,13 +91,13 @@ in stdenv.mkDerivation rec { # (build!=target): When cross-building a compiler we need to add # the build platform as well so rustc can compile build.rs # scripts. - ] ++ optionals (stdenv.buildPlatform != stdenv.targetPlatform) [ + ] ++ optionals (stdenv.buildPlatform != stdenv.targetPlatform && !fastCross) [ (rust.toRustTargetSpec stdenv.buildPlatform) # (host!=target): When building a cross-targeting compiler we # need to add the host platform as well so rustc can compile # build.rs scripts. - ] ++ optionals (stdenv.hostPlatform != stdenv.targetPlatform) [ + ] ++ optionals (stdenv.hostPlatform != stdenv.targetPlatform && !fastCross) [ (rust.toRustTargetSpec stdenv.hostPlatform) ])}" @@ -132,6 +136,37 @@ in stdenv.mkDerivation rec { "--set rust.jemalloc" ]; + # if we already have a rust compiler for build just compile the target std + # library and reuse compiler + buildPhase = if fastCross then " + runHook preBuild + + mkdir -p build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-{std,rustc}/${rust.toRustTargetSpec stdenv.hostPlatform}/release/ + ln -s ${rustc}/lib/rustlib/${rust.toRustTargetSpec stdenv.hostPlatform}/libstd-*.so build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-std/${rust.toRustTargetSpec stdenv.hostPlatform}/release/libstd.so + ln -s ${rustc}/lib/rustlib/${rust.toRustTargetSpec stdenv.hostPlatform}/librustc_driver-*.so build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-rustc/${rust.toRustTargetSpec stdenv.hostPlatform}/release/librustc.so + ln -s ${rustc}/bin/rustc build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-rustc/${rust.toRustTargetSpec stdenv.hostPlatform}/release/rustc-main + touch build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-std/${rust.toRustTargetSpec stdenv.hostPlatform}/release/.libstd.stamp + touch build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-rustc/${rust.toRustTargetSpec stdenv.hostPlatform}/release/.librustc.stamp + python ./x.py --keep-stage=0 --stage=1 build library/std + + runHook postBuild + " else null; + + installPhase = if fastCross then '' + runHook preInstall + + python ./x.py --keep-stage=0 --stage=1 install library/std + mkdir -v $out/bin $doc $man + makeWrapper ${rustc}/bin/rustc $out/bin/rustc --add-flags "--sysroot $out" + makeWrapper ${rustc}/bin/rustdoc $out/bin/rustdoc --add-flags "--sysroot $out" + ln -s ${rustc}/lib/rustlib/{manifest-rust-std-,}${rust.toRustTargetSpec stdenv.hostPlatform} $out/lib/rustlib/ + echo rust-std-${rust.toRustTargetSpec stdenv.hostPlatform} >> $out/lib/rustlib/components + lndir ${rustc.doc} $doc + lndir ${rustc.man} $man + + runHook postInstall + '' else null; + # The bootstrap.py will generated a Makefile that then executes the build. # The BOOTSTRAP_ARGS used by this Makefile must include all flags to pass # to the bootstrap builder. @@ -179,7 +214,8 @@ in stdenv.mkDerivation rec { nativeBuildInputs = [ file python3 rustc cmake which libffi removeReferencesTo pkg-config xz - ]; + ] + ++ optionals fastCross [ lndir makeWrapper ]; buildInputs = [ openssl ] ++ optionals stdenv.isDarwin [ libiconv Security ] @@ -188,7 +224,7 @@ in stdenv.mkDerivation rec { outputs = [ "out" "man" "doc" ]; setOutputFlags = false; - postInstall = lib.optionalString enableRustcDev '' + postInstall = lib.optionalString (enableRustcDev && !fastCross) '' # install rustc-dev components. Necessary to build rls, clippy... python x.py dist rustc-dev tar xf build/dist/rustc-dev*tar.gz diff --git a/nixpkgs/pkgs/development/compilers/zig/hook.nix b/nixpkgs/pkgs/development/compilers/zig/hook.nix index 788c432591ee..0c099a4c0d11 100644 --- a/nixpkgs/pkgs/development/compilers/zig/hook.nix +++ b/nixpkgs/pkgs/development/compilers/zig/hook.nix @@ -9,6 +9,26 @@ makeSetupHook { propagatedBuildInputs = [ zig ]; substitutions = { + # This zig_default_flags below is meant to avoid CPU feature impurity in + # Nixpkgs. However, this flagset is "unstable": it is specifically meant to + # be controlled by the upstream development team - being up to that team + # exposing or not that flags to the outside (especially the package manager + # teams). + + # Because of this hurdle, @andrewrk from Zig Software Foundation proposed + # some solutions for this issue. Hopefully they will be implemented in + # future releases of Zig. When this happens, this flagset should be + # revisited accordingly. + + # Below are some useful links describing the discovery process of this 'bug' + # in Nixpkgs: + + # https://github.com/NixOS/nixpkgs/issues/169461 + # https://github.com/NixOS/nixpkgs/issues/185644 + # https://github.com/NixOS/nixpkgs/pull/197046 + # https://github.com/NixOS/nixpkgs/pull/241741#issuecomment-1624227485 + # https://github.com/ziglang/zig/issues/14281#issuecomment-1624220653 + zig_default_flags = let releaseType = diff --git a/nixpkgs/pkgs/development/compilers/zig/setup-hook.sh b/nixpkgs/pkgs/development/compilers/zig/setup-hook.sh index f84a02a3268c..689ebec8a307 100644 --- a/nixpkgs/pkgs/development/compilers/zig/setup-hook.sh +++ b/nixpkgs/pkgs/development/compilers/zig/setup-hook.sh @@ -1,25 +1,5 @@ # shellcheck shell=bash disable=SC2154,SC2086 -# This readonly zigDefaultBuildFlagsArray below is meant to avoid CPU feature -# impurity in Nixpkgs. However, this flagset is "unstable": it is specifically -# meant to be controlled by the upstream development team - being up to that -# team exposing or not that flags to the outside (especially the package manager -# teams). - -# Because of this hurdle, @andrewrk from Zig Software Foundation proposed some -# solutions for this issue. Hopefully they will be implemented in future -# releases of Zig. When this happens, this flagset should be revisited -# accordingly. - -# Below are some useful links describing the discovery process of this 'bug' in -# Nixpkgs: - -# https://github.com/NixOS/nixpkgs/issues/169461 -# https://github.com/NixOS/nixpkgs/issues/185644 -# https://github.com/NixOS/nixpkgs/pull/197046 -# https://github.com/NixOS/nixpkgs/pull/241741#issuecomment-1624227485 -# https://github.com/ziglang/zig/issues/14281#issuecomment-1624220653 - readonly zigDefaultFlagsArray=(@zig_default_flags@) function zigSetGlobalCacheDir { @@ -35,7 +15,7 @@ function zigBuildPhase { $zigBuildFlags "${zigBuildFlagsArray[@]}" ) - echoCmd 'build flags' "${flagsArray[@]}" + echoCmd 'zig build flags' "${flagsArray[@]}" zig build "${flagsArray[@]}" runHook postBuild @@ -49,7 +29,7 @@ function zigCheckPhase { $zigCheckFlags "${zigCheckFlagsArray[@]}" ) - echoCmd 'check flags' "${flagsArray[@]}" + echoCmd 'zig check flags' "${flagsArray[@]}" zig build test "${flagsArray[@]}" runHook postCheck @@ -69,7 +49,7 @@ function zigInstallPhase { flagsArray+=("${prefixKey:---prefix}" "$prefix") fi - echoCmd 'install flags' "${flagsArray[@]}" + echoCmd 'zig install flags' "${flagsArray[@]}" zig build install "${flagsArray[@]}" runHook postInstall |