Changes in configure.sh [1c39d33b:d231a54] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure.sh

    r1c39d33b rd231a54  
    3939CONFIG_RULES="${SOURCE_DIR}/HelenOS.config"
    4040CONFIG_DEFAULTS="${SOURCE_DIR}/defaults"
    41 
    4241
    4342test "$#" -eq 1 && { test "$1" = "-h" || test "$1" = "--help"; }
     
    8584fi
    8685
    87 if ! which meson; then
     86if ! which meson >/dev/null 2>/dev/null; then
    8887        echo "Your system does not have Meson installed."
    8988        echo 'Please use `pip3 install meson`'
     
    9190fi
    9291
    93 if ! which ninja; then
     92if ! which ninja >/dev/null 2>/dev/null; then
    9493        echo "Your system does not have ninja installed."
    9594        echo 'Please use `pip3 install ninja`'
     
    9897
    9998# Link tools directory for convenience.
    100 ln -s "${SOURCE_DIR}/tools" tools
     99if [ ! -e tools ]; then
     100        ln -s "${SOURCE_DIR}/tools" tools
     101fi
    101102
    102103# Run HelenOS config tool.
     
    109110PLATFORM=`sed -n '/^PLATFORM\b/p' Makefile.config | sed 's:[^=]*= ::'`
    110111MACHINE=`sed -n '/^MACHINE\b/p' Makefile.config | sed 's:[^=]*= ::'`
     112COMPILER=`sed -n '/^COMPILER\b/p' Makefile.config | sed 's:[^=]*= ::'`
    111113
    112114cross_target="$PLATFORM"
     
    118120fi
    119121
     122if [ "$COMPILER" = 'clang' ]; then
     123    cross_target="${cross_target}_clang"
     124fi
     125
    120126cross_def="${SOURCE_DIR}/meson/cross/${cross_target}"
    121127cc_arch=`sed -n "s:cc_arch = '\(.*\)':\1:p" "$cross_def"`
    122128
    123 compname="$cc_arch-helenos-gcc"
     129if [ "$COMPILER" = 'clang' ]; then
     130    compname="$cc_arch-helenos-clang"
     131else
     132    compname="$cc_arch-helenos-gcc"
     133fi
     134unset compprefix
    124135
    125 if which "$compname"; then
     136if which "$compname" >/dev/null 2>/dev/null; then
    126137        # Compiler is in PATH
    127138        compprefix="$cc_arch-helenos-"
    128139
    129140elif [ -n "$CROSS_PREFIX" ]; then
    130         if ! which "$CROSS_PREFIX/bin/$compname"; then
     141        if which "$CROSS_PREFIX/bin/$compname" >/dev/null 2>/dev/null; then
     142                compprefix="$CROSS_PREFIX/bin/$cc_arch-helenos-"
     143        fi
     144
     145        if [ -z "$compprefix" ]; then
    131146                echo "ERROR: \$CROSS_PREFIX defined but $compname is not present in $CROSS_PREFIX/bin."
    132147                echo "Run tools/toolchain.sh to build cross-compiling toolchain."
    133148                exit 1
    134149        fi
     150else
     151        if [ -z "$XDG_DATA_HOME" ]; then
     152                        XDG_DATA_HOME="$HOME/.local/share"
     153        fi
    135154
    136         compprefix="$CROSS_PREFIX/bin/$cc_arch-helenos-"
    137 else
    138         if ! which "/usr/local/cross/bin/$compname"; then
    139                 echo "ERROR: \$CROSS_PREFIX is not defined and $compname is not present in /usr/local/cross/bin."
     155        if which "$XDG_DATA_HOME/HelenOS/cross/bin/$compname" >/dev/null 2>/dev/null; then
     156                compprefix="$XDG_DATA_HOME/HelenOS/cross/bin/$cc_arch-helenos-"
     157        elif which "/opt/HelenOS/cross/bin/$compname" >/dev/null 2>/dev/null; then
     158                compprefix="/opt/HelenOS/cross/bin/$cc_arch-helenos-"
     159        elif which "/usr/local/cross/bin/$compname" >/dev/null 2>/dev/null; then
     160                compprefix="/usr/local/cross/bin/$cc_arch-helenos-"
     161        fi
     162
     163        if [ -z "$compprefix" ]; then
     164                echo "ERROR: \$CROSS_PREFIX is not defined and $compname is not present in any of the following standard locations."
     165                echo " * $XDG_DATA_HOME/HelenOS/cross/bin"
     166                echo " * /opt/HelenOS/cross/bin"
     167                echo " * /usr/local/cross/bin"
    140168                echo "Run tools/toolchain.sh to build cross-compiling toolchain."
    141169                exit 1
    142170        fi
    143 
    144         compprefix="/usr/local/cross/bin/$cc_arch-helenos-"
    145171fi
    146172
    147173sed "s:@COMPPREFIX@:$compprefix:g" "$cross_def" > crossfile || exit 1
    148174
    149 meson "${SOURCE_DIR}" '.' --cross-file crossfile || exit 1
     175meson setup "${SOURCE_DIR}" '.' --cross-file crossfile || exit 1
    150176
    151177echo
Note: See TracChangeset for help on using the changeset viewer.