pass HOST_ variables, not BUILD_
[buildroot.git] / toolchain / uClibc / uClibc-0.9.28-fix_includes.patch
blob52c89678e153fdcb953a9466c9f89abe17989715
1 --- uClibc-0.9.28/Makefile.orig 2006-12-11 21:06:42.000000000 -0700
2 +++ uClibc-0.9.28/Makefile 2006-12-11 21:06:53.000000000 -0700
3 @@ -158,7 +158,7 @@
4 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
5 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
6 -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
7 - if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
8 + if [ "$(KERNEL_SOURCE)" = "$(DEVEL_PREFIX)" ] ; then \
9 extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
10 else \
11 extra_exclude="" ; \
12 --- uClibc-0.9.28/extra/scripts/fix_includes.sh.orig 2006-12-13 05:44:21.000000000 -0700
13 +++ uClibc-0.9.28/extra/scripts/fix_includes.sh 2006-12-13 05:44:35.000000000 -0700
14 @@ -1,183 +1,155 @@
15 #!/bin/sh
16 -# Copyright (C) 2003 Erik Andersen <andersen@uclibc.org>
18 -# This program is free software; you can redistribute it and/or
19 -# modify it under the terms of the GNU Library General Public
20 -# License as published by the Free Software Foundation; either
21 -# version 2 of the License, or (at your option) any later
22 -# version.
24 -# This program is distributed in the hope that it will be useful,
25 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
26 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 -# GNU Library General Public License for more details.
29 -# You should have received a copy of the GNU Library General
30 -# Public License along with this program; if not, write to the
31 -# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
32 -# Boston, MA 02111-1307 USA
34 -usage () {
35 - echo ""
36 - echo "usage: "`basename $0`" -k KERNEL_SOURCE_DIRECTORY -t TARGET_ARCH"
37 - echo ""
38 - echo "This utility scans the KERNEL_SOURCE_DIRECTORY directory and"
39 - echo "checks that it contains well formed kernel headers suitable"
40 - echo "for inclusion as the include/linux/ directory provided by"
41 - echo "uClibc."
42 - echo ""
43 - echo "If the specified kernel headers are present and already"
44 - echo "configured for the architecture specified by TARGET_ARCH,"
45 - echo "they will be used as-is."
46 - echo ""
47 - echo "If the specified kernel headers are missing entirely, this"
48 - echo "script will return an error."
49 - echo ""
50 - echo "If the specified kernel headers are present, but are either"
51 - echo "not yet configured or are configured for an architecture"
52 - echo "different than that specified by TARGET_ARCH, this script"
53 - echo "will attempt to 'fix' the kernel headers and make them"
54 - echo "suitable for use by uClibc. This fixing process may fail."
55 - echo "It is therefore best to always provide kernel headers that"
56 - echo "are already configured for the selected architecture."
57 - echo ""
58 - echo "Most Linux distributions provide 'kernel-headers' packages"
59 - echo "that are suitable for use by uClibc."
60 - echo ""
61 - echo ""
62 - exit 1;
63 +# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
65 +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
68 +usage() {
69 + echo ""
70 + echo "usage: "`basename $0`" -k KERNEL_SOURCE_DIRECTORY -t TARGET_ARCH"
71 + echo ""
72 + echo "This utility scans the KERNEL_SOURCE_DIRECTORY directory and"
73 + echo "checks that it contains well formed kernel headers suitable"
74 + echo "for inclusion as the include/linux/ directory provided by"
75 + echo "uClibc."
76 + echo ""
77 + echo "If the specified kernel headers are present and already"
78 + echo "configured for the architecture specified by TARGET_ARCH,"
79 + echo "they will be used as-is."
80 + echo ""
81 + echo "If the specified kernel headers are missing entirely, this"
82 + echo "script will return an error."
83 + echo ""
84 + echo "If the specified kernel headers are present, but are either"
85 + echo "not yet configured or are configured for an architecture"
86 + echo "different than that specified by TARGET_ARCH, this script"
87 + echo "will attempt to 'fix' the kernel headers and make them"
88 + echo "suitable for use by uClibc. This fixing process may fail."
89 + echo "It is therefore best to always provide kernel headers that"
90 + echo "are already configured for the selected architecture."
91 + echo ""
92 + echo "Most Linux distributions provide 'kernel-headers' packages"
93 + echo "that are suitable for use by uClibc."
94 + echo ""
95 + echo ""
96 + exit 1
99 -HAS_MMU="y";
102 +# Parse our arguments
104 +HAS_MMU="y"
105 while [ -n "$1" ]; do
106 - case $1 in
107 - -k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;;
108 - -t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;;
109 - -n ) shift; HAS_MMU="n"; ;;
110 - -* ) usage; ;;
111 - * ) usage; ;;
112 - esac;
113 -done;
114 + case $1 in
115 + -k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;;
116 + -t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;;
117 + -n ) shift; HAS_MMU="n"; ;;
118 + -* ) usage; ;;
119 + * ) usage; ;;
120 + esac
121 +done
123 -if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then
124 - echo "";
125 - echo "";
126 - echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!";
127 - echo "Perhaps your kernel source is broken?"
128 - echo "";
129 - echo "";
130 - exit 1;
131 -fi;
133 -if [ ! -d "$KERNEL_SOURCE" ]; then
134 - echo "";
135 - echo "";
136 - echo "$KERNEL_SOURCE is not a directory";
137 - echo "";
138 - echo "";
139 - exit 1;
140 -fi;
142 -if [ -f "$KERNEL_SOURCE/Makefile" ] ; then
143 -# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
144 -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`
145 -else
146 -ver=`grep UTS_RELEASE $KERNEL_SOURCE/include/linux/version.h | cut -d '"' -f 2`
147 -VERSION=`echo "$ver" | cut -d '.' -f 1`
148 -PATCHLEVEL=`echo "$ver" | cut -d '.' -f 2`
149 -if echo "$ver" | grep -q '-' ; then
150 -SUBLEVEL=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.//" | cut -d '-' -f 1`
151 -EXTRAVERSION=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.${SUBLEVEL}-//"`
152 -else
153 -SUBLEVEL=`echo "$ver" | cut -d '.' -f 3`
154 -#EXTRAVERSION=
157 +# Perform some sanity checks on our kernel sources
159 +if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then
160 + echo ""
161 + echo ""
162 + echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!"
163 + echo "Perhaps your kernel source is broken?"
164 + echo ""
165 + echo ""
166 + exit 1
168 -if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
169 -then
170 - echo "Unable to determine version for kernel headers"
171 - echo -e "\tprovided in directory $KERNEL_SOURCE"
172 - exit 1
173 +if [ ! -d "$KERNEL_SOURCE" ]; then
174 + echo ""
175 + echo ""
176 + echo "$KERNEL_SOURCE is not a directory"
177 + echo ""
178 + echo ""
179 + exit 1
182 -if [ "$MAKE_IS_SILENT" != "y" ]; then
183 -echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}"
184 -echo -e "\n"
185 -echo "Using kernel headers from $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} for architecture '$TARGET_ARCH'"
186 -echo -e "\tprovided in directory $KERNEL_SOURCE"
187 -echo -e "\n"
191 # Create a symlink to include/asm
194 rm -f include/asm*
195 if [ ! -d "$KERNEL_SOURCE/include/asm" ]; then
196 - echo "";
197 - echo "";
198 - echo "The symlink $KERNEL_SOURCE/include/asm is missing\!";
199 - echo "Perhaps you forgot to configure your kernel source?";
200 - echo "You really should configure your kernel source tree so I";
201 - echo "do not have to try and guess about this sort of thing.";
202 - echo ""
203 - echo "Attempting to guess a usable value....";
204 - echo ""
205 - echo "";
206 - sleep 1;
208 - if [ "$TARGET_ARCH" = "powerpc" ];then
209 - set -x;
210 - ln -fs $KERNEL_SOURCE/include/asm-ppc include/asm;
211 - set +x;
212 - elif [ "$TARGET_ARCH" = "mips" ];then
213 - set -x;
214 - ln -fs $KERNEL_SOURCE/include/asm-mips include/asm;
215 - set +x;
216 - elif [ "$TARGET_ARCH" = "arm" ];then
217 - set -x;
218 - ln -fs $KERNEL_SOURCE/include/asm-arm include/asm;
219 - set +x;
220 - if [ ! -L $KERNEL_SOURCE/include/asm-arm/proc ] ; then
221 - if [ ! -L proc ] ; then
222 - (cd include/asm;
223 - ln -fs proc-armv proc;
224 - ln -fs arch-ebsa285 arch);
225 - fi
226 + echo ""
227 + echo ""
228 + echo "The symlink $KERNEL_SOURCE/include/asm is missing\!"
229 + echo "Perhaps you forgot to configure your kernel source?"
230 + echo "You really should configure your kernel source tree so I"
231 + echo "do not have to try and guess about this sort of thing."
232 + echo ""
233 + echo "Attempting to guess a usable value...."
234 + echo ""
235 + echo ""
236 + sleep 1
238 + if [ "$TARGET_ARCH" = "powerpc" ]; then
239 + set -x
240 + ln -fs $KERNEL_SOURCE/include/asm-ppc include/asm
241 + set +x
242 + elif [ "$TARGET_ARCH" = "mips" ]; then
243 + set -x
244 + ln -fs $KERNEL_SOURCE/include/asm-mips include/asm
245 + set +x
246 + elif [ "$TARGET_ARCH" = "arm" ]; then
247 + set -x
248 + ln -fs $KERNEL_SOURCE/include/asm-arm include/asm
249 + set +x
250 + if [ ! -L $KERNEL_SOURCE/include/asm-arm/proc ]; then
251 + if [ ! -L proc ]; then
253 + cd include/asm
254 + ln -fs proc-armv proc
255 + ln -fs arch-ebsa285 arch
257 + fi
258 + fi
259 + elif [ "$TARGET_ARCH" = "cris" ]; then
260 + set -x
261 + ln -fs $KERNEL_SOURCE/include/asm-cris include/asm
262 + set +x
263 + elif [ "$HAS_MMU" != "y" ]; then
264 + if [ -d $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu ]; then
265 + set -x
266 + ln -fs $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu include/asm
267 + set +x
268 + else
269 + set -x
270 + ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm
271 + set +x
272 + fi
273 + else
274 + set -x
275 + ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm
276 + set +x
278 - elif [ "$TARGET_ARCH" = "cris" ]; then
279 - set -x;
280 - ln -fs $KERNEL_SOURCE/include/asm-cris include/asm;
281 - set +x;
282 - elif [ "$HAS_MMU" != "y" ]; then
283 - if [ -d $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu ] ; then
284 - set -x;
285 - ln -fs $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu include/asm;
286 - set +x;
287 - else
288 - set -x;
289 - ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm;
290 - set +x;
291 - fi;
292 - else
293 - set -x;
294 - ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm;
295 - set +x;
296 - fi;
297 else
298 -# No guessing required.....
299 -ln -fs $KERNEL_SOURCE/include/asm include/asm
300 -if [ -e $KERNEL_SOURCE/include/asm-$TARGET_ARCH ] ; then
301 -ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm-$TARGET_ARCH
302 + # No guessing required.....
303 + for x in $KERNEL_SOURCE/include/asm* ; do
304 + ln -fs ${x} include/
305 + done
307 -fi;
311 # Annoyingly, 2.6.x kernel headers also need an include/asm-generic/ directory
312 -if [ $VERSION -eq 2 ] && [ $PATCHLEVEL -ge 6 ] ; then
313 - ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic
314 -fi;
316 +if [ -e $KERNEL_SOURCE/include/asm-generic ]; then
317 + rm -f include/asm-generic
318 + ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic
323 # Create the include/linux symlink.
325 rm -f include/linux
326 ln -fs $KERNEL_SOURCE/include/linux include/linux