Changeset f3a7b0d in mainline for configure.sh


Ignore:
Timestamp:
2021-04-20T18:21:55Z (3 years ago)
Author:
Martin Decky <martin@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
de227aba
Parents:
6186f9f
Message:

Use more appropriate cross-compiler installation locations

The toolchain.sh and configure.sh scripts use the
$XDG_DATA_HOME/HelenOS/cross (i.e. $HOME/.local/share/HelenOS/cross)
location by default now. This allows the cross-compiler to be
installed without super user privileges and thus hopefully lowers the
entry barrier for newcomers.

To install the cross-compiler to a system-wide location, run the
toolchain.sh script with the —system-wide option. The default
system-wide location is /opt/HelenOS/cross now.

The configure.sh script falls back to /opt/HelenOS/cross and the
previously used /usr/local/cross. Thus recompiling an already
installed cross-compiler toolchain is not necessary.

The possibility to override the cross-compiler location using
$CROSS_PREFIX or having the cross-compiler available in $PATH
retained.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure.sh

    r6186f9f rf3a7b0d  
    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.
     
    122123
    123124compname="$cc_arch-helenos-gcc"
     125unset compprefix
    124126
    125 if which "$compname"; then
     127if which "$compname" >/dev/null 2>/dev/null; then
    126128        # Compiler is in PATH
    127129        compprefix="$cc_arch-helenos-"
    128130
    129131elif [ -n "$CROSS_PREFIX" ]; then
    130         if ! which "$CROSS_PREFIX/bin/$compname"; then
     132        if which "$CROSS_PREFIX/bin/$compname" >/dev/null 2>/dev/null; then
     133                compprefix="$CROSS_PREFIX/bin/$cc_arch-helenos-"
     134        fi
     135
     136        if [ -z "$compprefix" ]; then
    131137                echo "ERROR: \$CROSS_PREFIX defined but $compname is not present in $CROSS_PREFIX/bin."
    132138                echo "Run tools/toolchain.sh to build cross-compiling toolchain."
    133139                exit 1
    134140        fi
     141else
     142        if [ -z "$XDG_DATA_HOME" ]; then
     143                        XDG_DATA_HOME="$HOME/.local/share"
     144        fi
    135145
    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."
     146        if which "$XDG_DATA_HOME/HelenOS/cross/bin/$compname" >/dev/null 2>/dev/null; then
     147                compprefix="$XDG_DATA_HOME/HelenOS/cross/bin/$cc_arch-helenos-"
     148        elif which "/opt/HelenOS/cross/bin/$compname" >/dev/null 2>/dev/null; then
     149                compprefix="/opt/HelenOS/cross/bin/$cc_arch-helenos-"
     150        elif which "/usr/local/cross/bin/$compname" >/dev/null 2>/dev/null; then
     151                compprefix="/usr/local/cross/bin/$cc_arch-helenos-"
     152        fi
     153
     154        if [ -z "$compprefix" ]; then
     155                echo "ERROR: \$CROSS_PREFIX is not defined and $compname is not present in any of the following standard locations."
     156                echo " * $XDG_DATA_HOME/HelenOS/cross/bin"
     157                echo " * /opt/HelenOS/cross/bin"
     158                echo " * /usr/local/cross/bin"
    140159                echo "Run tools/toolchain.sh to build cross-compiling toolchain."
    141160                exit 1
    142161        fi
    143 
    144         compprefix="/usr/local/cross/bin/$cc_arch-helenos-"
    145162fi
    146163
Note: See TracChangeset for help on using the changeset viewer.