Changeset 1510
- Timestamp:
- Apr 9, 2008, 3:19:35 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kBuild/env.sh
r1507 r1510 1 #!/bin/sh should work fine too, just needs testing.1 #!/bin/sh 2 2 # $Id$ 3 3 ## @file … … 28 28 29 29 # 30 # Check if we're in eval mode or not. 31 # 32 ERR_REDIR=1 33 DBG_REDIR=1 34 EVAL_OPT= 35 DBG_OPT= 36 QUIET_OPT= 37 if test "$1" = "--debug"; then 38 DBG_OPT="true" 39 shift 40 fi 41 if test "$1" = "--quiet"; then 42 QUIET_OPT="true" 43 shift 44 fi 45 if test "$1" = "--eval"; then 46 EVAL_OPT="true" 47 ERR_REDIR=2 48 DBG_REDIR=2 49 shift 50 fi 51 52 53 # 30 54 # Determin the kBuild path from the script location. 31 55 # … … 35 59 fi 36 60 if test ! -f "$PATH_KBUILD/footer.kmk" -o ! -f "$PATH_KBUILD/header.kmk" -o ! -f "$PATH_KBUILD/rules.kmk"; then 37 echo "$0: error: PATH_KBUILD ($PATH_KBUILD) is not pointing to a popluated kBuild directory." ;61 echo "$0: error: PATH_KBUILD ($PATH_KBUILD) is not pointing to a popluated kBuild directory." 1>&${ERR_REDIR} 38 62 sleep 1; 39 63 exit 1; 40 64 fi 41 65 export PATH_KBUILD 42 echo "dbg: PATH_KBUILD=$PATH_KBUILD" 66 test -n "$DBG_OPT" && echo "dbg: PATH_KBUILD=$PATH_KBUILD" 1>&${DBG_REDIR} 43 67 44 68 … … 50 74 fi 51 75 export BUILD_TYPE 52 echo "dbg: BUILD_TYPE=$BUILD_TYPE" 76 test -n "$DBG_OPT" && echo "dbg: BUILD_TYPE=$BUILD_TYPE" 1>&${DBG_REDIR} 53 77 54 78 # … … 95 119 96 120 *) 97 echo "$0: unknown os $BUILD_PLATFORM" 121 echo "$0: unknown os $BUILD_PLATFORM" 1>&${ERR_REDIR} 98 122 sleep 1 99 123 exit 1 … … 102 126 fi 103 127 export BUILD_PLATFORM 104 echo "dbg: BUILD_PLATFORM=$BUILD_PLATFORM" 128 test -n "$DBG_OPT" && echo "dbg: BUILD_PLATFORM=$BUILD_PLATFORM" 1>&${DBG_REDIR} 105 129 106 130 if test -z "$BUILD_PLATFORM_ARCH"; then … … 173 197 ;; 174 198 175 *) echo "$0: unknown cpu/arch - $BUILD_PLATFORM_ARCH" 199 *) echo "$0: unknown cpu/arch - $BUILD_PLATFORM_ARCH" 1>&${ERR_REDIR} 176 200 sleep 1 177 201 exit 1 … … 181 205 fi 182 206 export BUILD_PLATFORM_ARCH 183 echo "dbg: BUILD_PLATFORM_ARCH=$BUILD_PLATFORM_ARCH" 207 test -n "$DBG_OPT" && echo "dbg: BUILD_PLATFORM_ARCH=$BUILD_PLATFORM_ARCH" 1>&${DBG_REDIR} 184 208 185 209 if test -z "$BUILD_PLATFORM_CPU"; then … … 187 211 fi 188 212 export BUILD_PLATFORM_CPU 189 echo "dbg: BUILD_PLATFORM_CPU=$BUILD_PLATFORM_CPU" 213 test -n "$DBG_OPT" && echo "dbg: BUILD_PLATFORM_CPU=$BUILD_PLATFORM_CPU" 1>&${DBG_REDIR} 190 214 191 215 # … … 197 221 fi 198 222 export BUILD_TARGET 199 echo "dbg: BUILD_TARGET=$BUILD_TARGET" 223 test -n "$DBG_OPT" && echo "dbg: BUILD_TARGET=$BUILD_TARGET" 1>&${DBG_REDIR} 200 224 201 225 if test -z "$BUILD_TARGET_ARCH"; then … … 203 227 fi 204 228 export BUILD_TARGET_ARCH 205 echo "dbg: BUILD_TARGET_ARCH=$BUILD_TARGET_ARCH" 229 test -n "$DBG_OPT" && echo "dbg: BUILD_TARGET_ARCH=$BUILD_TARGET_ARCH" 1>&${DBG_REDIR} 206 230 207 231 if test -z "$BUILD_TARGET_CPU"; then … … 213 237 fi 214 238 export BUILD_TARGET_CPU 215 echo "dbg: BUILD_TARGET_CPU=$BUILD_TARGET_CPU" 239 test -n "$DBG_OPT" && echo "dbg: BUILD_TARGET_CPU=$BUILD_TARGET_CPU" 1>&${DBG_REDIR} 216 240 217 241 … … 233 257 PATH_KBUILD_BIN="${PATH_KBUILD}/bin/${BUILD_PLATFORM}.${BUILD_PLATFORM_ARCH}" 234 258 fi 235 echo "dbg: PATH_KBUILD_BIN=${PATH_KBUILD_BIN} (not exported)" 259 test -n "$DBG_OPT" && echo "dbg: PATH_KBUILD_BIN=${PATH_KBUILD_BIN} (not exported)" 1>&${DBG_REDIR} 236 260 237 261 # Make shell. OS/2 and DOS only? 238 export MAKESHELL="${PATH_KBUILD_BIN}/kmk_ash${_SUFF_EXE}"; 262 if test "$BUILD_PLATFORM" = "os2"; then 263 export MAKESHELL="${PATH_KBUILD_BIN}/kmk_ash${_SUFF_EXE}"; 264 fi 239 265 240 266 # … … 242 268 # NOTE! Once bootstrapped this is the only thing that is actually necessary. 243 269 # 244 PATH="${PATH_KBUILD_BIN} /${_PATH_SEP}$PATH"270 PATH="${PATH_KBUILD_BIN}${_PATH_SEP}$PATH" 245 271 export PATH 246 echo "dbg: PATH=$PATH" 272 test -n "$DBG_OPT" && echo "dbg: PATH=$PATH" 1>&${DBG_REDIR} 247 273 248 274 # Sanity and x bits. 249 275 if test ! -d "${PATH_KBUILD_BIN}/"; then 250 echo "$0: warning: The bin directory for this platform doesn't exists. (${PATH_KBUILD_BIN}/)" 276 echo "$0: warning: The bin directory for this platform doesn't exists. (${PATH_KBUILD_BIN}/)" 1>&${ERR_REDIR} 251 277 else 252 278 for prog in kmk kDepPre kDepIDB kmk_append kmk_ash kmk_cat kmk_cp kmk_echo kmk_install kmk_ln kmk_mkdir kmk_mv kmk_rm kmk_rmdir kmk_sed; … … 254 280 chmod a+x ${PATH_KBUILD_BIN}/${prog} > /dev/null 2>&1 255 281 if test ! -f "${PATH_KBUILD_BIN}/${prog}${_SUFF_EXE}"; then 256 echo "$0: warning: The ${prog} program doesn't exist for this platform. (${PATH_KBUILD_BIN}/${prog}${_SUFF_EXE})" 282 echo "$0: warning: The ${prog} program doesn't exist for this platform. (${PATH_KBUILD_BIN}/${prog}${_SUFF_EXE})" 1>&${ERR_REDIR} 257 283 fi 258 284 done … … 262 288 unset _PATH_SEP 263 289 264 # Execute command or spawn shell. 265 if test $# -eq 0; then 266 echo "$0: info: Spawning work shell..." 267 if test "$TERM" != 'dumb' -a -n "$BASH"; then 268 export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]' 290 if test -n "$EVAL_OPT"; then 291 test -n "$DBG_OPT" && echo "dbg: echoing exported variables" 1>&${DBG_REDIR} 292 echo "export BUILD_PLATFORM=${BUILD_PLATFORM}" 293 echo "export BUILD_PLATFORM_ARCH=${BUILD_PLATFORM_ARCH}" 294 echo "export BUILD_PLATFORM_CPU=${BUILD_PLATFORM_CPU}" 295 echo "export BUILD_TARGET=${BUILD_TARGET}" 296 echo "export BUILD_TARGET_ARCH=${BUILD_TARGET_ARCH}" 297 echo "export BUILD_TARGET_CPU=${BUILD_TARGET_CPU}" 298 echo "export BUILD_TYPE=${BUILD_TYPE}" 299 echo "export PATH_KBUILD=${PATH_KBUILD}" 300 echo "export PATH=${PATH}" 301 test -n "$DBG_OPT" && echo "dbg: finished" 1>&${DBG_REDIR} 302 else 303 # Execute command or spawn shell. 304 if test $# -eq 0; then 305 test -z "${QUIET_OPT}" && echo "$0: info: Spawning work shell..." 1>&${ERR_REDIR} 306 if test "$TERM" != 'dumb' -a -n "$BASH"; then 307 export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]' 308 fi 309 $SHELL -i 310 else 311 echo "$0: info: Executing command: $*" 312 $* 269 313 fi 270 $SHELL -i 271 else 272 echo "$0: info: Executing command: $*" 273 $* 274 fi 275 314 fi 315
Note:
See TracChangeset
for help on using the changeset viewer.