Merge pull request #147986 from NickCao/rustc-llvmpackages

firefox: fix cross compilation
main
Rick van Schijndel 2 years ago committed by GitHub
commit 1f75e49103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      pkgs/applications/networking/browsers/firefox/common.nix
  2. 2
      pkgs/development/compilers/rust/1_60.nix
  3. 4
      pkgs/development/compilers/rust/default.nix
  4. 4
      pkgs/development/compilers/rust/rustc.nix
  5. 1
      pkgs/misc/sndio/default.nix
  6. 6
      pkgs/top-level/all-packages.nix

@ -65,6 +65,7 @@
, xorg , xorg
, zip , zip
, zlib , zlib
, pkgsBuildBuild
# optionals # optionals
@ -139,16 +140,21 @@ let
# Target the LLVM version that rustc is built with for LTO. # Target the LLVM version that rustc is built with for LTO.
llvmPackages0 = rustc.llvmPackages; llvmPackages0 = rustc.llvmPackages;
llvmPackagesBuildBuild0 = pkgsBuildBuild.rustc.llvmPackages;
# Force the use of lld and other llvm tools for LTO # Force the use of lld and other llvm tools for LTO
llvmPackages = llvmPackages0.override { llvmPackages = llvmPackages0.override {
bootBintoolsNoLibc = null; bootBintoolsNoLibc = null;
bootBintools = null; bootBintools = null;
}; };
llvmPackagesBuildBuild = llvmPackagesBuildBuild0.override {
bootBintoolsNoLibc = null;
bootBintools = null;
};
# LTO requires LLVM bintools including ld.lld and llvm-ar. # LTO requires LLVM bintools including ld.lld and llvm-ar.
buildStdenv = overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override { buildStdenv = overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override {
inherit (llvmPackages) bintools; bintools = if ltoSupport then buildPackages.rustc.llvmPackages.bintools else stdenv.cc.bintools;
}); });
# Compile the wasm32 sysroot to build the RLBox Sandbox # Compile the wasm32 sysroot to build the RLBox Sandbox
@ -193,10 +199,15 @@ buildStdenv.mkDerivation ({
# two patches. # two patches.
patchFlags = [ "-p1" "-l" ]; patchFlags = [ "-p1" "-l" ];
# if not explicitly set, wrong cc from buildStdenv would be used
HOST_CC = "${llvmPackagesBuildBuild.stdenv.cc}/bin/cc";
HOST_CXX = "${llvmPackagesBuildBuild.stdenv.cc}/bin/c++";
nativeBuildInputs = [ nativeBuildInputs = [
autoconf autoconf
cargo cargo
llvmPackages.llvm # llvm-objdump gnum4
llvmPackagesBuildBuild.bintools
makeWrapper makeWrapper
nodejs nodejs
perl perl
@ -273,13 +284,16 @@ buildStdenv.mkDerivation ({
export MOZILLA_OFFICIAL=1 export MOZILLA_OFFICIAL=1
''; '';
# firefox has a different definition of configurePlatforms from nixpkgs, see configureFlags
configurePlatforms = [ ];
configureFlags = [ configureFlags = [
"--disable-tests" "--disable-tests"
"--disable-updater" "--disable-updater"
"--enable-application=${application}" "--enable-application=${application}"
"--enable-default-toolkit=cairo-gtk3${lib.optionalString waylandSupport "-wayland"}" "--enable-default-toolkit=cairo-gtk3${lib.optionalString waylandSupport "-wayland"}"
"--enable-system-pixman" "--enable-system-pixman"
"--with-libclang-path=${llvmPackages.libclang.lib}/lib" "--with-libclang-path=${llvmPackagesBuildBuild.libclang.lib}/lib"
"--with-system-ffi" "--with-system-ffi"
"--with-system-icu" "--with-system-icu"
"--with-system-jpeg" "--with-system-jpeg"
@ -290,6 +304,9 @@ buildStdenv.mkDerivation ({
"--with-system-png" # needs APNG support "--with-system-png" # needs APNG support
"--with-system-webp" "--with-system-webp"
"--with-system-zlib" "--with-system-zlib"
# for firefox, host is buildPlatform, target is hostPlatform
"--host=${buildStdenv.buildPlatform.config}"
"--target=${buildStdenv.hostPlatform.config}"
] ]
# LTO is done using clang and lld on Linux. # LTO is done using clang and lld on Linux.
++ lib.optionals ltoSupport [ ++ lib.optionals ltoSupport [
@ -332,7 +349,6 @@ buildStdenv.mkDerivation ({
fontconfig fontconfig
freetype freetype
glib glib
gnum4
gtk3 gtk3
icu icu
libffi libffi

@ -33,7 +33,7 @@ import ./default.nix {
llvmShared = llvm_14.override { enableSharedLibraries = true; }; llvmShared = llvm_14.override { enableSharedLibraries = true; };
# Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox # Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox
llvmPackagesForBuild = pkgsBuildBuild.llvmPackages_14; llvmPackages = llvmPackages_14;
# Note: the version MUST be one version prior to the version we're # Note: the version MUST be one version prior to the version we're
# building # building

@ -10,7 +10,7 @@
, llvmSharedForBuild , llvmSharedForBuild
, llvmSharedForHost , llvmSharedForHost
, llvmSharedForTarget , llvmSharedForTarget
, llvmPackagesForBuild # Exposed through rustc for LTO in Firefox , llvmPackages # Exposed through rustc for LTO in Firefox
}: }:
{ stdenv, lib { stdenv, lib
, buildPackages , buildPackages
@ -64,7 +64,7 @@ in
version = rustcVersion; version = rustcVersion;
sha256 = rustcSha256; sha256 = rustcSha256;
inherit enableRustcDev; inherit enableRustcDev;
inherit llvmShared llvmSharedForBuild llvmSharedForHost llvmSharedForTarget llvmPackagesForBuild; inherit llvmShared llvmSharedForBuild llvmSharedForHost llvmSharedForTarget llvmPackages;
patches = rustcPatches; patches = rustcPatches;

@ -1,5 +1,5 @@
{ lib, stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget { lib, stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget
, llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget, llvmPackagesForBuild , llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget, llvmPackages
, fetchurl, file, python3 , fetchurl, file, python3
, darwin, cmake, rust, rustPlatform , darwin, cmake, rust, rustPlatform
, pkg-config, openssl , pkg-config, openssl
@ -179,7 +179,7 @@ in stdenv.mkDerivation rec {
passthru = { passthru = {
llvm = llvmShared; llvm = llvmShared;
llvmPackages = llvmPackagesForBuild; inherit llvmPackages;
}; };
meta = with lib; { meta = with lib; {

@ -11,6 +11,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = lib.optional stdenv.hostPlatform.isLinux alsa-lib; buildInputs = lib.optional stdenv.hostPlatform.isLinux alsa-lib;
configurePlatforms = [];
postInstall = '' postInstall = ''
install -Dm644 contrib/sndiod.service $out/lib/systemd/system/sndiod.service install -Dm644 contrib/sndiod.service $out/lib/systemd/system/sndiod.service

@ -26452,11 +26452,7 @@ with pkgs;
filezilla = callPackage ../applications/networking/ftp/filezilla { }; filezilla = callPackage ../applications/networking/ftp/filezilla { };
buildMozillaMach = buildMozillaMach = opts: callPackage (import ../applications/networking/browsers/firefox/common.nix opts) {};
let callPackage = newScope {
inherit (rustPackages) cargo rustc;
};
in opts: callPackage (import ../applications/networking/browsers/firefox/common.nix opts) {};
firefoxPackages = recurseIntoAttrs (callPackage ../applications/networking/browsers/firefox/packages.nix {}); firefoxPackages = recurseIntoAttrs (callPackage ../applications/networking/browsers/firefox/packages.nix {});

Loading…
Cancel
Save