From f1ed34081e1716a47610d83f13a6bedb511ca1b2 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <e.dolstra@tudelft.nl>
Date: Tue, 6 Jul 2004 17:27:11 +0000
Subject: [PATCH] * ATerm library example.

---
 examples/aterm/aterm/default.nix              | 30 +++++++++++++++++++
 examples/aterm/default.nix                    |  1 +
 examples/aterm/test/default.nix               | 16 ++++++++++
 examples/default.nix                          |  2 ++
 .../not-so-simple-header-auto/default.nix     |  2 +-
 5 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 examples/aterm/aterm/default.nix
 create mode 100644 examples/aterm/default.nix
 create mode 100644 examples/aterm/test/default.nix

diff --git a/examples/aterm/aterm/default.nix b/examples/aterm/aterm/default.nix
new file mode 100644
index 000000000..8bcf30bb6
--- /dev/null
+++ b/examples/aterm/aterm/default.nix
@@ -0,0 +1,30 @@
+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";
+  };
+
+  libATerm = makeLibrary {
+    libraryName = "ATerm";
+    objects = map {function = compile; list = sources;};
+  };
+
+}
diff --git a/examples/aterm/default.nix b/examples/aterm/default.nix
new file mode 100644
index 000000000..edaac40aa
--- /dev/null
+++ b/examples/aterm/default.nix
@@ -0,0 +1 @@
+import test/default.nix
\ No newline at end of file
diff --git a/examples/aterm/test/default.nix b/examples/aterm/test/default.nix
new file mode 100644
index 000000000..1b96f7a94
--- /dev/null
+++ b/examples/aterm/test/default.nix
@@ -0,0 +1,16 @@
+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;};
+
+  body = [fib];
+}
diff --git a/examples/default.nix b/examples/default.nix
index cbeaa8bf9..8b5b8bca5 100644
--- a/examples/default.nix
+++ b/examples/default.nix
@@ -1,4 +1,6 @@
 [ (import ./trivial)
   (import ./simple-header)
   (import ./not-so-simple-header)
+  (import ./not-so-simple-header-auto)
+  (import ./aterm)
 ]
\ No newline at end of file
diff --git a/examples/not-so-simple-header-auto/default.nix b/examples/not-so-simple-header-auto/default.nix
index 5843a985f..9e84b0c28 100644
--- a/examples/not-so-simple-header-auto/default.nix
+++ b/examples/not-so-simple-header-auto/default.nix
@@ -4,7 +4,7 @@ let {
 
   hello = link {programName = "hello"; objects = compileC {
     main = ./foo/hello.c;
-    localIncludes = import (findIncludes {main = toString ./foo/hello.c;});
+    localIncludes = "auto";
   };};
 
   body = [hello];
-- 
GitLab