patches/uClibc/0.9.28/005-fix_includes.sh.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/uClibc/0.9.28/005-fix_includes.sh.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,316 @@
     1.4 +--- uClibc-0.9.28/extra/scripts/fix_includes.sh.orig	2006-12-13 05:44:21.000000000 -0700
     1.5 ++++ uClibc-0.9.28/extra/scripts/fix_includes.sh	2006-12-13 05:44:35.000000000 -0700
     1.6 +@@ -1,183 +1,155 @@
     1.7 + #!/bin/sh
     1.8 +-# Copyright (C) 2003 Erik Andersen <andersen@uclibc.org>
     1.9 + #
    1.10 +-# This program is free software; you can redistribute it and/or
    1.11 +-# modify it under the terms of the GNU Library General Public
    1.12 +-# License as published by the Free Software Foundation; either
    1.13 +-# version 2 of the License, or (at your option) any later
    1.14 +-# version.
    1.15 +-#
    1.16 +-# This program is distributed in the hope that it will be useful,
    1.17 +-# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.18 +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    1.19 +-# GNU Library General Public License for more details.
    1.20 +-#
    1.21 +-# You should have received a copy of the GNU Library General
    1.22 +-# Public License along with this program; if not, write to the
    1.23 +-# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
    1.24 +-# Boston, MA 02111-1307 USA
    1.25 +-
    1.26 +-usage () {
    1.27 +-    echo ""
    1.28 +-    echo "usage: "`basename $0`" -k KERNEL_SOURCE_DIRECTORY -t TARGET_ARCH"
    1.29 +-    echo ""
    1.30 +-    echo "This utility scans the KERNEL_SOURCE_DIRECTORY directory and"
    1.31 +-    echo "checks that it contains well formed kernel headers suitable"
    1.32 +-    echo "for inclusion as the include/linux/ directory provided by"
    1.33 +-    echo "uClibc."
    1.34 +-    echo ""
    1.35 +-    echo "If the specified kernel headers are present and already"
    1.36 +-    echo "configured for the architecture specified by TARGET_ARCH,"
    1.37 +-    echo "they will be used as-is."
    1.38 +-    echo ""
    1.39 +-    echo "If the specified kernel headers are missing entirely, this"
    1.40 +-    echo "script will return an error."
    1.41 +-    echo ""
    1.42 +-    echo "If the specified kernel headers are present, but are either"
    1.43 +-    echo "not yet configured or are configured for an architecture"
    1.44 +-    echo "different than that specified by TARGET_ARCH, this script"
    1.45 +-    echo "will attempt to 'fix' the kernel headers and make them"
    1.46 +-    echo "suitable for use by uClibc.  This fixing process may fail."
    1.47 +-    echo "It is therefore best to always provide kernel headers that"
    1.48 +-    echo "are already configured for the selected architecture."
    1.49 +-    echo ""
    1.50 +-    echo "Most Linux distributions provide 'kernel-headers' packages"
    1.51 +-    echo "that are suitable for use by uClibc."
    1.52 +-    echo ""
    1.53 +-    echo ""
    1.54 +-    exit 1;
    1.55 ++# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
    1.56 ++#
    1.57 ++# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
    1.58 ++#
    1.59 ++
    1.60 ++usage() {
    1.61 ++	echo ""
    1.62 ++	echo "usage: "`basename $0`" -k KERNEL_SOURCE_DIRECTORY -t TARGET_ARCH"
    1.63 ++	echo ""
    1.64 ++	echo "This utility scans the KERNEL_SOURCE_DIRECTORY directory and"
    1.65 ++	echo "checks that it contains well formed kernel headers suitable"
    1.66 ++	echo "for inclusion as the include/linux/ directory provided by"
    1.67 ++	echo "uClibc."
    1.68 ++	echo ""
    1.69 ++	echo "If the specified kernel headers are present and already"
    1.70 ++	echo "configured for the architecture specified by TARGET_ARCH,"
    1.71 ++	echo "they will be used as-is."
    1.72 ++	echo ""
    1.73 ++	echo "If the specified kernel headers are missing entirely, this"
    1.74 ++	echo "script will return an error."
    1.75 ++	echo ""
    1.76 ++	echo "If the specified kernel headers are present, but are either"
    1.77 ++	echo "not yet configured or are configured for an architecture"
    1.78 ++	echo "different than that specified by TARGET_ARCH, this script"
    1.79 ++	echo "will attempt to 'fix' the kernel headers and make them"
    1.80 ++	echo "suitable for use by uClibc.  This fixing process may fail."
    1.81 ++	echo "It is therefore best to always provide kernel headers that"
    1.82 ++	echo "are already configured for the selected architecture."
    1.83 ++	echo ""
    1.84 ++	echo "Most Linux distributions provide 'kernel-headers' packages"
    1.85 ++	echo "that are suitable for use by uClibc."
    1.86 ++	echo ""
    1.87 ++	echo ""
    1.88 ++	exit 1
    1.89 + }
    1.90 + 
    1.91 +-HAS_MMU="y";
    1.92 ++
    1.93 ++#
    1.94 ++# Parse our arguments
    1.95 ++#
    1.96 ++HAS_MMU="y"
    1.97 + while [ -n "$1" ]; do
    1.98 +-    case $1 in
    1.99 +-	-k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;;
   1.100 +-	-t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;;
   1.101 +-	-n ) shift; HAS_MMU="n"; ;;
   1.102 +-	-* ) usage; ;;
   1.103 +-	* ) usage; ;;
   1.104 +-    esac;
   1.105 +-done;
   1.106 ++	case $1 in
   1.107 ++		-k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;;
   1.108 ++		-t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;;
   1.109 ++		-n ) shift; HAS_MMU="n"; ;;
   1.110 ++		-* ) usage; ;;
   1.111 ++		* ) usage; ;;
   1.112 ++	esac
   1.113 ++done
   1.114 + 
   1.115 +-if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then
   1.116 +-    echo "";
   1.117 +-    echo "";
   1.118 +-    echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!";
   1.119 +-    echo "Perhaps your kernel source is broken?"
   1.120 +-    echo "";
   1.121 +-    echo "";
   1.122 +-    exit 1;
   1.123 +-fi;
   1.124 + 
   1.125 +-if [ ! -d "$KERNEL_SOURCE" ]; then
   1.126 +-    echo "";
   1.127 +-    echo "";
   1.128 +-    echo "$KERNEL_SOURCE is not a directory";
   1.129 +-    echo "";
   1.130 +-    echo "";
   1.131 +-    exit 1;
   1.132 +-fi;
   1.133 +-
   1.134 +-if [ -f "$KERNEL_SOURCE/Makefile" ] ; then
   1.135 +-# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
   1.136 +-eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' $KERNEL_SOURCE/Makefile`
   1.137 +-else
   1.138 +-ver=`grep UTS_RELEASE $KERNEL_SOURCE/include/linux/version.h | cut -d '"' -f 2`
   1.139 +-VERSION=`echo "$ver" | cut -d '.' -f 1`
   1.140 +-PATCHLEVEL=`echo "$ver" | cut -d '.' -f 2`
   1.141 +-if echo "$ver" | grep -q '-' ; then
   1.142 +-SUBLEVEL=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.//" | cut -d '-' -f 1`
   1.143 +-EXTRAVERSION=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.${SUBLEVEL}-//"`
   1.144 +-else
   1.145 +-SUBLEVEL=`echo "$ver" | cut -d '.' -f 3`
   1.146 +-#EXTRAVERSION=
   1.147 +-fi
   1.148 ++#
   1.149 ++# Perform some sanity checks on our kernel sources
   1.150 ++#
   1.151 ++if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then
   1.152 ++	echo ""
   1.153 ++	echo ""
   1.154 ++	echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!"
   1.155 ++	echo "Perhaps your kernel source is broken?"
   1.156 ++	echo ""
   1.157 ++	echo ""
   1.158 ++	exit 1
   1.159 + fi
   1.160 +-if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
   1.161 +-then
   1.162 +-    echo "Unable to determine version for kernel headers"
   1.163 +-    echo -e "\tprovided in directory $KERNEL_SOURCE"
   1.164 +-    exit 1
   1.165 ++if [ ! -d "$KERNEL_SOURCE" ]; then
   1.166 ++	echo ""
   1.167 ++	echo ""
   1.168 ++	echo "$KERNEL_SOURCE is not a directory"
   1.169 ++	echo ""
   1.170 ++	echo ""
   1.171 ++	exit 1
   1.172 + fi
   1.173 + 
   1.174 +-if [ "$MAKE_IS_SILENT" != "y" ]; then
   1.175 +-echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}"
   1.176 +-echo -e "\n"
   1.177 +-echo "Using kernel headers from $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} for architecture '$TARGET_ARCH'"
   1.178 +-echo -e "\tprovided in directory $KERNEL_SOURCE"
   1.179 +-echo -e "\n"
   1.180 +-fi
   1.181 + 
   1.182 ++#
   1.183 + # Create a symlink to include/asm
   1.184 +-
   1.185 ++#
   1.186 + rm -f include/asm*
   1.187 + if [ ! -d "$KERNEL_SOURCE/include/asm" ]; then
   1.188 +-    echo "";
   1.189 +-    echo "";
   1.190 +-    echo "The symlink $KERNEL_SOURCE/include/asm is missing\!";
   1.191 +-    echo "Perhaps you forgot to configure your kernel source?";
   1.192 +-    echo "You really should configure your kernel source tree so I";
   1.193 +-    echo "do not have to try and guess about this sort of thing.";
   1.194 +-    echo ""
   1.195 +-    echo "Attempting to guess a usable value....";
   1.196 +-    echo ""
   1.197 +-    echo "";
   1.198 +-    sleep 1;
   1.199 +-
   1.200 +-    if [ "$TARGET_ARCH" = "powerpc" ];then
   1.201 +-	set -x;
   1.202 +-	ln -fs $KERNEL_SOURCE/include/asm-ppc include/asm;
   1.203 +-	set +x;
   1.204 +-    elif [ "$TARGET_ARCH" = "mips" ];then
   1.205 +-	set -x;
   1.206 +-	ln -fs $KERNEL_SOURCE/include/asm-mips include/asm;
   1.207 +-	set +x;
   1.208 +-    elif [ "$TARGET_ARCH" = "arm" ];then
   1.209 +-	set -x;
   1.210 +-	ln -fs $KERNEL_SOURCE/include/asm-arm include/asm;
   1.211 +-	set +x;
   1.212 +-	if [ ! -L $KERNEL_SOURCE/include/asm-arm/proc ] ; then
   1.213 +-	    if [ ! -L proc ] ; then
   1.214 +-		(cd include/asm;
   1.215 +-		ln -fs proc-armv proc;
   1.216 +-		ln -fs arch-ebsa285 arch);
   1.217 +-	    fi
   1.218 ++	echo ""
   1.219 ++	echo ""
   1.220 ++	echo "The symlink $KERNEL_SOURCE/include/asm is missing\!"
   1.221 ++	echo "Perhaps you forgot to configure your kernel source?"
   1.222 ++	echo "You really should configure your kernel source tree so I"
   1.223 ++	echo "do not have to try and guess about this sort of thing."
   1.224 ++	echo ""
   1.225 ++	echo "Attempting to guess a usable value...."
   1.226 ++	echo ""
   1.227 ++	echo ""
   1.228 ++	sleep 1
   1.229 ++
   1.230 ++	if [ "$TARGET_ARCH" = "powerpc" ]; then
   1.231 ++		set -x
   1.232 ++		ln -fs $KERNEL_SOURCE/include/asm-ppc include/asm
   1.233 ++		set +x
   1.234 ++	elif [ "$TARGET_ARCH" = "mips" ]; then
   1.235 ++		set -x
   1.236 ++		ln -fs $KERNEL_SOURCE/include/asm-mips include/asm
   1.237 ++		set +x
   1.238 ++	elif [ "$TARGET_ARCH" = "arm" ]; then
   1.239 ++		set -x
   1.240 ++		ln -fs $KERNEL_SOURCE/include/asm-arm include/asm
   1.241 ++		set +x
   1.242 ++	if [ ! -L $KERNEL_SOURCE/include/asm-arm/proc ]; then
   1.243 ++		if [ ! -L proc ]; then
   1.244 ++			(
   1.245 ++				cd include/asm
   1.246 ++				ln -fs proc-armv proc
   1.247 ++				ln -fs arch-ebsa285 arch
   1.248 ++			)
   1.249 ++		fi
   1.250 ++	fi
   1.251 ++	elif [ "$TARGET_ARCH" = "cris" ]; then
   1.252 ++		set -x
   1.253 ++		ln -fs $KERNEL_SOURCE/include/asm-cris include/asm
   1.254 ++		set +x
   1.255 ++	elif [ "$HAS_MMU" != "y" ]; then
   1.256 ++		if [ -d $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu ]; then
   1.257 ++			set -x
   1.258 ++			ln -fs $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu include/asm
   1.259 ++			set +x
   1.260 ++		else
   1.261 ++			set -x
   1.262 ++			ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm
   1.263 ++			set +x
   1.264 ++		fi
   1.265 ++	else
   1.266 ++		set -x
   1.267 ++		ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm
   1.268 ++		set +x
   1.269 + 	fi;
   1.270 +-    elif [ "$TARGET_ARCH" = "cris" ]; then
   1.271 +-	set -x;
   1.272 +-	ln -fs $KERNEL_SOURCE/include/asm-cris include/asm;
   1.273 +-	set +x;
   1.274 +-    elif [ "$HAS_MMU" != "y" ]; then
   1.275 +-	    if [ -d $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu ] ; then
   1.276 +-		set -x;
   1.277 +-		ln -fs $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu include/asm;
   1.278 +-		set +x;
   1.279 +-	    else
   1.280 +-		set -x;
   1.281 +-		ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm;
   1.282 +-		set +x;
   1.283 +-	    fi;
   1.284 +-    else
   1.285 +-	set -x;
   1.286 +-	ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm;
   1.287 +-	set +x;
   1.288 +-    fi;
   1.289 + else
   1.290 +-# No guessing required.....
   1.291 +-ln -fs $KERNEL_SOURCE/include/asm include/asm
   1.292 +-if [ -e $KERNEL_SOURCE/include/asm-$TARGET_ARCH ] ; then
   1.293 +-ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm-$TARGET_ARCH
   1.294 ++	# No guessing required.....
   1.295 ++	for x in $KERNEL_SOURCE/include/asm* ; do
   1.296 ++		ln -fs ${x} include/
   1.297 ++	done
   1.298 + fi
   1.299 +-fi;
   1.300 + 
   1.301 + 
   1.302 ++#
   1.303 + # Annoyingly, 2.6.x kernel headers also need an include/asm-generic/ directory
   1.304 +-if [ $VERSION -eq 2 ] && [ $PATCHLEVEL -ge 6 ] ; then
   1.305 +-    ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic
   1.306 +-fi;
   1.307 ++#
   1.308 ++if [ -e $KERNEL_SOURCE/include/asm-generic ]; then
   1.309 ++	rm -f include/asm-generic
   1.310 ++	ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic
   1.311 ++fi
   1.312 + 
   1.313 + 
   1.314 ++#
   1.315 + # Create the include/linux symlink.
   1.316 ++#
   1.317 + rm -f include/linux
   1.318 + ln -fs $KERNEL_SOURCE/include/linux include/linux
   1.319 +-