Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src New build.sh option: -c <compiler>



details:   https://anonhg.NetBSD.org/src/rev/af2e31d1526d
branches:  trunk
changeset: 935363:af2e31d1526d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Jun 30 21:22:19 2020 +0000

description:
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'.

diffstat:

 build.sh          |  29 ++++++++++++++++++++++++-----
 doc/BUILDING.mdoc |  19 ++++++++++++++++++-
 2 files changed, 42 insertions(+), 6 deletions(-)

diffs (105 lines):

diff -r 21c3fbb61f25 -r af2e31d1526d build.sh
--- a/build.sh  Tue Jun 30 21:10:13 2020 +0000
+++ b/build.sh  Tue Jun 30 21:22:19 2020 +0000
@@ -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 @@
        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 @@
     -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 @@
 
 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 @@
                        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 @@
        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}
 #
 
diff -r 21c3fbb61f25 -r af2e31d1526d doc/BUILDING.mdoc
--- a/doc/BUILDING.mdoc Tue Jun 30 21:10:13 2020 +0000
+++ b/doc/BUILDING.mdoc Tue Jun 30 21:22:19 2020 +0000
@@ -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 @@
 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



Home | Main Index | Thread Index | Old Index