summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2012-12-19 12:18:08 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2012-12-19 12:28:01 +0000
commitf54d4171e59ff7aaba2ca0520de1ef1d130e0fb4 (patch)
tree2bfbc8a9f6734418215dd09e618f220161e312b7
parentf5a2fbd8310daaec0642e76f8cfc146e2ac130db (diff)
downloadlinux-f54d4171e59ff7aaba2ca0520de1ef1d130e0fb4.tar.gz
-rw-r--r--scripts/Makefile.headersinst6
-rwxr-xr-x[-rw-r--r--]scripts/headers_install.sh31
2 files changed, 18 insertions, 19 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index a57f5bd5a13d..fb48d96053e4 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -50,8 +50,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
file$(if $(word 2, $(all-files)),s))
cmd_install = \
- $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \
- $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \
+ $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \
+ $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \
for F in $(wrapper-files); do \
echo "\#include <asm-generic/$$F>" > $(install)/$$F; \
done; \
@@ -77,7 +77,7 @@ __headersinst: $(subdirs) $(install-file)
@:
targets += $(install-file)
-$(install-file): scripts/headers_install.pl $(input-files) FORCE
+$(install-file): scripts/headers_install.sh $(input-files) FORCE
$(if $(unwanted),$(call cmd,remove),)
$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
$(call if_changed,install)
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index d2308ddbb3b5..6c0761e4990d 100644..100755
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -3,7 +3,7 @@
# headers_install prepare the listed header files for use in
# user space and copy the files to their destination.
#
-# Usage: headers_install.pl readdir installdir arch [files...]
+# Usage: headers_install.sh readdir installdir arch [files...]
# readdir: dir to open files
# installdir: dir to install the files
# arch: current architecture
@@ -16,6 +16,9 @@
# 2) Drop include of compiler.h
# 3) Drop all sections defined out by __KERNEL__ (using unifdef)
+# This is a port to shell of the original Perl version, to avoid
+# requiring Perl when building only the Linux API headers.
+
set -eu
readdir="$1"
@@ -27,11 +30,7 @@ unifdef="scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__"
for file in "$@"
do
- tmpfile=$(mktemp -d "$installdir")
-
- while (my $line = <$in>) {
- printf {$out} "%s", $line;
- }
+ tmpfile=$(mktemp --tmpdir="$installdir")
sed -r \
-e 's/([[:space:](])__user[[:space:]]/\1/g' \
@@ -39,25 +38,25 @@ do
-e 's/([[:space:](])__iomem[[:space:]]/\1/g' \
-e 's/([[:space:]])__attribute_const__[[:space:]]/ /g' \
-e 's/([[:space:]])__attribute_const__$//g' \
- -e 's/\<__packed\>/__attribute__((packed))/g' \
- -e 's/^#include <linux\/compiler.h>//' \
- -e 's/(^|[[:space:]])(inline)\>/\1__\2__/g' \
- -e 's/(^|[[:space:]])(asm)\>([[:space:](]|$)/\1__\2__\3/g' \
- -e 's/(^|[[:space:](])(volatile)\>([[:space:](]|$)/\1__\2__\3/g' \
+ -e 's/\<__packed\>/__attribute__((packed))/g' \
+ -e 's/^#include <linux\/compiler.h>//' \
+ -e 's/(^|[[:space:]])(inline)\>/\1__\2__/g' \
+ -e 's/(^|[[:space:]])(asm)\>([[:space:](]|$)/\1__\2__\3/g' \
+ -e 's/(^|[[:space:](])(volatile)\>([[:space:](]|$)/\1__\2__\3/g' \
"$readdir/$file" > "$tmpfile"
set +e
- $unifdef "$tmpfile" > "$installdir/$file"
+ $unifdef "$tmpfile" > "$installdir/$file"
exit=$?
set -e
- # unifdef will exit 0 on success, and will exit 1 when the
- # file was processed successfully but no changes were made,
- # so abort only when it's higher than that.
+ # unifdef will exit 0 on success, and will exit 1 when the
+ # file was processed successfully but no changes were made,
+ # so abort only when it's higher than that.
if [ "$exit" != 0 ] && [ "$exit" != 1 ]
then
exit 1
fi
- rm "$tmpfile"
+ rm "$tmpfile"
done