[PATCH] Support for building using WSL (Windows Subsystem for Linux) on Windows

Andrew Luo andrewluotechnologies at outlook.com
Fri Dec 14 08:58:14 UTC 2018


Anyways, got it working with an environment variable, patch is attached.

To use:

1. Open WSL
2. Run configure, pass in boot JDK
3. Run make (no extra error messages here).

Thanks,

-Andrew

-----Original Message-----
From: build-dev <build-dev-bounces at openjdk.java.net> On Behalf Of Andrew Luo
Sent: Thursday, December 13, 2018 11:07 PM
To: Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com>; Erik Joelsson <erik.joelsson at oracle.com>
Cc: build-dev at openjdk.java.net
Subject: RE: [PATCH] Support for building using WSL (Windows Subsystem for Linux) on Windows

Didn't see this message before I sent mine out.  How about an environment variable instead?  I don't want to make too much changes to the argument parsing logic, etc. of fixpath, instead in -w mode it could read an environment variable, perhaps FIXPATH_PATH and set PATH to that?

Thanks,

-Andrew

-----Original Message-----
From: Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com>
Sent: Thursday, December 13, 2018 10:36 PM
To: Erik Joelsson <erik.joelsson at oracle.com>
Cc: Andrew Luo <andrewluotechnologies at outlook.com>; build-dev at openjdk.java.net
Subject: Re: [PATCH] Support for building using WSL (Windows Subsystem for Linux) on Windows

Maybe we can get fixpath to help here? It could take an extra argument with -w, the additional directories to add to PATH before executing the target command?

/Magnus

