Skip to content

Instantly share code, notes, and snippets.

@gorlak
Last active April 16, 2023 03:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save gorlak/431be9d649d0ad3100c61bacdcb02423 to your computer and use it in GitHub Desktop.
Save gorlak/431be9d649d0ad3100c61bacdcb02423 to your computer and use it in GitHub Desktop.
A simple batch script to build MT/MTd/MD/MDd openssl static libs on windows
@echo off
setlocal
if "%VisualStudioVersion%" equ "" echo Please run this script from a Visual Studio command prompt for the compiler you want to use
if "%VisualStudioVersion%" equ "" exit /b 1
:: make perl.exe available via %PATH%
set PATH=%PATH%;%~dp0..\..\..\game\bin\perl\bin
pushd %~dp0src
perl Configure VC-WIN64A no-asm --prefix=%~dp0\x64-mt
call ms\do_win64a.bat
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
copy /y tmp32\lib.pdb %~dp0\x64-mt\lib\
nmake -f ms\nt.mak clean
perl Configure debug-VC-WIN64A no-asm --prefix=%~dp0\x64-mtd
call ms\do_win64a.bat
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
copy /y tmp32.dbg\lib.pdb %~dp0\x64-mtd\lib\
nmake -f ms\nt.mak clean
::
:: I'm sorry, but this is honestly the best answer @gorlak
::
copy /y ms\nt.mak ms\nt.mak.orig
perl Configure VC-WIN64A no-asm --prefix=%~dp0\x64-md
call ms\do_win64a.bat
copy /y ms\nt.mak ms\nt.mak.unhacked
perl -p -e "s/\/MT/\/MD/g" ms\nt.mak.unhacked > ms\nt.mak
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
copy /y tmp32\lib.pdb %~dp0\x64-md\lib\
nmake -f ms\nt.mak clean
perl Configure debug-VC-WIN64A no-asm --prefix=%~dp0\x64-mdd
call ms\do_win64a.bat
copy /y ms\nt.mak ms\nt.mak.unhacked
perl -p -e "s/\/MT/\/MD/g" ms\nt.mak.unhacked > ms\nt.mak
nmake -f ms\nt.mak
nmake -f ms\nt.mak install
copy /y tmp32.dbg\lib.pdb %~dp0\x64-mdd\lib\
nmake -f ms\nt.mak clean
copy /y ms\nt.mak.orig ms\nt.mak
popd
pushd %~dp0
if exist install attrib -r install\*.* /s
if exist install rmdir /s /q install
ren x64-mt\lib mt
ren x64-mtd\lib mtd
ren x64-md\lib md
ren x64-mdd\lib mdd
ren x64-mt install
mkdir install\lib\vstudio-%VisualStudioVersion%\x64
move install\mt install\lib\vstudio-%VisualStudioVersion%\x64\
move x64-mtd\mtd install\lib\vstudio-%VisualStudioVersion%\x64\
move x64-md\md install\lib\vstudio-%VisualStudioVersion%\x64\
move x64-mdd\mdd install\lib\vstudio-%VisualStudioVersion%\x64\
rmdir /s /q x64-mtd
rmdir /s /q x64-md
rmdir /s /q x64-mdd
popd
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment