Skip to content

Commit

Permalink
cc-wrapper: allow forcing targetPrefix or passing a custom one
Browse files Browse the repository at this point in the history
This can be useful for "toolchain-style" packages which don't let us set
a custom prefix.
  • Loading branch information
sternenseemann committed Jan 1, 2022
1 parent b47b401 commit 24b6926
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
, buildPackages ? {}
, libcxx ? null
# Prefix for binaries. Customarily ends with a dash separator.
#
# TODO(@Ericson2314) Make unconditional, or optional but always true by
# default.
, targetPrefix ? with stdenvNoCC;
lib.optionalString (targetPlatform != hostPlatform) (targetPlatform.config + "-")
}:

with lib;
Expand All @@ -31,13 +37,6 @@ let
stdenv = stdenvNoCC;
inherit (stdenv) hostPlatform targetPlatform;

# Prefix for binaries. Customarily ends with a dash separator.
#
# TODO(@Ericson2314) Make unconditional, or optional but always true by
# default.
targetPrefix = lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");

ccVersion = lib.getVersion cc;
ccName = lib.removePrefix targetPrefix (lib.getName cc);

Expand Down

0 comments on commit 24b6926

Please sign in to comment.