Changeset 3028
- Timestamp:
- Apr 8, 2007, 6:56:23 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/env.cmd
r2978 r3028 6 6 /** @file 7 7 * 8 * LIBC Development Environment Script. 9 * 10 * Copyright (c) 1999-2005 Knut St. Osmundsen <bird@anduin.net> 8 * LIBC Development Environment Setup Script. 9 * 10 * 11 * Copyright (c) 1999-2007 knut st. osmundsen <bird-src-spam@anduin.net> 12 * 13 * 14 * This file is part of kLIBC. 15 * 16 * kLIBC 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 * kLIBC 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 kLIBC; if not, write to the Free Software 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 29 * 12 30 */ … … 23 41 end 24 42 25 say ' WARNING:'26 say ' This is work in progress, and will probably not suit your'27 say ' environment at the moment!'28 say ''29 30 /*31 * Constants.32 */33 asBuildTypes.0 = 2;34 asBuildTypes.1 = 'debug';35 asBuildTypes.2 = 'release';36 asStages.0 = 237 asStages.1 = 'stage1'38 asStages.2 = 'stage2'39 40 43 /* 41 44 * Apply CMD.EXE workaround. … … 44 47 45 48 /* 46 * Parse argument 47 */ 48 parse arg sArgs 49 * Parse argument. 50 */ 49 51 fRm = 0; 50 fUseStagedGcc = 1; 52 sPathGcc = ''; 53 sPathUnix = EnvGet('UNIXROOT'); 54 sPathkBuild = EnvGet('PATH_KBUILD'); 55 fWithBuiltStuff = 1; 51 56 fUseBuildEnv = 1; 52 57 sBuildType = 'debug'; 53 58 sBuildTarget = 'os2'; 54 59 sBuildArch = 'x86'; 60 parse arg sArgs 55 61 do i = 1 to words(sArgs) 56 62 /* extract word */ … … 62 68 sArg = strip(strip(sArg, 'L', '/'), 'L', '-'); 63 69 select 64 when (sArg = 'disable-staged-gcc') then 65 fUseStagedGcc = 0; 66 when (sArg = 'enable-staged-gcc') then 67 fUseStagedGcc = 1; 68 70 when (sArg = 'gcc') then 71 do 72 if i = words(sArgs) then 73 do 74 say 'syntax error: '''sArg''' is missing the path.' 75 exit(12); 76 end 77 i = i + 1; 78 sPathGcc = word(sArgs, i); 79 end 80 when (sArg = 'unixroot') then 81 do 82 if i = words(sArgs) then 83 do 84 say 'syntax error: '''sArg''' is missing the path.' 85 exit(12); 86 end 87 i = i + 1; 88 sPathUnix = word(sArgs, i); 89 end 90 when (sArg = 'kbuild' | sArg = 'kBuild') then 91 do 92 if i = words(sArgs) then 93 do 94 say 'syntax error: '''sArg''' is missing the path.' 95 exit(12); 96 end 97 i = i + 1; 98 sPathkBuild = word(sArgs, i); 99 end 69 100 when (sArg = 'uninstall') then 70 101 fRM = 1; … … 80 111 end 81 112 else 113 do 82 114 sBuildType = ToLower(sArg); 83 end 84 85 if (sBuildType <> 'release' & sBuildType <> 'debug') then 86 do 87 call syntax; 88 exit(12); 89 end 90 115 if (sBuildType <> 'release' & sBuildType <> 'debug') then 116 do 117 say 'syntax error: Invalid build type '''sBuildType'''. valid types are: release and debug' 118 exit(12); 119 end 120 end 121 end 91 122 92 123 /* … … 95 126 */ 96 127 parse source . . sSrc 97 sPathRoot = filespec('drive', sSrc) || strip(filespec('path', sSrc), 'T', '\'); 98 sPathRootF = translate(sPathRoot, '/', '\'); 99 100 /* 101 * Figure where the tools directory is. 128 sPathRoot = ToDosSlash(FixPath(filespec('drive', sSrc) || strip(filespec('path', sSrc), 'T', '\'))); 129 sPathRootF = ToUnixSlash(sPathRoot); 130 if (substr(sPathRootF, 1, 2) = '//') then 131 do 132 say 'error: script invoked with UNC path. that won''t work.' 133 exit(12); 134 end 135 136 /* 137 * Figure where the UNIXROOT is. 102 138 * 103 * The tools directory is where we've got all the precompiled kNIX 104 * binaries and headers which are required to bootstrap kNIX. In 105 * GenToo terminology this is 'stage1'. 106 */ 107 sPathTools = sPathRoot || '\tools'; 108 sPathToolsF = translate(sPathTools, '/', '\'); 109 sPathToolsFD= translate(filespec('path', sPathTools), '/', '\') || 'tools'; 139 * The UNIXROOT is one or our parent directories, it is where all the 140 * unix/gnu tools are installed. It is also where you will install 141 * the packages that we compiler. If not specified we will got hunting 142 * for it... 143 */ 144 if (sPathUnix = '') then 145 do 146 sPathUnix = ToDosSlash(sPathRoot); 147 do while (1) 148 say 'sPathUnix='sPathUnix 149 if (DirExists(sPathUnix'\usr\bin')) then 150 leave; 151 152 /* next */ 153 sTmp = filespec('drive', sPathUnix)||strip(filespec('path', sPathUnix), 'T', '\'); 154 if (sTmp = sPathUnix) then 155 do 156 say 'error: cannot find a suitable unix root directory. Use the --unixroot <path> option.' 157 exit(12) 158 end 159 if (length(sTmp) == 2) then 160 sTmp = sTmp||'\'; 161 sPathUnix = sTmp; 162 end 163 say 'info: detected unix root at '''sPathUnix'''.'; 164 end 165 sPathUnix = ToDosSlash(FixPath(sPathUnix)); 166 sPathUnixF = ToUnixSlash(sPathUnix); 167 sPathUnixFD= ToUnixSlash(filespec('path', sPathUnix)||filespec('name', sPathUnix)); 168 if (ToLower(sPathUnixF) <> substr(ToLower(sPathRootF), 1, length(sPathUnixF))) then 169 say 'warning: the source tree is not under the unix root.'; 110 170 111 171 /* 112 172 * Figure where the output directory is. 113 * (kBuild actually decides this )173 * (kBuild actually decides this, so kee it in sync.) 114 174 */ 115 175 sPathOut = sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'sBuildType … … 119 179 * Check for kBuild. 120 180 */ 121 sPathkBuild = EnvGet('PATH_KBUILD');122 181 if (sPathkBuild = '') then 123 182 sPathkBuild = sPathRoot'\kBuild'; 124 sPathkBuild = translate(sPathkBuild, '\', '/');125 sPathkBuildF = translate(sPathkBuild, '/', '\');183 sPathkBuild = ToDosSlash(FixPath(sPathkBuild)); 184 sPathkBuildF = ToUnixSlash(sPathkBuild); 126 185 if (\FileExists(sPathkBuild'\footer.kmk')) then 127 186 do 128 say 'fatal error: cannot find kBuild!';187 say 'fatal error: cannot find a kBuild valid installation!'; 129 188 say 'check the build instructions (web) for how to get and install kBuild!'; 130 189 exit(8); … … 132 191 133 192 /* 193 * Check the gcc path. 194 */ 195 if (FileExists(sPathGcc'/usr/bin/g++.exe')) then 196 sPathGcc = sPathGcc'/usr'; 197 sPathGcc = FixPath(sPathGcc); 198 if (\FileExists(sPathGcc'/bin/g++.exe')) then 199 do 200 say 'fatal error: cannot find g++.exe at the specific gcc location: 'sPathGcc; 201 say 'Use the --gcc <path> option to point to a proper gcc installation.' 202 exit(8); 203 end 204 205 /* 134 206 * Setup the environment. 135 207 */ 136 208 /* cleanup */ 209 asBuildTypes.0 = 2; 210 asBuildTypes.1 = 'debug'; 211 asBuildTypes.2 = 'release'; 212 asStages.0 = 2 213 asStages.1 = 'stage1' 214 asStages.2 = 'stage2' 137 215 do i = 1 to asBuildTypes.0 138 s Mode = asBuildTypes.i;139 call EnvAddFront 1, 'PATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'s Mode'\dist\bin;'140 call EnvAddFront 1, 'PATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'s Mode'\dist\usr\omfhackbin;'141 call EnvAddFront 1, 'PATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'s Mode'\dist\usr\bin;'142 call EnvAddFront 1, 'PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'s Mode'/dist/bin;'143 call EnvAddFront 1, 'PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'s Mode'/dist/usr/bin;'144 call EnvAddFront 1, 'C_INCLUDE_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'s Mode'/dist/usr/include;'145 call EnvAddFront 1, 'CPLUS_INCLUDE_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'s Mode'/dist/usr/include;'146 call EnvAddFront 1, 'COBJ_INCLUDE_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'s Mode'/dist/usr/include;'147 call EnvAddFront 1, 'LIBRARY_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'s Mode'/dist/lib;'148 call EnvAddFront 1, 'LIBRARY_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'s Mode'/dist/usr/lib;'149 call EnvAddFront 1, 'LIBRARY_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'s Mode'/dist/usr/lib/gcc-lib/i386-pc-os2-emx/3.3.5;'216 sType = asBuildTypes.i; 217 call EnvAddFront 1, 'PATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'sType'\dist\bin;' 218 call EnvAddFront 1, 'PATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'sType'\dist\usr\omfhackbin;' 219 call EnvAddFront 1, 'PATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'sType'\dist\usr\bin;' 220 call EnvAddFront 1, 'PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'sType'/dist/bin;' 221 call EnvAddFront 1, 'PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'sType'/dist/usr/bin;' 222 call EnvAddFront 1, 'C_INCLUDE_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'sType'/dist/usr/include;' 223 call EnvAddFront 1, 'CPLUS_INCLUDE_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'sType'/dist/usr/include;' 224 call EnvAddFront 1, 'COBJ_INCLUDE_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'sType'/dist/usr/include;' 225 call EnvAddFront 1, 'LIBRARY_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'sType'/dist/lib;' 226 call EnvAddFront 1, 'LIBRARY_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'sType'/dist/usr/lib;' 227 call EnvAddFront 1, 'LIBRARY_PATH', sPathRootF'/out/'sBuildTarget'.'sBuildArch'/'sType'/dist/usr/lib/gcc-lib/i386-pc-os2-emx/3.3.5;' 150 228 do j = 1 to asStages.0 151 call EnvAddFront 1,'BEGINLIBPATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'s Mode'\obj\gcc\gcc\'asStages.j';'229 call EnvAddFront 1,'BEGINLIBPATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'sType'\obj\gcc\gcc\'asStages.j';' 152 230 end 153 call EnvAddFront 1, 'BEGINLIBPATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'s Mode'\dist\lib;'154 call EnvAddFront 1, 'BEGINLIBPATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'s Mode'\dist\usr\lib;'231 call EnvAddFront 1, 'BEGINLIBPATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'sType'\dist\lib;' 232 call EnvAddFront 1, 'BEGINLIBPATH', sPathRoot'\out\'sBuildTarget'.'sBuildArch'\'sType'\dist\usr\lib;' 155 233 end 156 234 if (fUseBuildEnv) then 235 do 157 236 'call BuildEnv.cmd unixõ vac365õ vac308õ toolkit452õ toolkit40õ emxõ emxpgccõ gcc302õ gcc303õ gcc321õ gcc322õ gcc335õ' 158 159 /* Basics */ 160 if (fUseBuildEnv & \fRm) then 161 'call BuildEnv.cmd cvs~ emx~ ';/*svn~'*/ 162 163 /* We do not want any influence from the emx, that's only runtime stuff. */ 164 call EnvSet 0, 'LDPATH' 165 call EnvSet 0, 'LIBRARY_PATH' 166 call EnvSet 0, 'C_INCLUDE_PATH' 167 call EnvSet 0, 'CPLUS_INCLUDE_PATH' 168 call EnvSet 0, 'COBJ_INCLUDE_PATH' 169 170 /* GCC */ 171 if (fUseStagedGcc | fRm) then 172 call GCC3xx 'gcc335', 'install', fRm, 1, 'gcc335' 173 else 174 do 175 'call BuildEnv.cmd gcc335' 176 call EnvAddFront fRm, 'LIBRARY_PATH', translate(EnvGet('PATH_IGCC'), '/', '\')'/lib;' 177 call EnvAddFront fRm, 'LIBRARY_PATH', translate(EnvGet('PATH_IGCC'), '/', '\')'/lib/gcc-lib/i386-pc-os2-emx/3.3.5/;' 178 end 179 180 /* ilink */ 181 if (fileExists(sPathTools'\x86.os2\vacpp\ilink\ilink.exe')) then 182 do 183 call EnvAddFront fRm, 'PATH', sPathTools'\x86.os2\vacpp\ilink;'; 184 call EnvAddFront fRm, 'DPATH', sPathTools'\x86.os2\vacpp\ilink;'; 185 call EnvAddFront fRm, 'BEGINLIBPATH', sPathTools'\x86.os2\vacpp\ilink;'; 186 call EnvSet fRm, 'EMXOMFLD_LINKER', 'ilink' 187 call EnvSet fRm, 'EMXOMFLD_TYPE', 'VAC365' 188 end 189 190 /* icsdebug */ 191 if (fileExists(sPathTools'\x86.os2\vacpp\icsdebug\bin\icsdebug.exe')) then 192 do 193 call EnvAddFront fRm, 'PATH', sPathTools'\x86.os2\vacpp\icsdebug\bin;'; 194 call EnvAddFront fRm, 'DPATH', sPathTools'\x86.os2\vacpp\icsdebug\help;'; 195 call EnvAddFront fRm, 'HELP', sPathTools'\x86.os2\vacpp\icsdebug\help;'; 196 call EnvAddFront fRm, 'BEGINLIBPATH', sPathTools'\x86.os2\vacpp\icsdebug\dll;'; 197 call EnvAddFront fRm, 'LOCPATH', sPathTools'\x86.os2\vacpp\icsdebug\locale;'; 198 end 199 200 /* idebug */ 201 if (fileExists(sPathTools'\x86.os2\vacpp\idebug\bin\idebug.exe')) then 202 do 203 call EnvAddFront fRm, 'PATH', sPathTools'\x86.os2\vacpp\idebug\bin;'; 204 call EnvAddFront fRm, 'DPATH', sPathTools'\x86.os2\vacpp\idebug\help;'; 205 call EnvAddFront fRm, 'HELP', sPathTools'\x86.os2\vacpp\idebug\help;'; 206 call EnvAddFront fRm, 'BEGINLIBPATH', sPathTools'\x86.os2\vacpp\idebug\dll;'; 207 call EnvAddFront fRm, 'NLSPATH', sPathTools'\x86.os2\vacpp\icsdebug\msg\%N;'; 208 end 209 210 /* other */ 211 call EnvSet fRm, 'BUILD_PROJECT', 'GCCOS2' 212 call EnvSet fRm, 'BUILD_MODE', translate(sBuildType) /* deprecated */ 213 call EnvSet fRm, 'PATH_TOP', sPathRootF 214 call EnvSet fRm, 'PATH_TOPD', substr(sPathRootF, 3) 215 call EnvSet fRm, 'PATH_OBJ', sPathOutF 216 call EnvSet fRm, 'PATH_OBJD', substr(sPathOutF, 3) 217 218 /* kBuild. */ 219 call EnvSet fRm, 'PATH_KBUILD', sPathkBuildF 220 call EnvAddFront fRm, 'PATH', sPathkBuild'\bin\os2.x86;' 221 call EnvAddFront fRm, 'BEGINLIBPATH', sPathkBuild'\bin\os2.x86;' 222 call EnvSet fRm, 'BUILD_TYPE', sBuildType 223 call EnvSet fRm, 'BUILD_TARGET', sBuildTarget 224 call EnvSet fRm, 'BUILD_TARGET_ARCH', 'x86' 225 call EnvSet fRm, 'BUILD_TARGET_CPU', 'i386' 226 call EnvSet fRm, 'BUILD_PLATFORM', sBuildTarget 227 call EnvSet fRm, 'BUILD_PLATFORM_ARCH','x86' 228 call EnvSet fRm, 'BUILD_PLATFORM_CPU', 'i386' 229 230 /* unixroot - todo: check for this and don't override existing unixroot! */ 231 call EnvSet fRm, 'UNIXROOT', sPathToolsF 232 call EnvAddFront 1, 'PATH', '.;' /* the sucker gets removed by 'buildenv toolkit40õ' */ 233 call EnvAddFront fRm, 'PATH', sPathToolsF'/usr/bin;' 234 call EnvAddFront fRm, 'PATH', sPathTools'\usr\bin;' 235 call EnvAddFront fRm, 'PATH', sPathToolsF'/bin;' 236 call EnvAddFront fRm, 'PATH', sPathTools'\bin;' 237 call EnvAddFront fRm, 'BEGINLIBPATH', sPathTools'\lib;'sPathTools'\bin;'sPathTools'\usr\bin;'sPathTools'\usr\lib;' 238 239 do i = 1 to asStages.0 240 call EnvAddFront fRm,'BEGINLIBPATH', sPathOut'\gcc\gcc\'asStages.i';' 241 end 242 243 /* hmm do I actually want this in the path? */ 244 /* at present we don't 245 call EnvAddFront fRm, 'C_INCLUDE_PATH', sPathToolsF'/usr/include;' 246 call EnvAddFront fRm, 'CPLUS_INCLUDE_PATH', sPathToolsF'/usr/include;' 247 call EnvAddFront fRm, 'OBJC_INCLUDE_PATH', sPathToolsF'/usr/include;' 248 call EnvAddFront fRm, 'LIBRARY_PATH', sPathToolsF'/usr/lib;' 249 */ 250 251 /* build tools? */ 252 call EnvSet fRm, 'PATH_BUILTUNIX', sPathOutF'/dist' 253 call EnvAddFront fRm, 'PATH', sPathOutF'/dist/usr/bin;' 254 call EnvAddFront fRm, 'PATH', sPathOut'\dist\usr\bin;' 255 call EnvAddFront fRm, 'PATH', sPathOutF'/dist/bin;' 256 call EnvAddFront fRm, 'PATH', sPathOut'\dist\bin;' 257 call EnvAddFront fRm, 'PATH', sPathOut'\dist/usr\omfhackbin;' /* remove me! */ 258 call EnvAddFront fRm, 'BEGINLIBPATH', sPathOut'\dist\usr\lib;' 259 call EnvAddFront fRm, 'C_INCLUDE_PATH', sPathOutF'/dist/usr/include;' 260 call EnvAddFront fRm, 'CPLUS_INCLUDE_PATH', sPathOutF'/dist/usr/include;' 261 call EnvAddFront fRm, 'OBJC_INCLUDE_PATH', sPathOutF'/dist/usr/include;' 262 call EnvAddFront fRm, 'LIBRARY_PATH', sPathOutF'/dist/usr/lib;' 263 call EnvAddFront fRm, 'LIBRARY_PATH', sPathOutF'/dist/usr/lib/gcc-lib/i386-pc-os2-emx/3.3.5;' 264 265 call EnvSet 1, 'AC_PREFIX' 266 call EnvSet 1, 'AC_MACRODIR' 267 call EnvSet fRm, 'PATH_SEPARATOR', ';' 268 call EnvSet fRm, 'CONFIG_SHELL', sPathToolsF'/bin/sh.exe' 269 call EnvSet fRm, 'MAKESHELL', sPathToolsF'/bin/sh.exe' 270 271 /* this messes up the EMX build, so unset it instead: 272 * call EnvSet fRm, 'EMXSHELL', sPathTools'\bin\sh.exe' */ 273 call EnvSet 1, 'EMXSHELL' 274 call EnvSet fRm, 'SHELL', sPathToolsF'/bin/sh.exe' 275 /*call EnvSet fRm, 'MAKE', sPathkBuildF'/bin/os2.x86/kmk.exe'*/ 276 call EnvSet fRM, 'PERLLIB_PREFIX', 'L:/Perl/lib;'sPathToolsF'/usr/lib/perl5' 277 call EnvSet fRM, 'PERL_SH_DIR', sPathToolsF'/bin' 278 call EnvSet fRM, 'PERL_BADLANG', '0' 279 call EnvSet fRM, 'TCL_LIBRARY', sPathToolsF'/usr/lib/tcl8.0' 280 281 call EnvSet fRm, 'HOSTTYPE', 'i386' 282 sHostName = EnvGet('HOSTNAME'); 283 if (sHostName = '') then 284 do 285 say 'warning: hostname not set. using ''blah'' as hostname.'; 286 sHostName = 'blah'; 287 call EnvSet fRm, 'HOSTNAME', sHostName; 288 end 289 if (EnvGet('LOGNAME') = '') then 290 call EnvSet fRm, 'LOGNAME', sHostName; 291 292 if (\fRm) then 293 do 294 sTmpF = translate(EnvGet('TMP'), '/', '\'); 295 call EnvSet 0, 'TMP', sTmpF; 296 call EnvSet 0, 'TMPDIR', sTmpF; 297 call EnvSet 0, 'TEMP', sTmpF; 298 call EnvSet 0, 'TEMPDIR', sTmpF; 299 end 300 301 /* libtool */ 302 call EnvSet fRm, 'LT_OS2_DLL_PREFIX', 'I' 303 call EnvSet 1, 'LT_OS2_DLL_MAPPED', '' 304 305 /* helpers for scripts */ 306 call EnvSet fRm, 'AWK', sPathToolsF'/usr/bin/gawk.exe' 307 call EnvSet fRm, 'GAWK', sPathToolsF'/usr/bin/gawk.exe' 308 call EnvSet fRm, 'SH', sPathToolsF'/bin/sh.exe' 309 call EnvSet fRm, 'ASH', sPathToolsF'/bin/ash.exe' 310 call EnvSet fRm, 'BASH', sPathToolsF'/bin/bash.exe' 311 312 /* Workaround for make handle leak. */ 313 call EnvSet fRm, 'EMXOPT', '-c -n -h1024'; 237 call EnvAddFront 1, 'PATH', '.;' /* the sucker gets removed by 'buildenv toolkit40õ' */ 238 end 314 239 315 240 /* unset some varible which may f**k up. */ 241 call EnvSet 1, 'AC_PREFIX' 242 call EnvSet 1, 'AC_MACRODIR' 316 243 call EnvSet 1, 'CC', '' 317 244 call EnvSet 1, 'CFLAGS', '' … … 326 253 call EnvSet 1, 'BISON_HAIRY', '' 327 254 call EnvSet 1, 'BISON_SIMPLE', '' 255 call EnvSet 1, 'EMXSHELL', '' /* messes up stuff */ 256 257 /* bird basics */ 258 if (fUseBuildEnv & \fRm) then 259 'call BuildEnv.cmd cvs~ emx~ ';/*svn~'*/ 260 261 /* We do not want any influence from the emx, that's only runtime stuff. */ 262 call EnvSet 1, 'LDPATH' 263 call EnvSet 1, 'LIBRARY_PATH' 264 call EnvSet 1, 'C_INCLUDE_PATH' 265 call EnvSet 1, 'CPLUS_INCLUDE_PATH' 266 call EnvSet 1, 'COBJ_INCLUDE_PATH' 267 268 /* icsdebug */ 269 if (fileExists(sPathUnix'\opt\icsdebug\bin\icsdebug.exe')) then 270 do 271 call EnvAddFront fRm, 'PATH', sPathUnix'\opt\icsdebug\bin;'; 272 call EnvAddFront fRm, 'DPATH', sPathUnix'\opt\icsdebug\help;'; 273 call EnvAddFront fRm, 'HELP', sPathUnix'\opt\icsdebug\help;'; 274 call EnvAddFront fRm, 'BEGINLIBPATH', sPathUnix'\opt\icsdebug\dll;'; 275 call EnvAddFront fRm, 'LOCPATH', sPathUnix'\opt\icsdebug\locale;'; 276 end 277 278 /* idebug */ 279 if (fileExists(sPathUnix'\opt\idebug\bin\idebug.exe')) then 280 do 281 call EnvAddFront fRm, 'PATH', sPathUnix'\opt\idebug\bin;'; 282 call EnvAddFront fRm, 'DPATH', sPathUnix'\opt\idebug\help;'; 283 call EnvAddFront fRm, 'HELP', sPathUnix'\opt\idebug\help;'; 284 call EnvAddFront fRm, 'BEGINLIBPATH', sPathUnix'\opt\idebug\dll;'; 285 call EnvAddFront fRm, 'NLSPATH', sPathUnix'\opt\icsdebug\msg\%N;'; 286 end 287 288 /* kBuild. */ 289 call EnvSet fRm, 'PATH_KBUILD', sPathkBuildF 290 call EnvAddFront fRm, 'PATH', sPathkBuild'\bin\os2.x86;' 291 call EnvAddFront fRm, 'BEGINLIBPATH', sPathkBuild'\bin\os2.x86;' 292 call EnvSet fRm, 'BUILD_TYPE', sBuildType 293 call EnvSet fRm, 'BUILD_TARGET', sBuildTarget 294 call EnvSet fRm, 'BUILD_TARGET_ARCH', 'x86' 295 call EnvSet fRm, 'BUILD_TARGET_CPU', 'i386' 296 call EnvSet fRm, 'BUILD_PLATFORM', sBuildTarget 297 call EnvSet fRm, 'BUILD_PLATFORM_ARCH','x86' 298 call EnvSet fRm, 'BUILD_PLATFORM_CPU', 'i386' 299 300 /* unixroot (assumes perl, tcl and stuff...) */ 301 call EnvSet fRm, 'UNIXROOT', sPathUnixF 302 call EnvAddFront fRm, 'PATH', sPathUnixF'/usr/local/bin;' 303 call EnvAddFront fRm, 'PATH', sPathUnix'\usr\local\bin;' 304 call EnvAddFront fRm, 'PATH', sPathUnixF'/usr/bin;' 305 call EnvAddFront fRm, 'PATH', sPathUnix'\usr\bin;' 306 call EnvAddFront fRm, 'PATH', sPathUnixF'/bin;' 307 call EnvAddFront fRm, 'PATH', sPathUnix'\bin;' 308 call EnvAddFront fRm, 'BEGINLIBPATH', sPathUnix'\lib;'sPathUnix'\usr\lib;'sPathUnix'\usr\local\lib;' 309 310 call EnvAddFront fRm, 'C_INCLUDE_PATH', sPathUnixF'/usr/include;'sPathUnixF'/usr/local/include;' 311 call EnvAddFront fRm, 'CPLUS_INCLUDE_PATH', sPathUnixF'/usr/include;'sPathUnixF'/usr/local/include;' 312 call EnvAddFront fRm, 'OBJC_INCLUDE_PATH', sPathUnixF'/usr/include;'sPathUnixF'/usr/local/include;' 313 call EnvAddFront fRm, 'LIBRARY_PATH', sPathUnixF'/lib;'sPathUnixF'/usr/lib;'sPathUnixF'/usr/local/lib;' 314 315 call EnvSet fRm, 'PATH_SEPARATOR', ';' 316 sShell = ''; 317 if (sShell = '' & FileExists(sPathUnixF'/bin/ash.exe')) then sShell = sPathUnixF'/bin/ash.exe'; 318 if (sShell = '' & FileExists(sPathUnixF'/bin/sh.exe')) then sShell = sPathUnixF'/bin/sh.exe'; 319 if (sShell = '' & FileExists(sPathUnixF'/bin/bash.exe')) then sShell = sPathUnixF'/bin/bash.exe'; 320 if (sShell = '') then sShell = sPathkBuildF'/bin/os2.x86/kmk_ash.exe'; 321 call EnvSet fRm, 'CONFIG_SHELL', sShell 322 call EnvSet fRm, 'MAKESHELL', sShell 323 call EnvSet fRm, 'SHELL', sShell 324 325 call EnvSet fRM, 'PERLLIB_PREFIX', 'L:/Perl/lib;'sPathUnixF'/usr/lib/perl5' 326 call EnvSet fRM, 'PERL_SH_DIR', sPathUnixF'/bin' 327 call EnvSet fRM, 'PERL_BADLANG', '0' 328 call EnvSet fRM, 'TCL_LIBRARY', sPathUnixF'/usr/lib/tcl8.0' 329 330 /* unixroot: must have all the temp variables with unix slashes. */ 331 if (\fRm) then 332 do 333 sTmpF = ToUnixSlash(FixPath(EnvGet('TMP'))); 334 if (sTmpF = '') then sTmpF = sPathUnixF'/tmp'; 335 if (\DirExists(sTmpF)) then say 'warning: TMP='''sTmpF''' doesn''t exist!'; 336 call EnvSet fRM, 'TMP', sTmpF; 337 call EnvSet fRM, 'TEMP', sTmpF; 338 call EnvSet fRM, 'TMPDIR', sTmpF; 339 if ( pos(filespec('drive', sTmpF), SysDriveMap(filespec('drive', sTmpF), "REMOTE")) > 0, 340 & word(SysDriveInfo(filespec('drive', sTmpF)), 4) = 'RAMDISK') then 341 do 342 say 'warning: detected RAMFS, setting TMPDIR to ''.'' to make sure yacc will work.' 343 call EnvSet fRM, 'TMPDIR', '.'; 344 end 345 end 346 347 /* unixroot: hostname */ 348 sHostName = EnvGet('HOSTNAME'); 349 if (sHostName = '') then 350 do 351 say 'warning: hostname not set. using ''localhost'' as hostname.'; 352 sHostName = 'localhost'; 353 call EnvSet fRm, 'HOSTNAME', sHostName; 354 end 355 356 /* unixroot: there must a user and home directory. */ 357 if (EnvGet('USER') = '') then 358 call EnvSet fRm, 'USER', EnvGet('USERNAME'); 359 if (EnvGet('USER') = '') then 360 call EnvSet fRm, 'USER', EnvGet('LOGNAME'); 361 if (EnvGet('USER') = '') then 362 call EnvSet fRm, 'USER', sHostName; 363 if (EnvGet('USERNAME') = '') then 364 call EnvSet fRm, 'USERNAME', EnvGet('USER'); 365 if (EnvGet('LOGNAME') = '') then 366 call EnvSet fRm, 'LOGNAME', EnvGet('USER'); 367 if (EnvGet('HOME') = '') then 368 call EnvSet fRm, 'HOME', ToUnixSlash(EnvGet('TMP')); 369 370 /* unixroot: libtool */ 371 call EnvSet fRm, 'LT_OS2_DLL_PREFIX', 'k' 372 call EnvSet 1, 'LT_OS2_DLL_MAPPED', '' 373 374 /* Workaround for make handle leak. */ 375 call EnvSet fRm, 'EMXOPT', '-c -n -h1024'; 376 377 /* GCC */ 378 call GCC3xx 'gcc335', fRm, sPathGcc 379 380 /* The built stuff? */ 381 if (fWithBuiltStuff) then 382 do 383 call EnvSet fRm, 'PATH_BUILTUNIX', sPathOutF'/dist' 384 call EnvAddFront fRm, 'PATH', sPathOutF'/dist/usr/bin;' 385 call EnvAddFront fRm, 'PATH', sPathOut'\dist\usr\bin;' 386 call EnvAddFront fRm, 'PATH', sPathOutF'/dist/bin;' 387 call EnvAddFront fRm, 'PATH', sPathOut'\dist\bin;' 388 call EnvAddFront fRm, 'PATH', sPathOut'\dist\usr\omfhackbin;' /* remove me! */ 389 call EnvAddFront fRm, 'BEGINLIBPATH', sPathOut'\dist\usr\lib;' 390 call EnvAddFront fRm, 'C_INCLUDE_PATH', sPathOutF'/dist/usr/include;' 391 call EnvAddFront fRm, 'CPLUS_INCLUDE_PATH', sPathOutF'/dist/usr/include;' 392 call EnvAddFront fRm, 'OBJC_INCLUDE_PATH', sPathOutF'/dist/usr/include;' 393 call EnvAddFront fRm, 'LIBRARY_PATH', sPathOutF'/dist/usr/lib;' 394 call EnvAddFront fRm, 'LIBRARY_PATH', sPathOutF'/dist/usr/lib/gcc-lib/i386-pc-os2-emx/3.3.5;' 395 end 328 396 329 397 /* fix LIBRARY_PATH (gcc configure is kind of picky about this). */ … … 580 648 DirExists: procedure 581 649 parse arg sDir, sComplain 582 rc = SysFileTree(sDir, 'sDirs', 'DO'); 583 if (rc = 0 & sDirs.0 = 1) then 584 return 1; 585 if (sComplain <> '') then 650 rc = SysFileTree(sDir, 'asDirs', 'DO'); 651 if (rc = 0 & asDirs.0 = 1) then 652 rc = 1; 653 else 654 rc = 0; 655 if (rc = 0 & sComplain <> '') then 586 656 say sComplain ''''sDir'''.'; 587 return 0; 588 589 590 591 /* 592 * EMX/GCC 3.x.x - this environment must be used 'on' the ordinary EMX. 593 * Note! bin.new has been renamed to bin! 594 * Note! make .lib of every .a! in 4OS2: for /R %i in (*.a) do if not exist %@NAME[%i].lib emxomf %i 595 */ 596 GCC3xx: procedure expose aCfg. aPath. sPathFile sPathTools sPathToolsF 597 parse arg sToolId,sOperation,fRM,fQuiet,sPathId 598 599 /* 600 * EMX/GCC main directory. 601 */ 602 /*sGCC = PathQuery(sPathId, sToolId, sOperation); 603 if (sGCC = '') then 604 return 1; 605 /* If config operation we're done now. */ 606 if (pos('config', sOperation) > 0) then 607 return 0; 608 */ 609 sGCC = sPathTools'\x86.os2\gcc\staged' 610 sGCCBack = translate(sGCC, '\', '/'); 611 sGCCForw = translate(sGCC, '/', '\'); 657 drop asDirs.; 658 return rc; 659 660 661 /** 662 * GCC 3.3.x. 663 */ 664 GCC3xx: procedure expose aCfg. aPath. sPathFile sPathUnix sPathUnixF 665 parse arg sToolId, fRM, sPathGcc 666 667 sGCCBack = ToDosSlash(sPathGcc); 668 sGCCForw = ToUnixSlash(sPathGcc); 612 669 chMajor = '3'; 613 670 chMinor = left(right(sToolId, 2), 1); … … 615 672 sVer = chMajor'.'chMinor'.'chRel 616 673 617 call EnvSet fRM, 'PATH_IGCC', sGCCBack; 618 call EnvSet fRM, 'CCENV', 'IGCC' 619 call EnvSet fRM, 'BUILD_ENV', 'IGCC' 620 call EnvSet fRM, 'BUILD_PLATFORM', 'OS2' 621 674 call EnvSet fRM, 'PATH_IGCC', sGCCBack; 622 675 call EnvAddFront fRM, 'BEGINLIBPATH', sGCCBack'\lib;' 623 676 call EnvAddFront fRM, 'PATH', sGCCForw'/bin;'sGCCBack'\bin;' 624 677 call EnvAddFront fRM, 'C_INCLUDE_PATH', sGCCForw'/include' 625 call EnvAddFront fRM, 'LIBRARY_PATH', sGCCForw'/lib/gcc-lib/i386-pc-os2-emx/'sVer';'sGCCForw'/lib;' sGCCForw'/lib/mt;'678 call EnvAddFront fRM, 'LIBRARY_PATH', sGCCForw'/lib/gcc-lib/i386-pc-os2-emx/'sVer';'sGCCForw'/lib;' 626 679 call EnvAddFront fRm, 'CPLUS_INCLUDE_PATH', sGCCForw'/include;' 627 680 call EnvAddFront fRm, 'CPLUS_INCLUDE_PATH', sGCCForw'/include/c++/'sVer'/backward;' … … 630 683 call EnvSet fRM, 'PROTODIR', sGCCForw'/include/cpp/gen' 631 684 call EnvSet fRM, 'OBJC_INCLUDE_PATH', sGCCForw'/include' 632 call EnvAddFront fRM, 'INFOPATH', sGCCForw'/info' 633 call EnvSet fRM, 'EMXBOOK', 'emxdev.inf+emxlib.inf+emxgnu.inf+emxbsd.inf' 634 call EnvAddFront fRM, 'HELPNDX', 'emxbook.ndx', '+', 1 635 636 /* 637 * Verify. 638 */ 639 if (pos('verify', sOperation) <= 0) then 640 return 0; 641 642 if (rc = 0) then 643 rc = CheckCmdOutput('g++ --version', 0, fQuiet, sVer); 644 if (rc = 0) then 645 do 646 sVerAS = '2.14'; 647 rc = CheckCmdOutput('as --version', 0, fQuiet, 'GNU assembler 'sVerAS); 648 end 649 return rc; 650 685 686 if (1) then 687 do 688 say 'info: Using wl.exe as OMF linker.'; 689 call EnvSet fRM, 'EMXOMFLD_TYPE', 'WLINK' 690 call EnvSet fRM, 'EMXOMFLD_LINKER', 'wl.exe' 691 end 692 else 693 do 694 say 'info: Using ilink.exe (v5) as OMF linker.'; 695 call EnvSet fRM, 'EMXOMFLD_TYPE', 'VAC365' 696 call EnvSet fRM, 'EMXOMFLD_LINKER', 'ilink.exe' 697 end 698 return 0; 651 699 652 700 … … 668 716 669 717 /** 718 * Fixes the casing of a path. 719 * Returns a DOS path. 720 */ 721 FixPath: procedure 722 parse arg sPath 723 724 sPath = ToDosSlash(sPath); 725 sDrv = translate(strip(filespec('drive', sPath))); 726 if (sDrv = '' & left(sPath, 2) = '\\') then 727 sDrv = '\\' || translate(word(strip(translate(sPath, ' ', '\')), 1)); 728 sPath = substr(sPath, length(sDrv) + 1); 729 if (sPath = '\' | sPath = '/') then 730 return sDrv||sPath; 731 732 /* split the path into words and take them on one by one. */ 733 sPath = strip(translate(sPath, ' ', '\/')); 734 sNewPath = sDrv; 735 do i = 1 to words(sPath) 736 sCur = word(sPath, i); 737 sTmp = sNewPath'\'sCur; 738 rc = SysFileTree(sTmp'?', 'asEntries', 'BO'); 739 if (rc = 0) then 740 do 741 do j = 1 to asEntries.0 742 sName = filespec('name', asEntries.j); 743 if (ToLower(sName) = ToLower(sCur)) then 744 do 745 sTmp = asEntries.j; 746 leave 747 end 748 end 749 drop asEntries.; 750 end 751 sNewPath = sTmp; 752 end 753 return sNewPath; 754 755 756 /** 670 757 * Translate a string to lower case. 671 758 */ … … 674 761 return translate(sString, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'); 675 762 763 764 /** 765 * Translate a path to unix slashes. 766 */ 767 ToUnixSlash: procedure 768 parse arg sPath 769 return translate(sPath, '/', '\'); 770 771 772 /** 773 * Translate a path to dos slashes. 774 */ 775 ToDosSlash: procedure 776 parse arg sPath 777 return translate(sPath, '\', '/'); 778
Note:
See TracChangeset
for help on using the changeset viewer.