Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. @echo off
  2. rem
  3. rem Based on the msys.bat file from the MSYS package
  4. rem http://www.mingw.org/wiki/msys
  5. rem
  6.  
  7. rem Shared directories for toolchains
  8. set TOOLS_DIR=D:/devtools
  9.  
  10. rem this should let run MSYS shell on x64
  11. if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
  12. SET COMSPEC=%WINDIR%\SysWOW64\cmd.exe
  13. )
  14.  
  15. rem some MSYS environment variables
  16. if "x%MSYSTEM%" == "x" set MSYSTEM=MINGW32
  17. if not "x%DISPLAY%" == "x" set DISPLAY=
  18.  
  19. set NOT_FOUND=
  20. set PATH_DIRS=%TOOLS_DIR%\bin;%TOOLS_DIR%\gcc-arm-none-eabi-5_2-2015q4-20151219-win32\bin;%TOOLS_DIR%\eclipse
  21. set MAKE_COMMAND=
  22.  
  23. call :which MSYSGIT "C:\Git\bin" git.exe
  24.  
  25. if "%NOT_FOUND%" == "" goto set_path
  26.  
  27. echo:
  28. echo Some tools were not found in the PATH or expected location:
  29. for %%f in (%NOT_FOUND%) do echo %%f
  30. echo You may want to install them and/or update paths in the %0 file.
  31. echo:
  32.  
  33. rem --------------------------------------------------------------------------
  34. rem Provide a clean environment for command line build. We remove the
  35. rem msysGit cmd subdirectory as well, so no recursive sh call can occur.
  36. rem --------------------------------------------------------------------------
  37.  
  38. :set_path
  39. set PATH=%SYSTEMROOT%\system32;%SYSTEMROOT%
  40. set PATH=%PATH_DIRS%;%PATH%
  41. rem echo PATH: %PATH%
  42.  
  43. rem --------------------------------------------------------------------------
  44. rem Start a shell.
  45. rem Any shell script can be passed to it via command line of this batch file.
  46. rem --------------------------------------------------------------------------
  47.  
  48. if not exist "%MSYSGIT%\bash.exe" goto no_bash
  49. call "%MSYSGIT%\bash.exe" --login -i %*
  50. goto :eof
  51.  
  52. :no_bash
  53. echo Cannot find bash, exiting with error
  54. exit 1
  55.  
  56. rem --------------------------------------------------------------------------
  57. rem Attempt to find executable in the directory given or in the PATH
  58. rem --------------------------------------------------------------------------
  59.  
  60. :which
  61. rem search in the directory given first
  62. for %%F in (%2) do set FP=%%~F\%3
  63. if exist "%FP%" goto found_directly
  64.  
  65. rem search in the PATH last
  66. for %%F in (%3) do set FP=%%~$PATH:F
  67. if exist "%FP%" goto found_in_path
  68.  
  69. :not_found
  70. for %%F in (%2) do set FP=%%~F
  71. rem echo %3: not found, expected in %FP%
  72. set FP=
  73. set NOT_FOUND=%NOT_FOUND% %3
  74. goto set
  75.  
  76. :found_directly
  77. for %%F in ("%FP%") do set FP=%%~dpsF
  78. rem echo %3: found at: %FP%
  79. goto set
  80.  
  81. :found_in_path
  82. for %%F in ("%FP%") do set FP=%%~dpsF
  83. rem echo %3: found in the PATH: %FP%
  84.  
  85. :set
  86. rem set results regardless of was it found or not
  87. set %1=%FP%
  88. rem echo %1=%FP%
  89. if "%FP%" == "" goto :eof
  90. if not "%PATH_DIRS%" == "" set PATH_DIRS=%PATH_DIRS%;
  91. set PATH_DIRS=%PATH_DIRS%%FP%
  92. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement