nim: remove stdlib indirection in wrapper

Fix #97601
This commit is contained in:
Emery Hemingway 2020-09-11 12:53:06 +02:00
parent 8149ab158b
commit 5885021135
2 changed files with 15 additions and 31 deletions

View File

@ -1,7 +1,7 @@
# https://nim-lang.github.io/Nim/packaging.html # https://nim-lang.github.io/Nim/packaging.html
{ stdenv, lib, fetchgit, fetchurl, makeWrapper, gdb, openssl, pcre, readline { stdenv, lib, fetchgit, fetchurl, makeWrapper, gdb, openssl, pcre, readline
, boehmgc, sqlite, nim-unwrapped, nim-stdlib, nim }: , boehmgc, sqlite, nim-unwrapped, nim }:
let let
version = "1.2.6"; version = "1.2.6";
@ -106,7 +106,6 @@ let
}; };
unwrapped = stdenv.mkDerivation { unwrapped = stdenv.mkDerivation {
# https://nim-lang.github.io/Nim/packaging.html
pname = "nim-unwrapped"; pname = "nim-unwrapped";
inherit version src; inherit version src;
@ -147,31 +146,13 @@ let
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
install -Dt $out/bin bin/* install -Dt $out/bin bin/*
ln -sf $out/nim/bin/nim $out/bin/nim
./install.sh $out
runHook postInstall runHook postInstall
''; '';
inherit meta; inherit meta;
}; };
stdlib = stdenv.mkDerivation {
pname = "nim-stdlib";
inherit (nim-unwrapped) version src patches;
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
touch bin/nim
./install.sh $TMPDIR
cp -r $TMPDIR/nim/lib $out
runHook postInstall
'';
meta = meta // {
description = meta.description + " (standard library)";
};
};
}; };
wrapped = let wrapped = let
@ -197,8 +178,12 @@ let
"--prefix PATH : ${lib.makeBinPath [ stdenv.cc gdb ]}:${ "--prefix PATH : ${lib.makeBinPath [ stdenv.cc gdb ]}:${
placeholder "out" placeholder "out"
}/bin" }/bin"
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.libc openssl ]}" "--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath [ stdenv.cc.libc openssl ]
}"
"--set NIM_CONFIG_PATH ${placeholder "out"}/etc/nim" "--set NIM_CONFIG_PATH ${placeholder "out"}/etc/nim"
''--set NIX_HARDENING_ENABLE "''${NIX_HARDENING_ENABLE/fortify}"''
# Fortify hardening appends -O2 to gcc flags which is unwanted for unoptimized nim builds.
]; ];
buildPhase = with stdenv; buildPhase = with stdenv;
@ -227,20 +212,19 @@ let
for binpath in ${nim}/bin/nim?*; do for binpath in ${nim}/bin/nim?*; do
local binname=`basename $binpath` local binname=`basename $binpath`
makeWrapper $binpath $out/bin/${targetPlatform.config}-$binname \ makeWrapper \
$binpath $out/bin/${targetPlatform.config}-$binname \
$wrapperArgs $wrapperArgs
ln -s $out/bin/${targetPlatform.config}-$binname $out/bin/$binname ln -s $out/bin/${targetPlatform.config}-$binname $out/bin/$binname
done done
makeWrapper ${nim}/bin/nim $out/bin/${targetPlatform.config}-nim \ makeWrapper \
$wrapperArgs \ ${nim}/nim/bin/nim $out/bin/${targetPlatform.config}-nim \
--set NIX_HARDENING_ENABLE "''${NIX_HARDENING_ENABLE/fortify}" \ $wrapperArgs
--add-flags --lib:${nim-stdlib}
ln -s $out/bin/${targetPlatform.config}-nim $out/bin/nim ln -s $out/bin/${targetPlatform.config}-nim $out/bin/nim
runHook postBuild runHook postBuild
''; '';
# Fortify hardening appends -O2 to gcc flags which is unwanted for unoptimized nim builds.
dontInstall = true; dontInstall = true;

View File

@ -9465,7 +9465,7 @@ in
nim = callPackage ../development/compilers/nim { }; nim = callPackage ../development/compilers/nim { };
nim-unwrapped = nim.unwrapped; nim-unwrapped = nim.unwrapped;
nim-stdlib = nim.stdlib;
nrpl = callPackage ../development/tools/nrpl { }; nrpl = callPackage ../development/tools/nrpl { };
neko = callPackage ../development/compilers/neko { }; neko = callPackage ../development/compilers/neko { };