]> mj.ucw.cz Git - pciutils.git/commitdiff
Better support for cross-compiling.
authorAlon Bar-Lev <alon.barlev@gmail.com>
Sun, 9 Nov 2008 19:44:21 +0000 (20:44 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 9 Nov 2008 19:45:03 +0000 (20:45 +0100)
It is difficult to cross compile pciutils, as the host is not standard 3 or 4 components and one need to pass all tools cross compile prefixes.

The attached patch makes it easier:

1. Add CROSS_COMPILE prefix for all toolchain tools. I also changed default CC
   to gcc, I can fix this if you like.

2. Allow parsing standard HOST, such as i686-pc-linux-gnu.

3. Make rel be RELEASE, maybe the whole release thing can be removed as it is
   not actually used.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Makefile
lib/configure

index bc163db5431c64d5d506944c5c98430a175049b5..67acf88a7b6c099226ecf28960a128d10eb60d61 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@ DATE=2008-09-19
 # Host OS and release (override if you are cross-compiling)
 HOST=
 RELEASE=
+CROSS_COMPILE=
 
 # Support for compressed pci.ids (yes/no, default: detect)
 ZLIB=
@@ -37,8 +38,9 @@ PKGCFDIR=$(LIBDIR)/pkgconfig
 INSTALL=install
 DIRINSTALL=install -d
 STRIP=-s
-AR=ar
-RANLIB=ranlib
+CC=$(CROSS_COMPILE)gcc
+AR=$(CROSS_COMPILE)ar
+RANLIB=$(CROSS_COMPILE)ranlib
 
 # Base name of the library (overriden on NetBSD, which has its own libpci)
 LIBNAME=libpci
index 4f17cdc48e9e7165cc2875ce459d2680c4430c5b..8895fcead708841e97817f0e22882a4183ff96e4 100755 (executable)
@@ -38,11 +38,12 @@ if [ -z "$HOST" ] ; then
        fi
        HOST=${3:-$cpu-$sys}
 fi
+[ -n "$RELEASE" ] && rel="${RELEASE}"
 # CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless.
-host=`echo $HOST | sed 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr '[A-Z]' '[a-z]'`
+host=`echo $HOST | sed -e 's/^\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)$/\1-\3/' -e 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr '[A-Z]' '[a-z]'`
 cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo " $host $rel"
+echo " $host $rel $cpu $sys"
 
 c=config.h
 m=config.mk
@@ -63,7 +64,7 @@ case $sys in
                echo >>$c '#define PCI_PATH_PROC_BUS_PCI "/proc/bus/pci"'
                echo >>$c '#define PCI_PATH_SYS_BUS_PCI "/sys/bus/pci"'
                case $cpu in
-                               i386|x86_64)    echo_n " i386-ports"
+                               i?86|x86_64)    echo_n " i386-ports"
                                                echo >>$c '#define PCI_HAVE_PM_INTEL_CONF'
                                                ;;
                esac
@@ -71,7 +72,7 @@ case $sys in
                ;;
        sunos)
                case $cpu in
-                               i386)           echo_n " i386-ports"
+                               i?86)           echo_n " i386-ports"
                                                echo >>$c "#define PCI_HAVE_PM_INTEL_CONF"
                                                ;;
                                *)