commit:     66f46063dd050dce3335db6b9200dcaf64826ff2
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Apr  2 11:18:25 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun May  5 08:15:45 2019 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=66f46063

scripts/bootstrap-prefix: add initial FreeBSD support

This is mostly non-functional, since FreeBSD/Prefix profiles are
missing.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 scripts/bootstrap-prefix.sh | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index 4149f661f1..3c4f7dbde7 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -181,6 +181,9 @@ configure_toolchain() {
        *-darwin*)
          # handled below
          ;;
+       *-freebsd*)
+         # comes with clang, handled below
+         ;;
        *)
          # The host may not have a functioning c++ toolchain, so use a
          # stage1 compiler that can build with C only.
@@ -318,6 +321,11 @@ configure_toolchain() {
                                sys-devel/llvm
                                sys-devel/clang"
                        ;;
+               *-freebsd*)
+                       CC=clang
+                       CXX=clang++
+                       # TODO: target clang toolchain someday?
+                       ;;
                *-solaris*)
                        local ccvers="$( (unset CHOST; gcc --version 
2>/dev/null) )"
                        case "${ccvers}" in
@@ -2290,7 +2298,7 @@ EOF
        esac
 
        # TODO: should we better use cc here? or check both?
-       if ! type -P gcc > /dev/null ; then
+       if ! type -P gcc > /dev/null && ! type -P clang > /dev/null ; then
                case "${CHOST}" in
                        *-darwin*)
                                cat << EOF
@@ -2420,6 +2428,7 @@ EOF
        case "${CHOST}" in
                *-cygwin*)     ncpu=$(cmd /D /Q /C 'echo 
%NUMBER_OF_PROCESSORS%' | tr -d "\\r") ;;
                *-darwin*)     ncpu=$(/usr/sbin/sysctl -n hw.ncpu)              
   ;;
+               *-freebsd*)    ncpu=$(/sbin/sysctl -n hw.ncpu)                  
   ;;
                *-solaris*)    ncpu=$(/usr/sbin/psrinfo | wc -l)                
   ;;
                *-linux-gnu*)  ncpu=$(cat /proc/cpuinfo | grep processor | wc 
-l)  ;;
                *-aix*)        ncpu=$(/usr/sbin/bindprocessor -q | cut -d: -f2 
| wc -w) ;;
@@ -2925,6 +2934,13 @@ if [[ -z ${CHOST} ]]; then
                        CYGWIN*)
                                CHOST="`uname -m`-pc-cygwin"
                                ;;
+                       FreeBSD)
+                               case `uname -m` in
+                                       amd64)
+                                               CHOST="x86_64-pc-freebsd`uname 
-r | sed 's|-.*$||'`"
+                                       ;;
+                               esac
+                               ;;
                        *)
                                eerror "Nothing known about platform `uname 
-s`."
                                eerror "Please set CHOST appropriately for your 
system"

Reply via email to