Nim
Nim copied to clipboard
bundle nif
The nif repo (https://github.com/nim-lang/nif) is now installed as a dependency for the Nim compiler. At the moment the important tools (nifler, xelim, nifgram, gear2) are imported to test that this dependency installation works, but only with the define -d:testNifImports, which the test suite enables for now. This is temporary until NIF is actually used in the compiler.
For nif to be able to import the compiler, the original plan was to generate a config file as described in https://github.com/nim-lang/nif/pull/96 but config files in parent folders aren't checked for imports. Instead the compiler generally defines --path:".." so that dependencies can import it like import compiler / .... nif also defines --path:$nim to work with any version of the compiler, but $nim isn't set to the compiler path when compiling the compiler, so this is disabled via -d:nifCompilerInPath.
In the future we can maybe just move the mutually dependent parts of NIF to the compiler codebase (gear2 & nifler for now), it might be painful to have to update both codebases for each change.
Also, for nif to compile for the bootstrapping version of the compiler (csources_v2), system.ensureMove is declared as a no-op for compiler versions that don't have it.