mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 22:42:41 +01:00
* Deal with directory components in header file references (e.g.,
`#include "foo/../bar/bla.h"') by building an appropriate tree of symlinks.
This commit is contained in:
parent
08de98f8b6
commit
0920fe3038
6 changed files with 87 additions and 7 deletions
|
|
@ -1,3 +1,4 @@
|
|||
[ (import ./trivial)
|
||||
(import ./simple-header)
|
||||
(import ./not-so-simple-header)
|
||||
]
|
||||
1
examples/not-so-simple-header/bar/hello.h
Normal file
1
examples/not-so-simple-header/bar/hello.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
#define WHAT "World"
|
||||
14
examples/not-so-simple-header/default.nix
Normal file
14
examples/not-so-simple-header/default.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
let {
|
||||
|
||||
inherit (import ../../lib) compileC link;
|
||||
|
||||
hello = link {objects = compileC {
|
||||
main = ./foo/hello.c;
|
||||
localIncludes = [
|
||||
[./foo/fnord/indirect.h "fnord/indirect.h"]
|
||||
[./bar/hello.h "fnord/../../bar/hello.h"]
|
||||
];
|
||||
};};
|
||||
|
||||
body = [hello];
|
||||
}
|
||||
3
examples/not-so-simple-header/foo/fnord/indirect.h
Normal file
3
examples/not-so-simple-header/foo/fnord/indirect.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#define HELLO "Hello"
|
||||
|
||||
#include "../../bar/hello.h"
|
||||
9
examples/not-so-simple-header/foo/hello.c
Normal file
9
examples/not-so-simple-header/foo/hello.c
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "fnord/indirect.h"
|
||||
|
||||
int main(int argc, char * * argv)
|
||||
{
|
||||
printf(HELLO " " WHAT "\n");
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue