67a34b6c03
* Remove the "version suffix" and BUILD_INFO.txt mechanisms, which I believe no one uses except winpty itself. Instead, a suffix can be added in the VERSION.txt file. * Instead of passing the version and commit info as a preprocessor macro when building every C++ file, write the info into a GenVersion.h header that is only included by WinptyVersion.cc. * Instead of writing a BUILD_INFO.txt in ship.py, pass COMMIT_HASH=<hash> to make. These changes accomplish two things: * People who build a tag from source won't see a "<ver>-dev" suffix anymore. * Changing the version or the commit will correctly rebuild the version object files (and only those object files). It will also relink every binary. Fixes https://github.com/rprichard/winpty/issues/72
79 lines
2.2 KiB
Batchfile
Executable File
79 lines
2.2 KiB
Batchfile
Executable File
@echo off
|
|
|
|
REM -- Script requirements:
|
|
REM --
|
|
REM -- * git This program must be in the Path to check out
|
|
REM -- build-gyp. If that directory already exists, then
|
|
REM -- git isn't necessary, but if it is missing, no
|
|
REM -- commit hash will be embedded into binaries.
|
|
REM --
|
|
REM -- * python A non-Cygwin Python 2 python.exe must be in the
|
|
REM -- Path to run gyp.
|
|
REM --
|
|
REM -- * msbuild msbuild must be in the Path. It is probably
|
|
REM -- important to have msbuild from the correct MSVC
|
|
REM -- release.
|
|
REM --
|
|
REM -- The script's output binaries are in the src/Release/{Win32,x64}
|
|
REM -- directory.
|
|
|
|
REM -------------------------------------------------------------------------
|
|
REM -- Parse arguments
|
|
|
|
setlocal
|
|
cd %~dp0
|
|
set GYP_ARGS=
|
|
set MSVC_PLATFORM=x64
|
|
|
|
:ParamLoop
|
|
if "%1" == "" goto :ParamDone
|
|
if "%1" == "--msvc-platform" (
|
|
REM -- One of Win32 or x64.
|
|
set MSVC_PLATFORM=%2
|
|
shift && shift
|
|
goto :ParamLoop
|
|
)
|
|
if "%1" == "--gyp-msvs-version" (
|
|
set GYP_ARGS=%GYP_ARGS% -G msvs_version=%2
|
|
shift && shift
|
|
goto :ParamLoop
|
|
)
|
|
if "%1" == "--toolset" (
|
|
set GYP_ARGS=%GYP_ARGS% -D WINPTY_MSBUILD_TOOLSET=%2
|
|
shift && shift
|
|
goto :ParamLoop
|
|
)
|
|
echo error: Unrecognized argument: %1
|
|
exit /b 1
|
|
:ParamDone
|
|
|
|
REM -------------------------------------------------------------------------
|
|
REM -- Check out GYP. GYP doesn't seem to have releases, so just use the
|
|
REM -- current master commit.
|
|
|
|
if not exist build-gyp (
|
|
git clone https://chromium.googlesource.com/external/gyp build-gyp || (
|
|
echo error: GYP clone failed
|
|
exit /b 1
|
|
)
|
|
)
|
|
|
|
REM -------------------------------------------------------------------------
|
|
REM -- Run gyp to generate MSVC project files.
|
|
|
|
cd src
|
|
|
|
call ..\build-gyp\gyp.bat winpty.gyp -I configurations.gypi %GYP_ARGS%
|
|
if errorlevel 1 (
|
|
echo error: GYP failed
|
|
exit /b 1
|
|
)
|
|
|
|
REM -------------------------------------------------------------------------
|
|
REM -- Compile the project.
|
|
|
|
msbuild winpty.sln /m /p:Platform=%MSVC_PLATFORM% || (
|
|
echo error: msbuild failed
|
|
exit /b 1
|
|
)
|