| 1 | /*
|
|---|
| 2 | echo this is a rexx script!
|
|---|
| 3 | cancel & quit & exit
|
|---|
| 4 | */
|
|---|
| 5 | /* $Id: envos2.cmd 1731 2008-09-05 04:27:14Z bird $ */
|
|---|
| 6 | /** @file
|
|---|
| 7 | * Environment setup script for OS/2.
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | /*
|
|---|
| 11 | *
|
|---|
| 12 | * Copyright (c) 1999-2008 knut st. osmundsen <bird-kBuild-spam@anduin.net>
|
|---|
| 13 | *
|
|---|
| 14 | * This file is part of kBuild.
|
|---|
| 15 | *
|
|---|
| 16 | * kBuild is free software; you can redistribute it and/or modify
|
|---|
| 17 | * it under the terms of the GNU General Public License as published by
|
|---|
| 18 | * the Free Software Foundation; either version 2 of the License, or
|
|---|
| 19 | * (at your option) any later version.
|
|---|
| 20 | *
|
|---|
| 21 | * kBuild is distributed in the hope that it will be useful,
|
|---|
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 24 | * GNU General Public License for more details.
|
|---|
| 25 | *
|
|---|
| 26 | * You should have received a copy of the GNU General Public License
|
|---|
| 27 | * along with kBuild; if not, write to the Free Software
|
|---|
| 28 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 29 | *
|
|---|
| 30 | */
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | /*
|
|---|
| 34 | * Setup the usual suspects.
|
|---|
| 35 | */
|
|---|
| 36 | Address CMD '@echo off';
|
|---|
| 37 | signal on novalue name NoValueHandler
|
|---|
| 38 | if (RxFuncQuery('SysLoadFuncs') = 1) then
|
|---|
| 39 | do
|
|---|
| 40 | call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
|
|---|
| 41 | call SysLoadFuncs;
|
|---|
| 42 | end
|
|---|
| 43 |
|
|---|
| 44 | /*
|
|---|
| 45 | * Apply the CMD.EXE workaround.
|
|---|
| 46 | */
|
|---|
| 47 | call FixCMDEnv;
|
|---|
| 48 |
|
|---|
| 49 | /*
|
|---|
| 50 | * Globals
|
|---|
| 51 | */
|
|---|
| 52 | skBuildPath = EnvGet("KBUILD_PATH");
|
|---|
| 53 | skBuildBinPath = EnvGet("KBUILD_BIN_PATH");
|
|---|
| 54 | skBuildType = EnvGet("KBUILD_TYPE");
|
|---|
| 55 | skBuildTarget = EnvGet("KBUILD_TARGET");
|
|---|
| 56 | skBuildTargetArch = EnvGet("KBUILD_TARGET_ARCH");
|
|---|
| 57 | skBuildTargetCpu = EnvGet("KBUILD_TARGET_CPU");
|
|---|
| 58 | skBuildHost = EnvGet("KBUILD_HOST");
|
|---|
| 59 | skBuildHostArch = EnvGet("KBUILD_HOST_ARCH");
|
|---|
| 60 | skBuildHostCpu = EnvGet("KBUILD_HOST_CPU");
|
|---|
| 61 |
|
|---|
| 62 | /*
|
|---|
| 63 | * Process arguments.
|
|---|
| 64 | */
|
|---|
| 65 | fOptFull = 0
|
|---|
| 66 | fOptLegacy = 0
|
|---|
| 67 | fOptDbg = 0
|
|---|
| 68 | fOptQuiet = 0
|
|---|
| 69 | sOptVars = ""
|
|---|
| 70 | fOptValueOnly = 0
|
|---|
| 71 | sShowVarPrefix = "";
|
|---|
| 72 | fOptOverrideAll = 0
|
|---|
| 73 | fOptOverrideType = 0;
|
|---|
| 74 | fSetType = 0;
|
|---|
| 75 | fOptOverrideTarget = 0;
|
|---|
| 76 | fOptOverrideTargetArch = 0;
|
|---|
| 77 | fOptDefault = 0;
|
|---|
| 78 |
|
|---|
| 79 | parse arg sArgs
|
|---|
| 80 | do while (sArgs <> '')
|
|---|
| 81 | parse value sArgs with sArg sRest
|
|---|
| 82 | say 'sArgs='sArgs';'
|
|---|
| 83 | say ' sArg='sArg';'
|
|---|
| 84 | say 'sRest='sRest';'
|
|---|
| 85 |
|
|---|
| 86 | select
|
|---|
| 87 | when (sArg = "--debug-script") then do
|
|---|
| 88 | fOptDbg = 1;
|
|---|
| 89 | end
|
|---|
| 90 | when (sArg = "--no-debug-script") then do
|
|---|
| 91 | fOptDbg = 0;
|
|---|
| 92 | end
|
|---|
| 93 | when (sArg = "--quiet") then do
|
|---|
| 94 | fOptQuiet = 1;
|
|---|
| 95 | end
|
|---|
| 96 | when (sArg = "--verbose") then do
|
|---|
| 97 | fOptQuiet = 0;
|
|---|
| 98 | end
|
|---|
| 99 | when (sArg = "--full") then do
|
|---|
| 100 | fOptFull = 1;
|
|---|
| 101 | end
|
|---|
| 102 | when (sArg = "--normal") then do
|
|---|
| 103 | fOptFull = 0;
|
|---|
| 104 | end
|
|---|
| 105 | when (sArg = "--legacy") then do
|
|---|
| 106 | fOptLegacy = 1;
|
|---|
| 107 | end
|
|---|
| 108 | when (sArg = "--no-legacy") then do
|
|---|
| 109 | fOptLegacy = 0;
|
|---|
| 110 | end
|
|---|
| 111 | when (sArg = "--eval") then do
|
|---|
| 112 | say "error: --eval is not supported on OS/2."
|
|---|
| 113 | end
|
|---|
| 114 | when (sArg = "--var") then do
|
|---|
| 115 | parse value sRest with sVar sRest2
|
|---|
| 116 | sRest = sRest2;
|
|---|
| 117 | if (sVar = '') then do
|
|---|
| 118 | say "syntax error: --var is missing the variable name";
|
|---|
| 119 | call SysSleep 1
|
|---|
| 120 | exit 1;
|
|---|
| 121 | end
|
|---|
| 122 | if (sVar = "all" | sOptVars = "all") then
|
|---|
| 123 | sOptVars = "all";
|
|---|
| 124 | else
|
|---|
| 125 | sOptVars = sOptVars || " " || sVar;
|
|---|
| 126 | end
|
|---|
| 127 | when (sArg = "--set") then do
|
|---|
| 128 | sShowVarPrefix = "SET ";
|
|---|
| 129 | end
|
|---|
| 130 | when (sArg = "--no-set") then do
|
|---|
| 131 | sShowVarPrefix = "";
|
|---|
| 132 | end
|
|---|
| 133 | when (sArg = "--value-only") then do
|
|---|
| 134 | fOptValueOnly = 1;
|
|---|
| 135 | end
|
|---|
| 136 | when (sArg = "--name-and-value") then do
|
|---|
| 137 | fOptValueOnly = 0;
|
|---|
| 138 | end
|
|---|
| 139 | when (sArg = "--release") then do
|
|---|
| 140 | fOptOverrideType = 1;
|
|---|
| 141 | fSetType = 1;
|
|---|
| 142 | skBuildType = 'release';
|
|---|
| 143 | end
|
|---|
| 144 | when (sArg = "--debug") then do
|
|---|
| 145 | fOptOverrideType = 1;
|
|---|
| 146 | fSetType = 1;
|
|---|
| 147 | skBuildType = 'debug';
|
|---|
| 148 | end
|
|---|
| 149 | when (sArg = "--profile") then do
|
|---|
| 150 | fOptOverrideType = 1;
|
|---|
| 151 | fSetType = 1;
|
|---|
| 152 | skBuildType = 'profile';
|
|---|
| 153 | end
|
|---|
| 154 | when (sArg = "--defaults") then do
|
|---|
| 155 | fOptOverrideAll = 1;
|
|---|
| 156 | skBuildType = "";
|
|---|
| 157 | skBuildTarget = "";
|
|---|
| 158 | skBuildTargetArch = "";
|
|---|
| 159 | skBuildTargetCpu = "";
|
|---|
| 160 | skBuildHost = "";
|
|---|
| 161 | skBuildHostArch = "";
|
|---|
| 162 | skBuildHostCpu = "";
|
|---|
| 163 | skBuildPath = "";
|
|---|
| 164 | skBuildBinPath = "";
|
|---|
| 165 | end
|
|---|
| 166 |
|
|---|
| 167 | when (sArg = "--help" | sArg = "-h" | sArg = "-?" | sArg = "/?" | sArg = "/h") then do
|
|---|
| 168 | say "kBuild Environment Setup Script, v0.1.4"
|
|---|
| 169 | say ""
|
|---|
| 170 | say "syntax: envos2.cmd [options] [command [args]]"
|
|---|
| 171 | say " or: envos2.cmd [options] --var <varname>"
|
|---|
| 172 | say ""
|
|---|
| 173 | say "The first form will execute the command, or if no command is given"
|
|---|
| 174 | say "modify the current invoking shell."
|
|---|
| 175 | say "The second form will print the specfified variable(s)."
|
|---|
| 176 | say ""
|
|---|
| 177 | say "Options:"
|
|---|
| 178 | say " --debug, --release, --profile"
|
|---|
| 179 | say " Alternative way of specifying KBUILD_TYPE."
|
|---|
| 180 | say " --defaults"
|
|---|
| 181 | say " Enforce defaults for all the KBUILD_* values."
|
|---|
| 182 | say " --debug-script, --no-debug-script"
|
|---|
| 183 | say " Controls debug output. Default: --no-debug-script"
|
|---|
| 184 | say " --quiet, --verbose"
|
|---|
| 185 | say " Controls informational output. Default: --verbose"
|
|---|
| 186 | say " --full, --normal"
|
|---|
| 187 | say " Controls the variable set. Default: --normal"
|
|---|
| 188 | say " --legacy, --no-legacy"
|
|---|
| 189 | say " Include legacy variables in result. Default: --no-legacy"
|
|---|
| 190 | say " --value-only, --name-and-value"
|
|---|
| 191 | say " Controls what the result of a --var query. Default: --name-and-value"
|
|---|
| 192 | say " --set, --no-set"
|
|---|
| 193 | say " Whether to prefix the variable output with 'SET'."
|
|---|
| 194 | say " Default: --no-set"
|
|---|
| 195 | say ""
|
|---|
| 196 | exit 1
|
|---|
| 197 | end
|
|---|
| 198 |
|
|---|
| 199 | when (sArg = "--") then do
|
|---|
| 200 | sArgs = sRest;
|
|---|
| 201 | leave;
|
|---|
| 202 | end
|
|---|
| 203 |
|
|---|
| 204 | when (left(sArg, 2) = '--') then do
|
|---|
| 205 | say 'syntax error: unknown option: '||sArg
|
|---|
| 206 | call SysSleep 1
|
|---|
| 207 | exit 1
|
|---|
| 208 | end
|
|---|
| 209 |
|
|---|
| 210 | otherwise do
|
|---|
| 211 | leave
|
|---|
| 212 | end
|
|---|
| 213 | end
|
|---|
| 214 | sArgs = sRest;
|
|---|
| 215 | end
|
|---|
| 216 | sCommand = strip(sArgs);
|
|---|
| 217 |
|
|---|
| 218 | /*
|
|---|
| 219 | * Deal with legacy environment variables.
|
|---|
| 220 | */
|
|---|
| 221 | if (\fOptOverrideAll) then do
|
|---|
| 222 | if (EnvGet("PATH_KBUILD") <> '') then do
|
|---|
| 223 | if (skBuildPath <> '' & skBuildPath <> EnvGet("PATH_KBUILD")) then do
|
|---|
| 224 | say "error: KBUILD_PATH ("||skBuildPath||") and PATH_KBUILD ("||EnvGet("PATH_KBUILD")||") disagree."
|
|---|
| 225 | call SysSleep 1;
|
|---|
| 226 | exit 1;
|
|---|
| 227 | end
|
|---|
| 228 | skBuildPath = EnvGet("PATH_KBUILD");
|
|---|
| 229 | end
|
|---|
| 230 |
|
|---|
| 231 | if (EnvGet("PATH_KBUILD_BIN") <> '') then do
|
|---|
| 232 | if (skBuildPath <> '' & skBuildBinPath <> EnvGet("PATH_KBUILD_BIN")) then do
|
|---|
| 233 | say "error: KBUILD_BIN_PATH ("||skBuildBinPath||") and PATH_KBUILD_BIN ("||EnvGet("PATH_KBUILD_BIN")||") disagree."
|
|---|
| 234 | call SysSleep 1;
|
|---|
| 235 | exit 1;
|
|---|
| 236 | end
|
|---|
| 237 | skBuildBinPath = EnvGet("PATH_KBUILD_BIN");
|
|---|
| 238 | end
|
|---|
| 239 |
|
|---|
| 240 | if (EnvGet("BUILD_TYPE") <> '') then do
|
|---|
| 241 | if (skBuildType <> '' & skBuildType <> EnvGet("BUILD_TYPE")) then do
|
|---|
| 242 | say "error: KBUILD_TYPE ("||skBuildType||") and BUILD_TYPE ("||EnvGet("BUILD_TYPE")||") disagree."
|
|---|
| 243 | call SysSleep 1;
|
|---|
| 244 | exit 1;
|
|---|
| 245 | end
|
|---|
| 246 | skBuildType = EnvGet("BUILD_TYPE");
|
|---|
| 247 | end
|
|---|
| 248 |
|
|---|
| 249 | if (EnvGet("BUILD_TARGET") <> '') then do
|
|---|
| 250 | if (skBuildTarget <> '' & skBuildTarget <> EnvGet("BUILD_TARGET")) then do
|
|---|
| 251 | say "error: KBUILD_TARGET ("||skBuildTarget||") and BUILD_TARGET ("||EnvGet("BUILD_TARGET")||") disagree."
|
|---|
| 252 | call SysSleep 1;
|
|---|
| 253 | exit 1;
|
|---|
| 254 | end
|
|---|
| 255 | skBuildTarget = EnvGet("BUILD_TARGET");
|
|---|
| 256 | end
|
|---|
| 257 |
|
|---|
| 258 | if (EnvGet("BUILD_TARGET_ARCH") <> '') then do
|
|---|
| 259 | if (skBuildTargetArch <> '' & skBuildTargetArch <> EnvGet("BUILD_TARGET_ARCH")) then do
|
|---|
| 260 | say "error: KBUILD_TARGET_ARCH ("||skBuildTargetArch ||") and BUILD_TARGET_ARCH ("||EnvGet("BUILD_TARGET_ARCH")||") disagree."
|
|---|
| 261 | call SysSleep 1;
|
|---|
| 262 | exit 1;
|
|---|
| 263 | end
|
|---|
| 264 | skBuildTargetArch = EnvGet("BUILD_TARGET_ARCH");
|
|---|
| 265 | end
|
|---|
| 266 |
|
|---|
| 267 | if (EnvGet("BUILD_TARGET_CPU") <> '') then do
|
|---|
| 268 | if (skBuildTargetCpu <> '' & skBuildTargetCpu <> EnvGet("BUILD_TARGET_CPU")) then do
|
|---|
| 269 | say "error: KBUILD_TARGET_CPU ("||skBuildTargetCpu ||") and BUILD_TARGET_CPU ("||EnvGet("BUILD_TARGET_CPU")||") disagree."
|
|---|
| 270 | call SysSleep 1;
|
|---|
| 271 | exit 1;
|
|---|
| 272 | end
|
|---|
| 273 | skBuildTargetCpu = EnvGet("BUILD_TARGET_CPU");
|
|---|
| 274 | end
|
|---|
| 275 |
|
|---|
| 276 | if (EnvGet("BUILD_PLATFORM") <> '') then do
|
|---|
| 277 | if (skBuildHost <> '' & skBuildHost <> EnvGet("BUILD_PLATFORM")) then do
|
|---|
| 278 | say "error: KBUILD_HOST ("||skBuildHost||") and BUILD_PLATFORM ("||EnvGet("BUILD_PLATFORM")||") disagree."
|
|---|
| 279 | call SysSleep 1;
|
|---|
| 280 | exit 1;
|
|---|
| 281 | end
|
|---|
| 282 | if (skBuildHost = '' & EnvGet("BUILD_PLATFORM") = "OS2") then do
|
|---|
| 283 | say "error: BUILD_PLATFORM=OS2! Please unset it or change it to 'os2'."
|
|---|
| 284 | call SysSleep 1;
|
|---|
| 285 | exit 1;
|
|---|
| 286 | end
|
|---|
| 287 | skBuildHost = EnvGet("BUILD_PLATFORM");
|
|---|
| 288 | end
|
|---|
| 289 |
|
|---|
| 290 | if (EnvGet("BUILD_PLATFORM_ARCH") <> '') then do
|
|---|
| 291 | if (skBuildHostArch <> '' & skBuildHostArch <> EnvGet("BUILD_PLATFORM_ARCH")) then do
|
|---|
| 292 | say "error: KBUILD_HOST_ARCH ("||skBuildHostArch ||") and BUILD_PLATFORM_ARCH ("||EnvGet("BUILD_PLATFORM_ARCH")||") disagree."
|
|---|
| 293 | call SysSleep 1;
|
|---|
| 294 | exit 1;
|
|---|
| 295 | end
|
|---|
| 296 | skBuildHostArch = EnvGet("BUILD_PLATFORM_ARCH");
|
|---|
| 297 | end
|
|---|
| 298 |
|
|---|
| 299 | if (EnvGet("BUILD_PLATFORM_CPU") <> '') then do
|
|---|
| 300 | if (skBuildHostCpu <> '' & skBuildHostCpu <> EnvGet("BUILD_PLATFORM_CPU")) then do
|
|---|
| 301 | say "error: KBUILD_HOST_CPU ("||skBuildHostCpu ||") and BUILD_PLATFORM_CPU ("||EnvGet("BUILD_PLATFORM_CPU")||") disagree."
|
|---|
| 302 | call SysSleep 1;
|
|---|
| 303 | exit 1;
|
|---|
| 304 | end
|
|---|
| 305 | skBuildHostCpu = EnvGet("BUILD_PLATFORM_CPU");
|
|---|
| 306 | end
|
|---|
| 307 | end
|
|---|
| 308 |
|
|---|
| 309 | /*
|
|---|
| 310 | * Set default build type.
|
|---|
| 311 | */
|
|---|
| 312 | if (skBuildType = '') then
|
|---|
| 313 | skBuildType = 'release';
|
|---|
| 314 | if (fOptDbg <> 0) then say "dbg: KBUILD_TYPE="||skBuildType
|
|---|
| 315 |
|
|---|
| 316 | /*
|
|---|
| 317 | * Determin the host platform (OS/2)
|
|---|
| 318 | */
|
|---|
| 319 | if (skBuildHost = '') then
|
|---|
| 320 | skBuildHost = 'os2';
|
|---|
| 321 | if (fOptDbg <> 0) then say "dbg: KBUILD_HOST="||skBuildHost
|
|---|
| 322 |
|
|---|
| 323 | if (skBuildHostArch = '') then do
|
|---|
| 324 | select
|
|---|
| 325 | when (skBuildHostCpu = 'i386',
|
|---|
| 326 | | skBuildHostCpu = 'i486',
|
|---|
| 327 | | skBuildHostCpu = 'i586',
|
|---|
| 328 | | skBuildHostCpu = 'i686',
|
|---|
| 329 | | skBuildHostCpu = 'i786',
|
|---|
| 330 | | skBuildHostCpu = 'i886',
|
|---|
| 331 | | skBuildHostCpu = 'i986') then do
|
|---|
| 332 | skBuildHostArch = "x86";
|
|---|
| 333 | end
|
|---|
| 334 | otherwise do
|
|---|
| 335 | skBuildHostArch = "x86";
|
|---|
| 336 | end
|
|---|
| 337 | end
|
|---|
| 338 | end
|
|---|
| 339 | if (fOptDbg <> 0) then say "dbg: KBUILD_HOST_ARCH="||skBuildHostArch
|
|---|
| 340 |
|
|---|
| 341 | if (skBuildHostCpu = '') then
|
|---|
| 342 | skBuildHostCpu = 'blend';
|
|---|
| 343 | if (fOptDbg <> 0) then say "dbg: KBUILD_HOST_CPU="||skBuildHostCpu
|
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 | /*
|
|---|
| 347 | * The target platform.
|
|---|
| 348 | * Defaults to the host when not specified.
|
|---|
| 349 | */
|
|---|
| 350 | if (skBuildTarget = '') then
|
|---|
| 351 | skBuildTarget = skBuildHost;
|
|---|
| 352 | if (fOptDbg <> 0) then say "dbg: KBUILD_TARGET="||skBuildTarget
|
|---|
| 353 |
|
|---|
| 354 | if (skBuildTargetArch = '') then
|
|---|
| 355 | skBuildTargetArch = skBuildHostArch;
|
|---|
| 356 | if (fOptDbg <> 0) then say "dbg: KBUILD_TARGET_ARCH="||skBuildTargetArch
|
|---|
| 357 |
|
|---|
| 358 | if (skBuildTargetCpu = '') then do
|
|---|
| 359 | if (skBuildTargetArch = skBuildHostArch) then
|
|---|
| 360 | skBuildTargetCpu = skBuildHostCpu;
|
|---|
| 361 | else
|
|---|
| 362 | skBuildTargetCpu = "blend";
|
|---|
| 363 | end
|
|---|
| 364 | if (fOptDbg <> 0) then say "dbg: KBUILD_TARGET_CPU="||skBuildTargetCpu
|
|---|
| 365 |
|
|---|
| 366 |
|
|---|
| 367 | /*
|
|---|
| 368 | * Determin KBUILD_PATH from the script location and calc KBUILD_BIN_PATH from there.
|
|---|
| 369 | */
|
|---|
| 370 | if (skBuildPath = '') then do
|
|---|
| 371 | skBuildPath = GetScriptDir()
|
|---|
| 372 | end
|
|---|
| 373 | skBuildPath = translate(skBuildPath, '/', '\')
|
|---|
| 374 | if ( FileExists(skBuildPath||"/footer.kmk") = 0,
|
|---|
| 375 | | FileExists(skBuildPath||"/header.kmk") = 0,
|
|---|
| 376 | | FileExists(skBuildPath||"/rules.kmk") = 0) then do
|
|---|
| 377 | say "error: KBUILD_PATH ("skBuildPath||") is not pointing to a popluated kBuild directory."
|
|---|
| 378 | call SysSleep 1
|
|---|
| 379 | exit 1
|
|---|
| 380 | end
|
|---|
| 381 | if (fOptDbg <> 0) then say "dbg: KBUILD_PATH="||skBuildPath;
|
|---|
| 382 |
|
|---|
| 383 | if (skBuildBinPath = '') then do
|
|---|
| 384 | skBuildBinPath = skBuildPath||'/bin/'||skBuildHost||'.'||skBuildHostArch;
|
|---|
| 385 | end
|
|---|
| 386 | skBuildBinPath = translate(skBuildBinPath, '/', '\')
|
|---|
| 387 | if (fOptDbg <> 0) then say "dbg: KBUILD_BIN_PATH="||skBuildBinPath;
|
|---|
| 388 |
|
|---|
| 389 | /*
|
|---|
| 390 | * Add the bin/x.y/ directory to the PATH and BEGINLIBPATH.
|
|---|
| 391 | * NOTE! Once bootstrapped this is the only thing that is actually necessary.
|
|---|
| 392 | */
|
|---|
| 393 | sOldPath = EnvGet("PATH");
|
|---|
| 394 | call EnvAddFront 0, "PATH", translate(skBuildBinPath, '\', '/');
|
|---|
| 395 | sNewPath = EnvGet("PATH");
|
|---|
| 396 | call EnvSet 0, "PATH", sOldPath;
|
|---|
| 397 | if (fOptDbg <> 0) then say "dbg: PATH="||sNewPath;
|
|---|
| 398 |
|
|---|
| 399 | sOldBeginLibPath = EnvGet("BEGINLIBPATH");
|
|---|
| 400 | call EnvAddFront 0, "BEGINLIBPATH", translate(skBuildBinPath, '\', '/');
|
|---|
| 401 | sNewBeginLibPath = EnvGet("BEGINLIBPATH");
|
|---|
| 402 | call EnvSet 0, "BEGINLIBPATH", sOldBeginLibPath;
|
|---|
| 403 | if (fOptDbg <> 0) then say "dbg: BEGINLIBPATH="||sNewBeginLibPath;
|
|---|
| 404 |
|
|---|
| 405 | /*
|
|---|
| 406 | * Sanity check
|
|---|
| 407 | */
|
|---|
| 408 | if (DirExists(skBuildBinPath) = 0) then
|
|---|
| 409 | say "warning: The bin directory for the build platform doesn't exist. ("||skBuildBinPath||")";
|
|---|
| 410 | else
|
|---|
| 411 | do
|
|---|
| 412 | sPrograms = "kmk kDepPre kDepIDB kmk_append kmk_ash kmk_cat kmk_cp kmk_echo kmk_install kmk_ln kmk_mkdir kmk_mv kmk_redirect kmk_rm kmk_rmdir kmk_sed";
|
|---|
| 413 | do i = 1 to words(sPrograms)
|
|---|
| 414 | sProgram = word(sPrograms, i);
|
|---|
| 415 | if (FileExists(skBuildBinPath||"\"||sProgram||".exe") = 0) then
|
|---|
| 416 | say "warning: The "||sProgram||" program doesn't exit for this platform. ("||skBuildBinPath||")";
|
|---|
| 417 | end
|
|---|
| 418 | end
|
|---|
| 419 |
|
|---|
| 420 |
|
|---|
| 421 | /*
|
|---|
| 422 | * The environment is in place, now take the requested action.
|
|---|
| 423 | */
|
|---|
| 424 | iRc = 0;
|
|---|
| 425 | if (sOptVars <> '') then
|
|---|
| 426 | do
|
|---|
| 427 | if (sOptVars = "all") then
|
|---|
| 428 | sOptVars = "KBUILD_PATH KBUILD_BIN_PATH KBUILD_TYPE ",
|
|---|
| 429 | || "KBUILD_TARGET KBUILD_TARGET_ARCH KBUILD_TARGET_CPU ",
|
|---|
| 430 | || "KBUILD_HOST KBUILD_HOST_ARCH KBUILD_HOST_CPU ";
|
|---|
| 431 |
|
|---|
| 432 | /* Echo variable values or variable export statements. */
|
|---|
| 433 | do i = 1 to words(sOptVars)
|
|---|
| 434 | sVar = word(sOptVars, i)
|
|---|
| 435 | sVal = '';
|
|---|
| 436 | select
|
|---|
| 437 | when (sVar = "PATH") then sVal = sNewPath;
|
|---|
| 438 | when (sVar = "BEGINLIBPATH") then sVal = sNewBeginLibPath;
|
|---|
| 439 | when (sVar = "KBUILD_PATH") then sVal = skBuildPath;
|
|---|
| 440 | when (sVar = "KBUILD_BIN_PATH") then sVal = skBuildBinPath;
|
|---|
| 441 | when (sVar = "KBUILD_TYPE") then sVal = skBuildType;
|
|---|
| 442 | when (sVar = "KBUILD_HOST") then sVal = skBuildHost;
|
|---|
| 443 | when (sVar = "KBUILD_HOST_ARCH") then sVal = skBuildHostArch;
|
|---|
| 444 | when (sVar = "KBUILD_HOST_CPU") then sVal = skBuildHostCpu;
|
|---|
| 445 | when (sVar = "KBUILD_TARGET") then sVal = skBuildTarget;
|
|---|
| 446 | when (sVar = "KBUILD_TARGET_ARCH") then sVal = skBuildTargetArch;
|
|---|
| 447 | when (sVar = "KBUILD_TARGET_CPU") then sVal = skBuildTargetCpu;
|
|---|
| 448 | otherwise do
|
|---|
| 449 | say "error: Unknown variable "||sVar||" specified in --var request."
|
|---|
| 450 | call SysSleep 1
|
|---|
| 451 | exit 1
|
|---|
| 452 | end
|
|---|
| 453 |
|
|---|
| 454 | end
|
|---|
| 455 | if (fOptValueOnly <> 0) then
|
|---|
| 456 | say sVal
|
|---|
| 457 | else
|
|---|
| 458 | say sShowVarPrefix||sVar||"="||sVal;
|
|---|
| 459 | end
|
|---|
| 460 | end
|
|---|
| 461 | else
|
|---|
| 462 | do
|
|---|
| 463 | /* Wipe out all variables - legacy included - with --default. */
|
|---|
| 464 | if (fOptOverrideAll <> 0) then do
|
|---|
| 465 | call EnvSet 0, KBUILD_PATH, ''
|
|---|
| 466 | call EnvSet 0, KBUILD_BIN_PATH, ''
|
|---|
| 467 | call EnvSet 0, KBUILD_HOST, ''
|
|---|
| 468 | call EnvSet 0, KBUILD_HOST_ARCH, ''
|
|---|
| 469 | call EnvSet 0, KBUILD_HOST_CPU, ''
|
|---|
| 470 | call EnvSet 0, KBUILD_TARGET, ''
|
|---|
| 471 | call EnvSet 0, KBUILD_TARGET_ARCH, ''
|
|---|
| 472 | call EnvSet 0, KBUILD_TARGET_CPU, ''
|
|---|
| 473 |
|
|---|
| 474 | call EnvSet 0, PATH_KBUILD, ''
|
|---|
| 475 | call EnvSet 0, PATH_KBUILD_BIN, ''
|
|---|
| 476 | call EnvSet 0, BUILD_PLATFORM, ''
|
|---|
| 477 | call EnvSet 0, BUILD_PLATFORM_ARCH, ''
|
|---|
| 478 | call EnvSet 0, BUILD_PLATFORM_CPU, ''
|
|---|
| 479 | call EnvSet 0, BUILD_TARGET, ''
|
|---|
| 480 | call EnvSet 0, BUILD_TARGET_ARCH, ''
|
|---|
| 481 | call EnvSet 0, BUILD_TARGET_CPU, ''
|
|---|
| 482 | end
|
|---|
| 483 |
|
|---|
| 484 | /* Export the variables. */
|
|---|
| 485 | call EnvSet 0, "PATH", sNewPath
|
|---|
| 486 | call EnvSet 0, "BEGINLIBPATH", sNewBeginLibPath
|
|---|
| 487 | if (fOptOverrideType <> 0) then call EnvSet 0, "KBUILD_TYPE", skBuildType
|
|---|
| 488 | if (fOptFull <> 0) then do
|
|---|
| 489 | call EnvSet 0, KBUILD_PATH, skBuildPath
|
|---|
| 490 | call EnvSet 0, KBUILD_HOST, skBuildHost
|
|---|
| 491 | call EnvSet 0, KBUILD_HOST_ARCH, skBuildHostArch
|
|---|
| 492 | call EnvSet 0, KBUILD_HOST_CPU, skBuildHostCpu
|
|---|
| 493 | call EnvSet 0, KBUILD_TARGET, skBuildTarget
|
|---|
| 494 | call EnvSet 0, KBUILD_TARGET_ARCH, skBuildTargetArch
|
|---|
| 495 | call EnvSet 0, KBUILD_TARGET_CPU, skBuildTargetCpu
|
|---|
| 496 |
|
|---|
| 497 | if (fOptLegacy <> 0) then do
|
|---|
| 498 | call EnvSet 0, PATH_KBUILD, skBuildPath
|
|---|
| 499 | call EnvSet 0, BUILD_PLATFORM, skBuildHost
|
|---|
| 500 | call EnvSet 0, BUILD_PLATFORM_ARCH, skBuildHostArch
|
|---|
| 501 | call EnvSet 0, BUILD_PLATFORM_CPU, skBuildHostCpu
|
|---|
| 502 | call EnvSet 0, BUILD_TARGET, skBuildTarget
|
|---|
| 503 | call EnvSet 0, BUILD_TARGET_ARCH, skBuildTargetArch
|
|---|
| 504 | call EnvSet 0, BUILD_TARGET_CPU, skBuildTargetCpu
|
|---|
| 505 | end
|
|---|
| 506 | end
|
|---|
| 507 |
|
|---|
| 508 | /*
|
|---|
| 509 | * Execute left over arguments.
|
|---|
| 510 | */
|
|---|
| 511 | if (strip(sCommand) <> '') then do
|
|---|
| 512 | if (fOptQuiet <> 0) then say "info: Executing command: "|| sCommand
|
|---|
| 513 | address CMD sCommand
|
|---|
| 514 | iRc = rc;
|
|---|
| 515 | if (fOptQuiet <> 0 & iRc <> 0) then say "info: rc="||iRc||": "|| sCommand
|
|---|
| 516 | end
|
|---|
| 517 | end
|
|---|
| 518 | if (fOptDbg <> 0) then say "dbg: finished (rc="||rc||")"
|
|---|
| 519 | exit (iRc);
|
|---|
| 520 |
|
|---|
| 521 |
|
|---|
| 522 | /*******************************************************************************
|
|---|
| 523 | * Procedure Section *
|
|---|
| 524 | *******************************************************************************/
|
|---|
| 525 |
|
|---|
| 526 | /**
|
|---|
| 527 | * Give the script syntax
|
|---|
| 528 | */
|
|---|
| 529 | syntax: procedure
|
|---|
| 530 | say 'syntax: envos2.cmd [command to be executed and its arguments]'
|
|---|
| 531 | say ''
|
|---|
| 532 | return 0;
|
|---|
| 533 |
|
|---|
| 534 |
|
|---|
| 535 | /**
|
|---|
| 536 | * No value handler
|
|---|
| 537 | */
|
|---|
| 538 | NoValueHandler:
|
|---|
| 539 | say 'NoValueHandler: line 'SIGL;
|
|---|
| 540 | exit(16);
|
|---|
| 541 |
|
|---|
| 542 |
|
|---|
| 543 |
|
|---|
| 544 | /**
|
|---|
| 545 | * Add sToAdd in front of sEnvVar.
|
|---|
| 546 | * Note: sToAdd now is allowed to be alist!
|
|---|
| 547 | *
|
|---|
| 548 | * Known features: Don't remove sToAdd from original value if sToAdd
|
|---|
| 549 | * is at the end and don't end with a ';'.
|
|---|
| 550 | */
|
|---|
| 551 | EnvAddFront: procedure
|
|---|
| 552 | parse arg fRM, sEnvVar, sToAdd, sSeparator
|
|---|
| 553 |
|
|---|
| 554 | /* sets default separator if not specified. */
|
|---|
| 555 | if (sSeparator = '') then sSeparator = ';';
|
|---|
| 556 |
|
|---|
| 557 | /* checks that sToAdd ends with an ';'. Adds one if not. */
|
|---|
| 558 | if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
|
|---|
| 559 | sToAdd = sToAdd || sSeparator;
|
|---|
| 560 |
|
|---|
| 561 | /* check and evt. remove ';' at start of sToAdd */
|
|---|
| 562 | if (substr(sToAdd, 1, 1) = ';') then
|
|---|
| 563 | sToAdd = substr(sToAdd, 2);
|
|---|
| 564 |
|
|---|
| 565 | /* loop thru sToAdd */
|
|---|
| 566 | rc = 0;
|
|---|
| 567 | i = length(sToAdd);
|
|---|
| 568 | do while i > 1 & rc = 0
|
|---|
| 569 | j = lastpos(sSeparator, sToAdd, i-1);
|
|---|
| 570 | rc = EnvAddFront2(fRM, sEnvVar, substr(sToAdd, j+1, i - j), sSeparator);
|
|---|
| 571 | i = j;
|
|---|
| 572 | end
|
|---|
| 573 |
|
|---|
| 574 | return rc;
|
|---|
| 575 |
|
|---|
| 576 | /**
|
|---|
| 577 | * Add sToAdd in front of sEnvVar.
|
|---|
| 578 | *
|
|---|
| 579 | * Known features: Don't remove sToAdd from original value if sToAdd
|
|---|
| 580 | * is at the end and don't end with a ';'.
|
|---|
| 581 | */
|
|---|
| 582 | EnvAddFront2: procedure
|
|---|
| 583 | parse arg fRM, sEnvVar, sToAdd, sSeparator
|
|---|
| 584 |
|
|---|
| 585 | /* sets default separator if not specified. */
|
|---|
| 586 | if (sSeparator = '') then sSeparator = ';';
|
|---|
| 587 |
|
|---|
| 588 | /* checks that sToAdd ends with a separator. Adds one if not. */
|
|---|
| 589 | if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
|
|---|
| 590 | sToAdd = sToAdd || sSeparator;
|
|---|
| 591 |
|
|---|
| 592 | /* check and evt. remove the separator at start of sToAdd */
|
|---|
| 593 | if (substr(sToAdd, 1, 1) = sSeparator) then
|
|---|
| 594 | sToAdd = substr(sToAdd, 2);
|
|---|
| 595 |
|
|---|
| 596 | /* Get original variable value */
|
|---|
| 597 | sOrgEnvVar = EnvGet(sEnvVar);
|
|---|
| 598 |
|
|---|
| 599 | /* Remove previously sToAdd if exists. (Changing sOrgEnvVar). */
|
|---|
| 600 | i = pos(translate(sToAdd), translate(sOrgEnvVar));
|
|---|
| 601 | if (i > 0) then
|
|---|
| 602 | sOrgEnvVar = substr(sOrgEnvVar, 1, i-1) || substr(sOrgEnvVar, i + length(sToAdd));
|
|---|
| 603 |
|
|---|
| 604 | /* set environment */
|
|---|
| 605 | if (fRM) then
|
|---|
| 606 | return EnvSet(0, sEnvVar, sOrgEnvVar);
|
|---|
| 607 | return EnvSet(0, sEnvVar, sToAdd||sOrgEnvVar);
|
|---|
| 608 |
|
|---|
| 609 |
|
|---|
| 610 | /**
|
|---|
| 611 | * Add sToAdd as the end of sEnvVar.
|
|---|
| 612 | * Note: sToAdd now is allowed to be alist!
|
|---|
| 613 | *
|
|---|
| 614 | * Known features: Don't remove sToAdd from original value if sToAdd
|
|---|
| 615 | * is at the end and don't end with a ';'.
|
|---|
| 616 | */
|
|---|
| 617 | EnvAddEnd: procedure
|
|---|
| 618 | parse arg fRM, sEnvVar, sToAdd, sSeparator
|
|---|
| 619 |
|
|---|
| 620 | /* sets default separator if not specified. */
|
|---|
| 621 | if (sSeparator = '') then sSeparator = ';';
|
|---|
| 622 |
|
|---|
| 623 | /* checks that sToAdd ends with a separator. Adds one if not. */
|
|---|
| 624 | if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
|
|---|
| 625 | sToAdd = sToAdd || sSeparator;
|
|---|
| 626 |
|
|---|
| 627 | /* check and evt. remove ';' at start of sToAdd */
|
|---|
| 628 | if (substr(sToAdd, 1, 1) = sSeparator) then
|
|---|
| 629 | sToAdd = substr(sToAdd, 2);
|
|---|
| 630 |
|
|---|
| 631 | /* loop thru sToAdd */
|
|---|
| 632 | rc = 0;
|
|---|
| 633 | i = length(sToAdd);
|
|---|
| 634 | do while i > 1 & rc = 0
|
|---|
| 635 | j = lastpos(sSeparator, sToAdd, i-1);
|
|---|
| 636 | rc = EnvAddEnd2(fRM, sEnvVar, substr(sToAdd, j+1, i - j), sSeparator);
|
|---|
| 637 | i = j;
|
|---|
| 638 | end
|
|---|
| 639 |
|
|---|
| 640 | return rc;
|
|---|
| 641 |
|
|---|
| 642 |
|
|---|
| 643 | /**
|
|---|
| 644 | * Add sToAdd as the end of sEnvVar.
|
|---|
| 645 | *
|
|---|
| 646 | * Known features: Don't remove sToAdd from original value if sToAdd
|
|---|
| 647 | * is at the end and don't end with a ';'.
|
|---|
| 648 | */
|
|---|
| 649 | EnvAddEnd2: procedure
|
|---|
| 650 | parse arg fRM, sEnvVar, sToAdd, sSeparator
|
|---|
| 651 |
|
|---|
| 652 | /* sets default separator if not specified. */
|
|---|
| 653 | if (sSeparator = '') then sSeparator = ';';
|
|---|
| 654 |
|
|---|
| 655 | /* checks that sToAdd ends with a separator. Adds one if not. */
|
|---|
| 656 | if (substr(sToAdd, length(sToAdd), 1) <> sSeparator) then
|
|---|
| 657 | sToAdd = sToAdd || sSeparator;
|
|---|
| 658 |
|
|---|
| 659 | /* check and evt. remove separator at start of sToAdd */
|
|---|
| 660 | if (substr(sToAdd, 1, 1) = sSeparator) then
|
|---|
| 661 | sToAdd = substr(sToAdd, 2);
|
|---|
| 662 |
|
|---|
| 663 | /* Get original variable value */
|
|---|
| 664 | sOrgEnvVar = EnvGet(sEnvVar);
|
|---|
| 665 |
|
|---|
| 666 | if (sOrgEnvVar <> '') then
|
|---|
| 667 | do
|
|---|
| 668 | /* Remove previously sToAdd if exists. (Changing sOrgEnvVar). */
|
|---|
| 669 | i = pos(translate(sToAdd), translate(sOrgEnvVar));
|
|---|
| 670 | if (i > 0) then
|
|---|
| 671 | sOrgEnvVar = substr(sOrgEnvVar, 1, i-1) || substr(sOrgEnvVar, i + length(sToAdd));
|
|---|
| 672 |
|
|---|
| 673 | /* checks that sOrgEnvVar ends with a separator. Adds one if not. */
|
|---|
| 674 | if (sOrgEnvVar = '') then
|
|---|
| 675 | if (right(sOrgEnvVar,1) <> sSeparator) then
|
|---|
| 676 | sOrgEnvVar = sOrgEnvVar || sSeparator;
|
|---|
| 677 | end
|
|---|
| 678 |
|
|---|
| 679 | /* set environment */
|
|---|
| 680 | if (fRM) then return EnvSet(0, sEnvVar, sOrgEnvVar);
|
|---|
| 681 | return EnvSet(0, sEnvVar, sOrgEnvVar||sToAdd);
|
|---|
| 682 |
|
|---|
| 683 |
|
|---|
| 684 | /**
|
|---|
| 685 | * Sets sEnvVar to sValue.
|
|---|
| 686 | */
|
|---|
| 687 | EnvSet: procedure
|
|---|
| 688 | parse arg fRM, sEnvVar, sValue
|
|---|
| 689 |
|
|---|
| 690 | /* if we're to remove this, make valuestring empty! */
|
|---|
| 691 | if (fRM) then
|
|---|
| 692 | sValue = '';
|
|---|
| 693 | sEnvVar = translate(sEnvVar);
|
|---|
| 694 |
|
|---|
| 695 | /*
|
|---|
| 696 | * Begin/EndLibpath fix:
|
|---|
| 697 | * We'll have to set internal these using both commandline 'SET'
|
|---|
| 698 | * and internal VALUE in order to export it and to be able to
|
|---|
| 699 | * get it (with EnvGet) again.
|
|---|
| 700 | */
|
|---|
| 701 | if ((sEnvVar = 'BEGINLIBPATH') | (sEnvVar = 'ENDLIBPATH')) then
|
|---|
| 702 | do
|
|---|
| 703 | if (length(sValue) >= 1024) then
|
|---|
| 704 | say 'Warning: 'sEnvVar' is too long,' length(sValue)' char.';
|
|---|
| 705 | return SysSetExtLibPath(sValue, substr(sEnvVar, 1, 1));
|
|---|
| 706 | end
|
|---|
| 707 |
|
|---|
| 708 | if (length(sValue) >= 1024) then
|
|---|
| 709 | do
|
|---|
| 710 | say 'Warning: 'sEnvVar' is too long,' length(sValue)' char.';
|
|---|
| 711 | say ' This may make CMD.EXE unstable after a SET operation to print the environment.';
|
|---|
| 712 | end
|
|---|
| 713 | sRc = VALUE(sEnvVar, sValue, 'OS2ENVIRONMENT');
|
|---|
| 714 | return 0;
|
|---|
| 715 |
|
|---|
| 716 |
|
|---|
| 717 | /**
|
|---|
| 718 | * Gets the value of sEnvVar.
|
|---|
| 719 | */
|
|---|
| 720 | EnvGet: procedure
|
|---|
| 721 | parse arg sEnvVar
|
|---|
| 722 | if ((translate(sEnvVar) = 'BEGINLIBPATH') | (translate(sEnvVar) = 'ENDLIBPATH')) then
|
|---|
| 723 | return SysQueryExtLibPath(substr(sEnvVar, 1, 1));
|
|---|
| 724 | return value(sEnvVar,, 'OS2ENVIRONMENT');
|
|---|
| 725 |
|
|---|
| 726 |
|
|---|
| 727 | /**
|
|---|
| 728 | * Checks if a file exists.
|
|---|
| 729 | * @param sFile Name of the file to look for.
|
|---|
| 730 | * @param sComplain Complaint text. Complain if non empty and not found.
|
|---|
| 731 | * @returns TRUE if file exists.
|
|---|
| 732 | * FALSE if file doesn't exists.
|
|---|
| 733 | */
|
|---|
| 734 | FileExists: procedure
|
|---|
| 735 | parse arg sFile, sComplain
|
|---|
| 736 | rc = stream(sFile, 'c', 'query exist');
|
|---|
| 737 | if ((rc = '') & (sComplain <> '')) then
|
|---|
| 738 | say sComplain ''''sFile'''.';
|
|---|
| 739 | return rc <> '';
|
|---|
| 740 |
|
|---|
| 741 |
|
|---|
| 742 | /**
|
|---|
| 743 | * Checks if a directory exists.
|
|---|
| 744 | * @param sDir Name of the directory to look for.
|
|---|
| 745 | * @param sComplain Complaint text. Complain if non empty and not found.
|
|---|
| 746 | * @returns TRUE if file exists.
|
|---|
| 747 | * FALSE if file doesn't exists.
|
|---|
| 748 | */
|
|---|
| 749 | DirExists: procedure
|
|---|
| 750 | parse arg sDir, sComplain
|
|---|
| 751 | rc = SysFileTree(sDir, 'sDirs', 'DO');
|
|---|
| 752 | if (rc = 0 & sDirs.0 = 1) then
|
|---|
| 753 | return 1;
|
|---|
| 754 | if (sComplain <> '') then
|
|---|
| 755 | say sComplain ''''sDir'''.';
|
|---|
| 756 | return 0;
|
|---|
| 757 |
|
|---|
| 758 |
|
|---|
| 759 | /**
|
|---|
| 760 | * Workaround for bug in CMD.EXE.
|
|---|
| 761 | * It messes up when REXX have expanded the environment.
|
|---|
| 762 | */
|
|---|
| 763 | FixCMDEnv: procedure
|
|---|
| 764 | /* do this anyway
|
|---|
| 765 | /* check for 4OS2 first */
|
|---|
| 766 | Address CMD 'set 4os2test_env=%@eval[2 + 2]';
|
|---|
| 767 | if (value('4os2test_env',, 'OS2ENVIRONMENT') = '4') then
|
|---|
| 768 | return 0;
|
|---|
| 769 | */
|
|---|
| 770 |
|
|---|
| 771 | /* force environment expansion by setting a lot of variables and freeing them.
|
|---|
| 772 | * ~6600 (bytes) */
|
|---|
| 773 | do i = 1 to 100
|
|---|
| 774 | Address CMD '@set dummyenvvar'||i'=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|---|
| 775 | end
|
|---|
| 776 | do i = 1 to 100
|
|---|
| 777 | Address CMD '@set dummyenvvar'||i'=';
|
|---|
| 778 | end
|
|---|
| 779 | return 0;
|
|---|
| 780 |
|
|---|
| 781 |
|
|---|
| 782 | /**
|
|---|
| 783 | * Translate a string to lower case.
|
|---|
| 784 | */
|
|---|
| 785 | ToLower: procedure
|
|---|
| 786 | parse arg sString
|
|---|
| 787 | return translate(sString, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
|---|
| 788 |
|
|---|
| 789 |
|
|---|
| 790 | /**
|
|---|
| 791 | * Gets the script directory.
|
|---|
| 792 | */
|
|---|
| 793 | GetScriptDir: procedure
|
|---|
| 794 | /*
|
|---|
| 795 | * Assuming this script is in the root directory, we can determing
|
|---|
| 796 | * the abs path to it by using the 'parse source' feature in rexx.
|
|---|
| 797 | */
|
|---|
| 798 | parse source . . sScript
|
|---|
| 799 | sScriptDir = filespec('drive', sScript) || strip(filespec('path', sScript), 'T', '\');
|
|---|
| 800 | return ToLower(sScriptDir);
|
|---|
| 801 |
|
|---|