From owner-freebsd-arch@FreeBSD.ORG Tue Mar 10 22:10:26 2009 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 798F51065675 for ; Tue, 10 Mar 2009 22:10:26 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2656A8FC19 for ; Tue, 10 Mar 2009 22:10:26 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n2AM9TRD036680 for ; Tue, 10 Mar 2009 16:09:30 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 10 Mar 2009 21:07:46 +0900 (JST) Message-Id: <20090310.210746.1649765883.imp@bsdimp.com> To: arch@freebsd.org From: "M. Warner Losh" X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Tue_Mar_10_21_07_46_2009_884)--" Content-Transfer-Encoding: 7bit Cc: Subject: Final sanity pass: xdev X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2009 22:10:27 -0000 ----Next_Part(Tue_Mar_10_21_07_46_2009_884)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit OK. I've had this reviewed before, and have been using variations of this patch since 6.1. However, since it has been a while, I thought I'd see if there were any objections before I committed this patch. It installs all the FreeBSD cross build tools as $(ARCH)-freebsd-$TOOL, which is what autoconf looks for. This may help cross building ports, ultimately, but it is also nice for cross compiling kernels (other changes to follow for that). To build, just say 'sudo make xdev XDEV=mips XDEV_ARCH=mips' and away you go. Note: sudo is required, since we have to install the compilers before building the libraries for the xbuild environment. Each tool chain takes up about 75-100M of space. Last call for Comments on this patch... Warner P.S. See you at AsiaBSDCon '09, right? :) ----Next_Part(Tue_Mar_10_21_07_46_2009_884)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xdev.diff" Index: Makefile =================================================================== --- Makefile (revision 189571) +++ Makefile (working copy) @@ -88,7 +88,7 @@ obj objlink regress rerelease showconfig tags toolchain update \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _cross-tools _includes _libraries _depend \ - build32 distribute32 install32 + build32 distribute32 install32 xdev xdev-build xdev-install TGTS+= ${SUBDIR_TARGETS} BITGTS= files includes Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 189571) +++ Makefile.inc1 (working copy) @@ -1328,3 +1328,89 @@ # showconfig: @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort + + +############### + +.if defined(XDEV) && defined(XDEV_ARCH) + +NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ + -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \ + -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS + +XDDIR=${XDEV}-freebsd +XDTP=/usr/${XDDIR} +CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ + TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} +CDENV= ${CDBENV} \ + _SHLIBDIRPREFIX=${XDTP} \ + TOOLS_PREFIX=${XDTP} +CD2ENV=${CDENV} \ + MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} + +CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp +CDMAKE=${CDENV} ${MAKE} ${NOFUN} +CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} +XDDESTDIR=${DESTDIR}${XDTP} + +.ORDER: xdev-build xdev-install +xdev: xdev-build xdev-install + +.ORDER: _xb-build-tools _xb-cross-tools +xdev-build: _xb-build-tools _xb-cross-tools + +_xb-build-tools: + ${_+_}cd ${.CURDIR}; \ + ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools + +_xb-cross-tools: +.for _tool in \ + gnu/usr.bin/binutils \ + gnu/usr.bin/cc + ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ + cd ${.CURDIR}/${_tool}; \ + ${CDMAKE} DIRPRFX=${_tool}/ obj; \ + ${CDMAKE} DIRPRFX=${_tool}/ depend; \ + ${CDMAKE} DIRPRFX=${_tool}/ all +.endfor + +_xi-mtree: + ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" + mkdir -p ${XDDESTDIR} + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ + -p ${XDDESTDIR} >/dev/null + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ + -p ${XDDESTDIR}/usr >/dev/null + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ + -p ${XDDESTDIR}/usr/include >/dev/null + +.ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links +xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links + +_xi-cross-tools: + @echo "_xi-cross-tools" +.for _tool in \ + gnu/usr.bin/binutils \ + gnu/usr.bin/cc + ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ + cd ${.CURDIR}/${_tool}; \ + ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} +.endfor + +_xi-includes: + ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ + DESTDIR=${XDDESTDIR} + +_xi-libraries: + ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ + DESTDIR=${XDDESTDIR} + +_xi-links: + ${_+_}cd ${XDDESTDIR}/usr/bin; \ + for i in *; do \ + ln -sf ../../${XDTP}/usr/bin/$$i \ + ../../../../usr/bin/${XDDIR}-$$i; \ + ln -sf ../../${XDTP}/usr/bin/$$i \ + ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ + done +.endif ----Next_Part(Tue_Mar_10_21_07_46_2009_884)----