Stop installing old style *-config script wrappers for cross-compiling

Gentoo avoids using these scripts as much as possible because they don't
play well when cross-compiling. Wrappers can help, but this approach is
considered too messy for Gentoo itself, and there are always other ways
around the problem.

I found that only app-emulation/open-vm-tools failed to build without
these wrappers. I have fixed this in Gentoo (and Flatcar) and sent a
simple patch further upstream.

I knew that other instances of this problem were being masked by the
presence of these scripts on the build host, so I manually removed them
all before rebuilding all of the board packages. This found about 8 more
affected packages, most of which were looking for krb5-config. These
have now been addressed in Gentoo or Flatcar as necessary. The Gentoo
fixes have not been applied to Flatcar yet, but they can be taken in the
round.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This commit is contained in:
James Le Cuirot 2024-08-08 10:41:04 +01:00
parent 18c972f61a
commit b59acee657
No known key found for this signature in database
GPG Key ID: 1226415D00DD3137
2 changed files with 0 additions and 83 deletions

View File

@ -1,48 +0,0 @@
#!/bin/bash
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Wrap all the old style config scripts.
# We'll be working with the env:
# argv[0]: armv7a-cros-linux-gnueabi-ncurses5-config
# CHOST: armv7a-cros-linux-gnueabi
# SYSROOT: /build/arm-generic
# See if there's a wrapper in the SYSROOT for us to execute, let's do
# that, and then filter the output for any -I/-L paths that'd screw us up.
wrap=${0##*/}
if [[ -z ${CHOST} ]] ; then
# Let's figure out the answer from $0. Do it piece by piece as
# we cannot assume the number of components in the target tuple
# or in the config script name. Tuples can have 1, 2, 3, or 4
# components, and config scripts can have as many as they want
# (although most of the time, it's just 2).
parts=( ${wrap//-/ } )
i=$(( ${#parts[@]} - 1 ))
cfg=${parts[${i}]}
while [[ $(( --i )) -ge 0 ]] ; do
cfg="${parts[${i}]}-${cfg}"
if [[ -e ${SYSROOT}/usr/bin/${cfg} ]] ; then
CHOST=${wrap%-${cfg}}
type -P ${CHOST}-gcc >/dev/null && break
unset CHOST
fi
done
else
cfg=${wrap#${CHOST}-}
fi
if [[ -z ${CHOST} ]] || [[ -z ${SYSROOT} ]] ; then
echo "${wrap}: please set CHOST/SYSROOT in the env" 1>&2
exit 1
fi
# Some wrappers will dynamically figure out where they're being run from,
# and then output a full path -I/-L path based on that. So we trim any
# expanded sysroot paths that might be in the output already to avoid
# having it be -L${SYSROOT}${SYSROOT}/usr/lib.
set -o pipefail
exec ${SYSROOT}/usr/bin/${cfg} "$@" | sed -r "s:(-[IL])(${SYSROOT})?:\1${SYSROOT}:g"

View File

@ -1,35 +0,0 @@
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Locate all the old style config scripts this package installs. Do it here
# here so we can search the temp $D which has only this pkg rather than the
# full ROOT which has everyone's files.
cros_pre_pkg_preinst_wrap_old_config_scripts() {
# Only wrap when installing into a board sysroot.
[[ $(cros_target) != "board_sysroot" ]] && return 0
local wrappers=$(
find "${D}"/usr/bin -name '*-config' -printf '%P ' 2>/dev/null
)
local wdir="${CROS_BUILD_BOARD_TREE}/bin"
mkdir -p "${wdir}"
local c w
for w in ${wrappers} ; do
# $CHOST-$CHOST-foo-config isn't helpful
if [[ ${w} == ${CHOST}-* ]]; then
continue
fi
# Skip anything that isn't a script, e.g. pkg-config
if ! head -n1 "${D}/usr/bin/${w}" | egrep -q '^#!\s*/bin/(ba)?sh'; then
continue
fi
w="${wdir}/${CHOST}-${w}"
c="${CROS_ADDONS_TREE}/scripts/config_wrapper"
if [[ ! -e ${w} ]] ; then
ln -s "${c}" "${w}"
fi
done
}