Trying to get tcc working

This commit is contained in:
Dax T. Games 2018-09-01 22:08:00 -05:00
parent 75e6644d2a
commit 541fc16daf
4 changed files with 101 additions and 94 deletions

45
vendor/init.bat vendored
View File

@ -7,8 +7,8 @@
:: !!! Use "%CMDER_ROOT%\config\user_profile.cmd" to add your own startup commands :: !!! Use "%CMDER_ROOT%\config\user_profile.cmd" to add your own startup commands
:: Use /v command line arg or set to > 0 for verbose output to aid in debugging. :: Use /v command line arg or set to > 0 for verbose output to aid in debugging.
set verbose-output=0 set verbose_output=0
set debug-output=0 set debug_output=0
set max_depth=1 set max_depth=1
:: Find root dir :: Find root dir
@ -37,9 +37,9 @@ call "%cmder_root%\vendor\lib\lib_profile"
if "%~1" == "" ( if "%~1" == "" (
goto :start goto :start
) else if /i "%1"=="/v" ( ) else if /i "%1"=="/v" (
set verbose-output=1 set verbose_output=1
) else if /i "%1"=="/d" ( ) else if /i "%1"=="/d" (
set debug-output=1 set debug_output=1
) else if /i "%1" == "/max_depth" ( ) else if /i "%1" == "/max_depth" (
if "%~2" geq "1" if "%~2" leq "5" ( if "%~2" geq "1" if "%~2" leq "5" (
set "max_depth=%~2" set "max_depth=%~2"
@ -62,11 +62,11 @@ call "%cmder_root%\vendor\lib\lib_profile"
shift shift
) )
) else if /i "%1" == "/git_install_root" ( ) else if /i "%1" == "/git_install_root" (
if exist "%~2" ( if exist "%2\cmd\git.exe" (
set "GIT_INSTALL_ROOT=%~2" set "GIT_INSTALL_ROOT=%~2"
shift shift
) else ( ) else (
%lib_console% show_error "The Git install root folder "%~2", you specified does not exist!" %lib_console% show_error "The Git install root folder "%~2\cmd\git.exe", you specified does not exist!"
exit /b exit /b
) )
) else if /i "%1" == "/home" ( ) else if /i "%1" == "/home" (
@ -85,11 +85,11 @@ call "%cmder_root%\vendor\lib\lib_profile"
goto var_loop goto var_loop
:start :start
%lib_console% debug-output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%" %lib_console% debug_output init.bat "Env Var - CMDER_ROOT=%CMDER_ROOT%"
%lib_console% debug-output init.bat "Env Var - debug-output=%debug-output%" %lib_console% debug_output init.bat "Env Var - debug_output=%debug_output%"
if defined CMDER_USER_CONFIG ( if defined CMDER_USER_CONFIG (
%lib_console% debug-output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!" %lib_console% debug_output init.bat "CMDER IS ALSO USING INDIVIDUAL USER CONFIG FROM '%CMDER_USER_CONFIG%'!"
) )
:: Pick right version of clink :: Pick right version of clink
@ -101,12 +101,14 @@ if "%PROCESSOR_ARCHITECTURE%"=="x86" (
set architecture_bits=64 set architecture_bits=64
) )
echo %comspec% |find /i "tcc.exe">nul
if %errorlevel% == 1 (
:: Tell the user about the clink config files... :: Tell the user about the clink config files...
if defined "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\settings" ( if defined "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\settings" (
echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings" echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings"
echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\ echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\
} else if not exist "%CMDER_ROOT%\config\settings" ( ) else if not exist "%CMDER_ROOT%\config\settings" (
echo Generating clink initial settings in "%CMDER_ROOT%\config\settings" echo Generating clink initial settings in "%CMDER_ROOT%\config\settings"
echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup. echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup.
) )
@ -117,6 +119,7 @@ if defined CMDER_USER_CONFIG (
) else ( ) else (
"%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor" "%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor"
) )
)
:: Prepare for git-for-windows :: Prepare for git-for-windows
@ -134,7 +137,7 @@ if defined GIT_INSTALL_ROOT (
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :FOUND_GIT) if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :FOUND_GIT)
) )
%lib_console% debug-output init.bat "Looking for Git install root..." %lib_console% debug_output init.bat "Looking for Git install root..."
:: get the version information for vendored git binary :: get the version information for vendored git binary
%lib_git% read_version VENDORED "%CMDER_ROOT%\vendor\git-for-windows\cmd" %lib_git% read_version VENDORED "%CMDER_ROOT%\vendor\git-for-windows\cmd"
@ -165,19 +168,18 @@ for /F "delims=" %%F in ('where git.exe 2^>nul') do (
set test_dir= set test_dir=
goto :FOUND_GIT goto :FOUND_GIT
) else ( ) else (
call :verbose-output Found old !GIT_VERSION_USER! in "!test_dir!", but not using... call :verbose_output Found old !GIT_VERSION_USER! in "!test_dir!", but not using...
set test_dir= set test_dir=
) )
) else ( ) else (
:: if the user provided git executable is not found :: if the user provided git executable is not found
if !errorlevel! equ -255 ( if !errorlevel! equ -255 (
call :verbose-output No git at "!git_executable!" found. call :verbose_output No git at "!git_executable!" found.
set test_dir= set test_dir=
) )
) )
) )
:: our last hope: our own git... :: our last hope: our own git...
@ -209,8 +211,8 @@ if defined GIT_INSTALL_ROOT (
) )
endlocal & set "PATH=%PATH%" & set "LANG=%LANG%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" endlocal & set "PATH=%PATH%" & set "LANG=%LANG%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
%lib_console% debug-output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%" %lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
%lib_console% debug-output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'" %lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'"
goto :PATH_ENHANCE goto :PATH_ENHANCE
:NO_GIT :NO_GIT
@ -246,6 +248,9 @@ if not defined user_aliases (
) )
) )
echo %comspec% |find /i "tcc.exe">nul
if %errorlevel% == 1 (
:: The aliases environment variable is used by alias.bat to id :: The aliases environment variable is used by alias.bat to id
:: the default file to store new aliases in. :: the default file to store new aliases in.
if not defined aliases ( if not defined aliases (
@ -280,6 +285,7 @@ if exist "%CMDER_ROOT%\config\aliases" (
type "%user_aliases%.old_format" >> "%user_aliases%" && del "%user_aliases%.old_format" type "%user_aliases%.old_format" >> "%user_aliases%" && del "%user_aliases%.old_format"
) )
endlocal endlocal
)
:: Add aliases to the environment :: Add aliases to the environment
call "%user_aliases%" call "%user_aliases%"
@ -288,7 +294,7 @@ call "%user_aliases%"
:: Basically we need to execute this post-install.bat because we are :: Basically we need to execute this post-install.bat because we are
:: manually extracting the archive rather than executing the 7z sfx :: manually extracting the archive rather than executing the 7z sfx
if exist "%GIT_INSTALL_ROOT%\post-install.bat" ( if exist "%GIT_INSTALL_ROOT%\post-install.bat" (
%lib_console% verbose-output "Running Git for Windows one time Post Install...." %lib_console% verbose_output "Running Git for Windows one time Post Install...."
pushd "%GIT_INSTALL_ROOT%\" pushd "%GIT_INSTALL_ROOT%\"
"%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat "%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
popd popd
@ -296,7 +302,7 @@ if exist "%GIT_INSTALL_ROOT%\post-install.bat" (
:: Set home path :: Set home path
if not defined HOME set "HOME=%USERPROFILE%" if not defined HOME set "HOME=%USERPROFILE%"
%lib_console% debug-output init.bat "Env Var - HOME=%HOME%" %lib_console% debug_output init.bat "Env Var - HOME=%HOME%"
set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd" set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd"
if exist "%CMDER_ROOT%\config\user_profile.cmd" ( if exist "%CMDER_ROOT%\config\user_profile.cmd" (
@ -332,7 +338,8 @@ echo @echo off
) >"%initialConfig%" ) >"%initialConfig%"
) )
if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" ( echo %comspec% |find /i "tcc.exe">nul
if %errorlevel% == 1 if exist "%CMDER_ROOT%\bin\alias.bat" if exist "%CMDER_ROOT%\vendor\bin\alias.cmd" (
echo Cmder's 'alias' command has been moved into '%CMDER_ROOT%\vendor\bin\alias.cmd' echo Cmder's 'alias' command has been moved into '%CMDER_ROOT%\vendor\bin\alias.cmd'
echo to get rid of this message either: echo to get rid of this message either:
echo. echo.

View File

@ -13,9 +13,9 @@ if "%~1" == "/h" (
exit /b exit /b
:debug-output :debug_output
:::=============================================================================== :::===============================================================================
:::debug-output - Output a debug message to the console. :::debug_output - Output a debug message to the console.
:::. :::.
:::include: :::include:
:::. :::.
@ -23,22 +23,22 @@ exit /b
:::. :::.
:::usage: :::usage:
:::. :::.
::: %lib_console% debug-output [caller] [message] ::: %lib_console% debug_output [caller] [message]
:::. :::.
:::required: :::required:
:::. :::.
::: [caller] <in> Script/sub routine name calling debug-output ::: [caller] <in> Script/sub routine name calling debug_output
:::. :::.
::: [message] <in> Message text to display. ::: [message] <in> Message text to display.
:::. :::.
:::------------------------------------------------------------------------------- :::-------------------------------------------------------------------------------
if %debug-output% gtr 0 echo DEBUG(%~1): %~2 & echo. if %debug_output% gtr 0 echo DEBUG(%~1): %~2 & echo.
exit /b exit /b
:verbose-output :verbose_output
:::=============================================================================== :::===============================================================================
:::verbose-output - Output a debug message to the console. :::verbose_output - Output a debug message to the console.
:::. :::.
:::include: :::include:
:::. :::.
@ -46,7 +46,7 @@ exit /b
:::. :::.
:::usage: :::usage:
:::. :::.
::: %lib_console% verbose-output "[message]" ::: %lib_console% verbose_output "[message]"
:::. :::.
:::required: :::required:
:::. :::.
@ -54,7 +54,7 @@ exit /b
:::. :::.
:::------------------------------------------------------------------------------- :::-------------------------------------------------------------------------------
if %verbose-output% gtr 0 echo %~1 if %verbose_output% gtr 0 echo %~1
exit /b exit /b
:show_error :show_error

View File

@ -42,11 +42,11 @@ exit /b
:: set the executable path :: set the executable path
set "git_executable=%~2\git.exe" set "git_executable=%~2\git.exe"
%lib_console% debug-output :read_version "Env Var - git_executable=%git_executable%" %lib_console% debug_output :read_version "Env Var - git_executable=%git_executable%"
:: check if the executable actually exists :: check if the executable actually exists
if not exist "%git_executable%" ( if not exist "%git_executable%" (
%lib_console% debug-output :read_version "%git_executable% does not exist." %lib_console% debug_output :read_version "%git_executable% does not exist."
exit /b -255 exit /b -255
) )
@ -54,7 +54,7 @@ exit /b
for /F "tokens=1,2,3 usebackq" %%A in (`"%git_executable%" --version 2^>nul`) do ( for /F "tokens=1,2,3 usebackq" %%A in (`"%git_executable%" --version 2^>nul`) do (
if /i "%%A %%B" == "git version" ( if /i "%%A %%B" == "git version" (
set "GIT_VERSION_%~1=%%C" set "GIT_VERSION_%~1=%%C"
%lib_console% debug-output :read_version "Env Var - GIT_VERSION_%~1=%%C" %lib_console% debug_output :read_version "Env Var - GIT_VERSION_%~1=%%C"
) else ( ) else (
%lib_console% show_error "git --version" returned an inproper version string! %lib_console% show_error "git --version" returned an inproper version string!
pause pause
@ -124,7 +124,7 @@ exit /b
call :parse_version %~1 %~2 call :parse_version %~1 %~2
:: ... and maybe display it, for debugging purposes. :: ... and maybe display it, for debugging purposes.
%lib_console% debug-output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!" %lib_console% debug_output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!"
exit /b exit /b
:compare_versions :compare_versions
@ -148,9 +148,9 @@ exit /b
:: checks all major, minor, patch and build variables for the given arguments. :: checks all major, minor, patch and build variables for the given arguments.
:: whichever binary that has the most recent version will be used based on the return code. :: whichever binary that has the most recent version will be used based on the return code.
:: %lib_console% debug-output Comparing: :: %lib_console% debug_output Comparing:
:: %lib_console% debug-output %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD! :: %lib_console% debug_output %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!
:: %lib_console% debug-output %~2: !%~2_MAJOR!.!%~2_MINOR!.!%~2_PATCH!.!%~2_BUILD! :: %lib_console% debug_output %~2: !%~2_MAJOR!.!%~2_MINOR!.!%~2_PATCH!.!%~2_BUILD!
if !%~1_MAJOR! GTR !%~2_MAJOR! (exit /b 1) if !%~1_MAJOR! GTR !%~2_MAJOR! (exit /b 1)
if !%~1_MAJOR! LSS !%~2_MAJOR! (exit /b -1) if !%~1_MAJOR! LSS !%~2_MAJOR! (exit /b -1)

View File

@ -57,28 +57,28 @@ exit /b
set "find_query=%find_query: =\ %" set "find_query=%find_query: =\ %"
set found=0 set found=0
%lib_console% debug-output :enhance_path "Env Var - find_query=%find_query%" %lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%"
echo "%PATH%"|findstr >nul /I /R ";%find_query%\"$" echo "%PATH%"|findstr >nul /I /R ";%find_query%\"$"
if "!ERRORLEVEL!" == "0" set found=1 if "!ERRORLEVEL!" == "0" set found=1
%lib_console% debug-output :enhance_path "Env Var 1 - found=!found!" %lib_console% debug_output :enhance_path "Env Var 1 - found=!found!"
if "!found!" == "0" ( if "!found!" == "0" (
echo "%PATH%"|findstr >nul /i /r ";%find_query%;" echo "%PATH%"|findstr >nul /i /r ";%find_query%;"
if "!ERRORLEVEL!" == "0" set found=1 if "!ERRORLEVEL!" == "0" set found=1
%lib_console% debug-output :enhance_path "Env Var 2 - found=!found!" %lib_console% debug_output :enhance_path "Env Var 2 - found=!found!"
) )
if "%found%" == "0" ( if "%found%" == "0" (
%lib_console% debug-output :enhance_path "BEFORE Env Var - PATH=!path!" %lib_console% debug_output :enhance_path "BEFORE Env Var - PATH=!path!"
if /i "%position%" == "append" ( if /i "%position%" == "append" (
%lib_console% debug-output :enhance_path "Appending '%add_path%'" %lib_console% debug_output :enhance_path "Appending '%add_path%'"
set "PATH=%PATH%;%add_path%" set "PATH=%PATH%;%add_path%"
) else ( ) else (
%lib_console% debug-output :enhance_path "Prepending '%add_path%'" %lib_console% debug_output :enhance_path "Prepending '%add_path%'"
set "PATH=%add_path%;%PATH%" set "PATH=%add_path%;%PATH%"
) )
%lib_console% debug-output :enhance_path "AFTER Env Var - PATH=!path!" %lib_console% debug_output :enhance_path "AFTER Env Var - PATH=!path!"
) )
endlocal & set "PATH=%PATH:;;=;%" endlocal & set "PATH=%PATH:;;=;%"
@ -134,20 +134,20 @@ exit /b
if "%depth%" == "" set depth=0 if "%depth%" == "" set depth=0
%lib_console% debug-output :enhance_path_recursive "Env Var - add_path=%add_path%" %lib_console% debug_output :enhance_path_recursive "Env Var - add_path=%add_path%"
%lib_console% debug-output :enhance_path_recursive "Env Var - position=%position%" %lib_console% debug_output :enhance_path_recursive "Env Var - position=%position%"
%lib_console% debug-output :enhance_path_recursive "Env Var - max_depth=%max_depth%" %lib_console% debug_output :enhance_path_recursive "Env Var - max_depth=%max_depth%"
if %max_depth% gtr !depth! ( if %max_depth% gtr !depth! (
%lib_console% debug-output :enhance_path_recursive "Adding parent directory - '%add_path%'" %lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_path%'"
call :enhance_path "%add_path%" %position% call :enhance_path "%add_path%" %position%
set /a "depth=!depth!+1" set /a "depth=!depth!+1"
for /d %%i in ("%add_path%\*") do ( for /d %%i in ("%add_path%\*") do (
%lib_console% debug-output :enhance_path_recursive "Env Var BEFORE - depth=!depth!" %lib_console% debug_output :enhance_path_recursive "Env Var BEFORE - depth=!depth!"
%lib_console% debug-output :enhance_path_recursive "Found Subdirectory - '%%~fi'" %lib_console% debug_output :enhance_path_recursive "Found Subdirectory - '%%~fi'"
call :enhance_path_recursive "%%~fi" %max_depth% %position% call :enhance_path_recursive "%%~fi" %max_depth% %position%
%lib_console% debug-output :enhance_path_recursive "Env Var AFTER- depth=!depth!" %lib_console% debug_output :enhance_path_recursive "Env Var AFTER- depth=!depth!"
) )
) )