libpng: update to 1.4.3
[qi-bootmenu-system.git] / sources / patches / linux-2.6.28-perl2.patch
blob42cf1c9c02e3f65bfd1b1b3ba3434cd2ed4a1d91
1 From: Rob Landley <rob@landley.net>
3 Remove perl from make headers_install by replacing a perl script (doing
4 a simple regex search and replace) with a smaller and faster shell script
5 implementation. The new shell script is a single for loop calling sed and
6 piping its output through unifdef to produce the target file.
8 Signed-off-by: Rob Landley <rob@landley.net>
9 ---
11 Changes from previous version (http://lkml.org/lkml/2009/1/2/22):
13 Updated for Mike Frysinger's Jan 2 commit adding asm/inline/volatile.
15 scripts/Makefile.headersinst | 6 ++--
16 scripts/headers_install.pl | 49 ---------------------------------
17 scripts/headers_install.sh | 39 ++++++++++++++++++++++++++
18 3 files changed, 42 insertions(+), 52 deletions(-)
20 diff -ruN linux-2.6.30.old/scripts/headers_install.pl linux-2.6.30/scripts/headers_install.pl
21 --- linux-2.6.30.old/scripts/headers_install.pl 2009-06-09 22:05:27.000000000 -0500
22 +++ linux-2.6.30/scripts/headers_install.pl 1969-12-31 18:00:00.000000000 -0600
23 @@ -1,49 +0,0 @@
24 -#!/usr/bin/perl -w
26 -# headers_install prepare the listed header files for use in
27 -# user space and copy the files to their destination.
29 -# Usage: headers_install.pl readdir installdir arch [files...]
30 -# readdir: dir to open files
31 -# installdir: dir to install the files
32 -# arch: current architecture
33 -# arch is used to force a reinstallation when the arch
34 -# changes because kbuild then detect a command line change.
35 -# files: list of files to check
37 -# Step in preparation for users space:
38 -# 1) Drop all use of compiler.h definitions
39 -# 2) Drop include of compiler.h
40 -# 3) Drop all sections defined out by __KERNEL__ (using unifdef)
42 -use strict;
44 -my ($readdir, $installdir, $arch, @files) = @ARGV;
46 -my $unifdef = "scripts/unifdef -U__KERNEL__";
48 -foreach my $file (@files) {
49 - local *INFILE;
50 - local *OUTFILE;
51 - my $tmpfile = "$installdir/$file.tmp";
52 - open(INFILE, "<$readdir/$file")
53 - or die "$readdir/$file: $!\n";
54 - open(OUTFILE, ">$tmpfile") or die "$tmpfile: $!\n";
55 - while (my $line = <INFILE>) {
56 - $line =~ s/([\s(])__user\s/$1/g;
57 - $line =~ s/([\s(])__force\s/$1/g;
58 - $line =~ s/([\s(])__iomem\s/$1/g;
59 - $line =~ s/\s__attribute_const__\s/ /g;
60 - $line =~ s/\s__attribute_const__$//g;
61 - $line =~ s/^#include <linux\/compiler.h>//;
62 - $line =~ s/(^|\s)(inline)\b/$1__$2__/g;
63 - $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
64 - $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
65 - printf OUTFILE "%s", $line;
66 - }
67 - close OUTFILE;
68 - close INFILE;
69 - system $unifdef . " $tmpfile > $installdir/$file";
70 - unlink $tmpfile;
72 -exit 0;
73 diff -ruN linux-2.6.30.old/scripts/headers_install.sh linux-2.6.30/scripts/headers_install.sh
74 --- linux-2.6.30.old/scripts/headers_install.sh 1969-12-31 18:00:00.000000000 -0600
75 +++ linux-2.6.30/scripts/headers_install.sh 2009-06-22 16:21:23.000000000 -0500
76 @@ -0,0 +1,39 @@
77 +#!/bin/sh
79 +if [ $# -lt 2 ]
80 +then
81 + echo "Usage: headers_install.sh INDIR OUTDIR [FILES...]
82 + echo
83 + echo "Prepares kernel header files for use by user space, by removing"
84 + echo "all compiler.h definitions and #includes, removing any"
85 + echo "#ifdef __KERNEL__ sections, and putting __underscores__ around"
86 + echo "asm/inline/volatile keywords."
87 + echo
88 + echo "INDIR: directory to read each kernel header FILE from."
89 + echo "OUTDIR: directory to write each userspace header FILE to."
90 + echo "FILES: list of header files to operate on."
92 + exit 1
93 +fi
95 +# Grab arguments
97 +INDIR="$1"
98 +shift
99 +OUTDIR="$1"
100 +shift
102 +# Iterate through files listed on command line
104 +for i in "$@"
106 + sed -r \
107 + -e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \
108 + -e 's/__attribute_const__([ \t]|$)/\1/g' \
109 + -e 's@^#include <linux/compiler.h>@@' \
110 + -e 's/(^|[ \t])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
111 + "$INDIR/$i" |
112 + scripts/unifdef -U__KERNEL__ - > "$OUTDIR/$i"
113 +done
115 +exit 0
116 diff -ruN linux-2.6.30.old/scripts/Makefile.headersinst linux-2.6.30/scripts/Makefile.headersinst
117 --- linux-2.6.30.old/scripts/Makefile.headersinst 2009-06-09 22:05:27.000000000 -0500
118 +++ linux-2.6.30/scripts/Makefile.headersinst 2009-06-22 16:21:23.000000000 -0500
119 @@ -46,8 +46,8 @@
120 quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
121 file$(if $(word 2, $(all-files)),s))
122 cmd_install = \
123 - $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \
124 - $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \
125 + $(CONFIG_SHELL) $< $(srctree)/$(obj) $(install) $(header-y); \
126 + $(CONFIG_SHELL) $< $(objtree)/$(obj) $(install) $(objhdr-y); \
127 touch $@
129 quiet_cmd_remove = REMOVE $(unwanted)
130 @@ -66,7 +66,7 @@
133 targets += $(install-file)
134 -$(install-file): scripts/headers_install.pl $(input-files) FORCE
135 +$(install-file): scripts/headers_install.sh $(input-files) FORCE
136 $(if $(unwanted),$(call cmd,remove),)
137 $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
138 $(call if_changed,install)