WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH v3] tools/check: check for headers and libraries in u

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH v3] tools/check: check for headers and libraries in user defined folders
From: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
Date: Tue, 25 Oct 2011 18:37:02 +0200
Cc: Ian.Jackson@xxxxxxxxxxxxx
Delivery-date: Tue, 25 Oct 2011 10:42:47 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:content-type:mime-version:content-transfer-encoding:subject :x-mercurial-node:message-id:in-reply-to:references:user-agent:date :from:to:cc; bh=r6dbMhCfOvvvU4xsDP8fB5NECiLn+2/3xUVbjsxNP5c=; b=auuW3/HuPv6ecWpd8dKrmSq2hGb+YGU/p/aMejbCfTkgpqXyFqbyFqP4MgqQ0UdI9t swNAv+TkZMbamUpiBCR9DOWuL2cd3p7e7C2eNvOpxCzSqFBofkegDnnlbVb80MZ18r+i 0YMwINOXSxH32CbCwWDboKKEAGsZ8ilbqE8KQ=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <0a720316685a73e2d5ae.1318930198@loki>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <0a720316685a73e2d5ae.1318930198@loki>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.9.2
# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
# Date 1319560415 -7200
# Node ID f5e0cd9fa6ee923b8524e6a3fd652714de34847d
# Parent  657f4a66dba0b5ca3ad5e89626e735d976e02141
tools/check: check for headers and libraries in user defined folders.

Parse EXTRA_INCLUDES, EXTRA_LIB, PREPEND_INCLUDES, PREPEND_LIB, 
APPEND_INCLUDES, APPEND_LIB during checks, to search for required files.

Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>

diff -r 657f4a66dba0 -r f5e0cd9fa6ee Config.mk
--- a/Config.mk Fri Oct 21 14:03:17 2011 +0200
+++ b/Config.mk Tue Oct 25 18:33:35 2011 +0200
@@ -176,6 +176,9 @@ CFLAGS += $(foreach i, $(PREPEND_INCLUDE
 APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
+CHECK_LIB = $(EXTRA_LIB) $(PREPEND_LIB) $(APPEND_LIB)
+CHECK_INCLUDES = $(EXTRA_INCLUDES) $(PREPEND_INCLUDES) $(APPEND_INCLUDES)
+
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
 
diff -r 657f4a66dba0 -r f5e0cd9fa6ee tools/check/Makefile
--- a/tools/check/Makefile      Fri Oct 21 14:03:17 2011 +0200
+++ b/tools/check/Makefile      Tue Oct 25 18:33:35 2011 +0200
@@ -1,18 +1,24 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+# Export the necessary environment variables for the tests
+export PYTHON
+export LIBXENAPI_BINDINGS
+export CHECK_INCLUDES
+export CHECK_LIB
+
 .PHONY: all install
 all install: check-build
 
 # Check this machine is OK for building on.
 .PHONY: check-build
 check-build:
-       PYTHON=$(PYTHON) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk build
+       ./chk build
 
 # Check this machine is OK for installing on.
 .PHONY: check-install
 check-install:
-       PYTHON=$(PYTHON) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk install
+       ./chk install
 
 .PHONY: clean
 clean:
diff -r 657f4a66dba0 -r f5e0cd9fa6ee tools/check/funcs.sh
--- a/tools/check/funcs.sh      Fri Oct 21 14:03:17 2011 +0200
+++ b/tools/check/funcs.sh      Tue Oct 25 18:33:35 2011 +0200
@@ -25,15 +25,23 @@ has_or_fail() {
 }
 
 has_header() {
+       check_sys_root || return 1
+
        case $1 in
                /*) ;;
-               *) set -- "/usr/include/$1" ;;
+               *)
+               if [ -r "$CROSS_SYS_ROOT/usr/include/$1" ]; then
+                       return 0
+               fi
+               for path in ${CHECK_INCLUDES}; do
+                       if [ -r "$CROSS_SYS_ROOT${path}/$1" ]; then
+                               return 0
+                       fi
+               done
+               ;;
        esac
 
-       check_sys_root || return 1
-
-       test -r "$CROSS_SYS_ROOT$1"
-       return $?
+       return 1
 }
 
 has_lib() {
@@ -42,6 +50,7 @@ has_lib() {
        # subshell to prevent pollution of caller's environment
        (
        PATH=/sbin:$PATH        # for ldconfig
+       LIBRARIES="$CHECK_LIB /usr/lib"
 
        # This relatively common in a sys-root; libs are installed but
        # ldconfig hasn't run there, so ldconfig -p won't work.
@@ -49,8 +58,15 @@ has_lib() {
            echo "Please run ldconfig -r \"$CROSS_SYS_ROOT\" to generate 
ld.so.cache"
            # fall through; ldconfig test below should fail
        fi
-       ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq "$1"
-       return $?
+       if [ "${OS}" = "Linux" ]; then
+               ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq 
"$1"
+               return $?
+       fi
+       if [ "${OS}" = "NetBSD" ]; then
+               ls -1 ${LIBRARIES} | grep -Fq "$1"
+               return $?
+       fi
+       return 1
        )
 }
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel