mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 15:02:42 +01:00
* Dirty interim hack to make header file dependency determination
reliable (if somewhat inefficient): make the current time an attribute of the derivation. Thus, every call to `nix-build' will cause the find-includes derivation to be re-done (but not the actual compilations if that's not necessary!). I added a `curTime' primop to do this.
This commit is contained in:
parent
7d386d5c29
commit
af54a60204
4 changed files with 22 additions and 3 deletions
|
|
@ -5,7 +5,12 @@ rec {
|
||||||
compileC = {main, localIncludes ? []}: stdenv.mkDerivation {
|
compileC = {main, localIncludes ? []}: stdenv.mkDerivation {
|
||||||
name = "compile-c";
|
name = "compile-c";
|
||||||
builder = ./compile-c.sh;
|
builder = ./compile-c.sh;
|
||||||
inherit main localIncludes;
|
localIncludes =
|
||||||
|
if localIncludes == "auto" then
|
||||||
|
import (findIncludes {main = toString main; hack = curTime;})
|
||||||
|
else
|
||||||
|
localIncludes;
|
||||||
|
inherit main;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -16,10 +21,10 @@ rec {
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
findIncludes = {main}: stdenv.mkDerivation {
|
findIncludes = {main, hack}: stdenv.mkDerivation {
|
||||||
name = "find-includes";
|
name = "find-includes";
|
||||||
builder = ./find-includes.sh;
|
builder = ./find-includes.sh;
|
||||||
inherit main;
|
inherit main hack;
|
||||||
};
|
};
|
||||||
|
|
||||||
link = {objects, programName ? "program"}: stdenv.mkDerivation {
|
link = {objects, programName ? "program"}: stdenv.mkDerivation {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ EvalState::EvalState()
|
||||||
addPrimOp0("true", primTrue);
|
addPrimOp0("true", primTrue);
|
||||||
addPrimOp0("false", primFalse);
|
addPrimOp0("false", primFalse);
|
||||||
addPrimOp0("null", primNull);
|
addPrimOp0("null", primNull);
|
||||||
|
addPrimOp0("curTime", primCurTime);
|
||||||
|
|
||||||
addPrimOp1("import", primImport);
|
addPrimOp1("import", primImport);
|
||||||
addPrimOp1("derivation", primDerivation);
|
addPrimOp1("derivation", primDerivation);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include "primops.hh"
|
#include "primops.hh"
|
||||||
#include "normalise.hh"
|
#include "normalise.hh"
|
||||||
#include "globals.hh"
|
#include "globals.hh"
|
||||||
|
|
@ -321,3 +323,9 @@ Expr primIsNull(EvalState & state, Expr arg)
|
||||||
ATMatcher m;
|
ATMatcher m;
|
||||||
return makeBool(atMatch(m, arg) >> "Null");
|
return makeBool(atMatch(m, arg) >> "Null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Expr primCurTime(EvalState & state)
|
||||||
|
{
|
||||||
|
return ATmake("Int(<int>)", time(0));
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,5 +34,10 @@ Expr primNull(EvalState & state);
|
||||||
/* Determine whether the argument is the null value. */
|
/* Determine whether the argument is the null value. */
|
||||||
Expr primIsNull(EvalState & state, Expr arg);
|
Expr primIsNull(EvalState & state, Expr arg);
|
||||||
|
|
||||||
|
/* Return the current time. !!! hack, impure - although due to
|
||||||
|
memoization of evaluation results this should always yield the same
|
||||||
|
value for a particular run of the program. */
|
||||||
|
Expr primCurTime(EvalState & state);
|
||||||
|
|
||||||
|
|
||||||
#endif /* !__PRIMOPS_H */
|
#endif /* !__PRIMOPS_H */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue