Skip to content

Commit eada3d7

Browse files
authored
Merge pull request #271 from jkloetzke/fix-autoreconf
Fix autoreconf
2 parents d102a22 + 22e9867 commit eada3d7

File tree

4 files changed

+208
-12
lines changed

4 files changed

+208
-12
lines changed

classes/install.yaml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,23 +163,34 @@ packageSetup: |
163163
fi
164164
}
165165
166-
# replace absolute interpreter paths with /usr/bin/env <interpreter>
166+
# Replace absolute interpreter paths with "/usr/bin/env <interpreter>" for
167+
# all executable scripts in directory.
168+
#
169+
# $1: directory (optional, defaults to ".")
167170
installFixShebang()
168171
{
169-
local f old new
172+
local shebang
170173
while IFS= read -r -d $'\0' f; do
171-
if cmp -s -n2 "$f" <<<'#!' ; then
172-
read -r old_cmd old_arg < "$f"
173-
if [[ "$old_cmd" == "#!/usr/bin/env" ]]; then
174-
continue
174+
read -n 4096 -r shebang < "$f"
175+
if [[ "${shebang:0:2}" == "#!" ]] ; then
176+
# Match part after "#!". Tabs and spaces before and after the
177+
# command are stripped by the kernel. We need to do the same!
178+
if [[ "${shebang:2}" =~ ^[$' \t']*([$'^ \t']+)[$' \t']*(.*)$ ]] ; then
179+
case "${BASH_REMATCH[1]}" in
180+
/usr/bin/env | /bin/sh | /bin/bash)
181+
continue
182+
;;
183+
esac
184+
185+
local cmd="${BASH_REMATCH[1]##*/}"
186+
local arg="${BASH_REMATCH[2]}"
187+
new="#!/usr/bin/env ${arg:+-S }${cmd}${arg:+ ${arg@Q}}"
188+
sed -i -e "1c $new" "$f"
175189
else
176-
old_cmd="${old_cmd:2}"
177-
old_cmd="${old_cmd##*/}"
190+
echo "WARNING: unrecognized shebang: $shebang"
178191
fi
179-
new="#!/usr/bin/env ${old_arg:+-S }${old_cmd}${old_arg:+ ${old_arg@Q}}"
180-
sed -i -e "1c $new" "$f"
181192
fi
182-
done < <(find "${1:-.}" -type f -perm -/111 -print0)
193+
done < <(find "${1:-.}" -type f -perm /111 -print0)
183194
}
184195
185196
# Everything except shared or static libraries or header files.

recipes/devel/autoconf-2.69.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ checkoutSCM:
1111

