@echo off
:: rem ---------------------------------------------------------------------------
:: rem Small script to fasten up the compilation of OpenSSL and mod_ssl for
:: rem Apache2 on
Win32
:: rem ---------------------------------------------------------------------------
if {%1} == {} goto :syntax
if {%2} == {} goto :syntax
set ApacheSrc=%1
set OpensslSrc=%2
set ApacheSrc=%ApacheSrc:.\=%
set ApacheName=%ApacheSrc%
set OpensslSrc=%OpensslSrc:.\=%
rem Set the following value to 1 if you want the script to attempt to set up the
rem GnuWin32 path itself. It assumes that the files are located in .\GnuWin32 as
rem a subfolder of your %ProgramFiles% folder.
set GnuWin32=1
rem This allows to set absolute pathes easily!!!
set perl=perl
set bison=bison
set flex=flex
set awk=awk
set sed=sed
set ln=ln
cls
if NOT {%GnuWin32%} == {1} goto skipgnuwin32
echo Setting environment variable PATH
set PATH=%PATH%;%ProgramFiles%\GnuWin32\bin
if exist "%ProgramFiles%\GnuWin32\bin\awk.exe" goto :skipgnuwin32
echo Now copying gawk.exe to awk.exe (AWK.EXE is required)
copy "%ProgramFiles%\GnuWin32\bin\gawk.exe" "%ProgramFiles%\GnuWin32\bin\awk.exe" > NUL
echo
:skipgnuwin32
echo.
echo Checking availability of all tools
echo --^> Perl: %ERRORLEVEL%
%perl% --help > NUL
if NOT {%ERRORLEVEL%} == {0} goto notools
echo ^!Perl: exists
echo --^> AWK (GAWK): %ERRORLEVEL%
%awk% --help > NUL
if NOT {%ERRORLEVEL%} == {0} goto notools
echo ^!AWK: exists
%bison% --help > NUL
echo --^> BISON: %ERRORLEVEL%
if NOT {%ERRORLEVEL%} == {0} goto notools
echo ^!BISON: exists
%flex% --help > NUL
echo --^> FLEX: %ERRORLEVEL%
if NOT {%ERRORLEVEL%} == {0} goto notools
echo ^!FLEX: exists
%sed% --help > NUL
echo --^> SED: %ERRORLEVEL%
if NOT {%ERRORLEVEL%} == {0} goto notools
echo ^!SED: exists
%ln% > NUL
echo --^> LN: %ERRORLEVEL%
if NOT {%ERRORLEVEL%} == {1} goto notools
echo ^!LN: exists
rem Everything found, so go on ;)
set buildme=buildme.cmd
echo.
echo -----------------------------------------------------------------------------
echo Apache
Win32 sources: ".\%ApacheSrc%"
echo OpenSSL sources: ".\%OpensslSrc%"
echo -----------------------------------------------------------------------------
echo.
echo.
rem ------------------------------------------------------------------------------
echo Creating junction in .\%ApacheSrc%\srclib for OpenSSL
if exist ".\%ApacheSrc%\srclib\openssl" goto skipjunction
ln -s ".\%ApacheSrc%\srclib\openssl" ".\%OpensslSrc%"
rem For unlinking
set CreatedJunction=1
:skipjunction
rem ------------------------------------------------------------------------------
echo ^@echo off > %buildme%
echo %perl% Configure VC-
WIN32 >> %buildme%
echo %perl% util\mkfiles.pl ^>MINFO >> %buildme%
echo %perl% util\mk1mf.pl
dll no-
asm no-mdc2 no-rc5 no-idea VC-
WIN32 ^>makefile >> %buildme%
echo %perl% util\mkdef.pl 32 libeay no-
asm no-mdc2 no-rc5 no-idea ^>ms\libeay32.def >> %buildme%
echo %perl% util\mkdef.pl 32 ssleay no-
asm no-mdc2 no-rc5 no-idea ^>ms\ssleay32.def >> %buildme%
echo nmake >> %buildme%
move /y %buildme% ".\%ApacheSrc%\srclib\openssl\" > NUL
pushd ".\%ApacheSrc%\srclib\openssl"
call %buildme%
popd
if NOT exist ".\%ApacheSrc%\!mod_ssl-stuff" md ".\%ApacheSrc%\!mod_ssl-stuff"
copy ".\%ApacheSrc%\srclib\openssl\out32dll\*.dll" ".\%ApacheSrc%\!mod_ssl-stuff\" > NUL
copy ".\%ApacheSrc%\srclib\openssl\out32dll\openssl.exe" ".\%ApacheSrc%\!mod_ssl-stuff\" > NUL
pushd ".\%ApacheSrc%\modules\ssl"
call nmake mod_ssl.mak
popd
copy ".\%ApacheSrc%\modules\ssl\Release\*.so" ".\%ApacheSrc%\!mod_ssl-stuff" > NUL
if NOT exist ".\mod_ssl-%ApacheName%" md ".\mod_ssl-%ApacheName%"
move /y ".\%ApacheSrc%\!mod_ssl-stuff\*.*" ".\mod_ssl-%ApacheName%\" > NUL
rd /s /q ".\%ApacheSrc%\!mod_ssl-stuff"
echo.
echo.
echo -----------------------------------------------------------------------------
echo Find the output files in ".\mod_ssl-%ApacheName%" if everything worked.
echo -----------------------------------------------------------------------------
echo.
goto endoffile
:syntax
cls
goto intsyntax
:notools
echo.
echo.
echo Could not find all required tools!
:intsyntax
rem ------------------------------------------------------------------------------
echo.
echo.
echo This script works as follows:
echo - It requires AWK, FLEX, BISON, SED and PERL to be set up correctly.
echo - It requires the path to development tools, libs and includes to be set.
echo - LN from [
url]http://www.chat.ru/~ashedel[/
url] and a NTFS volume
echo Given a path for the Apache source (1st parameter) and the OpenSSL source
echo (2nd parameter) - both the root ^[1^] to the source directories it will create
echo the build environment for OpenSSL and will finish with the mod_ssl module.
echo Apache itself is not being compiled.
echo.
echo ^[1^] Give the pathes without leading .\ - the sources should be direct
echo subfolders of the current directory!!! THIS IS IMPORTANT!
echo.
echo.
rem ------------------------------------------------------------------------------
:endoffile