[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] tools/check: check for headers and libraries in user defined folders.



# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
# Date 1321294664 0
# Node ID ca618f5deec257150480d89848ab173ace217e5a
# Parent  078392e5078d4482c2ae50200cf2610e50e7e259
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>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 078392e5078d -r ca618f5deec2 Config.mk
--- a/Config.mk Mon Nov 14 18:14:07 2011 +0000
+++ b/Config.mk Mon Nov 14 18:17:44 2011 +0000
@@ -176,6 +176,9 @@
 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 078392e5078d -r ca618f5deec2 tools/check/Makefile
--- a/tools/check/Makefile      Mon Nov 14 18:14:07 2011 +0000
+++ b/tools/check/Makefile      Mon Nov 14 18:17:44 2011 +0000
@@ -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 078392e5078d -r ca618f5deec2 tools/check/funcs.sh
--- a/tools/check/funcs.sh      Mon Nov 14 18:14:07 2011 +0000
+++ b/tools/check/funcs.sh      Mon Nov 14 18:17:44 2011 +0000
@@ -25,15 +25,23 @@
 }
 
 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 @@
        # 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 @@
            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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.