From 4826a708837bb3a14586e94ad5bd6a602466484a Mon Sep 17 00:00:00 2001
From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com>
Date: Sun, 5 Jan 2014 01:29:20 +0100
Subject: [PATCH] find nunit location automagically

---
 src/bindings/dotnet/SConscript | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/bindings/dotnet/SConscript b/src/bindings/dotnet/SConscript
index 717c8604..739f2d2f 100644
--- a/src/bindings/dotnet/SConscript
+++ b/src/bindings/dotnet/SConscript
@@ -39,7 +39,14 @@ dotnettestenv = dotnetenv.Clone()
 
 #dotnettestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
 #dotnettests = ['t/hammer.t']
-dotnettestenv.Append(CILLIBS=['/usr/lib/cli/nunit.core-2.6/nunit.core.dll','/usr/lib/cli/nunit.util-2.6/nunit.util.dll','/usr/lib/cli/nunit.framework-2.6/nunit.framework.dll','/usr/lib/cli/nunit.core.interfaces-2.6/nunit.core.interfaces.dll', thisdir + "/hammer.dll"])
+
+def makeCIL(env, cmd):
+    libs = cmd.split(' ')
+    for lib in libs:
+        env.Append(CILLIBS=[lib[3:]])
+
+dotnettestenv.ParseConfig('pkg-config --libs nunit', makeCIL)
+dotnettestenv.Append(CILLIBS=[thisdir + "/hammer.dll"])
 dotnettestlib = dotnettestenv.CLILibrary('hammer_test.dll', Glob('test/*.cs'))
 Depends(dotnettestlib, hammer_dll)
 
@@ -49,7 +56,7 @@ Depends(dotnettestlib, hammer_dll)
 Depends(dotnettestlib, libhammer_dotnet)
 dotnettest = Alias("testdotnet", [dotnettestexec], dotnettestexec)
 AlwaysBuild(dotnettestexec)
-testruns.append(dotnettestlib)
+testruns.extend(dotnettestlib)
 
 #dotnetinstallexec = dotnetenv.Command(None, libhammer_dotnet, "make install -C " + targetdir)
 #dotnetinstall = Alias("installdotnet", [dotnetinstallexec], dotnetinstallexec)
-- 
GitLab