svn commit: r231876 - in user/brooks/tchacks: . share/mk

Brooks Davis brooks at FreeBSD.org
Fri Feb 17 13:26:30 UTC 2012


Author: brooks
Date: Fri Feb 17 13:26:29 2012
New Revision: 231876
URL: http://svn.freebsd.org/changeset/base/231876

Log:
  Introduce a new variable, TCPATH which overrides other path elements
  during a full world build.  This allows portions of the toolchain
  to be replaced with external components.  It has been tested with
  cc, c++, nm, and ld replaced.  TCPATH is used by installed the tools you
  with to use under their common names and then building world with a
  command like:
  
  	make TCPATH=/tmp/tc buildworld
  
  TCPATH support depends on the ability to call cc/c++ with --sysroot
  which in turn requires that the linker the compiler users (hard
  coded at compile time) also support --sysroot.  In the case of GNU
  ld this is non-default.  You can produce a linker that works exactly
  like normal but also supports --sysroot by building binutils with
  the configure argument "--with-sysroot=/".
  
  The current patch is quite inefficient.   It still builds all crossbuild
  tools including copies of gcc and clang.  A more efficient and selective
  approach is certainly possible.

Modified:
  user/brooks/tchacks/Makefile.inc1
  user/brooks/tchacks/share/mk/bsd.dep.mk
  user/brooks/tchacks/share/mk/sys.mk

Modified: user/brooks/tchacks/Makefile.inc1
==============================================================================
--- user/brooks/tchacks/Makefile.inc1	Fri Feb 17 13:24:28 2012	(r231875)
+++ user/brooks/tchacks/Makefile.inc1	Fri Feb 17 13:26:29 2012	(r231876)
@@ -180,7 +180,11 @@ WORLDTMP=	${OBJTREE}${.CURDIR}/tmp
 BPATH=		${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
 XPATH=		${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
 STRICTTMPPATH=	${BPATH}:${XPATH}
+.if defined(TCPATH)
+TMPPATH=	${TCPATH}:${STRICTTMPPATH}:${PATH}
+.else
 TMPPATH=	${STRICTTMPPATH}:${PATH}
+.endif
 
 #
 # Avoid running mktemp(1) unless actually needed.
@@ -272,6 +276,9 @@ WMAKEENV=	${CROSSENV} \
 WMAKEENV+=	NO_CTF=1
 .endif
 WMAKE=		${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
+.if defined(TCPATH)
+WMAKE+=		SYSROOT=${WORLDTMP}
+.endif
 
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 # 32 bit world

Modified: user/brooks/tchacks/share/mk/bsd.dep.mk
==============================================================================
--- user/brooks/tchacks/share/mk/bsd.dep.mk	Fri Feb 17 13:24:28 2012	(r231875)
+++ user/brooks/tchacks/share/mk/bsd.dep.mk	Fri Feb 17 13:26:29 2012	(r231876)
@@ -125,8 +125,8 @@ depend: beforedepend ${DEPENDFILE} after
 
 # Different types of sources are compiled with slightly different flags.
 # Split up the sources, and filter out headers and non-applicable flags.
-MKDEP_CFLAGS=	${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BIDU]*} ${CFLAGS:M-std=*} ${CFLAGS:M-ansi}
-MKDEP_CXXFLAGS=	${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BIDU]*} ${CXXFLAGS:M-std=*} ${CXXFLAGS:M-ansi}
+MKDEP_CFLAGS=	${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BIDU]*} ${CFLAGS:M-std=*} ${CFLAGS:M-ansi} ${CFLAGS:M--sysroot*}
+MKDEP_CXXFLAGS=	${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BIDU]*} ${CXXFLAGS:M-std=*} ${CXXFLAGS:M-ansi} ${CFLAGS:M--sysroot*}
 
 DPSRCS+= ${SRCS}
 ${DEPENDFILE}: ${DPSRCS}

Modified: user/brooks/tchacks/share/mk/sys.mk
==============================================================================
--- user/brooks/tchacks/share/mk/sys.mk	Fri Feb 17 13:24:28 2012	(r231875)
+++ user/brooks/tchacks/share/mk/sys.mk	Fri Feb 17 13:26:29 2012	(r231876)
@@ -53,6 +53,9 @@ CFLAGS		?=	-O -pipe
 .else
 CFLAGS		?=	-O2 -pipe
 .endif
+.if defined(SYSROOT)
+CFLAGS		+=	--sysroot=${SYSROOT}
+.endif
 .if defined(NO_STRICT_ALIASING)
 CFLAGS		+=	-fno-strict-aliasing
 .endif


More information about the svn-src-user mailing list