main/gcc6: first changes for gcc6 cross compilers

* remove everything that causes conflicts when installing gcc6 and
  gcc6-armhf side by side
* fix up the existing "if cross compiling" code path to use the
  /usr/gcc6 prefix
* link binutils binaries to the locations they are expected to be
  by gcc (this took me hours to figure out....) as well as by the
  linux build system with CROSS_COMPILE
* link all gcc binaries to /usr/bin/gcc6-*
This commit is contained in:
Oliver Smith 2018-09-30 04:00:13 +02:00
parent 479055e896
commit 4101340742
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -1,6 +1,6 @@
pkgname=gcc6
pkgver=6.4.0
pkgrel=0
pkgrel=1
pkgdesc="Old GCC for old vendor kernels (C compiler only)"
url="http://gcc.gnu.org"
arch="all"
@ -337,12 +337,12 @@ package() {
cd "$_builddir"
make -j1 DESTDIR="${pkgdir}" install
# gcc symlinks
local prefix=/usr/gcc6
mkdir -p "$pkgdir"/usr/bin
ln -s "$prefix"/bin/gcc "$pkgdir"/usr/bin/gcc6
if [ "$CHOST" = "$CTARGET" ]; then
# gcc symlinks
ln -s gcc "$pkgdir$prefix"/bin/cc
ln -s gcc "$pkgdir$prefix"/bin/gcc6
fi
# remove docs
rm -r "$pkgdir/usr/share/"
@ -371,20 +371,49 @@ package() {
if [ "$CHOST" != "$CTARGET" ]; then
# cross-gcc: remove any files that would conflict with the
# native gcc package
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "$pkgdir"/usr/share
rm -rf "$pkgdir$prefix"/bin/cc \
"$pkgdir$prefix"/include \
"$pkgdir$prefix"/share
# libcc1 does not depend on target, don't ship it
rm -rf "$pkgdir"/usr/lib/libcc1.so*
rm -rf "$pkgdir$prefix"/lib/libcc1.so*
# fixup gcc library symlinks to be linker scripts so
# linker finds the libs from relocated sysroot
for so in "$pkgdir"/usr/$CTARGET/lib/*.so; do
for so in "$pkgdir$prefix"/$CTARGET/lib/*.so; do
if [ -h "$so" ]; then
local _real=$(basename $(readlink "$so"))
rm -f "$so"
echo "GROUP ($_real)" > "$so"
fi
done
# Link binutils binaries to /usr/gcc6
# This is the path GCC6 will look for them, if we don't create these
# symlinks, it will use the native binutils instead (which is of course
# failing and causes many headaches). See also: '-B' in 'man gcc'.
echo "Link binutils binaries to /usr/gcc6"
mkdir -p "$pkgdir$prefix/$CTARGET/bin"
for i in "as" "ld"; do
ln -sv "/usr/$CTARGET/bin/$i" \
"$pkgdir$prefix/$CTARGET/bin/$i"
done
# Link binutils to gcc6-* (so 'CROSS_COMPILE=gcc6-...' works)
echo "Link binutils to gcc6-*"
mkdir -p "$pkgdir/usr/bin"
for i in "ld" "ar" "nm"; do
ln -sv "/usr/bin/$CTARGET-$i" \
"$pkgdir/usr/bin/gcc6-$CTARGET-$i"
done
fi
# Link all binaries from /usr/gcc6/bin/* to /usr/bin/gcc6-*
echo "Link all gcc binaries to /usr/bin/gcc6-*"
mkdir -p "$pkgdir"/usr/bin
cd "$pkgdir$prefix/bin/"
for i in *; do
ln -sv "$prefix/bin/$i" "$pkgdir/usr/bin/gcc6-$i"
done
}
sha512sums="02c60e54527c7adf584798d5251f8a0b80c93d5deafce82501b2c28e6692e0bd783927bbfc4bc527a863c0cccc025150a34740a9e29badb02d4b48e56a8aba90 gcc-6.4.0.tar.xz