From ea032f8416daf5cf0b2774fcdd93c0f0fc2e75b1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 21 Dec 2024 18:21:03 +0000 Subject: [PATCH] lf -> crlf in vctool.bat --- .fossil-settings/crlf-glob | 7 +- .gitattributes | 2 + generic/tclZipfs.c | 2 +- tests/zipfs.test | 16 +- win/vctool.bat | 348 ++++++++++++++++++------------------- 5 files changed, 187 insertions(+), 188 deletions(-) diff --git a/.fossil-settings/crlf-glob b/.fossil-settings/crlf-glob index 6aa950b202..6d6fb95a8c 100644 --- a/.fossil-settings/crlf-glob +++ b/.fossil-settings/crlf-glob @@ -12,11 +12,8 @@ libtommath/*.dsp libtommath/*.sln libtommath/*.vcproj tools/tcl.wse.in -win/buildall.vc.bat +win/*.bat +win/*.vc win/coffbase.txt -win/makefile.vc -win/rules.vc -win/rules-ext.vc -win/targets.vc win/tcl.dsp win/tcl.dsw diff --git a/.gitattributes b/.gitattributes index a93c45ed7d..fa3a3bf533 100644 --- a/.gitattributes +++ b/.gitattributes @@ -23,6 +23,8 @@ # Declare files that will always have CRLF line endings on checkout. *.bat eol=crlf *.cs eol=crlf +*.dsp eol=crlf +*.dsw eol=crlf *.sln eol=crlf *.vc eol=crlf diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 1ec81b7106..6ad8f52533 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3848,7 +3848,7 @@ SerializeCentralDirectoryEntry( ZipEntry *z, /* The description of what to serialize. */ size_t nameLength, /* The length of the name. */ long long dataStartOffset) /* The overall file offset of the start of the - * data section of the file. */ + * data section of the file. */ { ZipWriteInt(start, end, buf + ZIP_CENTRAL_SIG_OFFS, ZIP_CENTRAL_HEADER_SIG); diff --git a/tests/zipfs.test b/tests/zipfs.test index c36f786f43..89a4d2e77f 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -922,19 +922,19 @@ namespace eval test_ns_zipfs { } -result {path "//zipfs:/testmt/a" not found in any zipfs volume} -returnCodes error test zipfs-info-tcllib-1 "zipfs info offset on tcl library" -constraints zipfslib -body { - expr {[lindex [zipfs info [file dirname $::tcl_library]] 3] > 0} + expr {[lindex [zipfs info [file dirname $::tcl_library]] 3] > 0} } -result 1 test zipfs-info-tcllib-2 "extract zip using zipfs info" -constraints zipfslib -cleanup { cleanup } -body { - set mt [file dirname $::tcl_library] - lassign [zipfs info $mt] container_path - - offset - set fd [open $container_path rb] - chan seek $fd $offset - set zipdata [read $fd] - zipfs mountdata $zipdata /testmt - list [expr {$offset > 0}] [file exists [file join [zipfs root] testmt tcl_library]] + set mt [file dirname $::tcl_library] + lassign [zipfs info $mt] container_path - - offset + set fd [open $container_path rb] + chan seek $fd $offset + set zipdata [read $fd] + zipfs mountdata $zipdata /testmt + list [expr {$offset > 0}] [file exists [file join [zipfs root] testmt tcl_library]] } -result {1 1} # diff --git a/win/vctool.bat b/win/vctool.bat index 2c69662bf2..5d8efd89a0 100644 --- a/win/vctool.bat +++ b/win/vctool.bat @@ -1,174 +1,174 @@ -@echo off -REM Pass /? as argument for usage. - -IF DEFINED VCINSTALLDIR goto setup - -echo "Not in a Visual Studio command prompt." -exit /B 1 - -:setup -setlocal - -set "tool=%0" - -REM Get the current directory -set "currentDir=%CD%" - -REM Use FOR command to get the parent directory -for %%I in ("%currentDir%") do set "parentDir=%%~dpI" - -REM Remove the trailing backslash -set "parentDir=%parentDir:~0,-1%" - -REM Use FOR command again to get the parent of the parent directory -for %%J in ("%parentDir%") do set "grandParentDir=%%~dpJ" - -REM Remove the trailing backslash -set "grandParentDir=%grandParentDir:~0,-1%" - -REM Use FOR command to extract the last component -for %%I in ("%grandParentDir%") do set "grandParentTail=%%~nxI" - -REM Extract the drive letter -for %%I in ("%currentDir%") do set "driveLetter=%%~dI" - -set ARCH=%VSCMD_ARG_TGT_ARCH% -if "%TCLINSTALLROOT%" == "" ( - set INSTROOT=%driveLetter%\Tcl\%grandParentTail%\%ARCH% -) else ( - set INSTROOT=%TCLINSTALLROOT%\%grandParentTail%\%ARCH% -) - -REM Parse options -:options -if "%1" == "" goto dobuilds -if "%1" == "/?" goto help -if "%1" == "-?" goto help -if /i "%1" == "/help" goto help -if "%1" == "all" goto all -if "%1" == "shared" goto shared -if "%1" == "static" goto static -if "%1" == "shared_noembed" goto shared_noembed -if "%1" == "static_noembed" goto static_noembed -if "%1" == "compile" goto compile -if "%1" == "test" goto targets -if "%1" == "install" goto targets -if "%1" == "runshell" goto targets -if "%1" == "debug" goto debug -goto help - -:debug -set debug=1 -shift -goto options - -:shared -set shared=1 -shift -goto options - -:static -set static=1 -shift -goto options - -:shared_noembed -set shared_noembed=1 -shift -goto options - -:static_noembed -set static_noembed=1 -shift -goto options - -:all -set shared=1 -set static=1 -set shared_noembed=1 -set static_noembed=1 -shift -goto options - -:targets -set TARGETS=%TARGETS% %1 -shift -goto options - -REM The makefile.vc compilation target is called "release" -:compile -set TARGETS=%TARGETS% release -shift -goto options - -:dobuilds -if "%shared%%static%%shared_noembed%%static_noembed%" == "" ( - echo At least one of shared, static, shared_noembed, static_noembed, all must be specified. - echo For more help, type "%0 help" - goto error -) - -if DEFINED shared ( - call :runmake shared -) -if DEFINED shared_noembed ( -call :runmake shared-noembed noembed -) -if DEFINED static ( -call :runmake static static -) -if DEFINED static_noembed ( -call :runmake static-noembed "static,noembed" -) - -:done -endlocal -exit /b 0 - -:error -endlocal -exit /b 1 - -:: call :runmake dir opts -:runmake -if "%debug%" == "" ( - nmake /s /f makefile.vc OUT_DIR=%currentDir%\vc-%ARCH%-%1 TMP_DIR=%currentDir%\vc-%ARCH%-%1\objs OPTS=pdbs,%2 INSTALLDIR=%INSTROOT%-%1 %TARGETS% && goto error -) else ( - nmake /s /f makefile.vc OUT_DIR=%currentDir%\vc-%ARCH%-%1-debug TMP_DIR=%currentDir%\vc-%ARCH%-%1-debug\objs OPTS=pdbs,%2 cdebug="-Zi -Od" INSTALLDIR=%INSTROOT%-%1-debug %TARGETS% && goto error -) -goto eof - -:help -echo. -echo Usage: %0 arg ... -echo. -echo where each arg may be either a build config or a target or "debug". -echo. -echo Configs: shared, static, shared_noembed, static_noembed, all -echo Targets: compile (default), test, install -echo. -echo Multiple configs and targets may be specified and intermixed. -echo At least one config must be specified. If no targets specified, -echo default is compile. If multiple targets are present, they -echo are built in specified order. -echo. -echo If "debug" is supplied as an argument, the build has optimizations -echo disabled and full debug information. -echo. -echo If environment variable TCLINSTALLROOT is defined, install target -echo will be subdirectory under it named after the grandparent of the -echo current directory. TCLINSTALLROOT defaults to the X:\Tcl where -echo X is the current drive. -echo. -echo For example, if the current directory C:\src\core-8-branch\tcl\win, -echo install directories will be echo under c:\Tcl\core-8-branch\ as -echo x64-shared, x64-static etc. or x64-shared-debug etc. if "debug" passed. -echo. -echo Examples: -echo %tool% shared (Builds default "shared" config) -echo %tool% shared test (Tests shared build) -echo %tool% static compile test (Builds and tests static build) -echo %tool% all debug (Build debug versions of all configs) -echo %tool% all compile install debug (Builds and installs all configs) -echo %tool% shared static shared_noembed (Builds three configs) -goto done +@echo off +REM Pass /? as argument for usage. + +IF DEFINED VCINSTALLDIR goto setup + +echo "Not in a Visual Studio command prompt." +exit /B 1 + +:setup +setlocal + +set "tool=%0" + +REM Get the current directory +set "currentDir=%CD%" + +REM Use FOR command to get the parent directory +for %%I in ("%currentDir%") do set "parentDir=%%~dpI" + +REM Remove the trailing backslash +set "parentDir=%parentDir:~0,-1%" + +REM Use FOR command again to get the parent of the parent directory +for %%J in ("%parentDir%") do set "grandParentDir=%%~dpJ" + +REM Remove the trailing backslash +set "grandParentDir=%grandParentDir:~0,-1%" + +REM Use FOR command to extract the last component +for %%I in ("%grandParentDir%") do set "grandParentTail=%%~nxI" + +REM Extract the drive letter +for %%I in ("%currentDir%") do set "driveLetter=%%~dI" + +set ARCH=%VSCMD_ARG_TGT_ARCH% +if "%TCLINSTALLROOT%" == "" ( + set INSTROOT=%driveLetter%\Tcl\%grandParentTail%\%ARCH% +) else ( + set INSTROOT=%TCLINSTALLROOT%\%grandParentTail%\%ARCH% +) + +REM Parse options +:options +if "%1" == "" goto dobuilds +if "%1" == "/?" goto help +if "%1" == "-?" goto help +if /i "%1" == "/help" goto help +if "%1" == "all" goto all +if "%1" == "shared" goto shared +if "%1" == "static" goto static +if "%1" == "shared_noembed" goto shared_noembed +if "%1" == "static_noembed" goto static_noembed +if "%1" == "compile" goto compile +if "%1" == "test" goto targets +if "%1" == "install" goto targets +if "%1" == "runshell" goto targets +if "%1" == "debug" goto debug +goto help + +:debug +set debug=1 +shift +goto options + +:shared +set shared=1 +shift +goto options + +:static +set static=1 +shift +goto options + +:shared_noembed +set shared_noembed=1 +shift +goto options + +:static_noembed +set static_noembed=1 +shift +goto options + +:all +set shared=1 +set static=1 +set shared_noembed=1 +set static_noembed=1 +shift +goto options + +:targets +set TARGETS=%TARGETS% %1 +shift +goto options + +REM The makefile.vc compilation target is called "release" +:compile +set TARGETS=%TARGETS% release +shift +goto options + +:dobuilds +if "%shared%%static%%shared_noembed%%static_noembed%" == "" ( + echo At least one of shared, static, shared_noembed, static_noembed, all must be specified. + echo For more help, type "%0 help" + goto error +) + +if DEFINED shared ( + call :runmake shared +) +if DEFINED shared_noembed ( +call :runmake shared-noembed noembed +) +if DEFINED static ( +call :runmake static static +) +if DEFINED static_noembed ( +call :runmake static-noembed "static,noembed" +) + +:done +endlocal +exit /b 0 + +:error +endlocal +exit /b 1 + +:: call :runmake dir opts +:runmake +if "%debug%" == "" ( + nmake /s /f makefile.vc OUT_DIR=%currentDir%\vc-%ARCH%-%1 TMP_DIR=%currentDir%\vc-%ARCH%-%1\objs OPTS=pdbs,%2 INSTALLDIR=%INSTROOT%-%1 %TARGETS% && goto error +) else ( + nmake /s /f makefile.vc OUT_DIR=%currentDir%\vc-%ARCH%-%1-debug TMP_DIR=%currentDir%\vc-%ARCH%-%1-debug\objs OPTS=pdbs,%2 cdebug="-Zi -Od" INSTALLDIR=%INSTROOT%-%1-debug %TARGETS% && goto error +) +goto eof + +:help +echo. +echo Usage: %0 arg ... +echo. +echo where each arg may be either a build config or a target or "debug". +echo. +echo Configs: shared, static, shared_noembed, static_noembed, all +echo Targets: compile (default), test, install +echo. +echo Multiple configs and targets may be specified and intermixed. +echo At least one config must be specified. If no targets specified, +echo default is compile. If multiple targets are present, they +echo are built in specified order. +echo. +echo If "debug" is supplied as an argument, the build has optimizations +echo disabled and full debug information. +echo. +echo If environment variable TCLINSTALLROOT is defined, install target +echo will be subdirectory under it named after the grandparent of the +echo current directory. TCLINSTALLROOT defaults to the X:\Tcl where +echo X is the current drive. +echo. +echo For example, if the current directory C:\src\core-8-branch\tcl\win, +echo install directories will be echo under c:\Tcl\core-8-branch\ as +echo x64-shared, x64-static etc. or x64-shared-debug etc. if "debug" passed. +echo. +echo Examples: +echo %tool% shared (Builds default "shared" config) +echo %tool% shared test (Tests shared build) +echo %tool% static compile test (Builds and tests static build) +echo %tool% all debug (Build debug versions of all configs) +echo %tool% all compile install debug (Builds and installs all configs) +echo %tool% shared static shared_noembed (Builds three configs) +goto done