tools/quilt: fix build error during kernel_menuconfig on a cleaned env
[openwrt/openwrt.git] / tools / quilt / patches / 000-relocatable.patch
1 --- a/bin/quilt.in
2 +++ b/bin/quilt.in
3 @@ -15,14 +15,22 @@ unset POSIXLY_CORRECT
4 unset GREP_OPTIONS
5
6 export TEXTDOMAIN=quilt
7 -export TEXTDOMAINDIR=@LOCALEDIR@
8
9 -: ${QUILT_DIR=@QUILT_DIR@}
10 +if test -n "$STAGING_DIR_HOST"; then
11 + export TEXTDOMAINDIR="$STAGING_DIR_HOST/share/locale"
12 + : ${QUILT_DIR=$STAGING_DIR_HOST/share/quilt} ${QUILT_LIB=$STAGING_DIR_HOST/lib/quilt}
13 + : ${QUILT_ETC=$STAGING_DIR_HOST/etc}
14 +else
15 + export TEXTDOMAINDIR=@LOCALEDIR@
16 + : ${QUILT_DIR=@QUILT_DIR@}
17 + : ${QUILT_ETC=@ETCDIR@}
18 +fi
19 +
20 export QUILT_DIR
21
22 if [ -z "$QUILTRC" ]
23 then
24 - for QUILTRC in $HOME/.quiltrc @ETCDIR@/quilt.quiltrc; do
25 + for QUILTRC in $HOME/.quiltrc $QUILT_ETC/quilt.quiltrc; do
26 [ -e $QUILTRC ] && break
27 done
28 export QUILTRC
29 --- a/quilt/scripts/edmail.in
30 +++ b/quilt/scripts/edmail.in
31 @@ -1,4 +1,6 @@
32 -#! @PERL@ -w
33 +#! @PERL@
34 +
35 +use warnings;
36
37 # RFCs important for this script:
38 #
39 @@ -29,7 +31,7 @@ BEGIN {
40 }
41
42 setlocale(LC_MESSAGES, "");
43 -bindtextdomain("quilt", "@LOCALEDIR@");
44 +bindtextdomain("quilt", $ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/locale' : "@LOCALEDIR@");
45 textdomain("quilt");
46
47 sub _($) {
48 --- a/quilt/scripts/patchfns.in
49 +++ b/quilt/scripts/patchfns.in
50 @@ -8,7 +8,11 @@
51 # See the COPYING and AUTHORS files for more details.
52
53 export TEXTDOMAIN=quilt
54 -export TEXTDOMAINDIR=@LOCALEDIR@
55 +if [ -n "$STAGING_DIR_HOST" ]; then
56 + export TEXTDOMAINDIR="$STAGING_DIR_HOST/share/locale"
57 +else
58 + export TEXTDOMAINDIR=@LOCALEDIR@
59 +fi
60
61 : ${LC_CTYPE:=$LANG}
62 : ${LC_MESSAGES:=$LANG}
63 --- a/quilt/scripts/remove-trailing-ws.in
64 +++ b/quilt/scripts/remove-trailing-ws.in
65 @@ -1,4 +1,6 @@
66 -#! @PERL@ -w
67 +#! @PERL@
68 +
69 +use warnings;
70
71 # Remove trailing whitespace from modified lines in working files.
72 #
73 @@ -31,7 +33,7 @@ BEGIN {
74 }
75
76 setlocale(LC_MESSAGES, "");
77 -bindtextdomain("quilt", "@LOCALEDIR@");
78 +bindtextdomain("quilt", $ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/locale' : "@LOCALEDIR@");
79 textdomain("quilt");
80
81 sub _($) {
82 --- a/Makefile.in
83 +++ b/Makefile.in
84 @@ -21,8 +21,8 @@ COLUMN := @COLUMN@
85 GETOPT := @GETOPT@
86 CP := @CP@
87 DATE := @DATE@
88 -PERL := @PERL@
89 -BASH := @BASH@
90 +PERL := /usr/bin/env perl
91 +BASH := /usr/bin/env bash
92 SHELL:= @BASH@ # It does not work if dash is used as a shell, for example
93 GREP := @GREP@
94 TAIL := @TAIL@
95 @@ -32,7 +32,7 @@ AWK := @AWK@
96 FIND := @FIND@
97 XARGS := @XARGS@
98 DIFF := @DIFF@
99 -PATCH := @PATCH@
100 +PATCH := /usr/bin/env patch
101 MKTEMP := @MKTEMP@
102 MSGMERGE := @MSGMERGE@
103 MSGFMT := @MSGFMT@
104 @@ -48,8 +48,8 @@ USE_NLS := @USE_NLS@
105 STAT_HARDLINK := @STAT_HARDLINK@
106 PATCH_WRAPPER := @PATCH_WRAPPER@
107
108 -COMPAT_SYMLINKS := @COMPAT_SYMLINKS@
109 -COMPAT_PROGRAMS := @COMPAT_PROGRAMS@
110 +COMPAT_SYMLINKS :=
111 +COMPAT_PROGRAMS :=
112
113 default: all
114
115 --- a/quilt/scripts/backup-files.in
116 +++ b/quilt/scripts/backup-files.in
117 @@ -53,7 +53,12 @@ usage ()
118 "
119 }
120
121 -: ${QUILT_DIR=@QUILT_DIR@}
122 +if test -n "$STAGING_DIR_HOST"; then
123 + : ${QUILT_DIR="$STAGING_DIR_HOST/share/quilt"}
124 +else
125 + : ${QUILT_DIR=@QUILT_DIR@}
126 +fi
127 +
128 . $QUILT_DIR/scripts/utilfns
129
130 ensure_nolinks()
131 --- a/bin/guards.in
132 +++ b/bin/guards.in
133 @@ -1,4 +1,6 @@
134 -#!@PERL@ -w
135 +#!@PERL@
136 +
137 +use warnings;
138
139 # This script is free software; you can redistribute it and/or modify
140 # it under the terms of the GNU General Public License version 2 as
141 --- a/compat/date.in
142 +++ b/compat/date.in
143 @@ -1,4 +1,6 @@
144 -#! @PERL@ -w
145 +#! @PERL@
146 +
147 +use warnings;
148
149 # This script is free software; you can redistribute it and/or modify
150 # it under the terms of the GNU General Public License version 2 as
151 --- a/compat/getopt.in
152 +++ b/compat/getopt.in
153 @@ -1,4 +1,6 @@
154 -#! @PERL@ -w
155 +#! @PERL@
156 +
157 +use warnings;
158
159 # This script is free software; you can redistribute it and/or modify
160 # it under the terms of the GNU General Public License version 2 as
161 --- a/quilt/scripts/dependency-graph.in
162 +++ b/quilt/scripts/dependency-graph.in
163 @@ -1,4 +1,6 @@
164 -#!@PERL@ -w
165 +#!@PERL@
166 +
167 +use warnings;
168
169 # This script is free software; you can redistribute it and/or modify
170 # it under the terms of the GNU General Public License version 2 as