mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 13:06:01 +01:00
Build a minimized Nix with MinGW
At this point many features are stripped out, but this works:
- Can run libnix{util,store,expr} unit tests
- Can run some Nix commands
Co-Authored-By volth <volth@volth.com>
Co-Authored-By Brian McKenna <brian@brianmckenna.org>
This commit is contained in:
parent
2248a3f545
commit
8433027e35
111 changed files with 1162 additions and 140 deletions
|
|
@ -33,15 +33,17 @@
|
|||
#include <optional>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
|
||||
#include <sys/resource.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
|
||||
#ifndef _WIN32 // TODO use portable implementation
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_BOEHMGC
|
||||
|
||||
#define GC_INCLUDE_NEW
|
||||
|
|
@ -2627,9 +2629,11 @@ void EvalState::maybePrintStats()
|
|||
|
||||
void EvalState::printStatistics()
|
||||
{
|
||||
#ifndef _WIN32 // TODO use portable implementation
|
||||
struct rusage buf;
|
||||
getrusage(RUSAGE_SELF, &buf);
|
||||
float cpuTime = buf.ru_utime.tv_sec + ((float) buf.ru_utime.tv_usec / 1000000);
|
||||
#endif
|
||||
|
||||
uint64_t bEnvs = nrEnvs * sizeof(Env) + nrValuesInEnvs * sizeof(Value *);
|
||||
uint64_t bLists = nrListElems * sizeof(Value *);
|
||||
|
|
@ -2646,7 +2650,9 @@ void EvalState::printStatistics()
|
|||
if (outPath != "-")
|
||||
fs.open(outPath, std::fstream::out);
|
||||
json topObj = json::object();
|
||||
#ifndef _WIN32 // TODO implement
|
||||
topObj["cpuTime"] = cpuTime;
|
||||
#endif
|
||||
topObj["envs"] = {
|
||||
{"number", nrEnvs},
|
||||
{"elements", nrValuesInEnvs},
|
||||
|
|
|
|||
|
|
@ -161,6 +161,8 @@ struct DebugTrace {
|
|||
bool isError;
|
||||
};
|
||||
|
||||
// Don't want Windows function
|
||||
#undef SearchPath
|
||||
|
||||
class EvalState : public std::enable_shared_from_this<EvalState>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,7 +28,10 @@
|
|||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <regex>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
|
@ -331,6 +334,8 @@ static RegisterPrimOp primop_import({
|
|||
}
|
||||
});
|
||||
|
||||
#ifndef _WIN32 // TODO implement via DLL loading on Windows
|
||||
|
||||
/* Want reasonable symbol names, so extern C */
|
||||
/* !!! Should we pass the Pos or the file name too? */
|
||||
extern "C" typedef void (*ValueInitializer)(EvalState & state, Value & v);
|
||||
|
|
@ -403,6 +408,8 @@ void prim_exec(EvalState & state, const PosIdx pos, Value * * args, Value & v)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Return a string representing the type of the expression. */
|
||||
static void prim_typeOf(EvalState & state, const PosIdx pos, Value * * args, Value & v)
|
||||
{
|
||||
|
|
@ -4593,6 +4600,7 @@ void EvalState::createBaseEnv()
|
|||
)",
|
||||
});
|
||||
|
||||
#ifndef _WIN32 // TODO implement on Windows
|
||||
// Miscellaneous
|
||||
if (evalSettings.enableNativeCode) {
|
||||
addPrimOp({
|
||||
|
|
@ -4606,6 +4614,7 @@ void EvalState::createBaseEnv()
|
|||
.fun = prim_exec,
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
addPrimOp({
|
||||
.name = "__traceVerbose",
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
// Do not want the windows macro (alias to `SearchPathA`)
|
||||
#undef SearchPath
|
||||
|
||||
/**
|
||||
* A "search path" is a list of ways look for something, used with
|
||||
* `builtins.findFile` and `< >` lookup expressions.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue