2005-05-02 15:25:28 +00:00
|
|
|
rec {
|
|
|
|
|
|
|
|
# Should point at your Nixpkgs installation.
|
|
|
|
pkgPath = ./pkgs;
|
|
|
|
|
|
|
|
pkgs = import (pkgPath + /system/all-packages.nix) {};
|
|
|
|
|
|
|
|
stdenv = pkgs.stdenv;
|
|
|
|
|
|
|
|
|
2005-08-14 10:19:55 +00:00
|
|
|
compileC = {main, localIncludes ? "auto", cFlags ? "", sharedLib ? false}:
|
2005-05-02 15:25:28 +00:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "compile-c";
|
|
|
|
builder = ./compile-c.sh;
|
|
|
|
localIncludes =
|
|
|
|
if localIncludes == "auto" then
|
|
|
|
import (findIncludes {
|
|
|
|
main = toString main;
|
|
|
|
hack = __currentTime;
|
|
|
|
inherit cFlags;
|
|
|
|
})
|
|
|
|
else
|
|
|
|
localIncludes;
|
|
|
|
inherit main;
|
|
|
|
cFlags = [
|
|
|
|
cFlags
|
2005-08-14 10:19:55 +00:00
|
|
|
(if sharedLib then ["-fpic"] else [])
|
2005-05-02 15:25:28 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
runCommand = {command}: {
|
|
|
|
name = "run-command";
|
|
|
|
builder = ./run-command.sh;
|
|
|
|
inherit command;
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
|
|
|
findIncludes = {main, hack, cFlags ? ""}: stdenv.mkDerivation {
|
|
|
|
name = "find-includes";
|
|
|
|
builder = ./find-includes.sh;
|
|
|
|
inherit main hack cFlags;
|
|
|
|
};
|
|
|
|
|
|
|
|
link = {objects, programName ? "program", libraries ? []}: stdenv.mkDerivation {
|
|
|
|
name = "link";
|
|
|
|
builder = ./link.sh;
|
|
|
|
inherit objects programName libraries;
|
|
|
|
};
|
|
|
|
|
|
|
|
makeLibrary = {objects, libraryName ? [], sharedLib ? false}:
|
|
|
|
# assert sharedLib -> fold (obj: x: assert obj.sharedLib && x) false objects
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "library";
|
|
|
|
builder = ./make-library.sh;
|
|
|
|
inherit objects libraryName sharedLib;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|