1212
checkoutDeterministic: True
1313
checkoutScript: |
14-
patchApplySeries $<<autoconf-2.69/*.patch>>
14+
patchApplySeries $<@autoconf-2.69/*.patch@>
1515
# We patch some files that would trigger the rebuild of the manpages.
1616
# Prevent that...
1717
touch man/*.1
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
From: Jan Kloetzke <[email protected]>
2+
Subject: [PATCH] Remove absolute perl path
3+
4+
The variaous autoconf scipts contain the trick that let's them execute
5+
even if they are interpreted by the shell. This line has the full path
6+
to perl which will not be correct in Bobs environment. As it is
7+
unneeded in the first place, just remove it.
8+
9+
diff -Nurp a/bin/autoheader.in b/bin/autoheader.in
10+
--- a/bin/autoheader.in 2025-09-12 15:51:09.408126785 +0200
11+
+++ b/bin/autoheader.in 2025-09-12 15:53:30.661992545 +0200
12+
@@ -2,9 +2,6 @@
13+
# -*- Perl -*-
14+
# @configure_input@
15+
16+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
17+
- if 0;
18+
-
19+
# autoheader -- create `config.h.in' from `configure.ac'
20+
21+
# Copyright (C) 1992-1994, 1996, 1998-2012 Free Software Foundation,
22+
diff -Nurp a/bin/autom4te.in b/bin/autom4te.in
23+
--- a/bin/autom4te.in 2025-09-12 15:51:09.408126785 +0200
24+
+++ b/bin/autom4te.in 2025-09-12 15:53:30.753996376 +0200
25+
@@ -2,9 +2,6 @@
26+
# -*- perl -*-
27+
# @configure_input@
28+
29+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
30+
- if 0;
31+
-
32+
# autom4te - Wrapper around M4 libraries.
33+
# Copyright (C) 2001-2003, 2005-2012 Free Software Foundation, Inc.
34+
35+
diff -Nurp a/bin/autoreconf.in b/bin/autoreconf.in
36+
--- a/bin/autoreconf.in 2025-09-12 15:51:09.408126785 +0200
37+
+++ b/bin/autoreconf.in 2025-09-12 15:53:30.850000372 +0200
38+
@@ -2,9 +2,6 @@
39+
# -*- perl -*-
40+
# @configure_input@
41+
42+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
43+
- if 0;
44+
-
45+
# autoreconf - install the GNU Build System in a directory tree
46+
# Copyright (C) 1994, 1999-2012 Free Software Foundation, Inc.
47+
48+
diff -Nurp a/bin/autoscan.in b/bin/autoscan.in
49+
--- a/bin/autoscan.in 2025-09-12 15:51:09.408126785 +0200
50+
+++ b/bin/autoscan.in 2025-09-12 15:53:30.934003871 +0200
51+
@@ -20,9 +20,6 @@
52+
53+
# Written by David MacKenzie <[email protected]>.
54+
55+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
56+
- if 0;
57+
-
58+
BEGIN
59+
{
60+
use File::Basename;
61+
diff -Nurp a/bin/autoupdate.in b/bin/autoupdate.in
62+
--- a/bin/autoupdate.in 2025-09-12 15:51:09.408126785 +0200
63+
+++ b/bin/autoupdate.in 2025-09-12 15:53:31.026007701 +0200
64+
@@ -21,9 +21,6 @@
65+
# Originally written by David MacKenzie <[email protected]>.
66+
# Rewritten by Akim Demaille <[email protected]>.
67+
68+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
69+
- if 0;
70+
-
71+
BEGIN
72+
{
73+
use File::Basename;
74+
diff -Nurp a/bin/ifnames.in b/bin/ifnames.in
75+
--- a/bin/ifnames.in 2025-09-12 15:51:09.408126785 +0200
76+
+++ b/bin/ifnames.in 2025-09-12 15:53:31.074009699 +0200
77+
@@ -2,9 +2,6 @@
78+
# -*- perl -*-
79+
# @configure_input@
80+
81+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
82+
- if 0;
83+
-
84+
# ifnames - print the identifiers used in C preprocessor conditionals
85+
86+
# Copyright (C) 1994-1995, 1999-2003, 2005-2012 Free Software
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
From: Jan Kloetzke <[email protected]>
2+
Subject: [PATCH] Remove absolute perl path
3+
4+
The variaous autoconf scipts contain the trick that let's them execute
5+
even if they are interpreted by the shell. This line has the full path
6+
to perl which will not be correct in Bobs environment. As it is
7+
unneeded in the first place, just remove it.
8+
9+
diff -Nurp a/bin/autoconf.in b/bin/autoconf.in
10+
--- a/bin/autoconf.in 2025-09-12 11:22:28.208013268 +0200
11+
+++ b/bin/autoconf.in 2025-09-12 15:37:32.333735416 +0200
12+
@@ -2,9 +2,6 @@
13+
# -*- Perl -*-
14+
# @configure_input@
15+
16+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
17+
- if 0;
18+
-
19+
# autoconf -- create 'configure' using m4 macros.
20+
21+
# Copyright (C) 1992-1994, 1996, 1999-2017, 2020-2023 Free Software
22+
diff -Nurp a/bin/autoheader.in b/bin/autoheader.in
23+
--- a/bin/autoheader.in 2025-09-12 11:22:28.208013268 +0200
24+
+++ b/bin/autoheader.in 2025-09-12 15:37:35.989891503 +0200
25+
@@ -2,9 +2,6 @@
26+
# -*- Perl -*-
27+
# @configure_input@
28+
29+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
30+
- if 0;
31+
-
32+
# autoheader -- create 'config.h.in' from 'configure.ac'.
33+
34+
# Copyright (C) 1992-1994, 1996, 1998-2017, 2020-2023 Free Software
35+
diff -Nurp a/bin/autom4te.in b/bin/autom4te.in
36+
--- a/bin/autom4te.in 2025-09-12 11:22:28.212013444 +0200
37+
+++ b/bin/autom4te.in 2025-09-12 15:37:39.382036313 +0200
38+
@@ -2,9 +2,6 @@
39+
# -*- perl -*-
40+
# @configure_input@
41+
42+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
43+
- if 0;
44+
-
45+
# autom4te - Wrapper around M4 libraries.
46+
# Copyright (C) 2001-2003, 2005-2017, 2020-2023 Free Software
47+
# Foundation, Inc.
48+
diff -Nurp a/bin/autoreconf.in b/bin/autoreconf.in
49+
--- a/bin/autoreconf.in 2025-09-12 11:22:28.212013444 +0200
50+
+++ b/bin/autoreconf.in 2025-09-12 15:37:44.074236624 +0200
51+
@@ -2,9 +2,6 @@
52+
# -*- perl -*-
53+
# @configure_input@
54+
55+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
56+
- if 0;
57+
-
58+
# autoreconf - install the GNU Build System in a directory tree
59+
# Copyright (C) 1994, 1999-2017, 2020-2023 Free Software Foundation,
60+
# Inc.
61+
diff -Nurp a/bin/autoscan.in b/bin/autoscan.in
62+
--- a/bin/autoscan.in 2025-09-12 11:22:28.212013444 +0200
63+
+++ b/bin/autoscan.in 2025-09-12 15:38:05.559153749 +0200
64+
@@ -21,9 +21,6 @@
65+
66+
# Written by David MacKenzie <[email protected]>.
67+
68+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
69+
- if 0;
70+
-
71+
use 5.006;
72+
use strict;
73+
use warnings FATAL => 'all';
74+
diff -Nurp a/bin/autoupdate.in b/bin/autoupdate.in
75+
--- a/bin/autoupdate.in 2025-09-12 11:22:28.212013444 +0200
76+
+++ b/bin/autoupdate.in 2025-09-12 15:38:05.683159042 +0200
77+
@@ -22,9 +22,6 @@
78+
# Originally written by David MacKenzie <[email protected]>.
79+
# Rewritten by Akim Demaille <[email protected]>.
80+
81+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
82+
- if 0;
83+
-
84+
use 5.006;
85+
use strict;
86+
use warnings FATAL => 'all';
87+
diff -Nurp a/bin/ifnames.in b/bin/ifnames.in
88+
--- a/bin/ifnames.in 2025-09-12 11:22:28.212013444 +0200
89+
+++ b/bin/ifnames.in 2025-09-12 15:38:05.735161261 +0200
90+
@@ -2,9 +2,6 @@
91+
# -*- perl -*-
92+
# @configure_input@
93+
94+
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
95+
- if 0;
96+
-
97+
# ifnames - print the identifiers used in C preprocessor conditionals
98+
99+
# Copyright (C) 1994-1995, 1999-2003, 2005-2017, 2020-2023 Free Software

0 commit comments

Comments
 (0)