> 13 dec. 2018 kl. 21:36 skrev Erik Joelsson <erik.joelsson at oracle.com>:
> 
>> On 2018-12-13 11:44, Andrew Luo wrote:
>> Oh, also, using WSLPATH to set PATH/l causes a LOT of extra output, namely, every time a Win32 executable is run this gets printed:
>> 
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /usr/local/sbin
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /usr/local/bin
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /usr/sbin
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /usr/bin
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /sbin
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /bin
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /usr/games
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /usr/local/games
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /snap/bin
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /usr/local/sbin
>> <3>init: (21845) ERROR: UtilTranslatePathList:2021: Failed to 
>> translate /usr/local/sbin
>> 
>> Don't know if there's any way to tell WSL to suppress it.
> 
> Hm, that becomes tricky. We need to export a PATH to Windows processes (Visual Studio processes really) that includes certain VS dirs so that they can load the dlls they need. It would be more convenient if that windows path could be stored in a different environment variable, but it doesn't seem like WSLENV can map between different names. Another approach could be to prefix the affected commands (CC etc) with something like "WSLENV=PATH/l PATH=...", with a filtered down version of the VS_PATH. That would also have the added benefit of making the commands we put in *.cmdline files be directly executable in a pure shell. Today those commands won't work since they rely on an exported PATH, even in Cygwin.
> 
> /Erik
> 
>> Thanks,
>> 
>> -Andrew
>> 
>> -----Original Message-----
>> From: Andrew Luo
>> Sent: Thursday, December 13, 2018 11:43 AM
>> To: Erik Joelsson <erik.joelsson at oracle.com>; Magnus Ihse Bursie 
>> <magnus.ihse.bursie at oracle.com>; build-dev at openjdk.java.net
>> Subject: RE: [PATCH] Support for building using WSL (Windows 
>> Subsystem for Linux) on Windows
>> 
>> Hi Erik,
>> 
>> Thanks for helping out on this.  I made some changes to your patch and can get it working on my system.  It's still building but it seems to be working.  Will update this thread once it's finished building...
>> 
>> Thanks,
>> 
>> -Andrew
>> 
>> -----Original Message-----
>> From: Erik Joelsson <erik.joelsson at oracle.com>
>> Sent: Thursday, December 13, 2018 10:36 AM
>> To: Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com>; Andrew Luo 
>> <andrewluotechnologies at outlook.com>; build-dev at openjdk.java.net
>> Subject: Re: [PATCH] Support for building using WSL (Windows 
>> Subsystem for Linux) on Windows
>> 
>> Hello,
>> 
>> It's nice to see this progressing!
>> 
>> I just wanted to let you know I took your patch from yesterday and started experimenting too. I managed to get configure to automatically find the Visual Studio installation as Magnus described, when running in a pure WSL shell without VS env. I still have some issues with the build though so the patch is not fully working yet. One thing I'm still experimenting with is the method of extraction of the VS variables. I think this can be improved more. In the old implementation we are relying on automatic conversion and sharing of some variables between Windows and the unix emulation (which Cygwin does for PATH and msys magically tries to do for all sorts of stuff). These need explicit declaration using WSLENV in WSL, but that also gives us a lot of control over it.
>> 
>> I have limited time to spend on this, so uploading the patch here for reference. Perhaps there is something there that could inspire you at least. I may get more time to revisit this next week or so.
>> 
>> http://cr.openjdk.java.net/~erikj/windows-wsl/webrev.01/index.html
>> 
>> /Erik
>> 
>>> On 2018-12-13 03:12, Magnus Ihse Bursie wrote:
>>>> On 2018-12-13 08:48, Andrew Luo wrote:
>>>> Hi,
>>>> 
>>>> I attached the latest patch, which now can use Windows paths.
>>> Great!
>>> 
>>> I looked at the code, and it looks really good. Just one request. I 
>>> understand why you want to unify the similar code between msys and 
>>> wsl, but unless you have actually verified on an msys system that 
>>> this does not break anything -- please do not do it. This entire 
>>> system of getting Windows environments to behave is very brittle, 
>>> and even things that looks like they "should" work, often turn out 
>>> not to do so in practice. So even though code duplication is a bad 
>>> thing in general, in this case I'd rather see that you just added 
>>> the support for WSL, instead of changing the old code. Unless, of 
>>> course, you have verified that it does not break msys.
>>> 
>>> I can also add that the code here is really horrendous. I'm sure 
>>> there's a more efficient way of achieving what we want -- sane, 
>>> space-free, universally usable paths that can be easily turned into 
>>> windows paths by fixpath, but there's been too many corner-cases, 
>>> too much of "oh no, now it breaks on cygwin if the code is in the 
>>> users home dir!" nasty surprises. Solving this properly would 
>>> probably involve creating some automated test that can be run on all 
>>> two (soon
>>> three) Windows unix environment. And I've never felt it worth it. So 
>>> it's been a lot of "well, just add this rewrite here too, just in 
>>> case, see, now it works!". I'm not proud of it, but it does it's thing.
>>> 
>>> (I also note that you didn't care about tr:ing the 8.3 path to lower 
>>> case. It's of course a matter of taste, but since the goal is to 
>>> transform the path to a unix-style path, I tend to think that a path 
>>> like /mnt/c/progra~1/micros~1/vc/cl.exe is more easier to the eye 
>>> than /mnt/c/PROGRA~1/MICROS~1/VC/cl.exe or whatever.)
>>> 
>>>>   The new instructions to build are (assuming 8.3 paths are enabled 
>>>> on your system...):
>>> Right, it's possible to disable 8.3 paths nowadays, yes? We should 
>>> probably add that to the build documentation.
>>>> 1. wsl must be started from a Windows Developer command prompt. To 
>>>> ensure the correct environment variables are propagated from 
>>>> Windows to WSL, you can run the following commands:
>>>> set WSLENV=INCLUDE/l:LIBPATH/l
>>>> 2. Start wsl (bash):
>>>> wsl
>>>> 3.    Run configure:
>>>> ./configure
>>>> --with-boot-jdk=/mnt/c/Users/Andrew/Downloads/openjdk-11.0.1_window
>>>> s-
>>>> x64_bin/jdk-11.0.1 --with-tools-dir="C:\Program Files 
>>>> (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary"
>>>> --with-ucrt-dll-dir="C:\Program Files (x86)\Windows 
>>>> Kits\10\Redist\ucrt\DLLs\x64"
>>>> 4.    Run make
>>>> I’ve tested make with the default target as well as “make images”
>>> Great, those are much simplified build instructions! If you are 
>>> happy with them, I can end here. However, I can't refrain from at 
>>> least mentioning that we do have code in place that should make even 
>>> a lot of these steps unnecessary. It's up to you if you want to make 
>>> the additional effort to adapt them to the WSL environment. In order:
>>> 
>>> 1) You should not have to start the Developer command prompt, nor 
>>> export the INCLUDE and LIBPATH environment variables. We locate the 
>>> vcenv.bat file (or whatever it's called), run this, and then extract 
>>> the relevant environment variables. But, maybe that is not possible 
>>> with that kind of env sharing between bat files and the unix 
>>> environment in WSL?
>>> 
>>> 2) We should be able to locate the relevant Visual Studio 
>>> installation and associated helper dll:s automatically, if if is 
>>> installed in a standard location. If the path rewriting is now 
>>> working properly, I see no reason why this would not work under WSL as well.
>>> 
>>> 3) The official stance is that only unix-style paths is allowed as 
>>> argument to configure flags. Otherwise we can't do things like read 
>>> the value of the flag and check if the file exists. For certain 
>>> arguments, this might work anyway, out of pure chance. But it's not 
>>> recommended. So if it ends up that you really need to point to the 
>>> visual studio installation, the example in the build confiuration 
>>> should be something like "--with-tools-dir="/mnt/c/Program Files 
>>> (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Auxiliary".
>>> 
>>>> The issues regarding the console input redirection I'm still 
>>>> investigating, but I doubt it's a bug in the build scripts, meaning 
>>>> it is likely a bug in the (boot) JDK or WSL.  Even if we fix the 
>>>> JDK, we probably still have to support older boot JDKs (even if the 
>>>> patch is backported), and waiting for Microsoft to fix a bug in WSL 
>>>> could take a while (and might only be fixed in a later version of Windows).
>>>> Thus, I think what we have is a good start, unless you think it's 
>>>> necessary to root cause the redirection issue first.  That said, I 
>>>> will keep this thread updated with my progress once I figure out 
>>>> the root cause of the issue.
>>> No, it's not necessary to find out the root cause. It would be nice 
>>> to know, but if the issue is only involving these two tools, and it 
>>> happens deterministically if it happens, I'm fine. Especially since 
>>> the workaround was actually an improvement. :-)
>>> 
>>> /Magnus
>>>> Thanks,
>>>> 
>>>> -Andrew
>>>> 
>>>> -----Original Message-----
>>>> From: Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com>
>>>> Sent: Wednesday, December 12, 2018 10:54 AM
>>>> To: Erik Joelsson <erik.joelsson at oracle.com>; Andrew Luo 
>>>> <andrewluotechnologies at outlook.com>; build-dev at openjdk.java.net
>>>> Subject: Re: [PATCH] Support for building using WSL (Windows 
>>>> Subsystem for Linux) on Windows
>>>> 
>>>>> On 2018-12-12 18:30, Erik Joelsson wrote:
>>>>> Hello,
>>>>> 
>>>>> I had the same trouble you describe trying to call cmd to create a 
>>>>> short path from WSL with an inline script. I managed to it working 
>>>>> by creating a script file like this:
>>>>> 
>>>>> shortName.cmd:
>>>>> 
>>>>> ---
>>>>> @ECHO OFF
>>>>> if '%1' NEQ '' echo %~s1
>>>>> ---
>>>>> 
>>>>> $ /mnt/c/Windows/System32/cmd.exe /c shortName.cmd "C:\Program Files"
>>>>> C:\PROGRA~1
>>>>> 
>>>>> We could put such a script in make/scripts.
>>>> That's a clever workaround. Andrew, can you see if you can use that 
>>>> technique to get the proper space safe path resolution to work? I 
>>>> think you can copy the msys code straight as it is, and just 
>>>> replace the call to cmd echo %~sA with cmd /c 
>>>> $TOPDIR/make/script/shortName.cmd, or whatever you end up calling it.
>>>>> /Erik
>>>>> 
>>>>>> On 2018-12-11 22:44, Andrew Luo wrote:
>>>>>> For the stdin/stdout redirection: basically, the issue was only 
>>>>>> occurring with those two executables.  Oddly enough, it would 
>>>>>> occur every time I tried (for SPP the output would be cutoff, 
>>>>>> presumably because the input was cutoff, and for the other 
>>>>>> executable,
>>>>>> available0 would throw an exception consistently for System.in).  
>>>>>> I have a hunch this is due to using WINAPI console functions for 
>>>>>> reading from a WSL shell, but I'm not 100% certain.  I plan to 
>>>>>> try to build a smaller sample that can reproduce the issue, and 
>>>>>> if it seems to be a Windows bug I will file a bug with Microsoft.
>>>> So what you are saying is that the issue was not intermittent, but 
>>>> always happened for those tools? If so, I can reluctantly agree to 
>>>> this fix. But I'd appreciate if you could drill down a bit and see 
>>>> what the problem really is.
>>>> 
>>>> /Magnus
>>>>>> As for the short paths, calling cmd.exe from WSL bash seems to be 
>>>>>> a bit buggy.  cmd.exe, when called from a standard Windows 
>>>>>> environment, works properly and prints the path, however, when 
>>>>>> called from WSL, I
>>>>>> get:
>>>>>> 
>>>>>> "(C:\Program Files (x86))" was unexpected at this time.
>>>>>> 
>>>>>> I verified that the correct path was being passed to cmd.exe (not 
>>>>>> a bash escaping issue) by creating my own test executable (C++) 
>>>>>> that just prints argv[0] ... argv[argc - 1] and when running my 
>>>>>> text executable from both Windows and WSL I get the same result, 
>>>>>> however when running cmd.exe with the exact same arguments, it 
>>>>>> works in Windows but not WSL.  I will file a bug with Microsoft for this issue.
>>>>>> 
>>>>>> Thanks,
>>>>>> 
>>>>>> -Andrew
>>>>>> 
>>>>>> 
>>>>>> -----Original Message-----
>>>>>> From: Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com>
>>>>>> Sent: Tuesday, December 11, 2018 6:18 AM
>>>>>> To: Andrew Luo <andrewluotechnologies at outlook.com>; Erik Joelsson 
>>>>>> <erik.joelsson at oracle.com>; build-dev at openjdk.java.net
>>>>>> Subject: Re: [PATCH] Support for building using WSL (Windows 
>>>>>> Subsystem for Linux) on Windows
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On 2018-12-11 14:37, Magnus Ihse Bursie wrote:
>>>>>>>> On 2018-12-11 06:25, Andrew Luo wrote:
>>>>>>>> Hi,
>>>>>>>> 
>>>>>>>> Yes, I've signed an OCA (I've also contributed changes to other 
>>>>>>>> groups before, but not build).
>>>>>>>> 
>>>>>>>> Okay, I have fixed the autconf-config* files.
>>>>>>>> 
>>>>>>>> Unfortunately, as Erik mentioned, there is no
>>>>>>>> (supported/reliable) way to access the WSL root / from 
>>>>>>>> /cygdrive/c, or even from Windows (there is a way in reality, 
>>>>>>>> however, it's not documented/supported by Microsoft and the 
>>>>>>>> location changes depending on the distribution/store app id/etc.
>>>>>>>> so best to avoid using it.) I can see if we can print information about versions however.
>>>>>>>> 
>>>>>>>> Right, WSL requires the .exe extension when accessing an 
>>>>>>>> executable, as this is Linux behavior (Linux doesn't have 
>>>>>>>> extensions for executables generally, but that's besides the 
>>>>>>>> point)...
>>>>>>>> 
>>>>>>>> I fixed BASIC_REMOVE_SYMBOLIC_LINKS - a leftover from another 
>>>>>>>> approach I tried.
>>>>>>>> 
>>>>>>>> For the redirect, redirect doesn't seem to be working when you 
>>>>>>>> have a bash shell input piped into a Win32 executable reading 
>>>>>>>> from stdin using WINAPI.  I'm not sure this is supported by the 
>>>>>>>> OpenJDK, more likely it might be a Microsoft issue.  For some 
>>>>>>>> reason, the stdin would be cut off (or I would see an exception 
>>>>>>>> thrown from
>>>>>>>> available0 in FileInputStream).  I personally didn't see any 
>>>>>>>> harm in changing piping into input/output files (since all the 
>>>>>>>> inputs/outputs are files anyways!).
>>>>>>> Ok, let me be sure I get this right. It is only the redirect of
>>>>>>> *input* that fails? (But you fixed both because of consistency). 
>>>>>>> I agree that the change itself is fine, even better than it is 
>>>>>>> right now
>>>>>>> -- I was mostly worried about the consequences of redirects is 
>>>>>>> not working; there might be other places that fail. But if 
>>>>>>> redirecting output works, I think we're mostly fine. That's 
>>>>>>> something we do all the time, for each executed command, so if 
>>>>>>> that did not work reliably it would be really bad.
>>>>>>> 
>>>>>>> But still... I tried greping for "<" and there's a lot of 
>>>>>>> places,
>>>>>>> 20+, that redirects input.
>>>>>>> 
>>>>>>> Or did this problem only happen when running *java* as the 
>>>>>>> recipient of the redirected input?
>>>>>>> 
>>>>>>> This worries me, and while I do think your change makes the 
>>>>>>> tools have a better UI, I don't like this as a workaround that 
>>>>>>> will not solve all potential problems. :(
>>>>>>> 
>>>>>>>> I fixed TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE - this was also 
>>>>>>>> from a few things I had tried earlier.
>>>>>>>> 
>>>>>>>> I disabled the $BASH code because to call bash from Win32 the 
>>>>>>>> correct way is either "wsl /bin/bash" or just "bash". $BASH 
>>>>>>>> correctly evaluates to /bin/bash, however 
>>>>>>>> BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH is implemented in 
>>>>>>>> terms of wslpath, which can only convert a path under /mnt/c 
>>>>>>>> back to a Windows path.  Other files under /, for example /bin 
>>>>>>>> and /bin/bash, cannot be converted to a Windwos path.
>>>>>>>> 
>>>>>>>> The escaping changes I made because it wasn't working. This 
>>>>>>>> does work with spaces in the path on WSL.  I don't have a 
>>>>>>>> Cygwin environment to check, perhaps someone else here could help out?
>>>>>>>> Otherwise I can refactor that code to use that echo statement 
>>>>>>>> for WSL and use the old echo statement for Cygwin.
>>>>>>> I can check it out the next time I'm on a Windows machine.
>>>>>>> 
>>>>>>>> I have fixed the extraneous debug print statement.
>>>>>>>> 
>>>>>>>> As for Windows vs Linux output - you can still force it to 
>>>>>>>> build a Linux output binary.  You just need to run configure as follows:
>>>>>>>> 
>>>>>>>> ./configure --with-boot-jdk=/home/andrew/jdk-11.0.1
>>>>>>>> ----build=x86_64-unknown-linux-gnu
>>>>>>>> --host=x86_64-unknown-linux-gnu
>>>>>>>> 
>>>>>>>> However, there is a behavior change: now, on WSL, by default, 
>>>>>>>> Windows binaries are targeted.  Previously, Linux binaries were 
>>>>>>>> the default target.  (Also, you can run configure twice and two 
>>>>>>>> sets of configurations will be generated, you can actually 
>>>>>>>> build both images by setting CONF=linux-x86_64-server-release 
>>>>>>>> or
>>>>>>>> CONF=windows-x86_64-server-release)
>>>>>>> If you run on WLS, it's reasonable that the default is Windows.
>>>>>>> The --build --host combo is good enough for me as a way to force 
>>>>>>> a linux build; we don't need an extra flag for this somewhat odd 
>>>>>>> build configuration.
>>>>>>> 
>>>>>>>> As for BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN, wslpath does not 
>>>>>>>> support
>>>>>>>> 8.3 names.  But perhaps the symlink workaround is acceptable 
>>>>>>>> for now and we can handle the 8.3 naming on WSL in a separate 
>>>>>>>> change, what do you guys think - personally I think what we 
>>>>>>>> have (assuming Cygwin still works) is at least a MVP for WSL devs.
>>>>>>>> Anyways, at least some people may have to use the symlink 
>>>>>>>> workaround if they've disabled 8.3 on NTFS.
>>>>>>> That's too bad, since it really helped with getting around the 
>>>>>>> issue with spaces in path that's mandatory on Windows using 
>>>>>>> default installation of Visual Studio. :(
>>>>>>> 
>>>>>>> Again, sorry if I don't know enough about WSL to know if this is 
>>>>>>> possible, but on msys we do the following:
>>>>>>>       new_path=`cmd /c "for %A in (\"$input_path\") do @echo 
>>>>>>> %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
>>>>>>> 'abcdefghijklmnopqrstuvwxyz'`
>>>>>>> 
>>>>>>> That is, we call the Windows cmd.exe using the "%~sA" variable 
>>>>>>> syntax to print the 8.3 version of the path (input_path is a 
>>>>>>> "normal" Windows path). Is there any way it's possible to do 
>>>>>>> this on WSL? It seems reasonable that you should be able to call 
>>>>>>> cmd.exe and redirect the output.
>>>>>>> 
>>>>>>> I think it will be worth trying to jump through some loops or 
>>>>>>> doing some dirty tricks to get this to work, because everything 
>>>>>>> will be
>>>>>>> *soooo* much simpler if you can reliably turn paths into 
>>>>>>> space-safe paths; our normal Windows build depends on it.
>>>>>> I also realized that if you make a WSL version of 
>>>>>> BASIC_FIXUP_EXECUTABLE, then you might be able to add .exe in it.
>>>>>> You will still need the EXE_SUFFIX when e.g. looking for the 
>>>>>> java.exe binary in locating the Boot JDK, but perhaps it will 
>>>>>> simplify some of the places.
>>>>>> 
>>>>>> I see now that the call to java in Images.gmk really should have 
>>>>>> been prefixed with $(FIXPATH) instead. Then you would not have 
>>>>>> needed the EXE_SUFFIX fix there.
>>>>>> 
>>>>>> Also, I suggest you look more closely on how we do things on msys 
>>>>>> than on cygwin; I have the feeling wsl is closer to msys (in 
>>>>>> terms of functionality from our perspective) than cygwin.
>>>>>>> /Magnus
>>>>>>>> Attaching my latest patch (generated using powershell, so to 
>>>>>>>> properly import you may need to convert UTF16 -> UTF8 and 
>>>>>>>> change CRLF to just LF, hg tends to be picky)...
>>>>>> Looks much better now!
>>>>>> 
>>>>>> Before accepting it, I'd like to understand more about the 
>>>>>> redirect issue, and see if there really is no way to rewrite the 
>>>>>> paths in a space-safe manner. Then I think this is good to go.
>>>>>> 
>>>>>> /Magnus
>>>>>> 
>>>>>>>> Thanks,
>>>>>>>> 
>>>>>>>> -Andrew
>>>>>>>> 
>>>>>>>> 
>>>>>>>> -----Original Message-----
>>>>>>>> From: Erik Joelsson <erik.joelsson at oracle.com>
>>>>>>>> Sent: Monday, December 10, 2018 9:19 AM
>>>>>>>> To: Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com>; Andrew 
>>>>>>>> Luo <andrewluotechnologies at outlook.com>;
>>>>>>>> build-dev at openjdk.java.net
>>>>>>>> Subject: Re: [PATCH] Support for building using WSL (Windows 
>>>>>>>> Subsystem for Linux) on Windows
>>>>>>>> 
>>>>>>>> Hello,
>>>>>>>> 
>>>>>>>>> On 2018-12-10 02:06, Magnus Ihse Bursie wrote:
>>>>>>>>>> On 2018-12-09 20:11, Andrew Luo wrote:
>>>>>>>>>> One important thing to note is that the WSL build targets Windows.
>>>>>>>>>> It is also possible to use WSL to target itself (a WSL Linux
>>>>>>>>>> binary) or even other distributions of Linux.  I have not 
>>>>>>>>>> implemented that yet, but I think I could do that as a next 
>>>>>>>>>> step if you guys think it would be useful (at least I think 
>>>>>>>>>> it would be useful, then you can test your changes for both 
>>>>>>>>>> Windows and Linux on one system...).
>>>>>>>>> I think if you just run configure ordinarily, it will behave 
>>>>>>>>> like a Linux system and build the Linux image right out-of-the-box..?
>>>>>>>>> But then again, maybe that behavior is negated by your changes 
>>>>>>>>> to config.guess and platform.m4. So maybe we need a flag to 
>>>>>>>>> configure to control this...
>>>>>>>> It is indeed possible to build a pure Linux binary in WSL today 
>>>>>>>> so I think it would be bad to lose that functionality. We 
>>>>>>>> certainly need a configure flag to control if a Windows or 
>>>>>>>> Linux build should be produced in this case. This is something 
>>>>>>>> I have been thinking about when I started tackling WSL builds 
>>>>>>>> some time ago but didn't really come up with a good solution. I 
>>>>>>>> didn't have the time to spend to really see it through though, 
>>>>>>>> so it's nice to see that someone else is trying.
>>>>>>>> 
>>>>>>>> We could simply use the --with-openjdk-target, that would 
>>>>>>>> perhaps be the cleanest, but it's also a bit cumbersome. We may 
>>>>>>>> need some simplification similar to how we have
>>>>>>>> --with-target-bits=32/64 as a simple switch (e.g. --with-wsl-target=linux/windows?).
>>>>>>>> 
>>>>>>>>>> Steps in case you want to try this out:
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 1.       Due to autotools not handling spaces well, you have to
>>>>>>>>>> create symlinks in Windows that will allow you to access 
>>>>>>>>>> Windows Kits and the VC++ compiler without spaces in the path:
>>>>>>>>>> 
>>>>>>>>>> mklink /D C:\VS "C:\Program Files (x86)\Microsoft Visual Studio"
>>>>>>>>>> 
>>>>>>>>>> mklink /D C:\WindowsKits "C:\Program Files (x86)\Windows Kits"
>>>>>>>>> That's a bit odd. We encounter spaces in paths on Windows 
>>>>>>>>> normally on cygwin and msys, and that works fine. I suspect 
>>>>>>>>> there is something missing with the rewriting functions. What 
>>>>>>>>> we do, is that we rewrite paths with spaces to paths without 
>>>>>>>>> spaces, by using the old 8+3 compatibility names, so we get 
>>>>>>>>> something like "/cygdrive/c/progra~1/microso~2" from 
>>>>>>>>> "C:\Program Files (x86)\Microsoft Visual Studio". Have a look 
>>>>>>>>> at BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN. I think you need a 
>>>>>>>>> WSL version of that, as well as of BASIC_FIXUP_PATH_CYGWIN.
>>>>>>>>> (And you need to call the BASIC_FIXUP_PATH_WSL from
>>>>>>>>> BASIC_FIXUP_PATH.)
>>>>>>>>> 
>>>>>>>>> If you get these parts right, I don't think you will need any 
>>>>>>>>> of the special instructions below to build. In fact, as long 
>>>>>>>>> as C:\... is properly remapped, the normal VS autodetect code 
>>>>>>>>> should work just fine. And perhaps you can even revert some of 
>>>>>>>>> the scarier changes in toolchain_windows.m4.
>>>>>>>> I definitely agree with Magnus that to make WSL truly 
>>>>>>>> supported, the path handling macros need to be replicated. I'm 
>>>>>>>> not sure how to solve it properly. The root path Magnus is 
>>>>>>>> asking for is not defined in WSL. In fact, from windows you 
>>>>>>>> cannot reach any path in the WSL filesystem. Only Windows 
>>>>>>>> drives are mounted in WSL, not the other way around. To convert 
>>>>>>>> to old style paths in Cygwin we rely on the cygpath utility.
>>>>>>>> There is a wslpath utility but does it support old style path 
>>>>>>>> conversions? If not, maybe it's possible to write such a tool in CMD/PowerShell?
>>>>>>>> 
>>>>>>>> /Erik
>>>>>>>> 
>>>>>>>> 
>>>>>>>>>> 2.       wsl must be started from a Windows Developer command
>>>>>>>>>> prompt.  To ensure the correct environment variables are 
>>>>>>>>>> propagated from Windows to WSL, you can run the following
>>>>>>>>>> commands:
>>>>>>>>>> 
>>>>>>>>>> set WSLENV=INCLUDE/l:LIBPATH/l
>>>>>>>>>> 
>>>>>>>>>> 3.       Start wsl (bash):
>>>>>>>>>> 
>>>>>>>>>> wsl
>>>>>>>>>> 
>>>>>>>>>> 4.       After starting bash you must set your compiler
>>>>>>>>>> variables to explicitly point to the correct tools:
>>>>>>>>>> 
>>>>>>>>>> export
>>>>>>>>>> AR=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Ho
>>>>>>>>>> st
>>>>>>>>>> x6
>>>>>>>>>> 4/
>>>>>>>>>> x64/lib.exe
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> export
>>>>>>>>>> CC=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Ho
>>>>>>>>>> st
>>>>>>>>>> x6
>>>>>>>>>> 4/
>>>>>>>>>> x64/cl.exe
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> export
>>>>>>>>>> CXX=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/H
>>>>>>>>>> os
>>>>>>>>>> tx
>>>>>>>>>> 64
>>>>>>>>>> /x64/cl.exe
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> export
>>>>>>>>>> LD=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Ho
>>>>>>>>>> st
>>>>>>>>>> x6
>>>>>>>>>> 4/
>>>>>>>>>> x64/link.exe
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> export RC=/mnt/c/WindowsKits/10/bin/10.0.17763.0/x64/rc.exe
>>>>>>>>>> 
>>>>>>>>>> export MT=/mnt/c/WindowsKits/10/bin/10.0.17763.0/x64/mt.exe
>>>>>>>>>> 
>>>>>>>>>> export
>>>>>>>>>> DUMPBIN=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/b
>>>>>>>>>> in
>>>>>>>>>> /H
>>>>>>>>>> os
>>>>>>>>>> tx64/x64/dumpbin.exe
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 5.       Run configure:
>>>>>>>>>> 
>>>>>>>>>> ./configure
>>>>>>>>>> --with-boot-jdk=/mnt/c/Users/Andrew/Downloads/openjdk-11.0.1_
>>>>>>>>>> wi
>>>>>>>>>> nd
>>>>>>>>>> ow
>>>>>>>>>> s-x64_bin/jdk-11.0.1
>>>>>>>>>> 
>>>>>>>>>> --with-tools-dir="C:\VS\2017\Enterprise\VC\Auxiliary"
>>>>>>>>>> --with-ucrt-dll-dir="/mnt/c/WindowsKits/10/Redist/ucrt/DLLs/x64"
>>>>>>>>>> 
>>>>>>>>>> 6.       Run make
>>>>>>>>>> 
>>>>>>>>>> I've tested make with the default target as well as "make images"
>>>>>>>>>> 
>>>>>>>>>> Let me know if you have any feedback/comments.
>>>>>>>>>> 
>>>>>>>>>> Thanks,
>>>>>>>>>> 
>>>>>>>>>> -Andrew
>>>>>>>>>> 

-------------- next part --------------
ÿþd i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / I m a g e s . g m k 
 
 - - -   a / m a k e / I m a g e s . g m k 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / I m a g e s . g m k 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 9 9 , 7   + 9 9 , 7   @ @ 
 
   	 ) 
 
                   i f e q   ( $ ( B U I L D _ C D S _ A R C H I V E ) ,   t r u e ) 
 
   	     $ ( c a l l   L o g W a r n ,   C r e a t i n g   C D S   a r c h i v e   f o r   j d k   i m a g e ) 
 
 - 	     $ ( J D K _ I M A G E _ D I R ) / b i n / j a v a   - X s h a r e : d u m p   - X m x 1 2 8 M   - X m s 1 2 8 M   $ ( L O G _ I N F O ) 
 
 + 	     $ ( J D K _ I M A G E _ D I R ) / b i n / j a v a $ ( E X E _ S U F F I X )   - X s h a r e : d u m p   - X m x 1 2 8 M   - X m s 1 2 8 M   $ ( L O G _ I N F O ) 
 
                   e n d i f 
 
   	 $ ( T O U C H )   $ @ 
 
   
 
 @ @   - 1 1 4 , 7   + 1 1 4 , 7   @ @ 
 
   	 ) 
 
                   i f e q   ( $ ( B U I L D _ C D S _ A R C H I V E ) ,   t r u e ) 
 
   	     $ ( c a l l   L o g W a r n ,   C r e a t i n g   C D S   a r c h i v e   f o r   j r e   i m a g e ) 
 
 - 	     $ ( J R E _ I M A G E _ D I R ) / b i n / j a v a   - X s h a r e : d u m p   - X m x 1 2 8 M   - X m s 1 2 8 M   $ ( L O G _ I N F O ) 
 
 + 	     $ ( J R E _ I M A G E _ D I R ) / b i n / j a v a $ ( E X E _ S U F F I X )   - X s h a r e : d u m p   - X m x 1 2 8 M   - X m s 1 2 8 M   $ ( L O G _ I N F O ) 
 
                   e n d i f 
 
   	 $ ( T O U C H )   $ @ 
 
   
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / b a s i c s . m 4 
 
 - - -   a / m a k e / a u t o c o n f / b a s i c s . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / b a s i c s . m 4 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 2 3 , 6   + 2 2 3 , 8   @ @ 
 
               B A S I C _ F I X U P _ P A T H _ C Y G W I N ( $ 1 ) 
 
           e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . m s y s " ;   t h e n 
 
               B A S I C _ F I X U P _ P A T H _ M S Y S ( $ 1 ) 
 
 +         e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +             B A S I C _ F I X U P _ P A T H _ W S L ( $ 1 ) 
 
           e l s e 
 
               #   W e ' r e   o n   a   u n i x   p l a t f o r m .   H o o r a y !   : ) 
 
               p a t h = " [ $ ] $ 1 " 
 
 @ @   - 2 7 0 , 6   + 2 7 2 , 8   @ @ 
 
               B A S I C _ F I X U P _ E X E C U T A B L E _ C Y G W I N ( $ 1 ) 
 
           e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . m s y s " ;   t h e n 
 
               B A S I C _ F I X U P _ E X E C U T A B L E _ M S Y S ( $ 1 ) 
 
 +         e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +             B A S I C _ F I X U P _ E X E C U T A B L E _ W S L ( $ 1 ) 
 
           e l s e 
 
               #   W e ' r e   o n   a   u n i x   p l a t f o r m .   H o o r a y !   : ) 
 
               #   F i r s t   s e p a r a t e   t h e   p a t h   f r o m   t h e   a r g u m e n t s .   T h i s   w i l l   s p l i t   a t   t h e   f i r s t 
 
 @ @   - 6 0 7 , 1 0   + 6 1 1 , 1 3   @ @ 
 
   
 
       #   T h e s e   a r e   n o t   r e q u i r e d   o n   a l l   p l a t f o r m s 
 
       B A S I C _ P A T H _ P R O G S ( C Y G P A T H ,   c y g p a t h ) 
 
 +     B A S I C _ P A T H _ P R O G S ( W S L P A T H ,   w s l p a t h ) 
 
       B A S I C _ P A T H _ P R O G S ( D F ,   d f ) 
 
       B A S I C _ P A T H _ P R O G S ( C P I O ,   [ c p i o   b s d c p i o ] ) 
 
       B A S I C _ P A T H _ P R O G S ( N I C E ,   n i c e ) 
 
       B A S I C _ P A T H _ P R O G S ( P A N D O C ,   p a n d o c ) 
 
 + 
 
 +     B A S I C _ P A T H _ P R O G S ( C M D ,   [ c m d . e x e   / m n t / c / W i n d o w s / S y s t e m 3 2 / c m d . e x e ] ) 
 
   ] ) 
 
   
 
   # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
 
 @ @   - 6 3 4 , 8   + 6 4 1 , 1 0   @ @ 
 
           B A S I C _ C H E C K _ P A T H S _ W I N D O W S 
 
       e l s e 
 
           P A T H _ S E P = " : " 
 
 +         E X E C U T A B L E _ S U F F I X = " " 
 
       f i 
 
       A C _ S U B S T ( P A T H _ S E P ) 
 
 +     A C _ S U B S T ( E X E C U T A B L E _ S U F F I X ) 
 
   
 
       #   W e   g e t   t h e   t o p - l e v e l   d i r e c t o r y   f r o m   t h e   s u p p o r t i n g   w r a p p e r s . 
 
       A C _ M S G _ C H E C K I N G ( [ f o r   t o p - l e v e l   d i r e c t o r y ] ) 
 
 @ @   - 9 8 0 , 6   + 9 8 9 , 8   @ @ 
 
                           M A K E _ E X P E C T E D _ E N V = ' c y g w i n ' 
 
                       e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . m s y s " ;   t h e n 
 
                           M A K E _ E X P E C T E D _ E N V = ' m s y s ' 
 
 +                     e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +                         M A K E _ E X P E C T E D _ E N V = ' x 8 6 _ 6 4 - p c - l i n u x - g n u ' 
 
                       e l s e 
 
                           A C _ M S G _ E R R O R ( [ U n k n o w n   W i n d o w s   e n v i r o n m e n t ] ) 
 
                       f i 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / b a s i c s _ w i n d o w s . m 4 
 
 - - -   a / m a k e / a u t o c o n f / b a s i c s _ w i n d o w s . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / b a s i c s _ w i n d o w s . m 4 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 3 2 , 6   + 3 2 , 1 3   @ @ 
 
       e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . m s y s " ;   t h e n 
 
           u n i x _ p a t h = ` $ E C H O   " $ w i n d o w s _ p a t h "   |   $ S E D   - e   ' s , ^ \ \ ( . \ \ ) : , / \ \ 1 , g '   - e   ' s , \ \ \ \ , / , g ' ` 
 
           $ 1 = " $ u n i x _ p a t h " 
 
 +     e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +         #   w s l p a t h   d o e s   n o t   c h e c k   t h e   i n p u t ,   o n l y   c a l l   i f   a n   a c t u a l   w i n d o w s   p a t h   w a s 
 
 +         #   g i v e n . 
 
 +         i f   $ E C H O   " $ w i n d o w s _ p a t h "   |   $ G R E P   - q   [ " ^ [ a - z A - Z ] : [ \ \ \ \ / ] " ] ;   t h e n 
 
 +             u n i x _ p a t h = ` $ W S L P A T H   - u   " $ w i n d o w s _ p a t h " ` 
 
 +             $ 1 = " $ u n i x _ p a t h " 
 
 +         f i 
 
       f i 
 
   ] ) 
 
   
 
 @ @   - 4 4 , 6   + 5 1 , 9   @ @ 
 
       e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . m s y s " ;   t h e n 
 
           w i n d o w s _ p a t h = ` c m d   / / c   e c h o   $ u n i x _ p a t h ` 
 
           $ 1 = " $ w i n d o w s _ p a t h " 
 
 +     e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +         w i n d o w s _ p a t h = ` $ W S L P A T H   - m   " $ u n i x _ p a t h " ` 
 
 +         $ 1 = " $ w i n d o w s _ p a t h " 
 
       f i 
 
   ] ) 
 
   
 
 @ @   - 1 0 0 , 6   + 1 1 0 , 3 1   @ @ 
 
       f i 
 
   ] ) 
 
   
 
 + #   H e l p e r   f u n c t i o n   w h i c h   p o s s i b l y   c o n v e r t s   a   p a t h   u s i n g   D O S - s t y l e   s h o r t   m o d e . 
 
 + #   I f   s o ,   t h e   u p d a t e d   p a t h   i s   s t o r e d   i n   $ n e w _ p a t h . 
 
 + #   $ 1 :   T h e   p a t h   t o   c h e c k 
 
 + A C _ D E F U N ( [ B A S I C _ M A K E _ W I N D O W S _ S P A C E _ S A F E _ W S L ] , 
 
 + [ 
 
 +     i n p u t _ p a t h = " $ 1 " 
 
 +     #   C h e c k   i f   w e   n e e d   t o   c o n v e r t   t h i s   u s i n g   D O S - s t y l e   s h o r t   m o d e .   I f   t h e   p a t h 
 
 +     #   c o n t a i n s   j u s t   s i m p l e   c h a r a c t e r s ,   u s e   i t .   O t h e r w i s e   ( s p a c e s ,   w e i r d   c h a r a c t e r s ) , 
 
 +     #   t a k e   n o   c h a n c e s   a n d   r e w r i t e   i t . 
 
 +     #   N o t e :   m 4   e a t s   o u r   [ ] ,   s o   w e   n e e d   t o   u s e   @ < : @   a n d   @ : > @   i n s t e a d . 
 
 +     h a s _ f o r b i d d e n _ c h a r s = ` $ E C H O   " $ i n p u t _ p a t h "   |   $ G R E P   [ [ ^ - _ / : a - z A - Z 0 - 9 \ \ . ] ] ` 
 
 +     i f   t e s t   " x $ h a s _ f o r b i d d e n _ c h a r s "   ! =   x ;   t h e n 
 
 +         #   N o w   c o n v e r t   i t   t o   m i x e d   D O S - s t y l e ,   s h o r t   m o d e   ( n o   s p a c e s ,   a n d   /   i n s t e a d   o f   \ ) 
 
 +         T O P D I R _ w i n d o w s = " $ T O P D I R " 
 
 +         B A S I C _ W I N D O W S _ R E W R I T E _ A S _ W I N D O W S _ M I X E D _ P A T H ( [ T O P D I R _ w i n d o w s ] ) 
 
 +         #   F i r s t   c o n v e r t   t o   W i n d o w s   p a t h   t o   m a k e   i n p u t   v a l i d   f o r   c m d 
 
 +         B A S I C _ W I N D O W S _ R E W R I T E _ A S _ W I N D O W S _ M I X E D _ P A T H ( [ i n p u t _ p a t h ] ) 
 
 +         n e w _ p a t h = ` $ C M D   / c   $ T O P D I R _ w i n d o w s / m a k e / s c r i p t s / w i n d o w s S h o r t N a m e . b a t   " $ i n p u t _ p a t h "   \ 
 
 +                 |   $ S E D   - e   ' s | \ r | | g '   \ 
 
 +                 |   $ T R   \ \ \ \ \ \ \ \   /   |   $ T R   ' A B C D E F G H I J K L M N O P Q R S T U V W X Y Z '   ' a b c d e f g h i j k l m n o p q r s t u v w x y z ' ` 
 
 +         #   R e w r i t e   b a c k   t o   u n i x   s t y l e 
 
 +         B A S I C _ W I N D O W S _ R E W R I T E _ A S _ U N I X _ P A T H ( [ n e w _ p a t h ] ) 
 
 +     f i 
 
 + ] ) 
 
 + 
 
   #   F I X M E :   T h e   B A S I C _ F I X U P _ * _ C Y G W I N / M S Y S   i s   m o s t   l i k e l y   t o o   c o n v o l u t e d 
 
   #   a n d   c o u l d   p r o b a b l y   b e   h e a v i l y   s i m p l i f i e d .   H o w e v e r ,   a l l   c h a n g e s   i n   t h i s 
 
   #   a r e a   t e n d   t o   n e e d   l o t   o f   t e s t i n g   i n   d i f f e r e n t   s c e n a r i o s ,   a n d   i n   l a c k   o f 
 
 @ @   - 1 5 7 , 6   + 1 9 2 , 2 3   @ @ 
 
       a l l _ f i x p a t h _ p r e f i x e s = ( " $ { a l l _ f i x p a t h _ p r e f i x e s @ < : @ @ @ : > @ } "   " $ { n e w _ p a t h : 0 : 1 0 } " ) 
 
   ] ) 
 
   
 
 + A C _ D E F U N ( [ B A S I C _ F I X U P _ P A T H _ W S L ] , 
 
 + [ 
 
 +     #   I n p u t   m i g h t   b e   g i v e n   a s   W i n d o w s   f o r m a t ,   s t a r t   b y   c o n v e r t i n g   t o 
 
 +     #   u n i x   f o r m a t . 
 
 +     n e w _ p a t h = " [ $ ] $ 1 " 
 
 +     B A S I C _ W I N D O W S _ R E W R I T E _ A S _ U N I X _ P A T H ( [ n e w _ p a t h ] ) 
 
 + 
 
 +     #   C a l l   h e l p e r   f u n c t i o n   w h i c h   p o s s i b l y   c o n v e r t s   t h i s   u s i n g   D O S - s t y l e   s h o r t   m o d e . 
 
 +     #   I f   s o ,   t h e   u p d a t e d   p a t h   i s   s t o r e d   i n   $ n e w _ p a t h . 
 
 +     B A S I C _ M A K E _ W I N D O W S _ S P A C E _ S A F E _ W S L ( [ $ n e w _ p a t h ] ) 
 
 + 
 
 +     i f   t e s t   " x $ p a t h "   ! =   " x $ n e w _ p a t h " ;   t h e n 
 
 +         $ 1 = " $ n e w _ p a t h " 
 
 +         A C _ M S G _ N O T I C E ( [ R e w r i t i n g   $ 1   t o   " $ n e w _ p a t h " ] ) 
 
 +     f i 
 
 + ] ) 
 
 + 
 
   A C _ D E F U N ( [ B A S I C _ F I X U P _ E X E C U T A B L E _ C Y G W I N ] , 
 
   [ 
 
       #   F i r s t   s e p a r a t e   t h e   p a t h   f r o m   t h e   a r g u m e n t s .   T h i s   w i l l   s p l i t   a t   t h e   f i r s t 
 
 @ @   - 3 0 5 , 6   + 3 5 7 , 7 9   @ @ 
 
       f i 
 
   ] ) 
 
   
 
 + A C _ D E F U N ( [ B A S I C _ F I X U P _ E X E C U T A B L E _ W S L ] , 
 
 + [ 
 
 +     #   F i r s t   s e p a r a t e   t h e   p a t h   f r o m   t h e   a r g u m e n t s .   T h i s   w i l l   s p l i t   a t   t h e   f i r s t 
 
 +     #   s p a c e . 
 
 +     c o m p l e t e = " [ $ ] $ 1 " 
 
 +     p a t h = " $ { c o m p l e t e % %   * } " 
 
 +     t m p = " $ c o m p l e t e   E O L " 
 
 +     a r g u m e n t s = " $ { t m p # *   } " 
 
 + 
 
 +     #   I n p u t   m i g h t   b e   g i v e n   a s   W i n d o w s   f o r m a t ,   s t a r t   b y   c o n v e r t i n g   t o 
 
 +     #   u n i x   f o r m a t . 
 
 +     n e w _ p a t h = " $ p a t h " 
 
 +     B A S I C _ W I N D O W S _ R E W R I T E _ A S _ U N I X _ P A T H ( [ n e w _ p a t h ] ) 
 
 + 
 
 +     #   N o w   t r y   t o   l o c a t e   e x e c u t a b l e   u s i n g   w h i c h 
 
 +     n e w _ p a t h _ b a k = " $ n e w _ p a t h " 
 
 +     n e w _ p a t h = ` $ W H I C H   " $ n e w _ p a t h "   2 >   / d e v / n u l l ` 
 
 +     #   b a t   a n d   c m d   f i l e s   a r e   n o t   c o n s i d e r e d   e x e c u t a b l e   i n   W S L 
 
 +     i f   t e s t   " x $ n e w _ p a t h "   =   x   \ 
 
 +             & &   t e s t   " x ` $ E C H O   \ " $ p a t h \ "   |   $ G R E P   - i   - e   \ " \ \ . b a t $ \ "   - e   \ " \ \ . c m d $ \ " ` "   ! =   x   \ 
 
 +             & &   t e s t   " x ` $ L S   \ " $ p a t h \ "   2 > / d e v / n u l l ` "   ! =   x ;   t h e n 
 
 +         n e w _ p a t h = " $ n e w _ p a t h _ b a c k " 
 
 +     f i 
 
 +     i f   t e s t   " x $ n e w _ p a t h "   =   x ;   t h e n 
 
 +         #   O o p s .   W h i c h   d i d n ' t   f i n d   t h e   e x e c u t a b l e . 
 
 +         #   T h e   s p l i t t i n g   o f   a r g u m e n t s   f r o m   t h e   e x e c u t a b l e   a t   a   s p a c e   m i g h t   h a v e   b e e n   i n c o r r e c t , 
 
 +         #   s i n c e   p a t h s   w i t h   s p a c e   a r e   m o r e   l i k e l y   i n   W i n d o w s .   G i v e   i t   a n o t h e r   t r y   w i t h   t h e   w h o l e 
 
 +         #   a r g u m e n t . 
 
 +         p a t h = " $ c o m p l e t e " 
 
 +         a r g u m e n t s = " E O L " 
 
 +         n e w _ p a t h = " $ p a t h " 
 
 +         B A S I C _ W I N D O W S _ R E W R I T E _ A S _ U N I X _ P A T H ( [ n e w _ p a t h ] ) 
 
 +         n e w _ p a t h _ b a k = " $ n e w _ p a t h " 
 
 +         n e w _ p a t h = ` $ W H I C H   " $ n e w _ p a t h "   2 >   / d e v / n u l l ` 
 
 +         #   b a t   a n d   c m d   f i l e s   a r e   n o t   c o n s i d e r e d   e x e c u t a b l e   i n   W S L 
 
 +         i f   t e s t   " x $ n e w _ p a t h "   =   x   \ 
 
 +                 & &   t e s t   " x ` $ E C H O   \ " $ p a t h \ "   |   $ G R E P   - i   - e   \ " \ \ . b a t $ \ "   - e   \ " \ \ . c m d $ \ " ` "   ! =   x   \ 
 
 +                 & &   t e s t   " x ` $ L S   \ " $ p a t h \ "   2 > / d e v / n u l l ` "   ! =   x ;   t h e n 
 
 +             n e w _ p a t h = " $ n e w _ p a t h _ b a k " 
 
 +         f i 
 
 +         i f   t e s t   " x $ n e w _ p a t h "   =   x ;   t h e n 
 
 +             #   I t ' s   s t i l l   n o t   f o u n d .   N o w   t h i s   i s   a n   u n r e c o v e r a b l e   e r r o r . 
 
 +             A C _ M S G _ N O T I C E ( [ T h e   p a t h   o f   $ 1 ,   w h i c h   r e s o l v e s   a s   " $ c o m p l e t e " ,   i s   n o t   f o u n d . ] ) 
 
 +             h a s _ s p a c e = ` $ E C H O   " $ c o m p l e t e "   |   $ G R E P   "   " ` 
 
 +             i f   t e s t   " x $ h a s _ s p a c e "   ! =   x ;   t h e n 
 
 +                 A C _ M S G _ N O T I C E ( [ Y o u   m i g h t   b e   m i x i n g   s p a c e s   i n   t h e   p a t h   a n d   e x t r a   a r g u m e n t s ,   w h i c h   i s   n o t   a l l o w e d . ] ) 
 
 +             f i 
 
 +             A C _ M S G _ E R R O R ( [ C a n n o t   l o c a t e   t h e   t h e   p a t h   o f   $ 1 ] ) 
 
 +         f i 
 
 +     f i 
 
 + 
 
 +     #   I n   W S L ,   s u f f i x e s   m u s t   b e   p r e s e n t   f o r   W i n d o w s   e x e c u t a b l e s 
 
 +     i f   t e s t   !   - f   " $ n e w _ p a t h " ;   t h e n 
 
 +         #   T r y   a d d i n g   . e x e   o r   . c m d 
 
 +         i f   t e s t   - f   " $ { n e w _ p a t h } . e x e " ;   t h e n 
 
 +             i n p u t _ t o _ s h o r t p a t h = " $ { n e w _ p a t h } . e x e " 
 
 +         e l i f   t e s t   - f   " $ { n e w _ p a t h } . c m d " ;   t h e n 
 
 +             i n p u t _ t o _ s h o r t p a t h = " $ { n e w _ p a t h } . c m d " 
 
 +         e l s e 
 
 +             A C _ M S G _ N O T I C E ( [ T h e   p a t h   o f   $ 1 ,   w h i c h   r e s o l v e s   a s   " $ n e w _ p a t h " ,   i s   i n v a l i d . ] ) 
 
 +             A C _ M S G _ N O T I C E ( [ N e i t h e r   " $ n e w _ p a t h "   n o r   " $ n e w _ p a t h . e x e / c m d "   c a n   b e   f o u n d ] ) 
 
 +             A C _ M S G _ E R R O R ( [ C a n n o t   l o c a t e   t h e   t h e   p a t h   o f   $ 1 ] ) 
 
 +         f i 
 
 +     e l s e 
 
 +         i n p u t _ t o _ s h o r t p a t h = " $ n e w _ p a t h " 
 
 +     f i 
 
 + 
 
 +     #   C a l l   h e l p e r   f u n c t i o n   w h i c h   p o s s i b l y   c o n v e r t s   t h i s   u s i n g   D O S - s t y l e   s h o r t   m o d e . 
 
 +     #   I f   s o ,   t h e   u p d a t e d   p a t h   i s   s t o r e d   i n   $ n e w _ p a t h . 
 
 +     n e w _ p a t h = " $ i n p u t _ t o _ s h o r t p a t h " 
 
 +     B A S I C _ M A K E _ W I N D O W S _ S P A C E _ S A F E _ W S L ( [ $ i n p u t _ t o _ s h o r t p a t h ] ) 
 
 + ] ) 
 
 + 
 
   #   S e t u p   b a s i c   c o n f i g u r a t i o n   p a t h s ,   a n d   p l a t f o r m - s p e c i f i c   s t u f f   r e l a t e d   t o   P A T H s . 
 
   A C _ D E F U N ( [ B A S I C _ C H E C K _ P A T H S _ W I N D O W S ] , 
 
   [ 
 
 @ @   - 3 3 9 , 6   + 4 6 4 , 7   @ @ 
 
           i f   t e s t   " x $ t e s t _ c y g d r i v e _ p r e f i x "   =   x ;   t h e n 
 
               A C _ M S G _ E R R O R ( [ Y o u r   c y g d r i v e   p r e f i x   i s   n o t   / c y g d r i v e .   T h i s   i s   c u r r e n t l y   n o t   s u p p o r t e d .   C h a n g e   w i t h   m o u n t   - c . ] ) 
 
           f i 
 
 +         E X E C U T A B L E _ S U F F I X = " " 
 
       e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . m s y s " ;   t h e n 
 
           A C _ M S G _ C H E C K I N G ( [ m s y s   r e l e a s e ] ) 
 
           M S Y S _ V E R S I O N = ` $ U N A M E   - r ` 
 
 @ @   - 3 5 3 , 8   + 4 7 9 , 1 1   @ @ 
 
           B A S I C _ W I N D O W S _ R E W R I T E _ A S _ U N I X _ P A T H ( M S Y S _ R O O T _ P A T H ) 
 
           A C _ M S G _ R E S U L T ( [ $ M S Y S _ R O O T _ P A T H ] ) 
 
           W I N D O W S _ E N V _ R O O T _ P A T H = " $ M S Y S _ R O O T _ P A T H " 
 
 +         E X E C U T A B L E _ S U F F I X = " " 
 
 +     e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +         E X E C U T A B L E _ S U F F I X = " . e x e " 
 
       e l s e 
 
 -         A C _ M S G _ E R R O R ( [ U n k n o w n   W i n d o w s   e n v i r o n m e n t .   N e i t h e r   c y g w i n   n o r   m s y s   w a s   d e t e c t e d . ] ) 
 
 +         A C _ M S G _ E R R O R ( [ U n k n o w n   W i n d o w s   e n v i r o n m e n t .   N e i t h e r   c y g w i n ,   m s y s ,   n o r   w s l   w a s   d e t e c t e d . ] ) 
 
       f i 
 
   
 
       #   T e s t   i f   w i n d o w s   o r   u n i x   ( c y g w i n / m s y s )   f i n d   i s   f i r s t   i n   p a t h . 
 
 @ @   - 3 9 5 , 6   + 5 2 4 , 8   @ @ 
 
                       |   t r   '   '   ' \ n '   |   $ G R E P   ' ^ / . / '   |   $ S O R T   |   $ U N I Q ` 
 
               f i x p a t h _ a r g u m e n t _ l i s t = ` e c h o   $ a l l _ u n i q u e _ p r e f i x e s     |   t r   '   '   ' @ ' ` 
 
               F I X P A T H = " $ F I X P A T H _ B I N   - m $ f i x p a t h _ a r g u m e n t _ l i s t " 
 
 +         e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   x w i n d o w s . w s l ;   t h e n 
 
 +             F I X P A T H = " $ F I X P A T H _ B I N   - w " 
 
           f i 
 
           F I X P A T H _ S R C _ W = " $ F I X P A T H _ S R C " 
 
           F I X P A T H _ B I N _ W = " $ F I X P A T H _ B I N " 
 
 @ @   - 4 1 2 , 6   + 5 4 3 , 1 7   @ @ 
 
               A C _ M S G _ E R R O R ( [ C o u l d   n o t   c r e a t e   $ F I X P A T H _ B I N ] ) 
 
           f i 
 
           A C _ M S G _ R E S U L T ( [ y e s ] ) 
 
 + 
 
 +         i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +             O L D _ W S L E N V = " $ W S L E N V " 
 
 + 	     W S L E N V = ` $ E C H O   $ W S L E N V   |   $ S E D   ' s / P A T H \ / l : / / ' ` 
 
 +             #   A p p e n d   V S _ P A T H 
 
 +             B A S I C _ A P P E N D _ T O _ P A T H ( P A T H ,   $ V S _ P A T H ) 
 
 +             B A S I C _ A P P E N D _ T O _ P A T H ( W S L E N V ,   " P A T H / l : L I B : I N C L U D E " ) 
 
 +             e x p o r t   W S L E N V 
 
 + 	     A C _ M S G _ N O T I C E ( [ R e w r i t i n g   W S L E N V   f r o m   $ O L D _ W S L E N V   t o   $ W S L E N V ] ) 
 
 +         f i 
 
 + 
 
           A C _ M S G _ C H E C K I N G ( [ i f   f i x p a t h . e x e   w o r k s ] ) 
 
           c d   $ F I X P A T H _ D I R 
 
           $ F I X P A T H   $ C C   $ F I X P A T H _ S R C   - F e $ F I X P A T H _ D I R / f i x p a t h 2 . e x e   \ 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / b o o t - j d k . m 4 
 
 - - -   a / m a k e / a u t o c o n f / b o o t - j d k . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / b o o t - j d k . m 4 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 6 3 , 1 8   + 6 3 , 1 8   @ @ 
 
           #   I f   p r e v i o u s   s t e p   c l a i m e d   t o   h a v e   f o u n d   a   J D K ,   c h e c k   i t   t o   s e e   i f   i t   s e e m s   t o   b e   v a l i d . 
 
           i f   t e s t   " x $ B O O T _ J D K _ F O U N D "   =   x m a y b e ;   t h e n 
 
               #   D o   w e   h a v e   a   b i n / j a v a ? 
 
 -             i f   t e s t   !   - x   " $ B O O T _ J D K / b i n / j a v a " ;   t h e n 
 
 +             i f   t e s t   !   - x   " $ B O O T _ J D K / b i n / j a v a $ E X E C U T A B L E _ S U F F I X " ;   t h e n 
 
                   A C _ M S G _ N O T I C E ( [ P o t e n t i a l   B o o t   J D K   f o u n d   a t   $ B O O T _ J D K   d i d   n o t   c o n t a i n   b i n / j a v a ;   i g n o r i n g ] ) 
 
                   B O O T _ J D K _ F O U N D = n o 
 
               e l s e 
 
                   #   D o   w e   h a v e   a   b i n / j a v a c ? 
 
 -                 i f   t e s t   !   - x   " $ B O O T _ J D K / b i n / j a v a c " ;   t h e n 
 
 +                 i f   t e s t   !   - x   " $ B O O T _ J D K / b i n / j a v a c $ E X E C U T A B L E _ S U F F I X " ;   t h e n 
 
                       A C _ M S G _ N O T I C E ( [ P o t e n t i a l   B o o t   J D K   f o u n d   a t   $ B O O T _ J D K   d i d   n o t   c o n t a i n   b i n / j a v a c ;   i g n o r i n g ] ) 
 
                       A C _ M S G _ N O T I C E ( [ ( T h i s   m i g h t   b e   a n   J R E   i n s t e a d   o f   a n   J D K ) ] ) 
 
                       B O O T _ J D K _ F O U N D = n o 
 
                   e l s e 
 
                       #   O h ,   t h i s   i s   l o o k i n g   g o o d !   W e   p r o b a b l y   h a v e   f o u n d   a   p r o p e r   J D K .   I s   i t   t h e   c o r r e c t   v e r s i o n ? 
 
 -                     B O O T _ J D K _ V E R S I O N = ` " $ B O O T _ J D K / b i n / j a v a "   $ U S E R _ B O O T _ J D K _ O P T I O N S   - v e r s i o n   2 > & 1   |   $ H E A D   - n   1 ` 
 
 +                     B O O T _ J D K _ V E R S I O N = ` " $ B O O T _ J D K / b i n / j a v a $ E X E C U T A B L E _ S U F F I X "   $ U S E R _ B O O T _ J D K _ O P T I O N S   - v e r s i o n   2 > & 1   |   $ H E A D   - n   1 ` 
 
                       i f   [   [ [   " $ B O O T _ J D K _ V E R S I O N "   = ~   " P i c k e d   u p "   ] ]   ] ;   t h e n 
 
                           A C _ M S G _ N O T I C E ( [ Y o u   h a v e   _ J A V A _ O P T I O N S   o r   J A V A _ T O O L _ O P T I O N S   s e t .   T h i s   c a n   m e s s   u p   t h e   b u i l d .   P l e a s e   u s e   - - w i t h - b o o t - j d k - j v m a r g s   i n s t e a d . ] ) 
 
                           A C _ M S G _ N O T I C E ( [ J a v a   r e p o r t s :   " $ B O O T _ J D K _ V E R S I O N " . ] ) 
 
 @ @   - 1 0 1 , 7   + 1 0 1 , 7   @ @ 
 
                           A C _ M S G _ C H E C K I N G ( [ f o r   B o o t   J D K ] ) 
 
                           A C _ M S G _ R E S U L T ( [ $ B O O T _ J D K ] ) 
 
                           A C _ M S G _ C H E C K I N G ( [ B o o t   J D K   v e r s i o n ] ) 
 
 -                         B O O T _ J D K _ V E R S I O N = ` " $ B O O T _ J D K / b i n / j a v a "   $ U S E R _ B O O T _ J D K _ O P T I O N S   - v e r s i o n   2 > & 1   |   $ T R   ' \ n \ r '   '     ' ` 
 
 +                         B O O T _ J D K _ V E R S I O N = ` " $ B O O T _ J D K / b i n / j a v a $ E X E C U T A B L E _ S U F F I X "   $ U S E R _ B O O T _ J D K _ O P T I O N S   - v e r s i o n   2 > & 1   |   $ T R   ' \ n \ r '   '     ' ` 
 
                           A C _ M S G _ R E S U L T ( [ $ B O O T _ J D K _ V E R S I O N ] ) 
 
                       f i   #   e n d   c h e c k   j d k   v e r s i o n 
 
                   f i   #   e n d   c h e c k   j a v a c 
 
 @ @   - 3 3 5 , 1 1   + 3 3 5 , 1 1   @ @ 
 
       A C _ S U B S T ( B O O T _ J D K ) 
 
   
 
       #   S e t u p   t o o l s   f r o m   t h e   B o o t   J D K . 
 
 -     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A ,   j a v a ) 
 
 -     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A C ,   j a v a c ) 
 
 -     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A D O C ,   j a v a d o c ) 
 
 -     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A R ,   j a r ) 
 
 -     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A R S I G N E R ,   j a r s i g n e r ) 
 
 +     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A ,   j a v a $ E X E C U T A B L E _ S U F F I X ) 
 
 +     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A C ,   j a v a c $ E X E C U T A B L E _ S U F F I X ) 
 
 +     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A D O C ,   j a v a d o c $ E X E C U T A B L E _ S U F F I X ) 
 
 +     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A R ,   j a r $ E X E C U T A B L E _ S U F F I X ) 
 
 +     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A R S I G N E R ,   j a r s i g n e r $ E X E C U T A B L E _ S U F F I X ) 
 
   
 
       #   F i n a l l y ,   s e t   s o m e   o t h e r   o p t i o n s . . . 
 
   
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . g u e s s 
 
 - - -   a / m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . g u e s s 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . g u e s s 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 6 0 , 6   + 6 0 , 1 5   @ @ 
 
       e s a c 
 
   f i 
 
   
 
 + #   T e s t   a n d   f i x   w s l 
 
 + e c h o   $ O U T   |   g r e p   x 8 6 _ 6 4 - u n k n o w n - l i n u x - g n u   >   / d e v / n u l l   2 >   / d e v / n u l l 
 
 + i f   t e s t   $ ?   =   0 ;   t h e n 
 
 +     u n a m e   - r   |   g r e p   M i c r o s o f t   >   / d e v / n u l l   2 >   / d e v / n u l l 
 
 +     i f   t e s t   $ ?   =   0 ;   t h e n 
 
 +         O U T = " x 8 6 _ 6 4 - p c - w s l " 
 
 +     f i 
 
 + f i 
 
 + 
 
   #   T e s t   a n d   f i x   a r c h i t e c t u r e   s t r i n g   o n   A I X 
 
   #   O n   A I X   ' c o n f i g . g u e s s '   r e t u r n s   ' p o w e r p c '   a s   a r c h i t e c t u r e   b u t   ' p o w e r p c '   i s 
 
   #   i m p l i c i t e l y   h a n d l e d   a s   3 2 - b i t   a r c h i t e c t u r e   i n   ' p l a t f o r m . m 4 '   s o   w e   c h e c k 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . s u b 
 
 - - -   a / m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . s u b 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . s u b 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 9 , 7   + 2 9 , 1 3   @ @ 
 
   
 
   D I R = ` d i r n a m e   $ 0 ` 
 
   
 
 - #   F i r s t ,   f i l t e r   o u t   e v e r y t h i n g   t h a t   d o e s n ' t   b e g i n   w i t h   " a a r c h 6 4 - " 
 
 + #   A l l o w   w s l 
 
 + i f   e c h o   $ *   |   g r e p   x 8 6 _ 6 4 - p c - w s l   > / d e v / n u l l   ;   t h e n 
 
 +         e c h o   $ * 
 
 +         e x i t 
 
 + f i 
 
 + 
 
 + #   F i l t e r   o u t   e v e r y t h i n g   t h a t   d o e s n ' t   b e g i n   w i t h   " a a r c h 6 4 - " 
 
   i f   !   e c h o   $ *   |   g r e p   ' ^ a a r c h 6 4 - '   > / d e v / n u l l   ;   t h e n 
 
           .   $ D I R / a u t o c o n f - c o n f i g . s u b   " $ @ " 
 
           #   a u t o c o n f - c o n f i g . s u b   e x i t s ,   s o   w e   n e v e r   r e a c h   h e r e ,   b u t   j u s t   i n 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / p l a t f o r m . m 4 
 
 - - -   a / m a k e / a u t o c o n f / p l a t f o r m . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / p l a t f o r m . m 4 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 1 8 8 , 6   + 1 8 8 , 1 0   @ @ 
 
               V A R _ O S = w i n d o w s 
 
               V A R _ O S _ E N V = w i n d o w s . c y g w i n 
 
               ; ; 
 
 +         * w s l * ) 
 
 +             V A R _ O S = w i n d o w s 
 
 +             V A R _ O S _ E N V = w i n d o w s . w s l 
 
 +             ; ; 
 
           * m i n g w * ) 
 
               V A R _ O S = w i n d o w s 
 
               V A R _ O S _ E N V = w i n d o w s . m s y s 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / s p e c . g m k . i n 
 
 - - -   a / m a k e / a u t o c o n f / s p e c . g m k . i n 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / s p e c . g m k . i n 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 1 2 2 , 7   + 1 2 2 , 1 3   @ @ 
 
   i f e q   ( $ ( O P E N J D K _ T A R G E T _ O S ) ,   w i n d o w s ) 
 
       #   O n   W i n d o w s ,   t h e   V i s u a l   S t u d i o   t o o l c h a i n   n e e d s   t h e   P A T H   t o   b e   a d j u s t e d 
 
       #   t o   i n c l u d e   V i s u a l   S t u d i o   t o o l s   ( t h i s   n e e d s   t o   b e   i n   c y g w i n / m s y s   s t y l e ) . 
 
 -     e x p o r t   P A T H : = @ V S _ P A T H @ 
 
 +     i f e q   ( $ ( O P E N J D K _ T A R G E T _ O S _ E N V ) ,   w i n d o w s . w s l ) 
 
 +         e x p o r t   P A T H : = $ ( O R I G I N A L _ P A T H ) : @ V S _ P A T H @ 
 
 +         e x p o r t   F I X P A T H _ P A T H : = " @ F I X P A T H _ P A T H @ " 
 
 +         e x p o r t   W S L E N V : = $ ( W S L E N V ) : F I X P A T H _ P A T H 
 
 +     e l s e 
 
 +         e x p o r t   P A T H : = @ V S _ P A T H @ 
 
 +     e n d i f 
 
   e n d i f 
 
   
 
   S Y S R O O T _ C F L A G S   : =   @ S Y S R O O T _ C F L A G S @ 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / t o o l c h a i n . m 4 
 
 - - -   a / m a k e / a u t o c o n f / t o o l c h a i n . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / t o o l c h a i n . m 4 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 8 1 , 1 3   + 2 8 1 , 1 3   @ @ 
 
   
 
       T O O L C H A I N _ C C _ B I N A R Y _ c l a n g = " c l a n g " 
 
       T O O L C H A I N _ C C _ B I N A R Y _ g c c = " g c c " 
 
 -     T O O L C H A I N _ C C _ B I N A R Y _ m i c r o s o f t = " c l " 
 
 +     T O O L C H A I N _ C C _ B I N A R Y _ m i c r o s o f t = " c l $ E X E C U T A B L E _ S U F F I X " 
 
       T O O L C H A I N _ C C _ B I N A R Y _ s o l s t u d i o = " c c " 
 
       T O O L C H A I N _ C C _ B I N A R Y _ x l c = " x l c _ r " 
 
   
 
       T O O L C H A I N _ C X X _ B I N A R Y _ c l a n g = " c l a n g + + " 
 
       T O O L C H A I N _ C X X _ B I N A R Y _ g c c = " g + + " 
 
 -     T O O L C H A I N _ C X X _ B I N A R Y _ m i c r o s o f t = " c l " 
 
 +     T O O L C H A I N _ C X X _ B I N A R Y _ m i c r o s o f t = " c l $ E X E C U T A B L E _ S U F F I X " 
 
       T O O L C H A I N _ C X X _ B I N A R Y _ s o l s t u d i o = " C C " 
 
       T O O L C H A I N _ C X X _ B I N A R Y _ x l c = " x l C _ r " 
 
   
 
 @ @   - 3 3 3 , 9   + 3 3 3 , 1 7   @ @ 
 
       i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S "   =   " x w i n d o w s "   \ 
 
               & &   t e s t   " x $ T O O L C H A I N _ T Y P E "   =   " x m i c r o s o f t " ;   t h e n 
 
           T O O L C H A I N _ S E T U P _ V I S U A L _ S T U D I O _ E N V 
 
 -         #   R e s e t   p a t h   t o   V S _ P A T H .   I t   w i l l   i n c l u d e   e v e r y t h i n g   t h a t   w a s   o n   P A T H   a t   t h e   t i m e   w e 
 
 -         #   r a n   T O O L C H A I N _ S E T U P _ V I S U A L _ S T U D I O _ E N V . 
 
 -         P A T H = " $ V S _ P A T H " 
 
 +         i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +             #   A p p e n d   V S _ P A T H 
 
 +             B A S I C _ A P P E N D _ T O _ P A T H ( P A T H ,   $ V S _ P A T H ) 
 
 +             B A S I C _ A P P E N D _ T O _ P A T H ( W S L E N V ,   " P A T H / l : L I B : I N C L U D E " ) 
 
 +             e x p o r t   W S L E N V 
 
 +         e l s e 
 
 +             #   R e s e t   p a t h   t o   V S _ P A T H .   I t   w i l l   i n c l u d e   e v e r y t h i n g   t h a t   w a s   o n   P A T H   a t   t h e   t i m e   w e 
 
 +             #   r a n   T O O L C H A I N _ S E T U P _ V I S U A L _ S T U D I O _ E N V . 
 
 +             B A S I C _ A P P E N D _ T O _ P A T H ( P A T H ,   $ V S _ P A T H ) 
 
 +             A C _ M S G _ N O T I C E ( P A T H   $ P A T H ) 
 
 +         f i 
 
           #   T h e   m i c r o s o f t   t o o l c h a i n   a l s o   r e q u i r e s   I N C L U D E   a n d   L I B   t o   b e   s e t . 
 
           e x p o r t   I N C L U D E = " $ V S _ I N C L U D E " 
 
           e x p o r t   L I B = " $ V S _ L I B " 
 
 @ @   - 3 6 8 , 6   + 3 7 6 , 2 9   @ @ 
 
           P A T H = " $ O L D _ P A T H " 
 
       f i 
 
   
 
 +     F I X P A T H _ P A T H = " " 
 
 +     i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +         O L D I F S = " $ I F S " 
 
 +         I F S = " : " 
 
 +         f o r   i   i n   $ P A T H ;   d o 
 
 +             p a t h = $ i 
 
 +             #   O n l y   p r o c e s s   n o n - e m p t y   e l e m e n t s 
 
 +             i f   t e s t   " x $ p a t h "   ! =   x ;   t h e n 
 
 +                 #   O n l y   p r o c e s s   e l e m e n t s   t h a t   h a v e   a   c o r r e s p o n d i n g   W i n d o w s   p a t h 
 
 +                 t e s t _ m o u n t e d _ w s l _ w i n d o w s _ p a t h = ` $ E C H O   $ p a t h   |   $ G R E P   ^ / m n t / . / ` 
 
 +                 i f   t e s t   " x $ t e s t _ m o u n t e d _ w s l _ w i n d o w s _ p a t h "   ! =   x ;   t h e n 
 
 +                     I F S = " $ O L D I F S " 
 
 +                     B A S I C _ W I N D O W S _ R E W R I T E _ A S _ W I N D O W S _ M I X E D _ P A T H ( [ p a t h ] ) 
 
 +                     F I X P A T H _ P A T H = " $ F I X P A T H _ P A T H $ p a t h ; " 
 
 +                 f i 
 
 +                 I F S = " ; " 
 
 +             f i 
 
 +         d o n e 
 
 +         I F S = " $ O L D I F S " 
 
 +         A C _ M S G _ N O T I C E ( " U s i n g   F I X P A T H _ P A T H   $ F I X P A T H _ P A T H " ) 
 
 +     f i 
 
 +     A C _ S U B S T ( F I X P A T H _ P A T H ) 
 
 + 
 
       #   R e s t o r e   t h e   f l a g s   t o   t h e   u s e r   s p e c i f i e d   v a l u e s . 
 
       #   T h i s   i s   n e c e s s a r y   s i n c e   A C _ P R O G _ C C   d e f a u l t s   C F L A G S   t o   " - g   - O 2 " 
 
       C F L A G S = " $ O R G _ C F L A G S " 
 
 @ @   - 4 3 0 , 7   + 4 6 1 , 7   @ @ 
 
           #   T h e r e   i s   n o   s p e c i f i c   v e r s i o n   f l a g ,   b u t   a l l   o u t p u t   s t a r t s   w i t h   a   v e r s i o n   s t r i n g . 
 
           #   F i r s t   l i n e   t y p i c a l l y   l o o k s   s o m e t h i n g   l i k e : 
 
           #   M i c r o s o f t   ( R )   3 2 - b i t   C / C + +   O p t i m i z i n g   C o m p i l e r   V e r s i o n   1 6 . 0 0 . 4 0 2 1 9 . 0 1   f o r   8 0 x 8 6 
 
 -         C O M P I L E R _ V E R S I O N _ O U T P U T = ` $ C O M P I L E R   2 > & 1   |   $ H E A D   - n   1   |   $ T R   - d   ' \ r ' ` 
 
 +         C O M P I L E R _ V E R S I O N _ O U T P U T = ` " $ C O M P I L E R "   2 > & 1   |   $ G R E P   - v   ' E R R O R . * U t i l T r a n s l a t e P a t h L i s t '   |   $ H E A D   - n   1   |   $ T R   - d   ' \ r ' ` 
 
           #   C h e c k   t h a t   t h i s   i s   l i k e l y   t o   b e   M i c r o s o f t   C L . E X E . 
 
           $ E C H O   " $ C O M P I L E R _ V E R S I O N _ O U T P U T "   |   $ G R E P   " M i c r o s o f t . * C o m p i l e r "   >   / d e v / n u l l 
 
           i f   t e s t   $ ?   - n e   0 ;   t h e n 
 
 @ @   - 6 9 8 , 7   + 7 2 9 , 7   @ @ 
 
           #   I n   t h e   M i c r o s o f t   t o o l c h a i n   w e   h a v e   a   s e p a r a t e   L D   c o m m a n d   " l i n k " . 
 
           #   M a k e   s u r e   w e   r e j e c t   / u s r / b i n / l i n k   ( a s   d e t e r m i n e d   i n   C Y G W I N _ L I N K ) ,   w h i c h   i s 
 
           #   a   c y g w i n   p r o g r a m   f o r   s o m e t h i n g   c o m p l e t e l y   d i f f e r e n t . 
 
 -         A C _ C H E C K _ P R O G ( [ L D ] ,   [ l i n k ] , [ l i n k ] , , ,   [ $ C Y G W I N _ L I N K ] ) 
 
 +         A C _ C H E C K _ P R O G ( [ L D ] ,   [ l i n k . e x e ] , [ l i n k . e x e ] , , ,   [ $ C Y G W I N _ L I N K ] ) 
 
           B A S I C _ F I X U P _ E X E C U T A B L E ( L D ) 
 
           #   V e r i f y   t h a t   w e   i n d e e d   s u c c e e d e d   w i t h   t h i s   t r i c k . 
 
           A C _ M S G _ C H E C K I N G ( [ i f   t h e   f o u n d   l i n k . e x e   i s   a c t u a l l y   t h e   V i s u a l   S t u d i o   l i n k e r ] ) 
 
 @ @   - 7 5 0 , 7   + 7 8 1 , 7   @ @ 
 
       # 
 
       i f   t e s t   " x $ T O O L C H A I N _ T Y P E "   =   x m i c r o s o f t ;   t h e n 
 
           #   T h e   c o r r e s p o n d i n g   a r   t o o l   i s   l i b . e x e   ( u s e d   t o   c r e a t e   s t a t i c   l i b r a r i e s ) 
 
 -         A C _ C H E C K _ P R O G ( [ A R ] ,   [ l i b ] , [ l i b ] , , , ) 
 
 +         A C _ C H E C K _ P R O G ( [ A R ] ,   [ l i b . e x e ] , [ l i b . e x e ] , , , ) 
 
       e l i f   t e s t   " x $ T O O L C H A I N _ T Y P E "   =   x g c c ;   t h e n 
 
           B A S I C _ C H E C K _ T O O L S ( A R ,   a r   g c c - a r ) 
 
       e l s e 
 
 @ @   - 7 7 4 , 1 2   + 8 0 5 , 1 2   @ @ 
 
       f i 
 
   
 
       i f   t e s t   " x $ T O O L C H A I N _ T Y P E "   =   x m i c r o s o f t ;   t h e n 
 
 -         A C _ C H E C K _ P R O G ( [ M T ] ,   [ m t ] ,   [ m t ] , , ,   [ / u s r / b i n / m t ] ) 
 
 +         A C _ C H E C K _ P R O G ( [ M T ] ,   [ m t . e x e ] ,   [ m t . e x e ] , , ,   [ / u s r / b i n / m t ] ) 
 
           B A S I C _ F I X U P _ E X E C U T A B L E ( M T ) 
 
           #   S e t u p   t h e   r e s o u r c e   c o m p i l e r   ( R C ) 
 
 -         A C _ C H E C K _ P R O G ( [ R C ] ,   [ r c ] ,   [ r c ] , , ,   [ / u s r / b i n / r c ] ) 
 
 +         A C _ C H E C K _ P R O G ( [ R C ] ,   [ r c . e x e ] ,   [ r c . e x e ] , , ,   [ / u s r / b i n / r c ] ) 
 
           B A S I C _ F I X U P _ E X E C U T A B L E ( R C ) 
 
 -         A C _ C H E C K _ P R O G ( [ D U M P B I N ] ,   [ d u m p b i n ] ,   [ d u m p b i n ] , , , ) 
 
 +         A C _ C H E C K _ P R O G ( [ D U M P B I N ] ,   [ d u m p b i n . e x e ] ,   [ d u m p b i n . e x e ] , , , ) 
 
           B A S I C _ F I X U P _ E X E C U T A B L E ( D U M P B I N ) 
 
           #   W e   n e e d   t o   c h e c k   f o r   ' m s b u i l d . e x e '   b e c a u s e   a t   t h e   p l a c e   w h e r e   w e   e x p e c t   t o 
 
           #   f i n d   ' m s b u i l d . e x e '   t h e r e ' s   a l s o   a   d i r e c t o r y   c a l l e d   ' m s b u i l d '   a n d   c o n f i g u r e 
 
 @ @   - 9 9 9 , 7   + 1 0 3 0 , 7   @ @ 
 
       #   C h e c k   f o r   e x t r a   p o t e n t i a l   b r o k e n n e s s . 
 
       i f   t e s t     " x $ T O O L C H A I N _ T Y P E "   =   x m i c r o s o f t ;   t h e n 
 
           #   O n   W i n d o w s ,   d o u b l e - c h e c k   t h a t   w e   g o t   t h e   r i g h t   c o m p i l e r . 
 
 -         C C _ V E R S I O N _ O U T P U T = ` $ C C   2 > & 1   |   $ H E A D   - n   1   |   $ T R   - d   ' \ r ' ` 
 
 +         C C _ V E R S I O N _ O U T P U T = ` $ C C   2 > & 1   |   $ G R E P   - v   ' E R R O R . * U t i l T r a n s l a t e P a t h L i s t '   |   $ H E A D   - n   1   |   $ T R   - d   ' \ r ' ` 
 
           C O M P I L E R _ C P U _ T E S T = ` $ E C H O   $ C C _ V E R S I O N _ O U T P U T   |   $ S E D   - n   " s / ^ . *   \ ( . * \ ) $ / \ 1 / p " ` 
 
           i f   t e s t   " x $ O P E N J D K _ T A R G E T _ C P U "   =   " x x 8 6 " ;   t h e n 
 
               i f   t e s t   " x $ C O M P I L E R _ C P U _ T E S T "   ! =   " x 8 0 x 8 6 "   - a   " x $ C O M P I L E R _ C P U _ T E S T "   ! =   " x x 8 6 " ;   t h e n 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / t o o l c h a i n _ w i n d o w s . m 4 
 
 - - -   a / m a k e / a u t o c o n f / t o o l c h a i n _ w i n d o w s . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / t o o l c h a i n _ w i n d o w s . m 4 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 1 1 5 , 7   + 1 1 5 , 7   @ @ 
 
                   V C V A R S F I L E S = " v c / b i n / v c v a r s 3 2 . b a t   v c / a u x i l i a r y / b u i l d / v c v a r s 3 2 . b a t " 
 
               e l s e 
 
                   V C V A R S F I L E S = " v c / b i n / a m d 6 4 / v c v a r s 6 4 . b a t   v c / b i n / x 8 6 _ a m d 6 4 / v c v a r s x 8 6 _ a m d 6 4 . b a t   \ 
 
 -                         v c / a u x i l i a r y / b u i l d / v c v a r s x 8 6 _ a m d 6 4 . b a t   v c / a u x i l i a r y / b u i l d / v c v a r s 6 4 . b a t " 
 
 +                         V C / A u x i l i a r y / B u i l d / v c v a r s x 8 6 _ a m d 6 4 . b a t   V C / A u x i l i a r y / B u i l d / v c v a r s 6 4 . b a t " 
 
               f i 
 
   
 
               f o r   V C V A R S F I L E   i n   $ V C V A R S F I L E S ;   d o 
 
 @ @   - 2 2 2 , 7   + 2 2 2 , 6   @ @ 
 
               [ C : / P r o g r a m   F i l e s / $ V S _ I N S T A L L _ D I R ] ,   [ w e l l - k n o w n   n a m e ] ) 
 
       T O O L C H A I N _ C H E C K _ P O S S I B L E _ V I S U A L _ S T U D I O _ R O O T ( [ $ { V S _ V E R S I O N } ] , 
 
               [ C : / P r o g r a m   F i l e s   ( x 8 6 ) / $ V S _ I N S T A L L _ D I R ] ,   [ w e l l - k n o w n   n a m e ] ) 
 
 - 
 
       i f   t e s t   " x $ S D K _ I N S T A L L _ D I R "   ! =   x ;   t h e n 
 
           i f   t e s t   " x $ P r o g r a m W 6 4 3 2 "   ! =   x ;   t h e n 
 
               T O O L C H A I N _ C H E C K _ P O S S I B L E _ W I N _ S D K _ R O O T ( [ $ { V S _ V E R S I O N } ] , 
 
 @ @   - 3 3 9 , 7   + 3 3 8 , 7   @ @ 
 
   [ 
 
       #   S t o r e   p a t h   t o   c y g w i n   l i n k . e x e   t o   h e l p   e x c l u d i n g   i t   w h e n   s e a r c h i n g   f o r 
 
       #   V S   l i n k e r .   T h i s   m u s t   b e   d o n e   b e f o r e   c h a n g i n g   t h e   P A T H   w h e n   l o o k i n g   f o r   V S . 
 
 -     A C _ P A T H _ P R O G ( C Y G W I N _ L I N K ,   l i n k ) 
 
 +     A C _ P A T H _ P R O G ( C Y G W I N _ L I N K ,   l i n k . e x e ) 
 
       i f   t e s t   " x $ C Y G W I N _ L I N K "   ! =   x ;   t h e n 
 
           A C _ M S G _ C H E C K I N G ( [ i f   t h e   f i r s t   f o u n d   l i n k . e x e   i s   a c t u a l l y   t h e   C y g w i n   l i n k   t o o l ] ) 
 
           " $ C Y G W I N _ L I N K "   - - v e r s i o n   >   / d e v / n u l l 
 
 @ @   - 3 7 2 , 8   + 3 7 1 , 1 3   @ @ 
 
               #   I n s t e a d   c r e a t e   a   s h e l l   s c r i p t   w h i c h   w i l l   s e t   t h e   r e l e v a n t   v a r i a b l e s   w h e n   r u n . 
 
               W I N P A T H _ V S _ E N V _ C M D = " $ V S _ E N V _ C M D " 
 
               B A S I C _ W I N D O W S _ R E W R I T E _ A S _ W I N D O W S _ M I X E D _ P A T H ( [ W I N P A T H _ V S _ E N V _ C M D ] ) 
 
 -             W I N P A T H _ B A S H = " $ B A S H " 
 
 -             B A S I C _ W I N D O W S _ R E W R I T E _ A S _ W I N D O W S _ M I X E D _ P A T H ( [ W I N P A T H _ B A S H ] ) 
 
 + 
 
 +             i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +                 W I N P A T H _ B A S H = " b a s h " 
 
 +             e l s e 
 
 +                 W I N P A T H _ B A S H = " $ B A S H " 
 
 +                 B A S I C _ W I N D O W S _ R E W R I T E _ A S _ W I N D O W S _ M I X E D _ P A T H ( [ W I N P A T H _ B A S H ] ) 
 
 +             f i 
 
   
 
               #   G e n e r a t e   a   D O S   b a t c h   f i l e   w h i c h   r u n s   $ V S _ E N V _ C M D ,   a n d   t h e n   c r e a t e s   a   s h e l l 
 
               #   s c r i p t   ( e x e c u t a b l e   b y   b a s h )   t h a t   w i l l   s e t u p   t h e   i m p o r t a n t   v a r i a b l e s . 
 
 @ @   - 3 8 1 , 7   + 3 8 5 , 7   @ @ 
 
               $ E C H O   " @ e c h o   o f f "   >     $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
               #   T h i s   w i l l   e n d   u p   s o m e t h i n g   l i k e : 
 
               #   c a l l   C : / p r o g r a ~ 2 / m i c r o s ~ 2 . 0 / v c / b i n / a m d 6 4 / v c v a r s 6 4 . b a t 
 
 -             $ E C H O   " c a l l   $ W I N P A T H _ V S _ E N V _ C M D   $ V S _ E N V _ A R G S "   > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 +             $ E C H O   " c a l l   \ " $ W I N P A T H _ V S _ E N V _ C M D \ "   $ V S _ E N V _ A R G S "   > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
               #   I n   s o m e   c a s e s ,   t h e   V S _ E N V _ C M D   w i l l   c h a n g e   d i r e c t o r y ,   c h a n g e   b a c k   s o 
 
               #   t h e   s e t - v s - e n v . s h   e n d s   u p   i n   t h e   r i g h t   p l a c e . 
 
               $ E C H O   ' c d   % ~ d p 0 '   > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 @ @   - 3 8 9 , 3 3   + 3 9 3 , 3 8   @ @ 
 
               #   C : / C y g W i n / b i n / b a s h   - c   ' e c h o   V S _ P A T H = \ " $ P A T H \ "   >   l o c a l d e v e n v . s h 
 
               #   T h e   t r a i l i n g   s p a c e   f o r   e v e r y o n e   e x c e p t   P A T H   i s   n o   t y p o ,   b u t   i s   n e e d e d   d u e 
 
               #   t o   t r a i l i n g   \   i n   t h e   W i n d o w s   p a t h s .   T h e s e   w i l l   b e   s t r i p p e d   l a t e r . 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   V S _ P A T H = " ' \ " $ P A T H \ "   >   s e t - v s - e n v . s h '   \ 
 
 +             #   T r y i n g   p u r e   C M D   e x t r a c t .   T h i s   r e s u l t s   i n   w i n d o w s   p a t h s   t h a t   n e e d   t o 
 
 +             #   b e   c o n v e r t e d   p o s t   e x t r a c t i o n ,   b u t   a   s i m p l e r   s c r i p t . 
 
 +             $ E C H O   ' e c h o   V S _ P A T H = " % P A T H % "   >   s e t - v s - e n v . s h '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   V S _ I N C L U D E = " ' \ " $ I N C L U D E \ ; $ i n c l u d e   \ "   > >   s e t - v s - e n v . s h '   \ 
 
 -                     > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   V S _ L I B = " ' \ " $ L I B \ ; $ l i b   \ "   > >   s e t - v s - e n v . s h '   \ 
 
 +             $ E C H O   ' e c h o   V S _ I N C L U D E = " % I N C L U D E %   "   > >   s e t - v s - e n v . s h '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   V C I N S T A L L D I R = " ' \ " $ V C I N S T A L L D I R   \ "   > >   s e t - v s - e n v . s h '   \ 
 
 +             $ E C H O   ' e c h o   V S _ L I B = " % L I B %   "   > >   s e t - v s - e n v . s h '   \ 
 
 +                     > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 +             $ E C H O   ' e c h o   V C I N S T A L L D I R = " % V C I N S T A L L D I R %   "   > >   s e t - v s - e n v . s h '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   W i n d o w s S d k D i r = " ' \ " $ W i n d o w s S d k D i r   \ "   > >   s e t - v s - e n v . s h '   \ 
 
 +             $ E C H O   ' e c h o   W i n d o w s S d k D i r = " % W i n d o w s S d k D i r %   "   > >   s e t - v s - e n v . s h '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   W I N D O W S S D K D I R = " ' \ " $ W I N D O W S S D K D I R   \ "   > >   s e t - v s - e n v . s h '   \ 
 
 +             $ E C H O   ' e c h o   W I N D O W S S D K D I R = " % W I N D O W S S D K D I R %   "   > >   s e t - v s - e n v . s h '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
   
 
               #   N o w   e x e c u t e   t h e   n e w l y   c r e a t e d   b a t   f i l e . 
 
               #   T h e   |   c a t   i s   t o   s t o p   S e t E n v . C m d   t o   m e s s   w i t h   s y s t e m   c o l o r s   o n   m s y s . 
 
               #   C h a n g e   d i r e c t o r y   s o   w e   d o n ' t   n e e d   t o   m e s s   w i t h   W i n d o w s   p a t h s   i n   r e d i r e c t s . 
 
               c d   $ V S _ E N V _ T M P _ D I R 
 
 -             c m d   / c   e x t r a c t - v s - e n v . b a t   |   $ C A T 
 
 +             $ C M D   / c   e x t r a c t - v s - e n v . b a t   |   $ C A T 
 
               c d   $ C U R D I R 
 
   
 
               i f   t e s t   !   - s   $ V S _ E N V _ T M P _ D I R / s e t - v s - e n v . s h ;   t h e n 
 
 -                 A C _ M S G _ N O T I C E ( [ C o u l d   n o t   s u c c e s f u l l y   e x t r a c t   t h e   e n v i o n m e n t   v a r i a b l e s   n e e d e d   f o r   t h e   V S   s e t u p . ] ) 
 
 +                 A C _ M S G _ N O T I C E ( [ C o u l d   n o t   s u c c e s f u l l y   e x t r a c t   t h e   e n v i r o n m e n t   v a r i a b l e s   n e e d e d   f o r   t h e   V S   s e t u p . ] ) 
 
                   A C _ M S G _ N O T I C E ( [ T r y   s e t t i n g   - - w i t h - t o o l s - d i r   t o   t h e   V C / b i n   d i r e c t o r y   w i t h i n   t h e   V S   i n s t a l l a t i o n ] ) 
 
                   A C _ M S G _ N O T I C E ( [ o r   r u n   " b a s h . e x e   - l "   f r o m   a   V S   c o m m a n d   p r o m p t   a n d   t h e n   r u n   c o n f i g u r e   f r o m   t h e r e . ] ) 
 
                   A C _ M S G _ E R R O R ( [ C a n n o t   c o n t i n u e ] ) 
 
               f i 
 
   
 
 +             #   R e m o v e   w i n d o w s   l i n e   e n d i n g s 
 
 +             $ S E D   - i   - e   ' s | \ r | | g '   $ V S _ E N V _ T M P _ D I R / s e t - v s - e n v . s h 
 
 + 
 
               #   N o w   s e t   a l l   p a t h s   a n d   o t h e r   e n v   v a r i a b l e s .   T h i s   w i l l   a l l o w   t h e   r e s t   o f 
 
               #   t h e   c o n f i g u r e   s c r i p t   t o   f i n d   a n d   r u n   t h e   c o m p i l e r   i n   t h e   p r o p e r   w a y . 
 
               A C _ M S G _ N O T I C E ( [ S e t t i n g   e x t r a c t e d   e n v i r o n m e n t   v a r i a b l e s ] ) 
 
 @ @   - 4 5 5 , 9   + 4 6 4 , 2 7   @ @ 
 
               A C _ S U B S T ( V S _ I N C L U D E ) 
 
               A C _ S U B S T ( V S _ L I B ) 
 
   
 
 -             #   C o n v e r t   V S _ I N C L U D E   i n t o   S Y S R O O T _ C F L A G S 
 
 +             #   C o n v e r t   V S _ P A T H   t o   u n i x   s t y l e 
 
               O L D I F S = " $ I F S " 
 
               I F S = " ; " 
 
 +             V S _ P A T H _ W I N D O W S = " $ V S _ P A T H " 
 
 +             V S _ P A T H = " " 
 
 +             f o r   i   i n   $ V S _ P A T H _ W I N D O W S ;   d o 
 
 +                 p a t h = $ i 
 
 +                 #   O n l y   p r o c e s s   n o n - e m p t y   e l e m e n t s 
 
 +                 i f   t e s t   " x $ p a t h "   ! =   x ;   t h e n 
 
 +                     I F S = " $ O L D I F S " 
 
 +                     #   C h e c k   t h a t   d i r e c t o r y   e x i s t s   b e f o r e   c a l l i n g   f i x u p _ p a t h 
 
 +                     t e s t p a t h = $ p a t h 
 
 +                     B A S I C _ W I N D O W S _ R E W R I T E _ A S _ U N I X _ P A T H ( [ t e s t p a t h ] ) 
 
 +                     i f   t e s t   - d   " $ t e s t p a t h " ;   t h e n 
 
 +                         B A S I C _ F I X U P _ P A T H ( [ p a t h ] ) 
 
 +                         B A S I C _ A P P E N D _ T O _ P A T H ( V S _ P A T H ,   $ p a t h ) 
 
 +                     f i 
 
 +                     I F S = " ; " 
 
 +                 f i 
 
 +             d o n e 
 
 +             #   C o n v e r t   V S _ I N C L U D E   i n t o   S Y S R O O T _ C F L A G S 
 
               f o r   i   i n   $ V S _ I N C L U D E ;   d o 
 
                   i p a t h = $ i 
 
                   #   O n l y   p r o c e s s   n o n - e m p t y   e l e m e n t s 
 
 @ @   - 6 0 0 , 1 0   + 6 2 7 , 1 0   @ @ 
 
               B A S I C _ W I N D O W S _ R E W R I T E _ A S _ U N I X _ P A T H ( C Y G W I N _ V S _ T O O L S _ D I R ) 
 
               i f   t e s t   " x $ O P E N J D K _ T A R G E T _ C P U _ B I T S "   =   x 6 4 ;   t h e n 
 
                   P O S S I B L E _ M S V C _ D L L = ` $ F I N D   " $ C Y G W I N _ V S _ T O O L S _ D I R "   - n a m e   $ D L L _ N A M E   \ 
 
 - 	         |   $ G R E P   - i   / x 6 4 /   |   $ H E A D   - - l i n e s   1 ` 
 
 +                 |   $ G R E P   - i   / x 6 4 /   |   $ H E A D   - - l i n e s   1 ` 
 
               e l s e 
 
                   P O S S I B L E _ M S V C _ D L L = ` $ F I N D   " $ C Y G W I N _ V S _ T O O L S _ D I R "   - n a m e   $ D L L _ N A M E   \ 
 
 - 	         |   $ G R E P   - i   / x 8 6 /   |   $ H E A D   - - l i n e s   1 ` 
 
 +                 |   $ G R E P   - i   / x 8 6 /   |   $ H E A D   - - l i n e s   1 ` 
 
               f i 
 
               T O O L C H A I N _ C H E C K _ P O S S I B L E _ M S V C _ D L L ( [ $ D L L _ N A M E ] ,   [ $ P O S S I B L E _ M S V C _ D L L ] , 
 
                       [ s e a r c h   o f   V S 1 0 0 C O M N T O O L S ] ) 
 
 @ @   - 6 1 6 , 1 4   + 6 4 3 , 1 4   @ @ 
 
           i f   t e s t   " x $ C Y G W I N _ V C _ I N S T A L L _ D I R "   ! =   x ;   t h e n 
 
               i f   t e s t   " x $ O P E N J D K _ T A R G E T _ C P U _ B I T S "   =   x 6 4 ;   t h e n 
 
                   P O S S I B L E _ M S V C _ D L L = ` $ F I N D   " $ C Y G W I N _ V C _ I N S T A L L _ D I R "   - n a m e   $ D L L _ N A M E   \ 
 
 - 	         |   $ G R E P   x 6 4   |   $ H E A D   - - l i n e s   1 ` 
 
 +                 |   $ G R E P   x 6 4   |   $ H E A D   - - l i n e s   1 ` 
 
               e l s e 
 
                   P O S S I B L E _ M S V C _ D L L = ` $ F I N D   " $ C Y G W I N _ V C _ I N S T A L L _ D I R "   - n a m e   $ D L L _ N A M E   \ 
 
 - 	         |   $ G R E P   x 8 6   |   $ G R E P   - v   i a 6 4   |   $ G R E P   - v   x 6 4   |   $ H E A D   - - l i n e s   1 ` 
 
 +                 |   $ G R E P   x 8 6   |   $ G R E P   - v   i a 6 4   |   $ G R E P   - v   x 6 4   |   $ H E A D   - - l i n e s   1 ` 
 
                   i f   t e s t   " x $ P O S S I B L E _ M S V C _ D L L "   =   x ;   t h e n 
 
                       #   W e ' r e   g r a s p i n g   a t   s t r a w s   n o w . . . 
 
                       P O S S I B L E _ M S V C _ D L L = ` $ F I N D   " $ C Y G W I N _ V C _ I N S T A L L _ D I R "   - n a m e   $ D L L _ N A M E   \ 
 
 - 	             |   $ H E A D   - - l i n e s   1 ` 
 
 +                     |   $ H E A D   - - l i n e s   1 ` 
 
                   f i 
 
               f i 
 
   
 
 @ @   - 6 9 3 , 7   + 7 2 0 , 7   @ @ 
 
       i f   t e s t   " x $ U S E _ U C R T "   =   " x t r u e " ;   t h e n 
 
           A C _ M S G _ C H E C K I N G ( [ f o r   U C R T   D L L   d i r ] ) 
 
           i f   t e s t   " x $ w i t h _ u c r t _ d l l _ d i r "   ! =   x ;   t h e n 
 
 -             i f   t e s t   - z   " $ ( l s   - d   " $ w i t h _ u c r t _ d l l _ d i r / * . d l l "   2 >   / d e v / n u l l ) " ;   t h e n 
 
 +             i f   t e s t   - z   " $ ( l s   - d   $ w i t h _ u c r t _ d l l _ d i r / * . d l l   2 >   / d e v / n u l l ) " ;   t h e n 
 
                   A C _ M S G _ R E S U L T ( [ n o ] ) 
 
                   A C _ M S G _ E R R O R ( [ C o u l d   n o t   f i n d   a n y   d l l s   i n   $ w i t h _ u c r t _ d l l _ d i r ] ) 
 
               e l s e 
 
 @ @   - 7 1 3 , 8   + 7 4 0 , 1 6   @ @ 
 
               f i 
 
               U C R T _ D L L _ D I R = " $ C Y G W I N _ W I N D O W S S D K D I R / R e d i s t / u c r t / D L L s / $ d l l _ s u b d i r " 
 
               i f   t e s t   - z   " $ ( l s   - d   " $ U C R T _ D L L _ D I R / " * . d l l   2 >   / d e v / n u l l ) " ;   t h e n 
 
 -                 A C _ M S G _ R E S U L T ( [ n o ] ) 
 
 -                 A C _ M S G _ E R R O R ( [ C o u l d   n o t   f i n d   a n y   d l l s   i n   $ U C R T _ D L L _ D I R ] ) 
 
 +                 #   T r y   w i t h   v e r s i o n   s u b d i r 
 
 +                 U C R T _ D L L _ D I R = " ` l s   - d   $ C Y G W I N _ W I N D O W S S D K D I R / R e d i s t / * / u c r t / D L L s / $ d l l _ s u b d i r   \ 
 
 +                         2 >   / d e v / n u l l   |   $ S O R T   - d   |   $ H E A D   - n 1 ` " 
 
 +                 i f   t e s t   - z   " $ U C R T _ D L L _ D I R "   \ 
 
 +                         | |   t e s t   - z   " $ ( l s   - d   " $ U C R T _ D L L _ D I R / " * . d l l   2 >   / d e v / n u l l ) " ;   t h e n 
 
 +                     A C _ M S G _ R E S U L T ( [ n o ] ) 
 
 +                     A C _ M S G _ E R R O R ( [ C o u l d   n o t   f i n d   a n y   d l l s   i n   $ U C R T _ D L L _ D I R ] ) 
 
 +                 e l s e 
 
 +                     A C _ M S G _ R E S U L T ( $ U C R T _ D L L _ D I R ) 
 
 +                 f i 
 
               e l s e 
 
                   A C _ M S G _ R E S U L T ( $ U C R T _ D L L _ D I R ) 
 
               f i 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / g e n d a t a / G e n d a t a - j a v a . b a s e . g m k 
 
 - - -   a / m a k e / g e n d a t a / G e n d a t a - j a v a . b a s e . g m k 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / g e n d a t a / G e n d a t a - j a v a . b a s e . g m k 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 5 5 , 7   + 5 5 , 7   @ @ 
 
   $ ( G E N D A T A _ C U R D A T A ) :   $ ( T O P D I R ) / m a k e / d a t a / c u r r e n c y / C u r r e n c y D a t a . p r o p e r t i e s   $ ( B U I L D _ T O O L S _ J D K ) 
 
   	 $ ( c a l l   M a k e D i r ,   $ ( @ D ) ) 
 
   	 $ ( R M )   $ @ 
 
 - 	 $ ( T O O L _ G E N E R A T E C U R R E N C Y D A T A )   - o   $ @ . t m p   <   $ < 
 
 + 	 $ ( T O O L _ G E N E R A T E C U R R E N C Y D A T A )   - o   $ @ . t m p   - i   $ < 
 
   	 $ ( M V )   $ @ . t m p   $ @ 
 
   	 $ ( C H M O D )   4 4 4   $ @ 
 
   
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / g e n s r c / G e n s r c B u f f e r . g m k 
 
 - - -   a / m a k e / g e n s r c / G e n s r c B u f f e r . g m k 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / g e n s r c / G e n s r c B u f f e r . g m k 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 3 0 , 7   + 2 3 0 , 8   @ @ 
 
       e n d i f 
 
   
 
       $ $ ( $ 1 _ D S T ) :   $ $ ( $ 1 _ D E P )   $ ( G E N S R C _ B U F F E R _ D S T ) / _ t h e . b u f f e r . d i r 
 
 - 	 $ ( T O O L _ S P P )   <   $ $ ( $ 1 _ S R C )   >   $ $ ( $ 1 _ O U T ) . t m p   \ 
 
 + 	 $ ( R M )   $ $ ( $ 1 _ O U T ) . t m p 
 
 + 	 $ ( T O O L _ S P P )   - i $ $ ( $ 1 _ S R C )   - o $ $ ( $ 1 _ O U T ) . t m p   \ 
 
   	         - K $ $ ( $ 1 _ t y p e )   \ 
 
   	         - K $ $ ( $ 1 _ c a t e g o r y )   \ 
 
   	         - K $ $ ( $ 1 _ s t r e a m s )   \ 
 
 @ @   - 2 6 0 , 1 2   + 2 6 1 , 1 2   @ @ 
 
                   i f e q   ( $ $ ( $ 1 _ B I N ) ,   1 ) 
 
   	     $ ( S E D )   - e   ' / # B I N / , $ $ $ $ d '   <   $ $ ( $ 1 _ O U T )   >   $ $ ( $ 1 _ D S T ) . t m p 
 
   	     $ ( R M )   $ $ ( $ 1 _ O U T ) 
 
 - 	     $ $ ( $ 1 _ c h a r _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 - 	     $ $ ( $ 1 _ s h o r t _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 - 	     $ $ ( $ 1 _ i n t _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 - 	     $ $ ( $ 1 _ l o n g _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 - 	     $ $ ( $ 1 _ f l o a t _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 - 	     $ $ ( $ 1 _ d o u b l e _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ c h a r _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ s h o r t _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ i n t _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ l o n g _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ f l o a t _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ d o u b l e _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
   	     $ ( P R I N T F )   " } \ n "   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
   	     m v   $ $ ( $ 1 _ D S T ) . t m p   $ $ ( $ 1 _ D S T ) 
 
                   e n d i f 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / g e n s r c / G e n s r c C h a r s e t C o d e r . g m k 
 
 - - -   a / m a k e / g e n s r c / G e n s r c C h a r s e t C o d e r . g m k 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / g e n s r c / G e n s r c C h a r s e t C o d e r . g m k 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 3 6 , 7   + 3 6 , 7   @ @ 
 
   $ ( G E N S R C _ C H A R S E T C O D E R _ D S T ) / C h a r s e t D e c o d e r . j a v a :   $ ( G E N S R C _ C H A R S E T C O D E R _ T E M P L A T E ) 
 
   	 $ ( c a l l   M a k e T a r g e t D i r ) 
 
   	 $ ( R M )   $ @ . t m p 
 
 - 	 $ ( T O O L _ S P P )   <   $ <   > $ @ . t m p   \ 
 
 + 	 $ ( T O O L _ S P P )   - i $ <   - o $ @ . t m p   \ 
 
   	         - K d e c o d e r   \ 
 
   	         - D A = ' A '   \ 
 
   	         - D a = ' a '   \ 
 
 @ @   - 7 1 , 7   + 7 1 , 7   @ @ 
 
   $ ( G E N S R C _ C H A R S E T C O D E R _ D S T ) / C h a r s e t E n c o d e r . j a v a :   $ ( G E N S R C _ C H A R S E T C O D E R _ T E M P L A T E ) 
 
   	 $ ( c a l l   M a k e T a r g e t D i r ) 
 
   	 $ ( R M )   $ @ . t m p 
 
 - 	 $ ( T O O L _ S P P )   <   $ <   > $ @ . t m p   \ 
 
 + 	 $ ( T O O L _ S P P )   - i $ <   - o $ @ . t m p   \ 
 
   	         - K e n c o d e r   \ 
 
   	         - D A = ' A n '   \ 
 
   	         - D a = ' a n '   \ 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / g e n s r c / G e n s r c V a r H a n d l e s . g m k 
 
 - - -   a / m a k e / g e n s r c / G e n s r c V a r H a n d l e s . g m k 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / g e n s r c / G e n s r c V a r H a n d l e s . g m k 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 5 9 , 8   + 5 9 , 9   @ @ 
 
   	     $ $ ( e v a l   $ 1 _ t y p e   : =   $ $ $ $ ( s h e l l   $ ( T R )   ' [ : u p p e r : ] '   ' [ : l o w e r : ] '   < < <   $ $ $ $ ( $ 1 _ T y p e ) ) ) 
 
                   e n d i f 
 
   	 $ $ ( c a l l   M a k e D i r ,   $ $ ( @ D ) ) 
 
 + 	 $ ( R M )   $ $ @ 
 
   	 $ ( T O O L _ S P P )   - n e l   - K $ $ ( $ 1 _ t y p e )   - D t y p e = $ $ ( $ 1 _ t y p e )   - D T y p e = $ $ ( $ 1 _ T y p e )   \ 
 
 - 	         $ $ ( $ 1 _ A R G S )   <   $ $ <   >   $ $ @ 
 
 + 	         $ $ ( $ 1 _ A R G S )   - i $ $ <   - o $ $ @ 
 
   
 
       G E N S R C _ V A R H A N D L E S   + =   $ $ ( $ 1 _ F I L E N A M E ) 
 
   e n d e f 
 
 @ @   - 1 4 7 , 1 0   + 1 4 8 , 1 1   @ @ 
 
   
 
       $ $ ( $ 1 _ F I L E N A M E ) :   $ ( V A R H A N D L E S _ S R C _ D I R ) / X - V a r H a n d l e B y t e A r r a y V i e w . j a v a . t e m p l a t e   $ ( B U I L D _ T O O L S _ J D K ) 
 
   	 $ $ ( c a l l   M a k e D i r ,   $ $ ( @ D ) ) 
 
 + 	 $ ( R M )   $ $ @ 
 
   	 $ ( T O O L _ S P P )   - n e l   - K $ $ ( $ 1 _ t y p e )   \ 
 
   	         - D t y p e = $ $ ( $ 1 _ t y p e )   - D T y p e = $ $ ( $ 1 _ T y p e )   - D B o x T y p e = $ $ ( $ 1 _ B o x T y p e )   \ 
 
   	         - D r a w T y p e = $ $ ( $ 1 _ r a w T y p e )   - D R a w T y p e = $ $ ( $ 1 _ R a w T y p e )   - D R a w B o x T y p e = $ $ ( $ 1 _ R a w B o x T y p e )   \ 
 
 - 	         $ $ ( $ 1 _ A R G S )   <   $ $ <   >   $ $ @ 
 
 + 	         $ $ ( $ 1 _ A R G S )   - i $ $ <   - o $ $ @ 
 
   
 
       G E N S R C _ V A R H A N D L E S   + =   $ $ ( $ 1 _ F I L E N A M E ) 
 
   e n d e f 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / g e n e r a t e c u r r e n c y d a t a / G e n e r a t e C u r r e n c y D a t a . j a v a 
 
 - - -   a / m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / g e n e r a t e c u r r e n c y d a t a / G e n e r a t e C u r r e n c y D a t a . j a v a 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / g e n e r a t e c u r r e n c y d a t a / G e n e r a t e C u r r e n c y D a t a . j a v a 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 8 , 7   + 2 8 , 9   @ @ 
 
   i m p o r t   j a v a . i o . I O E x c e p t i o n ; 
 
   i m p o r t   j a v a . i o . F i l e N o t F o u n d E x c e p t i o n ; 
 
   i m p o r t   j a v a . i o . D a t a O u t p u t S t r e a m ; 
 
 + i m p o r t   j a v a . i o . F i l e I n p u t S t r e a m ; 
 
   i m p o r t   j a v a . i o . F i l e O u t p u t S t r e a m ; 
 
 + i m p o r t   j a v a . i o . I n p u t S t r e a m ; 
 
   i m p o r t   j a v a . t e x t . S i m p l e D a t e F o r m a t ; 
 
   i m p o r t   j a v a . u t i l . D a t e ; 
 
   i m p o r t   j a v a . u t i l . H a s h M a p ; 
 
 @ @   - 1 3 4 , 1 9   + 1 3 6 , 4 4   @ @ 
 
           p r i v a t e   s t a t i c   S t r i n g   c u r r e n c i e s W i t h M i n o r U n i t s U n d e f i n e d ; 
 
   
 
           p u b l i c   s t a t i c   v o i d   m a i n ( S t r i n g [ ]   a r g s )   { 
 
 - 
 
 + 	         I n p u t S t r e a m   i n   =   S y s t e m . i n ; 
 
                   / /   L o o k   f o r   " - o   o u t p u t f i l e n a m e "   o p t i o n 
 
 -                 i f   (   a r g s . l e n g t h   = =   2   & &   a r g s [ 0 ] . e q u a l s ( " - o " )   )   { 
 
 -                         t r y   { 
 
 -                                 o u t   =   n e w   D a t a O u t p u t S t r e a m ( n e w   F i l e O u t p u t S t r e a m ( a r g s [ 1 ] ) ) ; 
 
 -                         }   c a t c h   (   F i l e N o t F o u n d E x c e p t i o n   e   )   { 
 
 -                                 S y s t e m . e r r . p r i n t l n ( " E r r o r :   "   +   e . g e t M e s s a g e ( ) ) ; 
 
 -                                 e . p r i n t S t a c k T r a c e ( S y s t e m . e r r ) ; 
 
 -                                 S y s t e m . e x i t ( 1 ) ; 
 
 -                         } 
 
 -                 }   e l s e   { 
 
 -                         S y s t e m . e r r . p r i n t l n ( " E r r o r :   I l l e g a l   a r g   c o u n t " ) ; 
 
 -                         S y s t e m . e x i t ( 1 ) ; 
 
 +                 f o r   ( i n t   n   =   0 ;   n   <   a r g s . l e n g t h ;   + + n )   { 
 
 +                         i f   ( a r g s [ n ] . e q u a l s ( " - o " ) )   { 
 
 + 	 	 	 	 + + n ; 
 
 + 	 	 	 	 i f   ( n   > =   a r g s . l e n g t h )   { 
 
 + 	 	 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   I n v a l i d   a r g u m e n t   f o r m a t " ) ; 
 
 + 	 	 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
 + 	 	 	 	 } 
 
 + 	 	 	 	 t r y   { 
 
 + 	 	 	 	 	 o u t   =   n e w   D a t a O u t p u t S t r e a m ( n e w   F i l e O u t p u t S t r e a m ( a r g s [ n ] ) ) ; 
 
 + 	 	 	 	 }   c a t c h   (   F i l e N o t F o u n d E x c e p t i o n   e   )   { 
 
 + 	 	 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   "   +   e . g e t M e s s a g e ( ) ) ; 
 
 + 	 	 	 	 	 e . p r i n t S t a c k T r a c e ( S y s t e m . e r r ) ; 
 
 + 	 	 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
 + 	 	 	 	 } 
 
 + 	 	 	 }   e l s e   i f   ( a r g s [ n ] . e q u a l s ( " - i " ) )   { 
 
 + 	 	 	 	 + + n ; 
 
 + 	 	 	 	 i f   ( n   > =   a r g s . l e n g t h )   { 
 
 + 	 	 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   I n v a l i d   a r g u m e n t   f o r m a t " ) ; 
 
 + 	 	 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
 + 	 	 	 	 } 
 
 + 	 	 	 	 t r y   { 
 
 + 	 	 	 	 	 i n   =   n e w   F i l e I n p u t S t r e a m ( a r g s [ n ] ) ; 
 
 + 	 	 	 	 }   c a t c h   (   F i l e N o t F o u n d E x c e p t i o n   e   )   { 
 
 + 	 	 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   "   +   e . g e t M e s s a g e ( ) ) ; 
 
 + 	 	 	 	 	 e . p r i n t S t a c k T r a c e ( S y s t e m . e r r ) ; 
 
 + 	 	 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
 + 	 	 	 	 } 
 
 + 	 	 	 }   e l s e   { 
 
 + 	 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   I n v a l i d   a r g u m e n t   "   +   a r g s [ n ] ) ; 
 
 + 	 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
 + 	 	 	 } 
 
 +                 } 
 
 + 
 
 +                 i f   ( o u t   = =   n u l l )   { 
 
 + 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   I n v a l i d   a r g u m e n t   f o r m a t " ) ; 
 
 + 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
                   } 
 
   
 
                   f o r m a t   =   n e w   S i m p l e D a t e F o r m a t ( " y y y y - M M - d d - H H - m m - s s " ,   L o c a l e . U S ) ; 
 
 @ @   - 1 5 4 , 7   + 1 8 1 , 7   @ @ 
 
                   f o r m a t . s e t L e n i e n t ( f a l s e ) ; 
 
   
 
                   t r y   { 
 
 -                         r e a d I n p u t ( ) ; 
 
 +                         r e a d I n p u t ( i n ) ; 
 
                           b u i l d M a i n A n d S p e c i a l C a s e T a b l e s ( ) ; 
 
                           b u i l d O t h e r T a b l e s ( ) ; 
 
                           w r i t e O u t p u t ( ) ; 
 
 @ @   - 1 6 7 , 9   + 1 9 4 , 9   @ @ 
 
                   } 
 
           } 
 
   
 
 -         p r i v a t e   s t a t i c   v o i d   r e a d I n p u t ( )   t h r o w s   I O E x c e p t i o n   { 
 
 +         p r i v a t e   s t a t i c   v o i d   r e a d I n p u t ( I n p u t S t r e a m   i n )   t h r o w s   I O E x c e p t i o n   { 
 
                   c u r r e n c y D a t a   =   n e w   P r o p e r t i e s ( ) ; 
 
 -                 c u r r e n c y D a t a . l o a d ( S y s t e m . i n ) ; 
 
 +                 c u r r e n c y D a t a . l o a d ( i n ) ; 
 
   
 
                   / /   i n i t i a l i z e   o t h e r   l o o k u p   s t r i n g s 
 
                   f o r m a t V e r s i o n   =   ( S t r i n g )   c u r r e n c y D a t a . g e t ( " f o r m a t V e r s i o n " ) ; 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / s p p / S p p . j a v a 
 
 - - -   a / m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / s p p / S p p . j a v a 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / s p p / S p p . j a v a 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 5 , 6   + 2 5 , 8   @ @ 
 
   
 
   p a c k a g e   b u i l d . t o o l s . s p p ; 
 
   
 
 + i m p o r t   j a v a . i o . F i l e I n p u t S t r e a m ; 
 
 + i m p o r t   j a v a . i o . F i l e O u t p u t S t r e a m ; 
 
   i m p o r t   j a v a . u t i l . * ; 
 
   i m p o r t   j a v a . u t i l . r e g e x . * ; 
 
   
 
 @ @   - 6 9 , 6   + 7 1 , 8   @ @ 
 
                   S e t < S t r i n g >   k e y s   =   n e w   H a s h S e t < > ( ) ; 
 
                   b o o l e a n   b e   =   f a l s e ; 
 
                   b o o l e a n   e l   =   t r u e ; 
 
 + 	 	 S t r i n g   i n p u t F i l e   =   n u l l ; 
 
 + 	 	 S t r i n g   o u t p u t F i l e   =   n u l l ; 
 
   
 
                   f o r   ( S t r i n g   a r g : a r g s )   { 
 
                           i f   ( a r g . s t a r t s W i t h ( " - D " ) )   { 
 
 @ @   - 7 6 , 6   + 8 0 , 1 0   @ @ 
 
                                   v a r s . p u t ( a r g . s u b s t r i n g ( 2 ,   i ) , a r g . s u b s t r i n g ( i + 1 ) ) ; 
 
                           }   e l s e   i f   ( a r g . s t a r t s W i t h ( " - K " ) )   { 
 
                                   k e y s . a d d ( a r g . s u b s t r i n g ( 2 ) ) ; 
 
 +                         }   e l s e   i f   ( a r g . s t a r t s W i t h ( " - i " ) )   { 
 
 +                                 i n p u t F i l e   =   a r g . s u b s t r i n g ( 2 ) ; 
 
 +                         }   e l s e   i f   ( a r g . s t a r t s W i t h ( " - o " ) )   { 
 
 +                                 o u t p u t F i l e   =   a r g . s u b s t r i n g ( 2 ) ; 
 
                           }   e l s e   i f   ( " - b e " . e q u a l s ( a r g ) )   { 
 
                                   b e   =   t r u e ; 
 
                           }   e l s e   i f   ( " - n e l " . e q u a l s ( a r g ) )   { 
 
 @ @   - 8 7 , 1 1   + 9 5 , 1 1   @ @ 
 
                   } 
 
   
 
                   S t r i n g B u f f e r   o u t   =   n e w   S t r i n g B u f f e r ( ) ; 
 
 -                 n e w   S p p ( ) . s p p ( n e w   S c a n n e r ( S y s t e m . i n ) , 
 
 +                 n e w   S p p ( ) . s p p ( n e w   S c a n n e r ( n e w   F i l e I n p u t S t r e a m ( i n p u t F i l e ) ) , 
 
                                               o u t ,   " " , 
 
                                               k e y s ,   v a r s ,   b e ,   e l , 
 
                                               f a l s e ) ; 
 
 -                 S y s t e m . o u t . p r i n t ( o u t . t o S t r i n g ( ) ) ; 
 
 +                 n e w   F i l e O u t p u t S t r e a m ( o u t p u t F i l e ,   t r u e ) . w r i t e ( o u t . t o S t r i n g ( ) . g e t B y t e s ( ) ) ; 
 
           } 
 
   
 
           s t a t i c   f i n a l   S t r i n g   L N S E P   =   S y s t e m . g e t P r o p e r t y ( " l i n e . s e p a r a t o r " ) ; 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / s r c / n a t i v e / f i x p a t h . c 
 
 - - -   a / m a k e / s r c / n a t i v e / f i x p a t h . c 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / s r c / n a t i v e / f i x p a t h . c 	 F r i   D e c   1 4   0 0 : 3 4 : 0 3   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 4 , 6   + 2 4 , 7   @ @ 
 
     * / 
 
   
 
   # i n c l u d e   < W i n d o w s . h > 
 
 + # i n c l u d e   < s t d b o o l . h > 
 
   # i n c l u d e   < i o . h > 
 
   # i n c l u d e   < s t d i o . h > 
 
   # i n c l u d e   < s t r i n g . h > 
 
 @ @   - 5 3 , 2 5   + 5 4 , 1 6   @ @ 
 
   } 
 
   
 
   / * 
 
 -   *   T e s t   i f   p o s   p o i n t s   t o   / c y g d r i v e / _ /   w h e r e   _   c a n 
 
 +   *   T e s t   i f   p o s   p o i n t s   t o   / p r e f i x / _ /   w h e r e   _   c a n 
 
     *   b e   a n y   c h a r a c t e r . 
 
     * / 
 
 - i n t   i s _ c y g d r i v e _ h e r e ( i n t   p o s ,   c h a r   c o n s t   * i n ,   i n t   l e n ) 
 
 + i n t   i s _ p r e f i x _ h e r e ( i n t   p o s ,   c h a r   c o n s t   * i n ,   i n t   l e n ,   c o n s t   c h a r *   p r e f i x ) 
 
   { 
 
 -     / /   L e n g t h   o f   / c y g d r i v e / c /   i s   1 2 
 
 -     i f   ( p o s + 1 2   >   l e n )   r e t u r n   0 ; 
 
 -     i f   ( i n [ p o s + 1 1 ] = = ' / '   & & 
 
 -             i n [ p o s + 9 ] = = ' / '   & & 
 
 -             i n [ p o s + 8 ] = = ' e '   & & 
 
 -             i n [ p o s + 7 ] = = ' v '   & & 
 
 -             i n [ p o s + 6 ] = = ' i '   & & 
 
 -             i n [ p o s + 5 ] = = ' r '   & & 
 
 -             i n [ p o s + 4 ] = = ' d '   & & 
 
 -             i n [ p o s + 3 ] = = ' g '   & & 
 
 -             i n [ p o s + 2 ] = = ' y '   & & 
 
 -             i n [ p o s + 1 ] = = ' c '   & & 
 
 -             i n [ p o s + 0 ] = = ' / ' )   { 
 
 -         r e t u r n   1 ; 
 
 +     / /   L e n g t h   o f   c /   i s   2 
 
 +     i n t   p r e f i x _ s i z e   =   s t r l e n ( p r e f i x ) ; 
 
 +     i f   ( p o s + p r e f i x _ s i z e + 2   >   l e n )   r e t u r n   0 ; 
 
 +     i f   ( i n [ p o s + p r e f i x _ s i z e + 1 ] = = ' / ' )   { 
 
 +         r e t u r n   s t r n c m p ( i n   +   p o s ,   p r e f i x ,   p r e f i x _ s i z e )   = =   0 ; 
 
       } 
 
       r e t u r n   0 ; 
 
   } 
 
 @ @   - 9 3 , 7   + 8 5 , 7   @ @ 
 
       } 
 
   
 
       f o r   ( i   =   0 ,   j   =   0 ;   i < l e n ; )   { 
 
 -         i f   ( i s _ c y g d r i v e _ h e r e ( i ,   i n ,   l e n ) )   { 
 
 +         i f   ( i s _ p r e f i x _ h e r e ( i ,   i n ,   l e n ,   " / c y g d r i v e / " ) )   { 
 
               o u t [ j + + ]   =   i n [ i + 1 0 ] ; 
 
               o u t [ j + + ]   =   ' : ' ; 
 
               i + = 1 1 ; 
 
 @ @   - 1 9 6 , 7   + 1 8 8 , 3 9   @ @ 
 
       r e t u r n   s t r ; 
 
   } 
 
   
 
 + / * 
 
 +   *   R e p l a c e   / m n t / _ /   w i t h   _ : / 
 
 +   *   W o r k s   i n   p l a c e   s i n c e   d r i v e   l e t t e r   i s   a l w a y s 
 
 +   *   s h o r t e r   t h a n   / m n t / 
 
 +   * / 
 
 + c h a r   * r e p l a c e _ c y g d r i v e _ w s l ( c h a r   c o n s t   * i n ) 
 
 + { 
 
 +     s i z e _ t   l e n   =   s t r l e n ( i n ) ; 
 
 +     c h a r   * o u t   =   ( c h a r * )   m a l l o c ( l e n + 1 ) ; 
 
 +     i n t   i , j ; 
 
 + 
 
 +     i f   ( l e n   <   7 )   { 
 
 +         m e m m o v e ( o u t ,   i n ,   l e n   +   1 ) ; 
 
 +         r e t u r n   o u t ; 
 
 +     } 
 
 + 
 
 +     f o r   ( i   =   0 ,   j   =   0 ;   i < l e n ; )   { 
 
 +         i f   ( i s _ p r e f i x _ h e r e ( i ,   i n ,   l e n ,   " / m n t / " ) )   { 
 
 +             o u t [ j + + ]   =   i n [ i + 5 ] ; 
 
 +             o u t [ j + + ]   =   ' : ' ; 
 
 +             i + = 6 ; 
 
 +         }   e l s e   { 
 
 +             o u t [ j ]   =   i n [ i ] ; 
 
 +             i + + ; 
 
 +             j + + ; 
 
 +         } 
 
 +     } 
 
 +     o u t [ j ]   =   ' \ 0 ' ; 
 
 +     r e t u r n   o u t ; 
 
 + } 
 
 + 
 
   c h a r * ( * r e p l a c e _ c y g d r i v e ) ( c h a r   c o n s t   * i n )   =   N U L L ; 
 
 + b o o l   d e b u g _ f i x p a t h   =   f a l s e ; 
 
   
 
   c h a r   * f i l e s _ t o _ d e l e t e [ 1 0 2 4 ] ; 
 
   i n t   n u m _ f i l e s _ t o _ d e l e t e   =   0 ; 
 
 @ @   - 2 5 0 , 1 1   + 2 7 4 , 1 1   @ @ 
 
           a p p e n d ( & b u f f e r ,   & b u f l e n ,   & u s e d ,   b l o c k ,   b l o c k l e n ) ; 
 
       } 
 
       b u f f e r [ u s e d ]   =   0 ; 
 
 -     i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +     i f   ( d e b u g _ f i x p a t h )   { 
 
           f p r i n t f ( s t d e r r ,   " f i x p a t h   i n p u t   f r o m   @ - f i l e   % s :   % s \ n " ,   & i n [ 1 ] ,   b u f f e r ) ; 
 
       } 
 
       f i x e d   =   r e p l a c e _ c y g d r i v e ( b u f f e r ) ; 
 
 -     i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +     i f   ( d e b u g _ f i x p a t h )   { 
 
           f p r i n t f ( s t d e r r ,   " f i x p a t h   c o n v e r t e d   t o   @ - f i l e   % s   i s :   % s \ n " ,   n a m e ,   f i x e d ) ; 
 
       } 
 
       f w r i t e ( f i x e d ,   s t r l e n ( f i x e d ) ,   1 ,   a t o u t ) ; 
 
 @ @   - 3 6 2 , 2 8   + 3 8 6 , 3 6   @ @ 
 
           D W O R D   p r o c e s s F l a g s   =   0 ; 
 
           B O O L   p r o c e s s I n h e r i t H a n d l e s   =   T R U E ; 
 
           B O O L   w a i t F o r C h i l d   =   T R U E ; 
 
 + 	 c o n s t   c h a r *   f i x p a t h P a t h ; 
 
   
 
 -         i f   ( a r g c < 2   | |   a r g v [ 1 ] [ 0 ]   ! =   ' - '   | |   ( a r g v [ 1 ] [ 1 ]   ! =   ' c '   & &   a r g v [ 1 ] [ 1 ]   ! =   ' m ' ) )   { 
 
 -                 f p r i n t f ( s t d e r r ,   " U s a g e :   f i x p a t h   - c | m < p a t h @ p a t h @ . . . >   [ - - d e t a c h ]   / c y g d r i v e / c / W I N D O W S / n o t e p a d . e x e   [ / c y g d r i v e / c / x / t e s t . t x t | @ / c y g d r i v e / c / x / a t f i l e ] \ n " ) ; 
 
 + 	 d e b u g _ f i x p a t h   =   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L ) ; 
 
 + 
 
 +         i f   ( a r g c < 2   | |   a r g v [ 1 ] [ 0 ]   ! =   ' - '   | |   ( a r g v [ 1 ] [ 1 ]   ! =   ' c '   & &   a r g v [ 1 ] [ 1 ]   ! =   ' m '   & &   a r g v [ 1 ] [ 1 ]   ! =   ' w ' ) )   { 
 
 +                 f p r i n t f ( s t d e r r ,   " U s a g e :   f i x p a t h   - c | m | w < p a t h @ p a t h @ . . . >   [ - - d e t a c h ]   / c y g d r i v e / c / W I N D O W S / n o t e p a d . e x e   [ / c y g d r i v e / c / x / t e s t . t x t | @ / c y g d r i v e / c / x / a t f i l e ] \ n " ) ; 
 
                   e x i t ( 0 ) ; 
 
           } 
 
   
 
 -         i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +         i f   ( d e b u g _ f i x p a t h )   { 
 
               c h a r   c o n s t   *   c m d l i n e   =   G e t C o m m a n d L i n e ( ) ; 
 
               f p r i n t f ( s t d e r r ,   " f i x p a t h   i n p u t   l i n e   > % s < \ n " ,   s t r s t r ( c m d l i n e ,   a r g v [ 1 ] ) ) ; 
 
           } 
 
   
 
           i f   ( a r g v [ 1 ] [ 1 ]   = =   ' c '   & &   a r g v [ 1 ] [ 2 ]   = =   ' \ 0 ' )   { 
 
 -             i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
                   f p r i n t f ( s t d e r r ,   " f i x p a t h   u s i n g   c y g w i n   m o d e \ n " ) ; 
 
               } 
 
               r e p l a c e _ c y g d r i v e   =   r e p l a c e _ c y g d r i v e _ c y g w i n ; 
 
           }   e l s e   i f   ( a r g v [ 1 ] [ 1 ]   = =   ' m ' )   { 
 
 -             i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
                   f p r i n t f ( s t d e r r ,   " f i x p a t h   u s i n g   m s y s   m o d e ,   w i t h   p a t h   l i s t :   % s \ n " ,   & a r g v [ 1 ] [ 2 ] ) ; 
 
               } 
 
               s e t u p _ m s y s _ p a t h _ l i s t ( a r g v [ 1 ] ) ; 
 
               r e p l a c e _ c y g d r i v e   =   r e p l a c e _ c y g d r i v e _ m s y s ; 
 
 + 	 }   e l s e   i f   ( a r g v [ 1 ] [ 1 ]   = =   ' w ' )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
 +                 f p r i n t f ( s t d e r r ,   " f i x p a t h   u s i n g   w s l   m o d e ,   w i t h   p a t h   l i s t :   % s \ n " ,   & a r g v [ 1 ] [ 2 ] ) ; 
 
 +             } 
 
 +             r e p l a c e _ c y g d r i v e   =   r e p l a c e _ c y g d r i v e _ w s l ; 
 
           }   e l s e   { 
 
               f p r i n t f ( s t d e r r ,   " f i x p a t h   U n k n o w n   m o d e :   % s \ n " ,   a r g v [ 1 ] ) ; 
 
               e x i t ( - 1 ) ; 
 
 @ @   - 3 9 1 , 7   + 4 2 3 , 7   @ @ 
 
   
 
           i f   ( a r g v [ 2 ] [ 0 ]   = =   ' - ' )   { 
 
               i f   ( s t r c m p ( a r g v [ 2 ] ,   " - - d e t a c h " )   = =   0 )   { 
 
 -                 i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +                 i f   ( d e b u g _ f i x p a t h )   { 
 
                       f p r i n t f ( s t d e r r ,   " f i x p a t h   i n   d e t a c h e d   m o d e \ n " ) ; 
 
                   } 
 
                   p r o c e s s F l a g s   | =   D E T A C H E D _ P R O C E S S ; 
 
 @ @   - 4 1 7 , 7   + 4 4 9 , 7   @ @ 
 
                   v a r [ v a r _ l e n   -   1 ]   =   ' \ 0 ' ; 
 
                   s t r u p r ( v a r ) ; 
 
   
 
 -                 i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +                 i f   ( d e b u g _ f i x p a t h )   { 
 
                       f p r i n t f ( s t d e r r ,   " f i x p a t h   s e t t i n g   v a r   > % s <   t o   > % s < \ n " ,   v a r ,   v a l ) ; 
 
                   } 
 
   
 
 @ @   - 4 8 0 , 1 2   + 5 1 2 , 1 2   @ @ 
 
           } 
 
           * c u r r e n t   =   ' \ 0 ' ; 
 
   
 
 -         i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +         i f   ( d e b u g _ f i x p a t h )   { 
 
               f p r i n t f ( s t d e r r ,   " f i x p a t h   c o n v e r t e d   l i n e   > % s < \ n " ,   l i n e ) ; 
 
           } 
 
   
 
           i f   ( c m d   = =   a r g c )   { 
 
 -               i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +               i f   ( d e b u g _ f i x p a t h )   { 
 
                     f p r i n t f ( s t d e r r ,   " f i x p a t h   n o   c o m m a n d   p r o v i d e d ! \ n " ) ; 
 
                 } 
 
                 e x i t ( 0 ) ; 
 
 @ @   - 4 9 8 , 6   + 5 3 0 , 2 9   @ @ 
 
           f f l u s h ( s t d e r r ) ; 
 
           f f l u s h ( s t d o u t ) ; 
 
   
 
 +         f i x p a t h P a t h   =   g e t e n v ( " F I X P A T H _ P A T H " ) ; 
 
 +         i f   ( f i x p a t h P a t h   ! =   N U L L )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
 +                 f p r i n t f ( s t d e r r ,   " F I X P A T H _ P A T H   s e t \ n " ) ; 
 
 +             } 
 
 +             c h a r *   p a t h   =   c a l l o c ( 3 2 7 6 7 ,   s i z e o f ( c h a r ) ) ; 
 
 + 	     s t r c a t ( p a t h ,   g e t e n v ( " P a t h " ) ) ; 
 
 +             s t r c a t ( p a t h ,   " : " ) ; 
 
 +             s t r c a t ( p a t h ,   f i x p a t h P a t h ) ; 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
 +                 f p r i n t f ( s t d e r r ,   " S e t t i n g   P a t h   t o   % s \ n " ,   p a t h ) ; 
 
 +             } 
 
 +             r c   =   S e t E n v i r o n m e n t V a r i a b l e ( " P a t h " ,   p a t h ) ; 
 
 +             i f   ( ! r c )   { 
 
 +                 / /   C o u l d   n o t   s e t   P a t h   f o r   s o m e   r e a s o n .     T r y   t o   r e p o r t   w h y . 
 
 +                 c o n s t   i n t   m s g _ l e n   =   8 0   +   s t r l e n ( p a t h ) ; 
 
 +                 c h a r   *   m s g   =   ( c h a r   * ) a l l o c a ( m s g _ l e n ) ; 
 
 +                 _ s n p r i n t f _ s ( m s g ,   m s g _ l e n ,   _ T R U N C A T E ,   " C o u l d   n o t   s e t   e n v i r o n m e n t   v a r i a b l e   [ P a t h = % s ] " ,   p a t h ) ; 
 
 +                 r e p o r t _ e r r o r ( m s g ) ; 
 
 +                 e x i t ( 1 ) ; 
 
 +             } 
 
 +         } 
 
 + 
 
           r c   =   C r e a t e P r o c e s s ( N U L L , 
 
                                                 l i n e , 
 
                                                 0 , 
 
 @ @   - 5 1 8 , 7   + 5 7 3 , 7   @ @ 
 
               W a i t F o r S i n g l e O b j e c t ( p i . h P r o c e s s ,   I N F I N I T E ) ; 
 
               G e t E x i t C o d e P r o c e s s ( p i . h P r o c e s s ,   & e x i t C o d e ) ; 
 
   
 
 -             i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
                   f o r   ( i = 0 ;   i < n u m _ f i l e s _ t o _ d e l e t e ;   + + i )   { 
 
                       f p r i n t f ( s t d e r r ,   " f i x p a t h   N o t   d e l e t i n g   t e m p o r a r y   f i l e   % s \ n " , 
 
                                       f i l e s _ t o _ d e l e t e [ i ] ) ; 
 
 @ @   - 5 3 0 , 1 3   + 5 8 5 , 1 3   @ @ 
 
               } 
 
   
 
               i f   ( e x i t C o d e   ! =   0 )   { 
 
 -                 i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +                 i f   ( d e b u g _ f i x p a t h )   { 
 
                       f p r i n t f ( s t d e r r ,   " f i x p a t h   e x i t   c o d e   % d \ n " , 
 
                                       e x i t C o d e ) ; 
 
                   } 
 
               } 
 
           }   e l s e   { 
 
 -             i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
                   f p r i n t f ( s t d e r r ,   " f i x p a t h   N o t   w a i t i n g   f o r   c h i l d   p r o c e s s " ) ; 
 
               } 
 
           } 
 
 


More information about the build-dev mailing list