mirror of
https://github.com/NixOS/nix
synced 2025-07-08 02:43:54 +02:00
* Merge remaining stuff from the nix-make branch.
* Add support for the creation of shared libraries to `compileC', `link', and `makeLibrary'. * Enable the ATerm library to be made into a shared library.
This commit is contained in:
parent
02f2da0142
commit
36fb29f8f0
22 changed files with 347 additions and 0 deletions
34
make/examples/aterm/aterm/default.nix
Normal file
34
make/examples/aterm/aterm/default.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{sharedLib ? true}:
|
||||
|
||||
rec {
|
||||
|
||||
inherit (import ../../../lib) compileC makeLibrary;
|
||||
|
||||
sources = [
|
||||
./afun.c
|
||||
./aterm.c
|
||||
./bafio.c
|
||||
./byteio.c
|
||||
./gc.c
|
||||
./hash.c
|
||||
./list.c
|
||||
./make.c
|
||||
./md5c.c
|
||||
./memory.c
|
||||
./tafio.c
|
||||
./version.c
|
||||
];
|
||||
|
||||
compile = fn: compileC {
|
||||
main = fn;
|
||||
localIncludes = "auto";
|
||||
forSharedLib = sharedLib;
|
||||
};
|
||||
|
||||
libATerm = makeLibrary {
|
||||
libraryName = "ATerm";
|
||||
objects = map compile sources;
|
||||
inherit sharedLib;
|
||||
};
|
||||
|
||||
}
|
1
make/examples/aterm/default.nix
Normal file
1
make/examples/aterm/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
import test/default.nix
|
18
make/examples/aterm/test/default.nix
Normal file
18
make/examples/aterm/test/default.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
let {
|
||||
|
||||
inherit (import ../../../lib) compileC link;
|
||||
|
||||
inherit (import ../aterm {}) libATerm;
|
||||
|
||||
compile = fn: compileC {
|
||||
main = fn;
|
||||
localIncludes = "auto";
|
||||
cFlags = "-I../aterm";
|
||||
};
|
||||
|
||||
fib = link {objects = compile ./fib.c; libraries = libATerm;};
|
||||
|
||||
primes = link {objects = compile ./primes.c; libraries = libATerm;};
|
||||
|
||||
body = [fib primes];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue