freebsd-ports/base
John Baldwin 86c96ca1f2 Override the library search directories for external GCC toolchains.
The default library search directories when building a native GCC end
up falling back to /usr/local/lib (for devel/*-gcc) and /usr/lib (for
base/gcc) even when --sysroot is used.  For devel/*-gcc, I previously
forced CROSS_DIRECTORY_STRUCTURE on in r466699 to workaround this.
However, this solution could not be used for base/gcc.  Instead, patch
the sources to remove several of the library search directories and
override STARTFILE_PREFIX_SPEC to only look in /usr/lib.  GCC still
adds tuple-specific subdirs to /usr/lib, but this is ok.

Bump PORTREVISION for both the external GCC toolchains and base/gcc.

Reviewed by:	kan
Differential Revision:	https://reviews.freebsd.org/D18677
2019-01-25 19:04:49 +00:00
..
binutils
gcc
Makefile
README

# $FreeBSD$

How to cross build initial toolchain

Example with sparc64

1/ install a cross toolchain
pkg install sparc64-xtoolchain-gcc

2/ cross build world
make CROSS_TOOLCHAIN=sparc64-gcc TARGET=sparc64 TARGET_ARCH=sparc64 buildworld

3/ install the world in a sysroot
make CROSS_TOOLCHAIN=sparc64-gcc TARGET=sparc64 TARGET_ARCH=sparc64 installworld DESTDIR=/sysroots/sparc64

4/ build the required port
$ cd base/binutils
make CROSS_TOOLCHAIN=sparc64-gcc CROSS_SYSROOT=/sysroots/sparc64 package

$ cd base/gcc
make CROSS_TOOLCHAIN=sparc64-gcc CROSS_SYSROOT=/sysroots/sparc64 package

the package are in base/gcc/work/pkg/*.txz and base/binutils/work/pkg/*.txz

To add a plist for a new binutils target
$ cd base/binutils
make CROSS_TOOLCHAIN=sparc64-gcc CROSS_SYSROOT=/sysroots/sparc64 makeplist > pkg-plist

edit the pkg-plist and remove everything which base does not provide via the
elftoolchain