mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
scripts/build: a shared sysroot is not thread-safe
This commit is contained in:
parent
eef940cc5a
commit
527ea323b8
@ -373,13 +373,14 @@ fi
|
|||||||
|
|
||||||
pkg_call_exists post_make_$TARGET && pkg_call post_make_$TARGET
|
pkg_call_exists post_make_$TARGET && pkg_call post_make_$TARGET
|
||||||
|
|
||||||
# make install writes directly to sysroot which then needs fixing up - this is racy
|
# Hack around directly writing/modifying the content of a shared sysroot
|
||||||
if listcontains "configure:target cmake-make:target autotools:target make:target" "${PKG_TOOLCHAIN}:${TARGET}"; then
|
# by temporarily installing new files to a package specific sysroot
|
||||||
acquire_exclusive_lock "${PKG_NAME}:${TARGET}" "build"
|
PKG_ORIG_SYSROOT_PREFIX="${SYSROOT_PREFIX}"
|
||||||
PKG_NEED_UNLOCK=yes
|
export SYSROOT_PREFIX="${BUILD}/.sysroot/${PKG_NAME}.${TARGET}"
|
||||||
else
|
rm -rf "${SYSROOT_PREFIX}"
|
||||||
PKG_NEED_UNLOCK=no
|
for d in /usr/lib /usr/include /usr/bin /usr/lib/pkgconfig; do
|
||||||
fi
|
mkdir -p "${SYSROOT_PREFIX}${d}"
|
||||||
|
done
|
||||||
|
|
||||||
# make install
|
# make install
|
||||||
pkg_call_exists pre_makeinstall_$TARGET && pkg_call pre_makeinstall_$TARGET
|
pkg_call_exists pre_makeinstall_$TARGET && pkg_call pre_makeinstall_$TARGET
|
||||||
@ -422,14 +423,26 @@ fi
|
|||||||
|
|
||||||
pkg_call_exists post_makeinstall_$TARGET && pkg_call post_makeinstall_$TARGET
|
pkg_call_exists post_makeinstall_$TARGET && pkg_call post_makeinstall_$TARGET
|
||||||
|
|
||||||
# This is the racy part - one or more processes may be creating, modifying or deleting
|
# Fixup temporary sysroot references to the shared sysroot
|
||||||
# $SYSROOT_PREFIX/usr/lib/*.la files while another (eg. this) process is rewriting the same
|
for i in $(find "${SYSROOT_PREFIX}/usr/lib" -type f -name "*.la" 2>/dev/null); do
|
||||||
# files as it fixes up the libdir prefix. Eugh.
|
sed -e "s:\(['= ]\)/usr:\\1${PKG_ORIG_SYSROOT_PREFIX}/usr:g" -i "${i}"
|
||||||
for i in $(find $SYSROOT_PREFIX/usr/lib/ -name "*.la" 2>/dev/null); do
|
done
|
||||||
sed -e "s:\(['= ]\)/usr:\\1$SYSROOT_PREFIX/usr:g" -i $i
|
for i in $(find "${SYSROOT_PREFIX}/usr/bin" -type f -name "*-config" 2>/dev/null); do
|
||||||
|
sed -e "s#${SYSROOT_PREFIX}/usr#${PKG_ORIG_SYSROOT_PREFIX}/usr#g" -i "${i}"
|
||||||
|
done
|
||||||
|
for i in $(find "${SYSROOT_PREFIX}/usr/lib" -type f -name "*.pc" 2>/dev/null); do
|
||||||
|
sed -e "s#${SYSROOT_PREFIX}/usr#${PKG_ORIG_SYSROOT_PREFIX}/usr#g" -i "${i}"
|
||||||
|
done
|
||||||
|
for i in $(find "${SYSROOT_PREFIX}/usr"/{lib,share} -type f -name "*.cmake" 2>/dev/null); do
|
||||||
|
sed -e "s#${SYSROOT_PREFIX}/usr#${PKG_ORIG_SYSROOT_PREFIX}/usr#g" -i "${i}"
|
||||||
done
|
done
|
||||||
|
|
||||||
[ "${PKG_NEED_UNLOCK}" = "yes" ] && release_exclusive_lock "${PKG_NAME}:${TARGET}" "build"
|
# Transfer the new sysroot content to the shared sysroot
|
||||||
|
mkdir -p "${PKG_ORIG_SYSROOT_PREFIX}"
|
||||||
|
cp -PR "${SYSROOT_PREFIX}"/* "${PKG_ORIG_SYSROOT_PREFIX}"
|
||||||
|
rm -rf "${SYSROOT_PREFIX}"
|
||||||
|
|
||||||
|
export SYSROOT_PREFIX="${PKG_ORIG_SYSROOT_PREFIX}"
|
||||||
|
|
||||||
if [ "$TARGET" = "target" -o "$TARGET" = "init" ]; then
|
if [ "$TARGET" = "target" -o "$TARGET" = "init" ]; then
|
||||||
if [ -d $INSTALL ]; then
|
if [ -d $INSTALL ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user