bump nim to 1.6.0
This commit is contained in:
parent
ffd4a9082b
commit
fbd8757fe7
|
@ -1,8 +1,9 @@
|
||||||
# https://nim-lang.github.io/Nim/packaging.html
|
# https://nim-lang.github.io/Nim/packaging.html
|
||||||
# https://nim-lang.org/docs/nimc.html
|
# https://nim-lang.org/docs/nimc.html
|
||||||
|
|
||||||
{ lib, buildPackages, stdenv, fetchurl, fetchgit, fetchFromGitHub, makeWrapper
|
{ lib, callPackage, buildPackages, stdenv, fetchurl, fetchgit, fetchFromGitHub
|
||||||
, openssl, pcre, readline, boehmgc, sqlite, nim-unwrapped }:
|
, makeWrapper, openssl, pcre, readline, boehmgc, sqlite, nim-unwrapped
|
||||||
|
, nimble-unwrapped }:
|
||||||
|
|
||||||
let
|
let
|
||||||
parseCpu = platform:
|
parseCpu = platform:
|
||||||
|
@ -22,9 +23,9 @@ let
|
||||||
"mips64"
|
"mips64"
|
||||||
else if isMsp430 then
|
else if isMsp430 then
|
||||||
"msp430"
|
"msp430"
|
||||||
else if isPowerPC && is32bit then
|
else if isPower && is32bit then
|
||||||
"powerpc"
|
"powerpc"
|
||||||
else if isPowerPC && is64bit then
|
else if isPower && is64bit then
|
||||||
"powerpc64"
|
"powerpc64"
|
||||||
else if isRiscV && is64bit then
|
else if isRiscV && is64bit then
|
||||||
"riscv64"
|
"riscv64"
|
||||||
|
@ -71,15 +72,17 @@ let
|
||||||
nimHost = parsePlatform stdenv.hostPlatform;
|
nimHost = parsePlatform stdenv.hostPlatform;
|
||||||
nimTarget = parsePlatform stdenv.targetPlatform;
|
nimTarget = parsePlatform stdenv.targetPlatform;
|
||||||
|
|
||||||
bootstrapCompiler = stdenv.mkDerivation rec {
|
bootstrapCompiler = let
|
||||||
|
revision = "561b417c65791cd8356b5f73620914ceff845d10";
|
||||||
|
in stdenv.mkDerivation {
|
||||||
pname = "nim-bootstrap";
|
pname = "nim-bootstrap";
|
||||||
version = "0.20.0";
|
version = "g${lib.substring 0 7 revision}";
|
||||||
|
|
||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
# A Git checkout is much smaller than a GitHub tarball.
|
# A Git checkout is much smaller than a GitHub tarball.
|
||||||
url = "https://github.com/nim-lang/csources.git";
|
url = "https://github.com/nim-lang/csources_v1.git";
|
||||||
rev = "v${version}";
|
rev = revision;
|
||||||
sha256 = "0i6vsfy1sgapx43n226q8m0pvn159sw2mhp50zm3hhb9zfijanis";
|
sha256 = "1c2k681knrha1zmf4abhb32i2wwd3nwflzylnqryxk753swla043";
|
||||||
};
|
};
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
@ -95,12 +98,12 @@ in {
|
||||||
|
|
||||||
nim-unwrapped = stdenv.mkDerivation rec {
|
nim-unwrapped = stdenv.mkDerivation rec {
|
||||||
pname = "nim-unwrapped";
|
pname = "nim-unwrapped";
|
||||||
version = "1.4.8";
|
version = "1.6.0";
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://nim-lang.org/download/nim-${version}.tar.xz";
|
url = "https://nim-lang.org/download/nim-${version}.tar.xz";
|
||||||
hash = "sha256-t5jFd0EdfZW4YxJh27Nnbp0a/Z42dA0ESWagVVtBRBo=";
|
hash = "sha256-UgZdSNcqcnAuwa/l96mDHhFnNTHiec3/nK7AGgfuxj0=";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ boehmgc openssl pcre readline sqlite ];
|
buildInputs = [ boehmgc openssl pcre readline sqlite ];
|
||||||
|
@ -111,7 +114,7 @@ in {
|
||||||
|
|
||||||
./nixbuild.patch
|
./nixbuild.patch
|
||||||
# Load libraries at runtime by absolute path
|
# Load libraries at runtime by absolute path
|
||||||
];
|
] ++ lib.optional (!stdenv.hostPlatform.isWindows) ./toLocation.patch;
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
@ -186,138 +189,141 @@ in {
|
||||||
nim' = buildPackages.nim-unwrapped;
|
nim' = buildPackages.nim-unwrapped;
|
||||||
nimble' = buildPackages.nimble-unwrapped;
|
nimble' = buildPackages.nimble-unwrapped;
|
||||||
inherit (stdenv) targetPlatform;
|
inherit (stdenv) targetPlatform;
|
||||||
in stdenv.mkDerivation {
|
self = stdenv.mkDerivation {
|
||||||
name = "${targetPlatform.config}-nim-wrapper-${nim'.version}";
|
name = "${targetPlatform.config}-nim-wrapper-${nim'.version}";
|
||||||
inherit (nim') version;
|
inherit (nim') version;
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
./nim.cfg.patch
|
./nim.cfg.patch
|
||||||
# Remove configurations that clash with ours
|
# Remove configurations that clash with ours
|
||||||
];
|
];
|
||||||
|
|
||||||
unpackPhase = ''
|
unpackPhase = ''
|
||||||
runHook preUnpack
|
runHook preUnpack
|
||||||
tar xf ${nim'.src} nim-$version/config
|
tar xf ${nim'.src} nim-$version/config
|
||||||
cd nim-$version
|
cd nim-$version
|
||||||
runHook postUnpack
|
runHook postUnpack
|
||||||
'';
|
|
||||||
|
|
||||||
dontConfigure = true;
|
|
||||||
|
|
||||||
buildPhase =
|
|
||||||
# Configure the Nim compiler to use $CC and $CXX as backends
|
|
||||||
# The compiler is configured by two configuration files, each with
|
|
||||||
# a different DSL. The order of evaluation matters and that order
|
|
||||||
# is not documented, so duplicate the configuration across both files.
|
|
||||||
''
|
|
||||||
runHook preBuild
|
|
||||||
cat >> config/config.nims << WTF
|
|
||||||
|
|
||||||
switch("os", "${nimTarget.os}")
|
|
||||||
switch("cpu", "${nimTarget.cpu}")
|
|
||||||
switch("define", "nixbuild")
|
|
||||||
|
|
||||||
# Configure the compiler using the $CC set by Nix at build time
|
|
||||||
import strutils
|
|
||||||
let cc = getEnv"CC"
|
|
||||||
if cc.contains("gcc"):
|
|
||||||
switch("cc", "gcc")
|
|
||||||
elif cc.contains("clang"):
|
|
||||||
switch("cc", "clang")
|
|
||||||
WTF
|
|
||||||
|
|
||||||
mv config/nim.cfg config/nim.cfg.old
|
|
||||||
cat > config/nim.cfg << WTF
|
|
||||||
os = "${nimTarget.os}"
|
|
||||||
cpu = "${nimTarget.cpu}"
|
|
||||||
define:"nixbuild"
|
|
||||||
WTF
|
|
||||||
|
|
||||||
cat >> config/nim.cfg < config/nim.cfg.old
|
|
||||||
rm config/nim.cfg.old
|
|
||||||
|
|
||||||
cat >> config/nim.cfg << WTF
|
|
||||||
|
|
||||||
clang.cpp.exe %= "\$CXX"
|
|
||||||
clang.cpp.linkerexe %= "\$CXX"
|
|
||||||
clang.exe %= "\$CC"
|
|
||||||
clang.linkerexe %= "\$CC"
|
|
||||||
gcc.cpp.exe %= "\$CXX"
|
|
||||||
gcc.cpp.linkerexe %= "\$CXX"
|
|
||||||
gcc.exe %= "\$CC"
|
|
||||||
gcc.linkerexe %= "\$CC"
|
|
||||||
WTF
|
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
wrapperArgs = [
|
dontConfigure = true;
|
||||||
"--prefix PATH : ${lib.makeBinPath [ buildPackages.gdb ]}:${
|
|
||||||
placeholder "out"
|
|
||||||
}/bin"
|
|
||||||
# Used by nim-gdb
|
|
||||||
|
|
||||||
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ openssl pcre ]}"
|
buildPhase =
|
||||||
# These libraries may be referred to by the standard library.
|
# Configure the Nim compiler to use $CC and $CXX as backends
|
||||||
# This is broken for cross-compilation because the package
|
# The compiler is configured by two configuration files, each with
|
||||||
# set will be shifted back by nativeBuildInputs.
|
# a different DSL. The order of evaluation matters and that order
|
||||||
|
# is not documented, so duplicate the configuration across both files.
|
||||||
|
''
|
||||||
|
runHook preBuild
|
||||||
|
cat >> config/config.nims << WTF
|
||||||
|
|
||||||
"--set NIM_CONFIG_PATH ${placeholder "out"}/etc/nim"
|
switch("os", "${nimTarget.os}")
|
||||||
# Use the custom configuration
|
switch("cpu", "${nimTarget.cpu}")
|
||||||
|
switch("define", "nixbuild")
|
||||||
|
|
||||||
''--set NIX_HARDENING_ENABLE "''${NIX_HARDENING_ENABLE/fortify}"''
|
# Configure the compiler using the $CC set by Nix at build time
|
||||||
# Fortify hardening appends -O2 to gcc flags which is unwanted for unoptimized nim builds.
|
import strutils
|
||||||
];
|
let cc = getEnv"CC"
|
||||||
|
if cc.contains("gcc"):
|
||||||
|
switch("cc", "gcc")
|
||||||
|
elif cc.contains("clang"):
|
||||||
|
switch("cc", "clang")
|
||||||
|
WTF
|
||||||
|
|
||||||
installPhase = ''
|
mv config/nim.cfg config/nim.cfg.old
|
||||||
runHook preInstall
|
cat > config/nim.cfg << WTF
|
||||||
|
os = "${nimTarget.os}"
|
||||||
|
cpu = "${nimTarget.cpu}"
|
||||||
|
define:"nixbuild"
|
||||||
|
WTF
|
||||||
|
|
||||||
mkdir -p $out/bin $out/etc
|
cat >> config/nim.cfg < config/nim.cfg.old
|
||||||
|
rm config/nim.cfg.old
|
||||||
|
|
||||||
cp -r config $out/etc/nim
|
cat >> config/nim.cfg << WTF
|
||||||
|
|
||||||
|
clang.cpp.exe %= "\$CXX"
|
||||||
|
clang.cpp.linkerexe %= "\$CXX"
|
||||||
|
clang.exe %= "\$CC"
|
||||||
|
clang.linkerexe %= "\$CC"
|
||||||
|
gcc.cpp.exe %= "\$CXX"
|
||||||
|
gcc.cpp.linkerexe %= "\$CXX"
|
||||||
|
gcc.exe %= "\$CC"
|
||||||
|
gcc.linkerexe %= "\$CC"
|
||||||
|
WTF
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
wrapperArgs = [
|
||||||
|
"--prefix PATH : ${lib.makeBinPath [ buildPackages.gdb ]}:${
|
||||||
|
placeholder "out"
|
||||||
|
}/bin"
|
||||||
|
# Used by nim-gdb
|
||||||
|
|
||||||
|
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ openssl pcre ]}"
|
||||||
|
# These libraries may be referred to by the standard library.
|
||||||
|
# This is broken for cross-compilation because the package
|
||||||
|
# set will be shifted back by nativeBuildInputs.
|
||||||
|
|
||||||
|
"--set NIM_CONFIG_PATH ${placeholder "out"}/etc/nim"
|
||||||
|
# Use the custom configuration
|
||||||
|
|
||||||
|
''--set NIX_HARDENING_ENABLE "''${NIX_HARDENING_ENABLE/fortify}"''
|
||||||
|
# Fortify hardening appends -O2 to gcc flags which is unwanted for unoptimized nim builds.
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out/bin $out/etc
|
||||||
|
|
||||||
|
cp -r config $out/etc/nim
|
||||||
|
|
||||||
|
for binpath in ${nim'}/bin/nim?*; do
|
||||||
|
local binname=`basename $binpath`
|
||||||
|
makeWrapper \
|
||||||
|
$binpath $out/bin/${targetPlatform.config}-$binname \
|
||||||
|
$wrapperArgs
|
||||||
|
ln -s $out/bin/${targetPlatform.config}-$binname $out/bin/$binname
|
||||||
|
done
|
||||||
|
|
||||||
for binpath in ${nim'}/bin/nim?*; do
|
|
||||||
local binname=`basename $binpath`
|
|
||||||
makeWrapper \
|
makeWrapper \
|
||||||
$binpath $out/bin/${targetPlatform.config}-$binname \
|
${nim'}/nim/bin/nim $out/bin/${targetPlatform.config}-nim \
|
||||||
|
--set-default CC $(command -v $CC) \
|
||||||
|
--set-default CXX $(command -v $CXX) \
|
||||||
$wrapperArgs
|
$wrapperArgs
|
||||||
ln -s $out/bin/${targetPlatform.config}-$binname $out/bin/$binname
|
ln -s $out/bin/${targetPlatform.config}-nim $out/bin/nim
|
||||||
done
|
|
||||||
|
|
||||||
makeWrapper \
|
makeWrapper \
|
||||||
${nim'}/nim/bin/nim $out/bin/${targetPlatform.config}-nim \
|
${nim'}/bin/testament $out/bin/${targetPlatform.config}-testament \
|
||||||
--set-default CC $(command -v $CC) \
|
$wrapperArgs
|
||||||
--set-default CXX $(command -v $CXX) \
|
ln -s $out/bin/${targetPlatform.config}-testament $out/bin/testament
|
||||||
$wrapperArgs
|
|
||||||
ln -s $out/bin/${targetPlatform.config}-nim $out/bin/nim
|
|
||||||
|
|
||||||
makeWrapper \
|
makeWrapper \
|
||||||
${nim'}/bin/testament $out/bin/${targetPlatform.config}-testament \
|
${nimble'}/bin/nimble $out/bin/${targetPlatform.config}-nimble \
|
||||||
$wrapperArgs
|
--suffix PATH : $out/bin
|
||||||
ln -s $out/bin/${targetPlatform.config}-testament $out/bin/testament
|
ln -s $out/bin/${targetPlatform.config}-nimble $out/bin/nimble
|
||||||
|
|
||||||
makeWrapper \
|
runHook postInstall
|
||||||
${nimble'}/bin/nimble $out/bin/${targetPlatform.config}-nimble \
|
'';
|
||||||
--suffix PATH : $out/bin
|
|
||||||
ln -s $out/bin/${targetPlatform.config}-nimble $out/bin/nimble
|
|
||||||
|
|
||||||
runHook postInstall
|
passthru = {
|
||||||
'';
|
nim = nim';
|
||||||
|
nimble = nimble';
|
||||||
|
};
|
||||||
|
|
||||||
passthru = {
|
meta = nim'.meta // {
|
||||||
nim = nim';
|
description = nim'.meta.description
|
||||||
nimble = nimble';
|
+ " (${targetPlatform.config} wrapper)";
|
||||||
};
|
platforms = with lib.platforms; unix ++ genode;
|
||||||
|
};
|
||||||
meta = nim'.meta // {
|
|
||||||
description = nim'.meta.description
|
|
||||||
+ " (${targetPlatform.config} wrapper)";
|
|
||||||
platforms = with lib.platforms; unix ++ genode;
|
|
||||||
};
|
};
|
||||||
|
in self // {
|
||||||
|
pkgs = callPackage ../../../top-level/nim-packages.nix { nim = self; };
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
diff --git a/config/nim.cfg b/config/nim.cfg
|
diff --git a/config/nim.cfg b/config/nim.cfg
|
||||||
index a33a2f0a9..e069193ff 100644
|
index 3b964d124..850ed0ed9 100644
|
||||||
--- a/config/nim.cfg
|
--- a/config/nim.cfg
|
||||||
+++ b/config/nim.cfg
|
+++ b/config/nim.cfg
|
||||||
@@ -8,26 +8,12 @@
|
@@ -8,26 +8,12 @@
|
||||||
|
@ -29,42 +29,3 @@ index a33a2f0a9..e069193ff 100644
|
||||||
path="$lib/deprecated/core"
|
path="$lib/deprecated/core"
|
||||||
path="$lib/deprecated/pure"
|
path="$lib/deprecated/pure"
|
||||||
path="$lib/pure/collections"
|
path="$lib/pure/collections"
|
||||||
@@ -111,7 +97,7 @@ path="$lib/pure"
|
|
||||||
@end
|
|
||||||
|
|
||||||
@if unix:
|
|
||||||
- @if not bsd or haiku:
|
|
||||||
+ @if not bsd or genode or haiku:
|
|
||||||
# -fopenmp
|
|
||||||
gcc.options.linker = "-ldl"
|
|
||||||
gcc.cpp.options.linker = "-ldl"
|
|
||||||
@@ -295,29 +281,6 @@ vcc.cpp.options.size = "/O1"
|
|
||||||
# Configuration for the Tiny C Compiler:
|
|
||||||
tcc.options.always = "-w"
|
|
||||||
|
|
||||||
-# Configuration for the Genode toolchain
|
|
||||||
-@if genode:
|
|
||||||
- noCppExceptions # avoid std C++
|
|
||||||
- tlsEmulation:on # no TLS segment register magic
|
|
||||||
- @if i386 or amd64:
|
|
||||||
- gcc.exe = "genode-x86-gcc"
|
|
||||||
- gcc.cpp.exe = "genode-x86-g++"
|
|
||||||
- gcc.cpp.linkerexe = "genode-x86-ld"
|
|
||||||
- @elif arm:
|
|
||||||
- gcc.exe = "genode-arm-gcc"
|
|
||||||
- gcc.cpp.exe = "genode-arm-g++"
|
|
||||||
- gcc.cpp.linkerexe = "genode-arm-ld"
|
|
||||||
- @elif arm64:
|
|
||||||
- gcc.exe = "genode-aarch64-gcc"
|
|
||||||
- gcc.cpp.exe = "genode-aarch64-g++"
|
|
||||||
- gcc.cpp.linkerexe = "genode-aarch64-ld"
|
|
||||||
- @elif riscv64:
|
|
||||||
- gcc.exe = "genode-riscv-gcc"
|
|
||||||
- gcc.cpp.exe = "genode-riscv-g++"
|
|
||||||
- gcc.cpp.linkerexe = "genode-riscv-ld"
|
|
||||||
- @end
|
|
||||||
-@end
|
|
||||||
-
|
|
||||||
@if arm or arm64:
|
|
||||||
--define:nimEmulateOverflowChecks
|
|
||||||
@end
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
diff --git a/lib/std/private/miscdollars.nim b/lib/std/private/miscdollars.nim
|
||||||
|
index 840fedf54..6c3436308 100644
|
||||||
|
--- a/lib/std/private/miscdollars.nim
|
||||||
|
+++ b/lib/std/private/miscdollars.nim
|
||||||
|
@@ -6,9 +6,8 @@ template toLocation*(result: var string, file: string | cstring, line: int, col:
|
||||||
|
# it can be done in a single place.
|
||||||
|
result.add file
|
||||||
|
if line > 0:
|
||||||
|
- result.add "("
|
||||||
|
+ result.add ":"
|
||||||
|
addInt(result, line)
|
||||||
|
if col > 0:
|
||||||
|
- result.add ", "
|
||||||
|
+ result.add ":"
|
||||||
|
addInt(result, col)
|
||||||
|
- result.add ")"
|
Loading…
Reference in New Issue