VirtualBox

Changeset 994 in kBuild


Ignore:
Timestamp:
May 29, 2007 8:00:08 PM (18 years ago)
Author:
bird
Message:

logical order. use test. Made the CPU defaults consistent.

Location:
trunk/kBuild
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/env.sh

    r993 r994  
    3030# Determin the kBuild path from the script location.
    3131#
    32 if [ -z "$PATH_KBUILD" ]; then
     32if test -z "$PATH_KBUILD"; then
    3333    PATH_KBUILD=`dirname "$0"`
    3434    PATH_KBUILD=`cd "$PATH_KBUILD" ; /bin/pwd`
    3535fi
    36 if [ ! -f "$PATH_KBUILD/footer.kmk" -o ! -f "$PATH_KBUILD/header.kmk" -o ! -f "$PATH_KBUILD/rules.kmk" ]; then
     36if test ! -f "$PATH_KBUILD/footer.kmk" -o ! -f "$PATH_KBUILD/header.kmk" -o ! -f "$PATH_KBUILD/rules.kmk"; then
    3737    echo "$0: error: PATH_KBUILD ($PATH_KBUILD) is not pointing to a popluated kBuild directory.";
    3838    sleep 1;
     
    4545# Set default build type.
    4646#
    47 if [ -z "$BUILD_TYPE" ]; then
     47if test -z "$BUILD_TYPE"; then
    4848    BUILD_TYPE=release
    4949fi
     
    5858# sure any new additions are unique. (See header.kmk, KBUILD_OSES/ARCHES.)
    5959#
    60 if [ -z "$BUILD_PLATFORM_ARCH" ]; then
     60if test -z "$BUILD_PLATFORM"; then
     61    BUILD_PLATFORM=`uname`
     62    case "$BUILD_PLATFORM" in
     63        linux|Linux|GNU/Linux|LINUX)
     64            BUILD_PLATFORM=linux
     65            ;;
     66
     67        os2|OS/2|OS2)
     68            BUILD_PLATFORM=os2
     69            ;;
     70
     71        freebsd|FreeBSD|FREEBSD)
     72            BUILD_PLATFORM=freebsd
     73            ;;
     74
     75        openbsd|OpenBSD|OPENBSD)
     76            BUILD_PLATFORM=openbsd
     77            ;;
     78
     79        netbsd|NetBSD|NETBSD)
     80            BUILD_PLATFORM=netbsd
     81            ;;
     82
     83        Darwin|darwin)
     84            BUILD_PLATFORM=darwin
     85            ;;
     86
     87        SunOS)
     88            BUILD_PLATFORM=solaris
     89            ;;
     90
     91        WindowsNT|CYGWIN_NT-*)
     92            BUILD_PLATFORM=win
     93            ;;
     94
     95        *)
     96            echo "$0: unknown os $BUILD_PLATFORM"
     97            sleep 1
     98            exit 1
     99            ;;
     100    esac
     101fi
     102export BUILD_PLATFORM
     103echo "dbg: BUILD_PLATFORM=$BUILD_PLATFORM"
     104
     105if test -z "$BUILD_PLATFORM_ARCH"; then
    61106    # Try deduce it from the cpu if given.
    62     if [ -s "$BUILD_PLATFORM_CPU" ]; then
     107    if test -s "$BUILD_PLATFORM_CPU"; then
    63108        case "$BUILD_PLATFORM_CPU" in
    64109            i[3456789]86)
     
    71116    fi
    72117fi
    73 if [ -z "$BUILD_PLATFORM_ARCH" ]; then
     118if test -z "$BUILD_PLATFORM_ARCH"; then
    74119    # Use uname (lots of guesses here, please help clean this up...)
    75120    BUILD_PLATFORM_ARCH=`uname -m`
     
    130175echo "dbg: BUILD_PLATFORM_ARCH=$BUILD_PLATFORM_ARCH"
    131176
    132 if [ -z "$BUILD_PLATFORM_CPU" ]; then
     177if test -z "$BUILD_PLATFORM_CPU"; then
    133178    BUILD_PLATFORM_CPU="blend"
    134179fi
     
    136181echo "dbg: BUILD_PLATFORM_CPU=$BUILD_PLATFORM_CPU"
    137182
    138 if [ -z "$BUILD_PLATFORM" ]; then
    139     BUILD_PLATFORM=`uname`
    140     case "$BUILD_PLATFORM" in
    141         linux|Linux|GNU/Linux|LINUX)
    142             BUILD_PLATFORM=linux
    143             ;;
    144 
    145         os2|OS/2|OS2)
    146             BUILD_PLATFORM=os2
    147             ;;
    148 
    149         freebsd|FreeBSD|FREEBSD)
    150             BUILD_PLATFORM=freebsd
    151             ;;
    152 
    153         openbsd|OpenBSD|OPENBSD)
    154             BUILD_PLATFORM=openbsd
    155             ;;
    156 
    157         netbsd|NetBSD|NETBSD)
    158             BUILD_PLATFORM=netbsd
    159             ;;
    160 
    161         Darwin|darwin)
    162             BUILD_PLATFORM=darwin
    163             ;;
    164 
    165         SunOS)
    166             BUILD_PLATFORM=solaris
    167             ;;
    168 
    169         WindowsNT|CYGWIN_NT-*)
    170             BUILD_PLATFORM=win
    171             ;;
    172 
    173         *)
    174             echo "$0: unknown os $BUILD_PLATFORM"
    175             sleep 1
    176             exit 1
    177             ;;
    178     esac
    179 fi
    180 export BUILD_PLATFORM
    181 echo "dbg: BUILD_PLATFORM=$BUILD_PLATFORM"
    182 
    183 
    184183#
    185184# The target platform.
    186185# Defaults to the host when not specified.
    187186#
    188 if [ -z "$BUILD_TARGET_CPU" ]; then
    189     BUILD_TARGET_CPU="$BUILD_PLATFORM_CPU"
     187if test -z "$BUILD_TARGET"; then
     188    BUILD_TARGET="$BUILD_PLATFORM"
     189fi
     190export BUILD_TARGET
     191echo "dbg: BUILD_TARGET=$BUILD_TARGET"
     192
     193if test -z "$BUILD_TARGET_ARCH"; then
     194    BUILD_TARGET_ARCH="$BUILD_PLATFORM_ARCH"
     195fi
     196export BUILD_TARGET_ARCH
     197echo "dbg: BUILD_TARGET_ARCH=$BUILD_TARGET_ARCH"
     198
     199if test -z "$BUILD_TARGET_CPU"; then
     200    if test "$BUILD_TARGET_ARCH" = "$BUILD_PLATFORM_ARCH"; then
     201        BUILD_TARGET_CPU="$BUILD_PLATFORM_CPU"
     202    else
     203        BUILD_TARGET_CPU="blend"
     204    fi
    190205fi
    191206export BUILD_TARGET_CPU
    192207echo "dbg: BUILD_TARGET_CPU=$BUILD_TARGET_CPU"
    193 
    194 if [ -z "$BUILD_TARGET_ARCH" ]; then
    195     BUILD_TARGET_ARCH="$BUILD_PLATFORM_ARCH"
    196 fi
    197 export BUILD_TARGET_ARCH
    198 echo "dbg: BUILD_TARGET_ARCH=$BUILD_TARGET_ARCH"
    199 
    200 if [ -z "$BUILD_TARGET" ]; then
    201     BUILD_TARGET="$BUILD_PLATFORM"
    202 fi
    203 export BUILD_TARGET
    204 echo "dbg: BUILD_TARGET=$BUILD_TARGET"
    205208
    206209
     
    227230
    228231# Sanity and x bits.
    229 if [ ! -d "$PATH_KBUILD/bin/$BUILD_PLATFORM.$BUILD_PLATFORM_ARCH/" ]; then
     232if test ! -d "$PATH_KBUILD/bin/$BUILD_PLATFORM.$BUILD_PLATFORM_ARCH/"; then
    230233    echo "$0: warning: The bin directory for this platform doesn't exists. ($PATH_KBUILD/bin/$BUILD_PLATFORM.$BUILD_PLATFORM_ARCH/)"
    231234else
     
    233236    do
    234237        chmod a+x $PATH_KBUILD/bin/$BUILD_PLATFORM.$BUILD_PLATFORM_ARCH/${prog} > /dev/null 2>&1
    235         if [ ! -f "$PATH_KBUILD/bin/$BUILD_PLATFORM.$BUILD_PLATFORM_ARCH/${prog}${_SUFF_EXE}" ]; then
     238        if test ! -f "$PATH_KBUILD/bin/$BUILD_PLATFORM.$BUILD_PLATFORM_ARCH/${prog}${_SUFF_EXE}"; then
    236239            echo "$0: warning: The ${prog} program doesn't exist for this platform. ($PATH_KBUILD/bin/$BUILD_PLATFORM.$BUILD_PLATFORM_ARCH/${prog}${_SUFF_EXE})"
    237240        fi
     
    243246
    244247# Execute command or spawn shell.
    245 if [ $# -eq 0 ]; then
     248if test $# -eq 0; then
    246249    echo "$0: info: Spawning work shell..."
    247     if [ "$TERM" != 'dumb'  ] && [ -n "$BASH" ]; then
     250    if test "$TERM" != 'dumb'  -a  -n "$BASH"; then
    248251        export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'
    249252    fi
  • trunk/kBuild/header.kmk

    r992 r994  
    177177
    178178ifeq ($(strip $(BUILD_PLATFORM_CPU)),)
    179  $(error kBuild: The BUILD_PLATFORM_CPU value is missing (should be set by kmk)!)
    180 endif
    181 ifneq (.$(words $(BUILD_PLATFORM_CPU)).$(BUILD_PLATFORM_CPU).,.1.$(strip $(BUILD_PLATFORM_CPU)).)
    182  $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' contains spaces/tabs!)
    183 endif
    184 ifneq ($(filter $(BUILD_PLATFORM_CPU), $(KBUILD_OSES) $(BUILD_ARCHES)),)
    185  $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' was found in the OS or architecture keywords!)
    186 endif
    187 ifeq ($(BUILD_PLATFORM_CPU),$(BUILD_TYPE))
    188  $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' is the same as the BUILD_TYPE!)
     179 BUILD_PLATFORM_CPU := blend
     180else
     181 ifneq (.$(words $(BUILD_PLATFORM_CPU)).$(BUILD_PLATFORM_CPU).,.1.$(strip $(BUILD_PLATFORM_CPU)).)
     182  $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' contains spaces/tabs!)
     183 endif
     184 ifneq ($(filter $(BUILD_PLATFORM_CPU), $(KBUILD_OSES) $(BUILD_ARCHES)),)
     185  $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' was found in the OS or architecture keywords!)
     186 endif
     187 ifeq ($(BUILD_PLATFORM_CPU),$(BUILD_TYPE))
     188  $(error kBuild: The BUILD_PLATFORM_CPU value '$(BUILD_PLATFORM_CPU)' is the same as the BUILD_TYPE!)
     189 endif
    189190endif
    190191
     
    218219ifndef BUILD_TARGET_CPU
    219220 BUILD_TARGET_CPU := $(BUILD_PLATFORM_CPU)
    220 else
    221  ifeq ($(strip $(BUILD_TARGET_CPU)),)
    222   $(error kBuild: The BUILD_TARGET_CPU value is missing (should be set by kmk)!)
    223  endif
     221else ifeq ($(strip $(BUILD_TARGET_CPU)),)
     222 ifeq ($(BUILD_TARGET_ARCH),$(BUILD_PLATFORM_ARCH))
     223  BUILD_TARGET_CPU := $(BUILD_PLATFORM_CPU)
     224 else
     225  BUILD_TARGET_CPU := blend
     226 endif
     227else
    224228 ifneq (.$(words $(BUILD_TARGET_CPU)).$(BUILD_TARGET_CPU).,.1.$(strip $(BUILD_TARGET_CPU)).)
    225229  $(error kBuild: The BUILD_TARGET_CPU value '$(BUILD_TARGET_CPU)' contains spaces/tabs!)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette