Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions pkgs/development/tools/mold/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ stdenv
, fetchFromGitHub
, lib
, coreutils
, autoPatchelfHook
, cmake
, llvmPackages_latest
Expand Down Expand Up @@ -30,6 +31,35 @@ stdenv.mkDerivation rec {
LTO = 1;
makeFlags = [ "PREFIX=${placeholder "out"}" ];

suffixSalt = lib.replaceStrings ["-" "."] ["_" "_"] stdenv.targetPlatform.config;
wrapperName = "MOLD_WRAPPER";
coreutils_bin = lib.getBin coreutils;
Comment thread
tobim marked this conversation as resolved.
postInstall = let
targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(stdenv.targetPlatform.config + "-");
Comment thread
tobim marked this conversation as resolved.
Outdated
in ''
mkdir -p $out/nix-support

mv $out/bin/mold $out/bin/.mold

export prog=$out/bin/.mold
Comment on lines +47 to +49

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not use wrapProgram or makeWrapper?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i don't understand how those tools would help solve the problem in a better way.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this would help here.

substituteAll \
${../../../build-support/bintools-wrapper/ld-wrapper.sh} \
"$out/bin/${targetPrefix}mold"
chmod +x "$out/bin/${targetPrefix}mold"
ln -s $out/bin/${targetPrefix}mold $out/bin/${targetPrefix}ld

substituteAll \
${../../../build-support/bintools-wrapper/add-flags.sh} \
$out/nix-support/add-flags.sh
substituteAll \
${../../../build-support/bintools-wrapper/add-hardening.sh} \
$out/nix-support/add-hardening.sh
substituteAll \
${../../../build-support/wrapper-common/utils.bash} \
$out/nix-support/utils.bash
'';

passthru = {
updateScript = nix-update-script {
attrPath = pname;
Expand Down