freebsd-ports/base
John Baldwin 3708c41ab9 Add 32-bit mips support to base/binutils and base/gcc.
- When cross-building packages, set ARCH to the target arch instead of
  the arch of the build host.  This fixes bsd.ssp.mk on MIPS which was
  trying to enable SSP on MIPS cross-built packages because the host
  ARCH was amd64.  A new HOST_ARCH variable is added to set the
  --build triple for configure scripts, but I believe most other uses of
  ARCH in ports are really about the target, not the build host so this
  is the more correct general direction.
- Some updates to base/binutils and base/gcc to use ARCH as the target
  architecture.
- Drop the extra arguments to GCC to set include and library paths and
  only set --sysroot.
- Move the --sysroot flags into CC, CXX, CPP (which is now set to XCPP)
  and LD instead of passing it in CFLAGS, etc.  The base/gcc build uses
  ends up using the CFLAGS when building native binaries for the build
  host which fails when tripping over the --sysroot.  I think this might
  have accidentally worked before because the powerpc64 headers in
  /usr/include/machine were "close enough" to the amd64 headers, but with
  32-bit MIPS this failed hard.
- Add the GCC MIPS patch from devel/powerpc64-gcc to base/gcc to add
  MIPS support to base/gcc.
- Add a MIPS plist for base/binutils.
- Set helper variables for the base/gcc plist to tag architecture-specific
  headers (e.g. for intrinsincs) and use these to tag powerpc and MIPS
  specific headers.
- Drop the include-fixed headers from base/gcc.
- Strip /usr/local/include from the default list of include paths for
  base/gcc.
- Use libc++'s include path for C++ for base/gcc.

Reviewed by:	bapt
Approved by:	portmgr (bapt)
Differential Revision:	https://reviews.freebsd.org/D15267
2018-05-09 15:18:27 +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