From 291b9f5e791d88b5515a868ed430946da0d7f5ba Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Wed, 24 Nov 2010 15:52:00 +0000
Subject: [PATCH] use our own ncurses in varnish-2.1.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40604 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 buildout/software-profiles/varnish.cfg |  3 ++
 buildout/tests/assertSoftware.py       | 41 ++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/buildout/software-profiles/varnish.cfg b/buildout/software-profiles/varnish.cfg
index f2f2c447e9..e678c18d4c 100644
--- a/buildout/software-profiles/varnish.cfg
+++ b/buildout/software-profiles/varnish.cfg
@@ -7,6 +7,7 @@ parts =
   varnish-2.1
 
 extends =
+  ../software-profiles/ncurses.cfg
   ../software-profiles/pcre.cfg
   ../software-profiles/patch.cfg
 
@@ -38,3 +39,5 @@ patches =
 environment =
   PATH=${patch:location}/bin:%(PATH)s
   PKG_CONFIG_PATH=${pcre:location}/lib/pkgconfig
+  CPPFLAGS =-I${ncurses:location}/include
+  LDFLAGS =-Wl,-rpath -Wl,${ncurses:location}/lib
diff --git a/buildout/tests/assertSoftware.py b/buildout/tests/assertSoftware.py
index 2db2647c2e..4aa01cba7a 100644
--- a/buildout/tests/assertSoftware.py
+++ b/buildout/tests/assertSoftware.py
@@ -1800,6 +1800,47 @@ class AssertW3m(AssertSoftwareMixin):
           ]]
     self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
 
+class AssertVarnish(AssertSoftwareMixin):
+  def test_ld_varnishd(self):
+    elf_dict = readElfAsDict('parts/varnish-2.1/sbin/varnishd')
+    self.assertEqual(sorted([
+      'libc',
+      'libdl',
+      'libm',
+      'libnsl',
+      'libpthread',
+      'libvarnish',
+      'libvarnishcompat',
+      'libvcl',
+      ]),
+        elf_dict['library_list'])
+    soft_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
+    expected_rpath_list = [os.path.join(soft_dir, software, 'lib') for
+        software in [
+          'ncurses',
+          'varnish-2.1',
+          ]]
+    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
+
+  def test_ld_varnishtop(self):
+    elf_dict = readElfAsDict('parts/varnish-2.1/bin/varnishtop')
+    self.assertEqual(sorted([
+      'libc',
+      'libncurses',
+      'libpthread',
+      'libvarnish',
+      'libvarnishapi',
+      'libvarnishcompat',
+      ]),
+        elf_dict['library_list'])
+    soft_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
+    expected_rpath_list = [os.path.join(soft_dir, software, 'lib') for
+        software in [
+          'ncurses',
+          'varnish-2.1',
+          ]]
+    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
+
 class AssertElfLinkedInternally(AssertSoftwareMixin):
   def test(self):
     return
-- 
2.30.9