ia64/xen-unstable

changeset 16163:08295dc13166

Fix x86/64 build for *BSD.
- Config.mk: uname -m prints "amd64". Deal with this.
- do not assume python is always in /usr/bin
- get-fields.sh: make it portable and non-bash specific
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
author Keir Fraser <keir@xensource.com>
date Fri Oct 19 14:49:08 2007 +0100 (2007-10-19)
parents 6236adfbebe6
children 959b4b92b6bf
files Config.mk xen/include/Makefile xen/tools/compat-build-header.py xen/tools/compat-build-source.py xen/tools/get-fields.sh
line diff
     1.1 --- a/Config.mk	Fri Oct 19 14:30:10 2007 +0100
     1.2 +++ b/Config.mk	Fri Oct 19 14:49:08 2007 +0100
     1.3 @@ -4,7 +4,8 @@
     1.4  debug ?= n
     1.5  
     1.6  XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
     1.7 -                         -e s/ppc/powerpc/ -e s/i86pc/x86_32/)
     1.8 +                         -e s/ppc/powerpc/ -e s/i86pc/x86_32/   \
     1.9 +                         -e s/amd64/x86_64/)
    1.10  XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
    1.11  XEN_OS              ?= $(shell uname -s)
    1.12  
     2.1 --- a/xen/include/Makefile	Fri Oct 19 14:30:10 2007 +0100
     2.2 +++ b/xen/include/Makefile	Fri Oct 19 14:49:08 2007 +0100
     2.3 @@ -61,7 +61,7 @@ compat/%.c: public/%.h xlat.lst Makefile
     2.4  compat/xlat.h: xlat.lst $(filter-out compat/xlat.h,$(headers-y)) $(BASEDIR)/tools/get-fields.sh Makefile
     2.5  	grep -v '^[	 ]*#' xlat.lst | \
     2.6  	while read what name hdr; do \
     2.7 -		/bin/bash $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $$(echo compat/$$hdr | sed 's,@arch@,$(compat-arch-y),g') || exit $$?; \
     2.8 +		/bin/sh $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $$(echo compat/$$hdr | sed 's,@arch@,$(compat-arch-y),g') || exit $$?; \
     2.9  	done >$@.new
    2.10  	mv -f $@.new $@
    2.11  
     3.1 --- a/xen/tools/compat-build-header.py	Fri Oct 19 14:30:10 2007 +0100
     3.2 +++ b/xen/tools/compat-build-header.py	Fri Oct 19 14:49:08 2007 +0100
     3.3 @@ -1,4 +1,4 @@
     3.4 -#!/usr/bin/python
     3.5 +#!/usr/bin/env python
     3.6  
     3.7  import re,sys
     3.8  
     4.1 --- a/xen/tools/compat-build-source.py	Fri Oct 19 14:30:10 2007 +0100
     4.2 +++ b/xen/tools/compat-build-source.py	Fri Oct 19 14:49:08 2007 +0100
     4.3 @@ -1,4 +1,4 @@
     4.4 -#!/usr/bin/python
     4.5 +#!/usr/bin/env python
     4.6  
     4.7  import re,sys
     4.8  
     5.1 --- a/xen/tools/get-fields.sh	Fri Oct 19 14:30:10 2007 +0100
     5.2 +++ b/xen/tools/get-fields.sh	Fri Oct 19 14:49:08 2007 +0100
     5.3 @@ -1,11 +1,12 @@
     5.4 -#!/bin/bash
     5.5 +#!/bin/sh
     5.6  test -n "$1" -a -n "$2" -a -n "$3"
     5.7  set -ef
     5.8  
     5.9  SED=sed
    5.10 -[ -x /usr/xpg4/bin/sed ] && SED=/usr/xpg4/bin/sed
    5.11 +test -x /usr/xpg4/bin/sed && SED=/usr/xpg4/bin/sed
    5.12  
    5.13 -get_fields() {
    5.14 +get_fields ()
    5.15 +{
    5.16  	local level=1 aggr=0 name= fields=
    5.17  	for token in $2
    5.18  	do
    5.19 @@ -24,7 +25,7 @@ get_fields() {
    5.20  				return 0
    5.21  			fi
    5.22  			;;
    5.23 -		[[:alpha:]_]*)
    5.24 +		[a-zA-Z_]*)
    5.25  			test $aggr = 0 -o -n "$name" || name="$token"
    5.26  			;;
    5.27  		esac
    5.28 @@ -32,7 +33,8 @@ get_fields() {
    5.29  	done
    5.30  }
    5.31  
    5.32 -build_enums() {
    5.33 +build_enums ()
    5.34 +{
    5.35  	local level=1 kind= fields= members= named= id= token
    5.36  	for token in $2
    5.37  	do
    5.38 @@ -64,7 +66,7 @@ build_enums() {
    5.39  				named='?'
    5.40  			fi
    5.41  			;;
    5.42 -		[[:alpha:]]*)
    5.43 +		[a-zA-Z]*)
    5.44  			id=$token
    5.45  			if [ -n "$named" -a -n "${kind#*;}" ]
    5.46  			then
    5.47 @@ -85,7 +87,8 @@ build_enums() {
    5.48  	done
    5.49  }
    5.50  
    5.51 -handle_field() {
    5.52 +handle_field ()
    5.53 +{
    5.54  	if [ -z "$5" ]
    5.55  	then
    5.56  		echo " \\"
    5.57 @@ -161,7 +164,7 @@ for line in sys.stdin.readlines():
    5.58  					array_type=$token
    5.59  				fi
    5.60  				;;
    5.61 -			[[:alpha:]]*)
    5.62 +			[a-zA-Z]*)
    5.63  				id=$token
    5.64  				;;
    5.65  			[\,\;])
    5.66 @@ -202,13 +205,15 @@ for line in sys.stdin.readlines():
    5.67  	fi
    5.68  }
    5.69  
    5.70 -copy_array() {
    5.71 +copy_array ()
    5.72 +{
    5.73  	echo " \\"
    5.74  	echo "${1}if ((_d_)->$2 != (_s_)->$2) \\"
    5.75  	echo -n "$1    memcpy((_d_)->$2, (_s_)->$2, sizeof((_d_)->$2));"
    5.76  }
    5.77  
    5.78 -handle_array() {
    5.79 +handle_array ()
    5.80 +{
    5.81  	local i="i$(echo $4 | $SED 's,[^;], ,g' | wc -w | $SED 's,[[:space:]]*,,g')"
    5.82  	echo " \\"
    5.83  	echo "$1{ \\"
    5.84 @@ -225,7 +230,8 @@ handle_array() {
    5.85  	echo -n "$1}"
    5.86  }
    5.87  
    5.88 -build_body() {
    5.89 +build_body ()
    5.90 +{
    5.91  	echo
    5.92  	echo -n "#define XLAT_$1(_d_, _s_) do {"
    5.93  	local level=1 fields= id= array= arrlvl=1 array_type= type= token
    5.94 @@ -270,7 +276,7 @@ build_body() {
    5.95  				array_type=$token
    5.96  			fi
    5.97  			;;
    5.98 -		[[:alpha:]_]*)
    5.99 +		[a-zA-Z_]*)
   5.100  			if [ -n "$array" ]
   5.101  			then
   5.102  				array="$array $token"
   5.103 @@ -308,7 +314,8 @@ build_body() {
   5.104  	echo ""
   5.105  }
   5.106  
   5.107 -check_field() {
   5.108 +check_field ()
   5.109 +{
   5.110  	if [ -z "$(echo "$4" | $SED 's,[^{}],,g')" ]
   5.111  	then
   5.112  		echo "; \\"
   5.113 @@ -320,7 +327,7 @@ check_field() {
   5.114  				case $n in
   5.115  				struct|union)
   5.116  					;;
   5.117 -				[[:alpha:]_]*)
   5.118 +				[a-zA-Z_]*)
   5.119  					echo -n "    CHECK_$n"
   5.120  					break
   5.121  					;;
   5.122 @@ -350,7 +357,7 @@ check_field() {
   5.123  			"}")
   5.124  				level=$(expr $level - 1) id=
   5.125  				;;
   5.126 -			[[:alpha:]]*)
   5.127 +			[a-zA-Z]*)
   5.128  				id=$token
   5.129  				;;
   5.130  			[\,\;])
   5.131 @@ -366,7 +373,8 @@ check_field() {
   5.132  	fi
   5.133  }
   5.134  
   5.135 -build_check() {
   5.136 +build_check ()
   5.137 +{
   5.138  	echo
   5.139  	echo "#define CHECK_$1 \\"
   5.140  	local level=1 fields= kind= id= arrlvl=1 token
   5.141 @@ -395,7 +403,7 @@ build_check() {
   5.142  		"]")
   5.143  			arrlvl=$(expr $arrlvl - 1)
   5.144  			;;
   5.145 -		[[:alpha:]_]*)
   5.146 +		[a-zA-Z_]*)
   5.147  			test $level != 2 -o $arrlvl != 1 || id=$token
   5.148  			;;
   5.149  		[\,\;])