New build.sh option: -c <compiler>

Could never remember what the incantation is to do a clang build, so
now it's just `build.sh -c clang'.
This commit is contained in:
riastradh 2020-06-30 21:22:19 +00:00
parent 9c6a61e7ae
commit 8039b48b5b
2 changed files with 42 additions and 6 deletions

View File

@ -1,5 +1,5 @@
#! /usr/bin/env sh
# $NetBSD: build.sh,v 1.341 2020/06/13 18:00:29 riastradh Exp $
# $NetBSD: build.sh,v 1.342 2020/06/30 21:22:19 riastradh Exp $
#
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
# All rights reserved.
@ -1028,8 +1028,8 @@ usage()
cat <<_usage_
Usage: ${progname} [-EhnoPRrUuxy] [-a arch] [-B buildid] [-C cdextras]
[-D dest] [-j njob] [-M obj] [-m mach] [-N noisy]
[-O obj] [-R release] [-S seed] [-T tools]
[-c compiler>] [-D dest] [-j njob] [-M obj] [-m mach]
[-N noisy] [-O obj] [-R release] [-S seed] [-T tools]
[-V var=[value]] [-w wrapper] [-X x11src] [-Y extsrcsrc]
[-Z var]
operation [...]
@ -1081,6 +1081,10 @@ Usage: ${progname} [-EhnoPRrUuxy] [-a arch] [-B buildid] [-C cdextras]
-a arch Set MACHINE_ARCH to arch. [Default: deduced from MACHINE]
-B buildid Set BUILDID to buildid.
-C cdextras Append cdextras to CDEXTRA variable for inclusion on CD-ROM.
-c compiler Select compiler:
clang
gcc
[Default: gcc]
-D dest Set DESTDIR to dest. [Default: destdir.MACHINE]
-E Set "expert" mode; disables various safety checks.
Should not be used without expert knowledge of the build system.
@ -1130,7 +1134,7 @@ _usage_
parseoptions()
{
opts='a:B:C:D:Ehj:M:m:N:nO:oPR:rS:T:UuV:w:X:xY:yZ:'
opts='a:B:C:c:D:Ehj:M:m:N:nO:oPR:rS:T:UuV:w:X:xY:yZ:'
opt_a=false
opt_m=false
@ -1176,6 +1180,21 @@ parseoptions()
CDEXTRA="${CDEXTRA}${CDEXTRA:+ }${OPTARG}"
;;
-c)
eval ${optargcmd}
case "${OPTARG}" in
gcc) # default, no variables needed
;;
clang) setmakeenv HAVE_LLVM yes
setmakeenv MKLLVM yes
setmakeenv MKGCC no
;;
#pcc) ...
# ;;
*) bomb "Unknown compiler: ${OPTARG}"
esac
;;
-D)
eval ${optargcmd}; resolvepath OPTARG
setmakeenv DESTDIR "${OPTARG}"
@ -1942,7 +1961,7 @@ createmakewrapper()
eval cat <<EOF ${makewrapout}
#! ${HOST_SH}
# Set proper variables to allow easy "make" building of a NetBSD subtree.
# Generated from: \$NetBSD: build.sh,v 1.341 2020/06/13 18:00:29 riastradh Exp $
# Generated from: \$NetBSD: build.sh,v 1.342 2020/06/30 21:22:19 riastradh Exp $
# with these arguments: ${_args}
#

View File

@ -1,4 +1,4 @@
.\" $NetBSD: BUILDING.mdoc,v 1.126 2019/05/08 14:03:57 leot Exp $
.\" $NetBSD: BUILDING.mdoc,v 1.127 2020/06/30 21:22:19 riastradh Exp $
.\"
.\" Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -1693,6 +1693,23 @@ Multiple paths may be specified via multiple
options, or via a single option whose argument contains multiple
space-separated paths.
.
.It Fl c Ar compiler
Select the compiler for the toolchain to build
.Nx
and for inclusion in the
.Nx
distribution.
Supported choices:
.Bl -inset -offset indent
.It clang
.It gcc
[default]
.El
.Pp
The compiler used to build the toolchain can be different; see
.Sy HOST_CC
and
.Sy HOST_CXX .
.It Fl D Ar dest
Set the value of
.Sy DESTDIR