Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/automake-wrapper/files/, sys-devel/automake-wrapper/
Date: Mon, 26 Feb 2018 17:49:26
Message-Id: 1519667345.1c995dec8c8361c4c52b83a06b2cfc20c2d7213d.whissi@gentoo
1 commit: 1c995dec8c8361c4c52b83a06b2cfc20c2d7213d
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 26 17:48:37 2018 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 26 17:49:05 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c995dec
7
8 sys-devel/automake-wrapper: Bump to v11
9
10 Add sys-devel/automake-1.16 support.
11
12 Package-Manager: Portage-2.3.24, Repoman-2.3.6
13
14 .../automake-wrapper/automake-wrapper-11.ebuild | 36 ++++
15 sys-devel/automake-wrapper/files/am-wrapper-11.sh | 186 +++++++++++++++++++++
16 2 files changed, 222 insertions(+)
17
18 diff --git a/sys-devel/automake-wrapper/automake-wrapper-11.ebuild b/sys-devel/automake-wrapper/automake-wrapper-11.ebuild
19 new file mode 100644
20 index 00000000000..71a6ff489ca
21 --- /dev/null
22 +++ b/sys-devel/automake-wrapper/automake-wrapper-11.ebuild
23 @@ -0,0 +1,36 @@
24 +# Copyright 1999-2018 Gentoo Foundation
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI="6"
28 +
29 +DESCRIPTION="wrapper for automake to manage multiple automake versions"
30 +HOMEPAGE="https://www.gentoo.org/"
31 +SRC_URI=""
32 +
33 +LICENSE="GPL-2"
34 +SLOT="0"
35 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
36 +IUSE=""
37 +
38 +S=${WORKDIR}
39 +
40 +src_unpack() {
41 + cp "${FILESDIR}"/am-wrapper-${PV}.sh "${S}"/ || die
42 +}
43 +
44 +src_prepare() {
45 + default
46 +
47 + # usr/bin/aclocal: bad substitution -> /bin/sh != POSIX shell
48 + if use prefix ; then
49 + sed -i -e '1c\#!'"${EPREFIX}"'/bin/sh' \
50 + "${S}"/am-wrapper-${PV}.sh || die
51 + fi
52 +}
53 +
54 +src_install() {
55 + newbin "${S}"/am-wrapper-${PV}.sh automake
56 + dosym automake /usr/bin/aclocal
57 +
58 + keepdir /usr/share/aclocal
59 +}
60
61 diff --git a/sys-devel/automake-wrapper/files/am-wrapper-11.sh b/sys-devel/automake-wrapper/files/am-wrapper-11.sh
62 new file mode 100644
63 index 00000000000..290762680d2
64 --- /dev/null
65 +++ b/sys-devel/automake-wrapper/files/am-wrapper-11.sh
66 @@ -0,0 +1,186 @@
67 +#!/bin/sh
68 +# Copyright 1999-2018 Gentoo Foundation
69 +# Distributed under the terms of the GNU General Public License v2
70 +
71 +# Executes the correct automake version.
72 +#
73 +# If WANT_AUTOMAKE is set (can be a whitespace delimited list of versions):
74 +# - attempt to find an installed version using those
75 +# - if magic keyword 'latest' is found, pick the latest version that exists
76 +# - if nothing found, warn, and proceed as if WANT_AUTOMAKE was not set (below)
77 +# If WANT_AUTOMAKE is not set:
78 +# - Try to detect the version of automake used to generate things (look at
79 +# Makefile.in and aclocal.m4 and any other useful file)
80 +# - If detected version is not found, warn and proceed as if blank slate
81 +# - Try to locate the latest version of automake that exists and run it
82 +
83 +(set -o posix) 2>/dev/null && set -o posix
84 +
85 +_stderr() { printf 'am-wrapper: %s: %b\n' "${argv0}" "$*" 1>&2; }
86 +warn() { _stderr "warning: $*"; }
87 +err() { _stderr "error: $*"; exit 1; }
88 +unset IFS
89 +which() {
90 + local p
91 + IFS=: # we don't use IFS anywhere, so don't bother saving/restoring
92 + for p in ${PATH} ; do
93 + p="${p}/$1"
94 + [ -e "${p}" ] && echo "${p}" && return 0
95 + done
96 + unset IFS
97 + return 1
98 +}
99 +
100 +#
101 +# Sanitize argv[0] since it isn't always a full path #385201
102 +#
103 +argv0=${0##*/}
104 +case $0 in
105 + ${argv0})
106 + # find it in PATH
107 + if ! full_argv0=$(which "${argv0}") ; then
108 + err "could not locate ${argv0}; file a bug"
109 + fi
110 + ;;
111 + *)
112 + # re-use full/relative paths
113 + full_argv0=$0
114 + ;;
115 +esac
116 +
117 +if ! seq 0 0 2>/dev/null 1>&2 ; then #338518
118 + seq() {
119 + local f l i
120 + case $# in
121 + 1) f=1 i=1 l=$1;;
122 + 2) f=$1 i=1 l=$2;;
123 + 3) f=$1 i=$2 l=$3;;
124 + esac
125 + while :; do
126 + [ $l -lt $f -a $i -gt 0 ] && break
127 + [ $f -lt $l -a $i -lt 0 ] && break
128 + echo $f
129 + : $(( f += i ))
130 + done
131 + return 0
132 + }
133 +fi
134 +
135 +#
136 +# Set up bindings between actual version and WANT_AUTOMAKE;
137 +# Start with last known versions to speed up lookup process.
138 +#
139 +LAST_KNOWN_AUTOMAKE_VER="16"
140 +vers=$(printf '1.%s ' `seq ${LAST_KNOWN_AUTOMAKE_VER} -1 4`)
141 +
142 +#
143 +# Helper to scan for a usable program based on version.
144 +#
145 +binary=
146 +all_vers=
147 +find_binary() {
148 + local v
149 + all_vers="${all_vers} $*" # For error messages.
150 + for v ; do
151 + if [ -x "${full_argv0}-${v}" ] ; then
152 + binary="${full_argv0}-${v}"
153 + binary_ver=${v}
154 + return 0
155 + fi
156 + done
157 + return 1
158 +}
159 +
160 +#
161 +# Try and find a usable automake version. First check the WANT_AUTOMAKE
162 +# setting (whitespace delimited list), then fallback to the latest.
163 +#
164 +find_latest() {
165 + if ! find_binary ${vers} ; then
166 + # Brute force it.
167 + find_binary $(printf '1.%s ' `seq 99 -1 ${LAST_KNOWN_AUTOMAKE_VER}`)
168 + fi
169 +}
170 +for wx in ${WANT_AUTOMAKE:-latest} ; do
171 + if [ "${wx}" = "latest" ] ; then
172 + find_latest && break
173 + else
174 + find_binary ${wx} && break
175 + fi
176 +done
177 +
178 +if [ -z "${binary}" ] && [ -n "${WANT_AUTOMAKE}" ] ; then
179 + warn "could not locate installed version for WANT_AUTOMAKE='${WANT_AUTOMAKE}'; ignoring"
180 + unset WANT_AUTOMAKE
181 + find_latest
182 +fi
183 +
184 +if [ -z "${binary}" ] ; then
185 + err "Unable to locate any usuable version of automake.\n" \
186 + "\tI tried these versions:${all_vers}\n" \
187 + "\tWith a base name of '${full_argv0}'."
188 +fi
189 +
190 +#
191 +# autodetect helpers
192 +#
193 +do_awk() {
194 + local file=$1 ; shift
195 + local v=$(awk -v regex="$*" '{
196 + if (ret = match($0, regex)) {
197 + s = substr($0, ret, RLENGTH)
198 + ret = match(s, "[0-9]\\.[0-9]+")
199 + print substr(s, ret, RLENGTH)
200 + exit
201 + }
202 + }' "${file}")
203 + case " ${auto_vers} " in
204 + *" ${v} "*) ;;
205 + *) auto_vers="${auto_vers:+${auto_vers} }${v}" ;;
206 + esac
207 +}
208 +
209 +#
210 +# autodetect routine
211 +#
212 +if [ -z "${WANT_AUTOMAKE}" ] ; then
213 + auto_vers=
214 + if [ -r "Makefile.in" ] ; then
215 + do_awk Makefile.in '^# Makefile.in generated (automatically )?by automake [0-9]\\.[0-9]+'
216 + fi
217 + if [ -r "aclocal.m4" ] ; then
218 + do_awk aclocal.m4 'generated automatically by aclocal [0-9]\\.[0-9]+'
219 + do_awk aclocal.m4 '[[:space:]]*\\[?AM_AUTOMAKE_VERSION\\(\\[?[0-9]\\.[0-9]+[^)]*\\]?\\)'
220 + fi
221 + # We don't need to set $binary here as it has already been setup for us
222 + # earlier to the latest available version.
223 + if [ -n "${auto_vers}" ] ; then
224 + if ! find_binary ${auto_vers} ; then
225 + warn "auto-detected versions not found (${auto_vers}); falling back to latest available"
226 + fi
227 + fi
228 +fi
229 +
230 +if [ -n "${WANT_AMWRAPPER_DEBUG}" ] ; then
231 + if [ -n "${WANT_AUTOMAKE}" ] ; then
232 + warn "DEBUG: WANT_AUTOMAKE is set to ${WANT_AUTOMAKE}"
233 + fi
234 + warn "DEBUG: will execute <${binary}>"
235 +fi
236 +
237 +#
238 +# for further consistency
239 +#
240 +export WANT_AUTOMAKE="${binary_ver}"
241 +
242 +#
243 +# Now try to run the binary
244 +#
245 +if [ ! -x "${binary}" ] ; then
246 + # this shouldn't happen
247 + err "${binary} is missing or not executable.\n" \
248 + "\tPlease try installing the correct version of automake."
249 +fi
250 +
251 +exec "${binary}" "$@"
252 +# The shell will error out if `exec` failed.