Annotation of embedaddon/curl/projects/build-openssl.bat, revision 1.1

1.1     ! misho       1: @echo off
        !             2: rem ***************************************************************************
        !             3: rem *                                  _   _ ____  _
        !             4: rem *  Project                     ___| | | |  _ \| |
        !             5: rem *                             / __| | | | |_) | |
        !             6: rem *                            | (__| |_| |  _ <| |___
        !             7: rem *                             \___|\___/|_| \_\_____|
        !             8: rem *
        !             9: rem * Copyright (C) 2012 - 2019, Steve Holme, <steve_holme@hotmail.com>.
        !            10: rem *
        !            11: rem * This software is licensed as described in the file COPYING, which
        !            12: rem * you should have received as part of this distribution. The terms
        !            13: rem * are also available at https://curl.haxx.se/docs/copyright.html.
        !            14: rem *
        !            15: rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
        !            16: rem * copies of the Software, and permit persons to whom the Software is
        !            17: rem * furnished to do so, under the terms of the COPYING file.
        !            18: rem *
        !            19: rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
        !            20: rem * KIND, either express or implied.
        !            21: rem *
        !            22: rem ***************************************************************************
        !            23: 
        !            24: :begin
        !            25:   rem Check we are running on a Windows NT derived OS
        !            26:   if not "%OS%" == "Windows_NT" goto nodos
        !            27: 
        !            28:   rem Set our variables
        !            29:   setlocal ENABLEDELAYEDEXPANSION
        !            30:   set VC_VER=
        !            31:   set BUILD_PLATFORM=
        !            32:   set BUILD_CONFIG=
        !            33: 
        !            34:   rem Ensure we have the required arguments
        !            35:   if /i "%~1" == "" goto syntax
        !            36: 
        !            37:   rem Calculate the program files directory
        !            38:   if defined PROGRAMFILES (
        !            39:     set "PF=%PROGRAMFILES%"
        !            40:     set OS_PLATFORM=x86
        !            41:   )
        !            42:   if defined PROGRAMFILES(x86) (
        !            43:     set "PF=%PROGRAMFILES(x86)%"
        !            44:     set OS_PLATFORM=x64
        !            45:   )
        !            46: 
        !            47: :parseArgs
        !            48:   if not "%~1" == "" (
        !            49:     if /i "%~1" == "vc6" (
        !            50:       set VC_VER=6.0
        !            51:       set VC_DESC=VC6
        !            52:       set "VC_PATH=Microsoft Visual Studio\VC98"
        !            53:     ) else if /i "%~1" == "vc7" (
        !            54:       set VC_VER=7.0
        !            55:       set VC_DESC=VC7
        !            56:       set "VC_PATH=Microsoft Visual Studio .NET\Vc7"
        !            57:     ) else if /i "%~1" == "vc7.1" (
        !            58:       set VC_VER=7.1
        !            59:       set VC_DESC=VC7.1
        !            60:       set "VC_PATH=Microsoft Visual Studio .NET 2003\Vc7"
        !            61:     ) else if /i "%~1" == "vc8" (
        !            62:       set VC_VER=8.0
        !            63:       set VC_DESC=VC8
        !            64:       set "VC_PATH=Microsoft Visual Studio 8\VC"
        !            65:     ) else if /i "%~1" == "vc9" (
        !            66:       set VC_VER=9.0
        !            67:       set VC_DESC=VC9
        !            68:       set "VC_PATH=Microsoft Visual Studio 9.0\VC"
        !            69:     ) else if /i "%~1" == "vc10" (
        !            70:       set VC_VER=10.0
        !            71:       set VC_DESC=VC10
        !            72:       set "VC_PATH=Microsoft Visual Studio 10.0\VC"
        !            73:     ) else if /i "%~1" == "vc11" (
        !            74:       set VC_VER=11.0
        !            75:       set VC_DESC=VC11
        !            76:       set "VC_PATH=Microsoft Visual Studio 11.0\VC"
        !            77:     ) else if /i "%~1" == "vc12" (
        !            78:       set VC_VER=12.0
        !            79:       set VC_DESC=VC12
        !            80:       set "VC_PATH=Microsoft Visual Studio 12.0\VC"
        !            81:     ) else if /i "%~1" == "vc14" (
        !            82:       set VC_VER=14.0
        !            83:       set VC_DESC=VC14
        !            84:       set "VC_PATH=Microsoft Visual Studio 14.0\VC"
        !            85:     ) else if /i "%~1" == "vc14.1" (
        !            86:       set VC_VER=14.1
        !            87:       set VC_DESC=VC14.1
        !            88: 
        !            89:       rem Determine the VC14.1 path based on the installed edition in descending
        !            90:       rem order (Enterprise, then Professional and finally Community)
        !            91:       if exist "%PF%\Microsoft Visual Studio\2017\Enterprise\VC" (
        !            92:         set "VC_PATH=Microsoft Visual Studio\2017\Enterprise\VC"
        !            93:       ) else if exist "%PF%\Microsoft Visual Studio\2017\Professional\VC" (
        !            94:         set "VC_PATH=Microsoft Visual Studio\2017\Professional\VC"
        !            95:       ) else (
        !            96:         set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
        !            97:       )
        !            98:     ) else if /i "%~1" == "vc14.2" (
        !            99:       set VC_VER=14.2
        !           100:       set VC_DESC=VC14.2
        !           101: 
        !           102:       rem Determine the VC14.2 path based on the installed edition in descending
        !           103:       rem order (Enterprise, then Professional and finally Community)
        !           104:       if exist "%PF%\Microsoft Visual Studio\2019\Enterprise\VC" (
        !           105:         set "VC_PATH=Microsoft Visual Studio\2019\Enterprise\VC"
        !           106:       ) else if exist "%PF%\Microsoft Visual Studio\2019\Professional\VC" (
        !           107:         set "VC_PATH=Microsoft Visual Studio\2019\Professional\VC"
        !           108:       ) else (
        !           109:         set "VC_PATH=Microsoft Visual Studio\2019\Community\VC"
        !           110:       )
        !           111:     ) else if /i "%~1%" == "x86" (
        !           112:       set BUILD_PLATFORM=x86
        !           113:     ) else if /i "%~1%" == "x64" (
        !           114:       set BUILD_PLATFORM=x64
        !           115:     ) else if /i "%~1%" == "debug" (
        !           116:       set BUILD_CONFIG=debug
        !           117:     ) else if /i "%~1%" == "release" (
        !           118:       set BUILD_CONFIG=release
        !           119:     ) else if /i "%~1" == "-?" (
        !           120:       goto syntax
        !           121:     ) else if /i "%~1" == "-h" (
        !           122:       goto syntax
        !           123:     ) else if /i "%~1" == "-help" (
        !           124:       goto syntax
        !           125:     ) else if /i "%~1" == "-VSpath" (
        !           126:       if "%~2" == "" (
        !           127:         echo.
        !           128:         echo Error. Please provide VS Path.
        !           129:         goto error
        !           130:       ) else (
        !           131:         set "ABS_VC_PATH=%~2\VC"
        !           132:         shift
        !           133:       )
        !           134:     ) else if /i "%~1" == "-perlpath" (
        !           135:       if "%~2" == "" (
        !           136:         echo.
        !           137:         echo Error. Please provide Perl root Path.
        !           138:         goto error
        !           139:       ) else (
        !           140:         set "PERL_PATH=%~2"
        !           141:         shift
        !           142:       )
        !           143:     ) else (
        !           144:       if not defined START_DIR (
        !           145:         set START_DIR=%~1%
        !           146:       ) else (
        !           147:         goto unknown
        !           148:       )
        !           149:     )
        !           150: 
        !           151:     shift & goto parseArgs
        !           152:   )
        !           153: 
        !           154: :prerequisites
        !           155:   rem Compiler is a required parameter
        !           156:   if not defined VC_VER goto syntax
        !           157: 
        !           158:   rem Default the start directory if one isn't specified
        !           159:   if not defined START_DIR set START_DIR=..\..\openssl
        !           160: 
        !           161:   if not defined ABS_VC_PATH (
        !           162:     rem Check we have a program files directory
        !           163:     if not defined PF goto nopf
        !           164:     set "ABS_VC_PATH=%PF%\%VC_PATH%"
        !           165:   )
        !           166: 
        !           167:   rem Check we have Visual Studio installed
        !           168:   if not exist "%ABS_VC_PATH%" goto novc
        !           169: 
        !           170:   if not defined PERL_PATH (
        !           171:     rem Check we have Perl in our path
        !           172:     perl --version <NUL 1>NUL 2>&1
        !           173:     if errorlevel 1 (
        !           174:       rem It isn't so check we have it installed and set the path if it is
        !           175:       if exist "%SystemDrive%\Perl" (
        !           176:         set "PATH=%SystemDrive%\Perl\bin;%PATH%"
        !           177:       ) else (
        !           178:         if exist "%SystemDrive%\Perl64" (
        !           179:           set "PATH=%SystemDrive%\Perl64\bin;%PATH%"
        !           180:         ) else (
        !           181:           goto noperl
        !           182:         )
        !           183:       )
        !           184:     )
        !           185:   ) else (
        !           186:     set "PATH=%PERL_PATH%\Perl\bin;%PATH%"
        !           187:   )
        !           188: 
        !           189:   rem Check the start directory exists
        !           190:   if not exist "%START_DIR%" goto noopenssl
        !           191: 
        !           192: :setup
        !           193:   if "%BUILD_PLATFORM%" == "" (
        !           194:     if "%VC_VER%" == "6.0" (
        !           195:       set BUILD_PLATFORM=x86
        !           196:     ) else if "%VC_VER%" == "7.0" (
        !           197:       set BUILD_PLATFORM=x86
        !           198:     ) else if "%VC_VER%" == "7.1" (
        !           199:       set BUILD_PLATFORM=x86
        !           200:     ) else (
        !           201:       set BUILD_PLATFORM=%OS_PLATFORM%
        !           202:     )
        !           203:   )
        !           204: 
        !           205:   if "%BUILD_PLATFORM%" == "x86" (
        !           206:     set VCVARS_PLATFORM=x86
        !           207:   ) else if "%BUILD_PLATFORM%" == "x64" (
        !           208:     if "%VC_VER%" == "6.0" goto nox64
        !           209:     if "%VC_VER%" == "7.0" goto nox64
        !           210:     if "%VC_VER%" == "7.1" goto nox64
        !           211:     if "%VC_VER%" == "8.0" set VCVARS_PLATFORM=x86_amd64
        !           212:     if "%VC_VER%" == "9.0" set VCVARS_PLATFORM=%BUILD_PLATFORM%
        !           213:     if "%VC_VER%" == "10.0" set VCVARS_PLATFORM=%BUILD_PLATFORM%
        !           214:     if "%VC_VER%" == "11.0" set VCVARS_PLATFORM=amd64
        !           215:     if "%VC_VER%" == "12.0" set VCVARS_PLATFORM=amd64
        !           216:     if "%VC_VER%" == "14.0" set VCVARS_PLATFORM=amd64
        !           217:     if "%VC_VER%" == "14.1" set VCVARS_PLATFORM=amd64
        !           218:     if "%VC_VER%" == "14.2" set VCVARS_PLATFORM=amd64
        !           219:   )
        !           220: 
        !           221:   if exist "%START_DIR%\ms\do_ms.bat" (
        !           222:     set LEGACY_BUILD=TRUE
        !           223:   ) else (
        !           224:     set LEGACY_BUILD=FALSE
        !           225:   )
        !           226: 
        !           227: :start
        !           228:   echo.
        !           229:   set SAVED_PATH=%CD%
        !           230: 
        !           231:   if "%VC_VER%" == "6.0" (
        !           232:     call "%ABS_VC_PATH%\bin\vcvars32"
        !           233:   ) else if "%VC_VER%" == "7.0" (
        !           234:     call "%ABS_VC_PATH%\bin\vcvars32"
        !           235:   ) else if "%VC_VER%" == "7.1" (
        !           236:     call "%ABS_VC_PATH%\bin\vcvars32"
        !           237:   ) else if "%VC_VER%" == "14.1" (
        !           238:     call "%ABS_VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
        !           239:   ) else if "%VC_VER%" == "14.2" (
        !           240:     call "%ABS_VC_PATH%\Auxiliary\Build\vcvarsall" %VCVARS_PLATFORM%
        !           241:   ) else (
        !           242:     call "%ABS_VC_PATH%\vcvarsall" %VCVARS_PLATFORM%
        !           243:   )
        !           244: 
        !           245:   echo.
        !           246:   cd /d %SAVED_PATH%
        !           247:   if defined START_DIR cd /d %START_DIR%
        !           248:   goto %BUILD_PLATFORM%
        !           249: 
        !           250: :x64
        !           251:   rem Calculate our output directory
        !           252:   set OUTDIR=build\Win64\%VC_DESC%
        !           253:   if not exist %OUTDIR% md %OUTDIR%
        !           254: 
        !           255:   if not "%BUILD_CONFIG%" == "release" (
        !           256:     rem Configuring 64-bit Static Library Debug Build
        !           257:     call :configure x64 debug static %LEGACY_BUILD%
        !           258: 
        !           259:     rem Perform the build
        !           260:     call :build x64 static %LEGACY_BUILD%
        !           261: 
        !           262:     rem Perform the install
        !           263:     call :install debug static %LEGACY_BUILD%
        !           264: 
        !           265:     rem Configuring 64-bit Shared Library Debug Build
        !           266:     call :configure x64 debug shared %LEGACY_BUILD%
        !           267: 
        !           268:     rem Perform the build
        !           269:     call :build x64 shared %LEGACY_BUILD%
        !           270: 
        !           271:     rem Perform the install
        !           272:     call :install debug shared %LEGACY_BUILD%
        !           273:   )
        !           274: 
        !           275:   if not "%BUILD_CONFIG%" == "debug" (
        !           276:     rem Configuring 64-bit Static Library Release Build
        !           277:     call :configure x64 release static %LEGACY_BUILD%
        !           278: 
        !           279:     rem Perform the build
        !           280:     call :build x64 static %LEGACY_BUILD%
        !           281: 
        !           282:     rem Perform the install
        !           283:     call :install release static %LEGACY_BUILD%
        !           284: 
        !           285:     rem Configuring 64-bit Shared Library Release Build
        !           286:     call :configure x64 release shared %LEGACY_BUILD%
        !           287: 
        !           288:     rem Perform the build
        !           289:     call :build x64 shared %LEGACY_BUILD%
        !           290: 
        !           291:     rem Perform the install
        !           292:     call :install release shared %LEGACY_BUILD%
        !           293:   )
        !           294: 
        !           295:   goto success
        !           296: 
        !           297: :x86
        !           298:   rem Calculate our output directory
        !           299:   set OUTDIR=build\Win32\%VC_DESC%
        !           300:   if not exist %OUTDIR% md %OUTDIR%
        !           301: 
        !           302:   if not "%BUILD_CONFIG%" == "release" (
        !           303:     rem Configuring 32-bit Static Library Debug Build
        !           304:     call :configure x86 debug static %LEGACY_BUILD%
        !           305: 
        !           306:     rem Perform the build
        !           307:     call :build x86 static %LEGACY_BUILD%
        !           308: 
        !           309:     rem Perform the install
        !           310:     call :install debug static %LEGACY_BUILD%
        !           311: 
        !           312:     rem Configuring 32-bit Shared Library Debug Build
        !           313:     call :configure x86 debug shared %LEGACY_BUILD%
        !           314: 
        !           315:     rem Perform the build
        !           316:     call :build x86 shared %LEGACY_BUILD%
        !           317: 
        !           318:     rem Perform the install
        !           319:     call :install debug shared %LEGACY_BUILD%
        !           320:   )
        !           321: 
        !           322:   if not "%BUILD_CONFIG%" == "debug" (
        !           323:     rem Configuring 32-bit Static Library Release Build
        !           324:     call :configure x86 release static %LEGACY_BUILD%
        !           325: 
        !           326:     rem Perform the build
        !           327:     call :build x86 static %LEGACY_BUILD%
        !           328: 
        !           329:     rem Perform the install
        !           330:     call :install release static %LEGACY_BUILD%
        !           331: 
        !           332:     rem Configuring 32-bit Shared Library Release Build
        !           333:     call :configure x86 release shared %LEGACY_BUILD%
        !           334: 
        !           335:     rem Perform the build
        !           336:     call :build x86 shared %LEGACY_BUILD%
        !           337: 
        !           338:     rem Perform the install
        !           339:     call :install release shared %LEGACY_BUILD%
        !           340:   )
        !           341: 
        !           342:   goto success
        !           343: 
        !           344: rem Function to configure the build.
        !           345: rem
        !           346: rem %1 - Platform (x86 or x64)
        !           347: rem %2 - Configuration (release or debug)
        !           348: rem %3 - Build Type (static or shared)
        !           349: rem %4 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE)
        !           350: rem
        !           351: :configure
        !           352:   setlocal
        !           353: 
        !           354:   if "%1" == "" exit /B 1
        !           355:   if "%2" == "" exit /B 1
        !           356:   if "%3" == "" exit /B 1
        !           357:   if "%4" == "" exit /B 1
        !           358: 
        !           359:   if "%4" == "TRUE" (
        !           360:     rem Calculate the build directory
        !           361:     set build_dir=%cd%
        !           362: 
        !           363:     rem Calculate the configure options
        !           364:     if "%1" == "x86" (
        !           365:       if "%2" == "debug" (
        !           366:         set options=debug-VC-WIN32
        !           367:       ) else if "%2" == "release" (
        !           368:         set options=VC-WIN32
        !           369:       ) else (
        !           370:         exit /B 1
        !           371:       )
        !           372: 
        !           373:       set options=!options! no-asm
        !           374:     ) else if "%1" == "x64" (
        !           375:       if "%2" == "debug" (
        !           376:         set options=debug-VC-WIN64A
        !           377:       ) else if "%2" == "release" (
        !           378:         set options=VC-WIN64A
        !           379:       ) else (
        !           380:         exit /B 1
        !           381:       )
        !           382:     ) else (
        !           383:       exit /B 1
        !           384:     )
        !           385:   ) else if "%4" == "FALSE" (
        !           386:     rem Has configure already been ran?
        !           387:     if exist makefile (
        !           388:       rem Clean up the previous build
        !           389:       nmake clean
        !           390: 
        !           391:       rem Remove the old makefile
        !           392:       del makefile 1>nul
        !           393:     )
        !           394: 
        !           395:     rem Calculate the build directory
        !           396:     set build_dir=%cd%\build\tmp
        !           397: 
        !           398:     rem Calculate the configure options
        !           399:     if "%1" == "x86" (
        !           400:       set options=VC-WIN32
        !           401:     ) else if "%1" == "x64" (
        !           402:       set options=VC-WIN64A
        !           403:     ) else (
        !           404:       exit /B 1
        !           405:     )
        !           406: 
        !           407:     if "%2" == "debug" (
        !           408:       set options=!options! --debug
        !           409:     ) else if "%2" == "release" (
        !           410:       set options=!options! --release
        !           411:     ) else (
        !           412:       exit /B 1
        !           413:     )
        !           414: 
        !           415:     if "%3" == "static" (
        !           416:       set options=!options! no-shared
        !           417:     ) else if not "%3" == "shared" (
        !           418:       exit /B 1
        !           419:     )
        !           420: 
        !           421:     set options=!options! no-asm
        !           422:   ) else (
        !           423:     exit /B 1
        !           424:   )
        !           425: 
        !           426:   set options=%options% --prefix=%build_dir%
        !           427: 
        !           428:   rem Run the configure
        !           429:   perl Configure %options%
        !           430: 
        !           431:   exit /B %ERRORLEVEL
        !           432: 
        !           433: rem Main build function.
        !           434: rem
        !           435: rem %1 - Platform (x86 or x64)
        !           436: rem %2 - Build Type (static or shared)
        !           437: rem %3 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE)
        !           438: rem
        !           439: :build
        !           440:   setlocal
        !           441: 
        !           442:   if "%1" == "" exit /B 1
        !           443:   if "%2" == "" exit /B 1
        !           444:   if "%3" == "" exit /B 1
        !           445: 
        !           446:   if "%3" == "TRUE" (
        !           447:     if "%1" == "x86" (
        !           448:       call ms\do_ms.bat
        !           449:     ) else if "%1" == "x64" (
        !           450:       call ms\do_win64a.bat
        !           451:     ) else (
        !           452:       exit /B 1
        !           453:     )
        !           454: 
        !           455:     if "%2" == "static" (
        !           456:       nmake -f ms\nt.mak
        !           457:     ) else if "%2" == "shared" (
        !           458:       nmake -f ms\ntdll.mak
        !           459:     ) else (
        !           460:       exit /B 1
        !           461:     )
        !           462:   ) else if "%2" == "FALSE" (
        !           463:     nmake
        !           464:   ) else (
        !           465:     exit /B 1
        !           466:   )
        !           467: 
        !           468:   exit /B 0
        !           469: 
        !           470: rem Main installation function.
        !           471: rem
        !           472: rem %1 - Configuration (release or debug)
        !           473: rem %2 - Build Type (static or shared)
        !           474: rem %3 - Build type (TRUE for legacy aka pre v1.1.0; otherwise FALSE)
        !           475: rem
        !           476: :install
        !           477:   setlocal
        !           478: 
        !           479:   if "%1" == "" exit /B 1
        !           480:   if "%2" == "" exit /B 1
        !           481:   if "%3" == "" exit /B 1
        !           482: 
        !           483:   rem Copy the generated files to our directory structure
        !           484:   if "%3" == "TRUE" (
        !           485:     if "%1" == "debug" (
        !           486:       if "%2" == "static" (
        !           487:         rem Move the output directories
        !           488:         if exist "%OUTDIR%\LIB Debug" (
        !           489:           copy /y out32.dbg\* "%OUTDIR%\LIB Debug" 1>nul
        !           490:           rd out32.dbg /s /q
        !           491:         ) else (
        !           492:           move out32.dbg "%OUTDIR%\LIB Debug" 1>nul
        !           493:         )
        !           494: 
        !           495:         rem Move the PDB files
        !           496:         move tmp32.dbg\lib.pdb "%OUTDIR%\LIB Debug" 1>nul
        !           497: 
        !           498:         rem Remove the intermediate directories
        !           499:         rd tmp32.dbg /s /q
        !           500:       ) else if "%2" == "shared" (
        !           501:         if exist "%OUTDIR%\DLL Debug" (
        !           502:           copy /y out32dll.dbg\* "%OUTDIR%\DLL Debug" 1>nul
        !           503:           rd out32dll.dbg /s /q
        !           504:         ) else (
        !           505:           move out32dll.dbg "%OUTDIR%\DLL Debug" 1>nul
        !           506:         )
        !           507: 
        !           508:         rem Move the PDB files
        !           509:         move tmp32dll.dbg\lib.pdb "%OUTDIR%\DLL Debug" 1>nul
        !           510: 
        !           511:         rem Remove the intermediate directories
        !           512:         rd tmp32dll.dbg /s /q
        !           513:       ) else (
        !           514:         exit /B 1
        !           515:       )
        !           516:     ) else if "%1" == "release" (
        !           517:       if "%2" == "static" (
        !           518:         rem Move the output directories
        !           519:         if exist "%OUTDIR%\LIB Release" (
        !           520:           copy /y out32\* "%OUTDIR%\LIB Release" 1>nul
        !           521:           rd out32 /s /q
        !           522:         ) else (
        !           523:           move out32 "%OUTDIR%\LIB Release" 1>nul
        !           524:         )
        !           525: 
        !           526:         rem Move the PDB files
        !           527:         move tmp32\lib.pdb "%OUTDIR%\LIB Release" 1>nul
        !           528: 
        !           529:         rem Remove the intermediate directories
        !           530:         rd tmp32 /s /q
        !           531:       ) else if "%2" == "shared" (
        !           532:         if exist "%OUTDIR%\DLL Release" (
        !           533:           copy /y out32dll\* "%OUTDIR%\DLL Release" 1>nul
        !           534:           rd out32dll /s /q
        !           535:         ) else (
        !           536:           move out32dll "%OUTDIR%\DLL Release" 1>nul
        !           537:         )
        !           538: 
        !           539:         rem Move the PDB files
        !           540:         move tmp32dll\lib.pdb "%OUTDIR%\DLL Release" 1>nul
        !           541: 
        !           542:         rem Remove the intermediate directories
        !           543:         rd tmp32dll /s /q
        !           544:       ) else (
        !           545:         exit /B 1
        !           546:       )
        !           547:     )
        !           548:   ) else if "%3" == "FALSE" (
        !           549:     rem Calculate the build directory
        !           550:     set build_dir=%cd%\build\tmp
        !           551: 
        !           552:     rem Perform the installation
        !           553:     nmake install_sw
        !           554: 
        !           555:     rem Move the output directories
        !           556:     if "%1" == "debug" (
        !           557:       if "%2" == "static" (
        !           558:         if not exist "%OUTDIR%\LIB Debug" (
        !           559:           mkdir "%OUTDIR%\LIB Debug" 1>nul
        !           560:         )
        !           561: 
        !           562:         move !build_dir!\lib\*.lib "%OUTDIR%\LIB Debug" 1>nul
        !           563:         move !build_dir!\bin\*.exe "%OUTDIR%\LIB Debug" 1>nul
        !           564:       ) else if "%2" == "shared" (
        !           565:         if not exist "%OUTDIR%\DLL Debug" (
        !           566:           mkdir "%OUTDIR%\DLL Debug" 1>nul
        !           567:         )
        !           568: 
        !           569:         move !build_dir!\lib\*.lib "%OUTDIR%\DLL Debug" 1>nul
        !           570:         move !build_dir!\bin\*.dll "%OUTDIR%\DLL Debug" 1>nul
        !           571:         move !build_dir!\bin\*.exe "%OUTDIR%\DLL Debug" 1>nul
        !           572:         move !build_dir!\bin\*.pdb "%OUTDIR%\DLL Debug" 1>nul
        !           573:       ) else (
        !           574:         exit /B 1
        !           575:       )
        !           576:     ) else if "%1" == "release" (
        !           577:       if "%2" == "static" (
        !           578:         if not exist "%OUTDIR%\LIB Release" (
        !           579:           mkdir "%OUTDIR%\LIB Release" 1>nul
        !           580:         )
        !           581: 
        !           582:         move !build_dir!\lib\*.lib "%OUTDIR%\LIB Release" 1>nul
        !           583:         move !build_dir!\bin\*.exe "%OUTDIR%\LIB Release" 1>nul
        !           584:       ) else if "%2" == "shared" (
        !           585:         if not exist "%OUTDIR%\DLL Release" (
        !           586:           mkdir "%OUTDIR%\DLL Release" 1>nul
        !           587:         )
        !           588: 
        !           589:         move !build_dir!\lib\*.lib "%OUTDIR%\DLL Release" 1>nul
        !           590:         move !build_dir!\bin\*.dll "%OUTDIR%\DLL Release" 1>nul
        !           591:         move !build_dir!\bin\*.exe "%OUTDIR%\DLL Release" 1>nul
        !           592:       ) else (
        !           593:         exit /B 1
        !           594:       )
        !           595:     ) else (
        !           596:       exit /B 1
        !           597:     )
        !           598: 
        !           599:     rem Remove the output directories
        !           600:     rd !build_dir! /s /q
        !           601:   ) else (
        !           602:     exit /B 1
        !           603:   )
        !           604: 
        !           605:   exit /B 0
        !           606: 
        !           607: :syntax
        !           608:   rem Display the help
        !           609:   echo.
        !           610:   echo Usage: build-openssl ^<compiler^> [platform] [configuration] [directory] [-VSpath] ["VSpath"] [-perlpath] ["perlpath"]
        !           611:   echo.
        !           612:   echo Compiler:
        !           613:   echo.
        !           614:   echo vc6       - Use Visual Studio 6
        !           615:   echo vc7       - Use Visual Studio .NET
        !           616:   echo vc7.1     - Use Visual Studio .NET 2003
        !           617:   echo vc8       - Use Visual Studio 2005
        !           618:   echo vc9       - Use Visual Studio 2008
        !           619:   echo vc10      - Use Visual Studio 2010
        !           620:   echo vc11      - Use Visual Studio 2012
        !           621:   echo vc12      - Use Visual Studio 2013
        !           622:   echo vc14      - Use Visual Studio 2015
        !           623:   echo vc14.1    - Use Visual Studio 2017
        !           624:   echo vc14.2    - Use Visual Studio 2019
        !           625:   echo.
        !           626:   echo Platform:
        !           627:   echo.
        !           628:   echo x86       - Perform a 32-bit build
        !           629:   echo x64       - Perform a 64-bit build
        !           630:   echo.
        !           631:   echo Configuration:
        !           632:   echo.
        !           633:   echo debug     - Perform a debug build
        !           634:   echo release   - Perform a release build
        !           635:   echo.
        !           636:   echo Other:
        !           637:   echo.
        !           638:   echo directory - Specifies the OpenSSL source directory
        !           639:   echo.
        !           640:   echo -VSpath - Specify the custom VS path if Visual Studio is installed at other location
        !           641:   echo           then "C:/<ProgramFiles>/Microsoft Visual Studio[version]
        !           642:   echo           For e.g. -VSpath "C:\apps\MVS14"
        !           643:   echo.
        !           644:   echo -perlpath - Specify the custom perl root path if perl is not located at "C:\Perl" and it is a
        !           645:   echo             portable copy of perl and not installed on the win system
        !           646:   echo             For e.g. -perlpath "D:\strawberry-perl-5.24.3.1-64bit-portable"
        !           647:   goto error
        !           648: 
        !           649: :unknown
        !           650:   echo.
        !           651:   echo Error: Unknown argument '%1'
        !           652:   goto error
        !           653: 
        !           654: :nodos
        !           655:   echo.
        !           656:   echo Error: Only a Windows NT based Operating System is supported
        !           657:   goto error
        !           658: 
        !           659: :nopf
        !           660:   echo.
        !           661:   echo Error: Cannot obtain the directory for Program Files
        !           662:   goto error
        !           663: 
        !           664: :novc
        !           665:   echo.
        !           666:   echo Error: %VC_DESC% is not installed
        !           667:   echo Error: Please check whether Visual compiler is installed at the path "%ABS_VC_PATH%"
        !           668:   echo Error: Please provide proper VS Path by using -VSpath
        !           669:   goto error
        !           670: 
        !           671: :noperl
        !           672:   echo.
        !           673:   echo Error: Perl is not installed
        !           674:   echo Error: Please check whether Perl is installed or it is at location "C:\Perl"
        !           675:   echo Error: If Perl is portable please provide perl root path by using -perlpath
        !           676:   goto error
        !           677: 
        !           678: :nox64
        !           679:   echo.
        !           680:   echo Error: %VC_DESC% does not support 64-bit builds
        !           681:   goto error
        !           682: 
        !           683: :noopenssl
        !           684:   echo.
        !           685:   echo Error: Cannot locate OpenSSL source directory
        !           686:   goto error
        !           687: 
        !           688: :error
        !           689:   if "%OS%" == "Windows_NT" endlocal
        !           690:   exit /B 1
        !           691: 
        !           692: :success
        !           693:   cd /d %SAVED_PATH%
        !           694:   endlocal
        !           695:   exit /B 0

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>