mirror of
https://github.com/pygos/build.git
synced 2024-11-14 07:27:10 +01:00
2fb62ec2f1
We tell the autoconf configure script that we are going to install stuff to prefix "/" with libdir being set to "/lib", so the script ends up writing "libdir='/lib'" to the libtool *.la scripts. This is all fine and dandy until we do a 'make install' with DESTDIR set to our actual package deploy directory. Libtool goes "OMG WTF we aren't instaling to / afterall" and thinks it needs to do a relinking phase. During relinking, it passes "-L$libdir" to gcc, which ends up as "-L/lib". Now, gcc tries to link against local system libraries. Best case, the build breaks and we know something stupid happened. It really bites us if we try to cross compile from e.g. x86 to x86. Until now, it worked to simply patch the *.la scripts before 'make install', like other distros do, but recent versions of util-linux now ship with a newer version of the libtool script which simply regenerates the *.la files. This commit adds an extension to the patch script that patches the actuall libtool script itself. Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
55 lines
1 KiB
Bash
55 lines
1 KiB
Bash
apply_patches() {
|
|
local PATCH
|
|
|
|
for PATCH in $SCRIPTDIR/pkg/$PKGNAME/*.patch; do
|
|
if [ -f $PATCH ]; then
|
|
patch -p1 < $PATCH
|
|
fi
|
|
done
|
|
}
|
|
|
|
strip_files() {
|
|
local f
|
|
|
|
for f in $@; do
|
|
[ ! -L "$f" ] || continue;
|
|
|
|
if [ -d "$f" ]; then
|
|
strip_files ${f}/*
|
|
fi
|
|
|
|
[ -f "$f" ] || continue;
|
|
|
|
if file $f | grep -q -i elf; then
|
|
${TARGET}-strip --discard-all "$f"
|
|
fi
|
|
done
|
|
}
|
|
|
|
deploy_dev_cleanup() {
|
|
local f
|
|
|
|
if [ -d "$1/share/pkgconfig" ]; then
|
|
mkdir -p "$1/lib/pkgconfig"
|
|
mv $1/share/pkgconfig/* "$1/lib/pkgconfig"
|
|
rmdir "$1/share/pkgconfig"
|
|
fi
|
|
|
|
for f in ${1}/lib/*.la; do
|
|
[ ! -e "$f" ] || rm "$f"
|
|
done
|
|
}
|
|
|
|
unfuck_libtool() {
|
|
local libdir="$PKGDEPLOYDIR/$PKGNAME/lib"
|
|
local f
|
|
|
|
for f in $(find $PKGBUILDDIR -type f -name '*.la' -o -name '*.lai'); do
|
|
sed -i "s#libdir='.*'#libdir='$libdir'#g" "$f"
|
|
done
|
|
|
|
sed -i -r "s/(finish_cmds)=.*$/\1=\"\"/" "$PKGBUILDDIR/libtool"
|
|
sed -i -r "s/(hardcode_into_libs)=.*$/\1=no/" "$PKGBUILDDIR/libtool"
|
|
|
|
sed -i "s#libdir='\$install_libdir'#libdir='$libdir'#g" "$PKGBUILDDIR/libtool"
|
|
}
|