Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc: provide both native and cross forms of gcc.libs libraries #209153

Merged
merged 1 commit into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/development/compilers/gcc/10/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ stdenv.mkDerivation ({
};

targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;

buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/gcc/11/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ stdenv.mkDerivation ({
};

targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;

buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/gcc/12/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ stdenv.mkDerivation ({
};

targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;

buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/gcc/4.8/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ stdenv.mkDerivation ({
};

targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;

buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/gcc/4.9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ stdenv.mkDerivation ({
};

targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;

buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/gcc/6/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ stdenv.mkDerivation ({
};

targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;

buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/gcc/7/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ stdenv.mkDerivation ({
;

targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;

buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/gcc/8/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ stdenv.mkDerivation ({
};

targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;

buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/compilers/gcc/9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ stdenv.mkDerivation ({
};

targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;

buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/gcc/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,17 @@ preInstall() {
ln -s lib "$out/${targetConfig}/lib32"
ln -s lib "${!outputLib}/${targetConfig}/lib32"
fi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should migrate this eventually to the normal nix phases and share those between all gcc.

There seems to be also a good chunk of other copy pasted code. Not sure how easily we could group that into a shared file and if it would just reduce readability a lot. Maybe we could also use version ranges when something is not supposed to be done for every gcc version.

# cc-wrappers uses --sysroot=/nix/store/does/not/exist as a way to
# drop default sysheaders search path. Unfortunately that switches
# clang++ into searching libraries in gcc in cross-compiler paths:
# from ${!outputLib}/lib (native)
# to ${!outputLib}/${targetPlatformConfig}/lib
# We create the symlink to make both native and cross paths
# available even if the toolchain is not the cross-compiler.
if [ ! -e ${!outputLib}/${targetPlatformConfig} ] ; then
ln -s . ${!outputLib}/${targetPlatformConfig}
fi
}


Expand Down