logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> How-to's & Documentation & Tips View previous topic :: View next topic
Reply to topic   Topic: HOWTO: Building Apache and dependencies using CMake Page 1, 2  Next
Author
tangent
Moderator


Joined: 16 Aug 2020
Posts: 305
Location: UK

PostPosted: Fri 18 Dec '20 19:10    Post subject: HOWTO: Building Apache and dependencies using CMake Reply with quote

This is an update to the previous excellent work from idblew and others mentioned in post
https://www.apachelounge.com/viewtopic.php?t=6462


Note:
If you find any issues please report in the Building & Member Downloads forum (not in How-to's & Documentation & Tips NOR this topic)

Improvements or faults you can post here.

Change log :

18 Dec 2020 : 1.0 - Initial release.
19 Dec 2020 : 1.1 - Switch to Strawberry Perl. Remove LIBSSH2, YAJL and MOD_SECURITY.
05 Jan 2021 : 1.2 - Add LUA to src tree.
16 Feb 2021 : 1.3 - Patch CURL build support for OpenSSL. Update CURL , NGHTTP2 and OpenSSL versions.
27 Aug 2021 : 1.4 - Update CURL, EXPAT, HTTPD, LIBXML2. NGHTTP2, OpenSSL and PCRE versions.
22 Nov 2021 : 1.5 - Update CURL, HTTPD, JANSSON and NGHTTP2 versions.
28 Dec 2021 : 1.6 - Update HTTPD and OpenSSL versions.
14 Jan 2022 : 1.7 - Update EXPAT and CURL versions. Patch APR (1.7.0) handle leak (PR 61165).
19 Mar 2022 : 1.8 - Update CURL, EXPAT, HTTPD, LUA, NGHTTP2, OpenSSL and PCRE versions.
13 Jun 2022 : 1.9 - Update CURL, EXPAT, HTTPD, LIBXML2, OpenSSL, PCRE2 and ZLIB versions.
10 Nov 2022 : 2.0 - Update CURL, EXPAT, LIBXML2, OpenSSL, and ZLIB versions. Default to OpenSSL V3. Set CURL default SSL backend to Schannel rather than OpenSSL.
05 Feb 2023 : 2.1 - Update APR, APR-UTIL, CURL, HTTPD, NGHTTP2, and PCRE2 versions.
08 Mar 2023 : 2.2 - Update CURL, HTTPD, NGHTTP2, and OpenSSL versions.
12 May 2023 : 2.3 - Update APR, CURL, HTTPD, LIBXML2, and OpenSSL versions.
10 Aug 2023 : 2.4 - Update CURL, LIBXML2, LUA, NGHTTP2, and OpenSSL versions.
20 Oct 2023 : 2.5 - Update BROTLI, CURL, HTTPD, NGHTTP2, and OpenSSL versions.
04 Feb 2024 : 2.6 - Patch HTTPD ApacheMonitor.rc file to comment out MANIFEST file reference, which otherwise causes a duplicate resource cvtres/link error following recent updates to VS2022. Update CURL, LIBXML2, NGHTTP2, OpenSSL and ZLIB versions.

The following topics gives some additional backgound on the choices made for building CURL
https://www.apachelounge.com/viewtopic.php?p=39886
https://www.apachelounge.com/viewtopic.php?p=41513


In this variant I have chosen a command line solution, developing a batch file (post below) to build the required packages from source.
I've not used GitHub to directly download sources, since I wanted a solution that would build without an active Internet connection.

If appropriate, the following can be hosted in a virtual machine derived from an image at https://developer.microsoft.com/en-us/windows/downloads/virtual-machines, into which you can directly configure or install the necessary toolsets, viz:
    Visual Studio Community 2022
    Visual Studio Build Tools 2022
    CMake for Windows - (bundled with Visual Studio)
    Strawberry Perl 64-bit
    Netwide Assembler (NASM)
Several members have requested details on building ZLIB, LUA, APR-ICONV, etc., and these are covered in the process below using CMake where possible, and NMake.

Sequence
  1. Preparation
    Prepare the following structure with source folders based on the appropriate version of each package you choose to build. This list matches the latest package versions at the time of writing.

    You can of course change the folder path names in the source tree (no whitespace advised), updating the paths in the build batch file accordingly.

    Code:
    C:\Development
       └ Apache24
          ├ src
          │   ├ apr-1.7.4
          │   ├ apr-iconv-1.2.2
          │   ├ apr-util-1.6.3
          │   ├ brotli-1.1,0
          │   ├ curl-8.6.0
          │   ├ expat-2.5.0
          │   ├ httpd-2.4.58
          │   ├ jansson-2.14
          │   ├ libxml2-2.12.5
          │   ├ lua-5.4.6
          │   ├ mod_fcgid-2.3.9
          │   ├ nghttp2-1.59.0
          │   ├ openssl-3.1.5
          │   ├ pcre2-10.42
          │   └ zlib-1.3.1
          │
          └ build

    Note you don't need to prepare sub-folders below 'build', which get created during build process.

  2. Source Packages
    Download and extract the required packages (*.tar.gz or *.zip format) into the appropriate source folders shown above. I use 7-Zip to extract the package files from source archives.

    Note, the build batch file does patch source files where necessary (using Perl), but you may well wish to apply later security patches and updates manually to the source structures as appropriate.

  3. Build Batch File
    Download the build batch file code from the post below in this thread, and save it in the above 'build' folder as build_all.bat

    a) Edit the build batch file to set BUILD_BASE as required, if using a different path to that above.
    b) Update the target PREFIX, if the default location of C:\Apache24 isn't acceptable (again no whitespace advised).
    c) Choose 32 or 64 bit builds by setting the PLATFORM variable in the build batch file to x86 or x64 as required.
    d) Similarly, set the variable BUILD_TYPE to Release or Debug.
    e) Update the path to the vcvarsall.bat file if need be to match your Visual Studio toolset.
    f) Edit the package version details to match your downloads as appropriate.
    g) Choose options to build PCRE2 (default) vs PCRE, and equally OpenSSL3 (default) vs OpenSSL.
    h) Set the CURL_USE_OPENSSL variable to OFF if you don't want to build CURL with OpenSSL support.
    i) Comment out the CURL_DEFAULT_SSL_BACKEND variable if you want the default CURL backend to be OpenSSL.

  4. Additional Notes
    a) The build process doesn't clear source folders in case they've been patched. However, the package folder below 'build' is deleted each time.
    b) Package EXPAT is now required when building APR-UTIL
    c) Building APR-ICONV will rebuild APR using NMake, the output of which goes into the APR source folder rather than the build folder.
    d) CMakeLists.txt for LUA 5.4 is an extra file which can be downloaded from https://apaste.info/5LSB (for LUA 5.3 CMakeLists.txt can be downloaded from https://apaste.info/yOSR).
    e) HTTPD 2.4.48 onwards builds with LUA 5.4, with no need to patch the mod_lua source module.
    f) You may choose to build further packages to provide additional functionality in CURL and NGHTTP2, e.g. packages LIBSSH2, LIBEV, LIBEVENT, C-ARES, CUNIT, JEMALLOC, PYTHON, etc. These are beyond the scope of this HOWTO but can be added using similar build logic.
    g) It may be necessary to turn off real time AV scanning to prevent file lock failures during the build process.
    h) The various Perl inline patch edit sections may look daunting but note there are numerous ^ escape characters in there to cope with the vagaries of batch file continuation lines, embedded double quotes, and right parentheses in "if then else" blocks.

  5. Build
    Open a command or Powershell window, change to the above build folder, and run the build_all.bat batch file. Ideally, redirect the build process output to a log file so you can check for errors. If using Powershell, you can use the tee command, viz:

    Code:
    C:\Development\Apache24\build> .\build_all.bat 2>&1 | tee build_all.log

  6. Checks
    When finished search the log file output for fatal errors (hopefully none).

    Confirm Apache files have been created below PREFIX and run as expected, viz:

    Code:
    cd /d C:\Apache24\bin
    .\openssl version
    .\httpd -V
    .\httpd

    I hope people find this updated HOWTO useful.


Last edited by tangent on Sun 04 Feb '24 21:26; edited 23 times in total
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 305
Location: UK

PostPosted: Fri 18 Dec '20 19:11    Post subject: Reply with quote

Change log:

18 Dec 2020 : 1.0 - Initial release.
19 Dec 2020 : 1.1 - Switch CURL to SCHANNEL for mod_md. Remove LIBSSH2, YAJL and MOD_SECURITY. Add LUA_COMPAT_ALL compile option to LUA.
03 Jan 2021 : 1.2 - Move CURL build after NGHTTP2 and update options to include HTTP2, BROTLI and UNICODE.
16 Feb 2021 : 1.3 - Patch CURL build support for OpenSSL to force use of native CA store on Windows. Request CURL builds with LDAPS support (Schannel based).
27 Aug 2021 : 1.4 - Update CURL , EXPAT, HTTPD, LIBXML2. NGHTTP2, OpenSSL and PCRE versions.
22 Nov 2021 : 1.5 - Update CURL, HTTPD, JANSSON and NGHTTP2 versions.
28 Dec 2021 : 1.6 - Update HTTPD and OpenSSL versions.
14 Jan 2022 : 1.7 - Update EXPAT and CURL versions. Patch APR (1.7.0) handle leak (PR 61165).
19 Mar 2022 : 1.8 - Update CURL, EXPAT, HTTPD, LUA, NGHTTP2, OpenSSL and PCRE versions. Provide options to build PCRE2 rather than PCRE, and similarly build OpenSSL3 rather than OpenSSL.
13 Jun 2022 : 1.9 - Update CURL, EXPAT, HTTPD, LIBXML2, OpenSSL, PCRE2 and ZLIB versions.
10 Nov 2022 : 2.0 - Update CURL, EXPAT, LIBXML2, OpenSSL, and ZLIB versions. Default to OpenSSL V3. Set CURL default SSL backend to Schannel rather than OpenSSL.
05 Feb 2023 : 2.1 - Update APR, APR-UTIL, CURL, HTTPD, NGHTTP2, and PCRE2 versions.
08 Mar 2023 : 2.2 - Update CURL, HTTPD, NGHTTP2, and OpenSSL versions.
12 May 2023 : 2.3 - Update APR, CURL, HTTPD, LIBXML2, and OpenSSL versions.
10 Aug 2023 : 2.4 - Update CURL, LIBXML2, LUA, NGHTTP2, and OpenSSL versions.
20 Oct 2023 : 2.5 - Update BROTLI, CURL, HTTPD, NGHTTP2, and OpenSSL versions.
04 Feb 2024 : 2.6 - Patch HTTPD ApacheMonitor.rc file to comment out MANIFEST file reference, which otherwise causes a duplicate resource cvtres/link error following recent updates to VS2022. Update CURL, LIBXML2, NGHTTP2, OpenSSL and ZLIB versions.


Code:
@echo off

rem @(#)build_all.bat 2.6 - 2024-02-04 tangent
rem
rem 1.0 - Initial release. 2020-12-17
rem 1.1 - Switch CURL to Schannel (WinSSL) rather than OpenSSL, for mod_md.
rem       Accordingly, remove LIBSSH2. Remove YAJL and MOD_SECURITY since not core
rem       ASF/Apache modules. Add LUA_COMPAT_ALL compile option to LUA. 2020-12-18
rem 1.2 - Move CURL build after NGHTTP2 and update options to include HTTP2, BROTLI and UNICODE. 2021-01-03
rem 1.3 - Use OpenSSL (conditionally) with CURL and patch to force use of native CA store on Windows.
rem       Request CURL builds with LDAPS support (Schannel based). 2021-02-16
rem 1.4 - Remove extraneous CMake INSTALL_MSVC_PDB option entries.
rem       Bump releases: PCRE (8.45), EXPAT (2.4.1), OPENSSL (1.1.1l), LIBXML2 (2.9.12),
rem       LUA (5.4.3), NGHTTP2 (1.44.0), CURL (7.78.0), HTTPD (2.4.48). 2021-08-27
rem 1.5 - Bump releases: JANSSON (2.14), NGHTTP2 (1.46.0), CURL (7.80.0), HTTPD (2.4.51). 2021-11-22
rem 1.6 - Bump releases: HTTPD (2.4.52), OpenSSL (1.1.1m). 2021-12-28
rem 1.7 - Bump EXPAT (2.4.2), CURL (7.81.0). Change LUA option LUA_COMPAT_ALL to LUA_COMPAT_5_3.
rem       Patch APR (1.7.0) handle leak (PR 61165 [Ivan Zhakov]). Refine Perl patch edits.
rem       Update VCVARSALL script path for MS Visual Studio 2022 (VS17). 2022-01-14
rem 1.8 - Bump CURL (7.82.0), EXPAT (2.4.7), HTTPD (2.4.53), LUA (5.4.4), NGHTTP2 (1.47.0),
rem       OPENSSL (1.1.1n/3.0.2), PCRE2 (10.39). Provide options to build PCRE2 rather than PCRE,
rem       and similarly build OpenSSL3 rather than OpenSSL. 2022-03-17
rem 1.9 - Bump CURL (7.83.1), EXPAT (2.4.8), HTTPD (2.4.54), LIBXML2 (2.9.14), OPENSSL (1.1.1o/3.0.3),
rem       PCRE2 (10.40), ZLIB (1.2.12). 2022-06-13
rem 2.0 - Bump CURL (7.86.0), EXPAT (2.5.0), LIBXML2 (2.10.3), OPENSSL (1.1.1s/3.0.7), ZLIB (1.2.13).
rem       Add option to set CURL default SSL backend to Schannel rather than OpenSSL. 2022-11-10
rem 2.1 - Bump APR (1.7.2), APR-UTIL (1.6.3), CURL (7.87.0), HTTPD (2.4.55), NGHTTP2 (1.51.0),
rem       PCRE2 (10.42). 2023-02-05
rem 2.2 - Bump CURL (7.88.1), HTTPD (2.4.56), NGHTTP2 (1.52.0), OPENSSL (1.1.1t/3.0.8). 2023-03-08
rem 2.3 - Bump APR (1.7.4), CURL (8.0.1), HTTPD (2.4.57), LIBXML2 (2.11.2), OPENSSL (1.1.1t/3.1.0). 2023-05-12
rem 2.4 - Bump CURL (8.2.1), LIBXML2 (2.11.5), LUA (5.4.6), NGHTTP2 (1.55.1), OPENSSL (1.1.1v/3.1.2). 2023-08-10
rem 2.5 - Bump BROTLI (1.1.0), CURL (8.4.0), HTTPD (2.4.58), NGHTTP2 (1.57.0), OPENSSL (1.1.1w/3.1.3). 2023-10-20
rem 2.6 - Patch HTTPD ApacheMonitor.rc file to comment out MANIFEST file reference, which otherwise
rem       causes a duplicate resource cvtres/link error following recent updates to VS2022.
rem       Bump CURL (8.6.0), LIBXML2 (2.12.5), NGHTTP2 (1.59.0), OPENSSL (3.1.5), ZLIB (1.3.1). 2024-02-04

rem Apache build command file for Windows.
rem
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION

rem Set required build base folder and target prefix.
rem
set BUILD_BASE=C:\Development\Apache24\build
set PREFIX=C:\Apache24

rem Set required build platform to x86 or x64.
rem
rem set PLATFORM=x86
set PLATFORM=x64

rem Set required build type to Release or Debug.
rem
rem set BUILD_TYPE=Debug
set BUILD_TYPE=Release

rem Specify if PCRE2 build is required, TRUE or FALSE.
rem
set BUILD_PCRE2=TRUE

rem Specify if OPENSSL3 build is required, TRUE or FALSE.
rem
set BUILD_OPENSSL3=TRUE

rem Request PDB files - ON or OFF.
rem
set INSTALL_PDB=OFF

rem Define build packages with their version. This is also the recommended build order.

set ZLIB=zlib-1.3.1
if /i "%BUILD_PCRE2%" == "TRUE" (
  set PCRE=pcre2-10.42
) else (
  set PCRE=pcre-8.45
)
set EXPAT=expat-2.5.0
if /i "%BUILD_OPENSSL3%" == "TRUE" (
  set OPENSSL=openssl-3.1.5
) else (
  set OPENSSL=openssl-1.1.1w
)
set LIBXML2=libxml2-2.12.5
set JANSSON=jansson-2.14
set BROTLI=brotli-1.1.0
set LUA=lua-5.4.6
set APR=apr-1.7.4
set APR-ICONV=apr-iconv-1.2.2
set APR-UTIL=apr-util-1.6.3
set NGHTTP2=nghttp2-1.59.0
set CURL=curl-8.6.0
set HTTPD=httpd-2.4.58
set MOD_FCGID=mod_fcgid-2.3.9

rem Use OpenSSL with CURL - ON or OFF.
rem
set CURL_USE_OPENSSL=ON
rem
rem Specify CURL default SSL backend. Defaults to OpenSSL if not specified.
rem NB - you can change the SSL backend at run time with environment variable CURL_SSL_BACKEND.
rem
set CURL_DEFAULT_SSL_BACKEND=SCHANNEL

rem ------------------------------------------------------------------------------
rem
rem Define path to MS Visual Studio build environment script.

set VCVARSALL=C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat

if exist "%VCVARSALL%" (
  call "%VCVARSALL%" %PLATFORM%
) else (
  echo Could not find "%VCVARSALL%"
  exit /b
)

rem ------------------------------------------------------------------------------
rem
rem ZLIB

rem Check for package and switch to source folder.
rem
call :check_package_source %ZLIB%

if !STATUS! == 0 (
  set ZLIB_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DBUILD_SHARED_LIBS=ON -DINSTALL_PKGCONFIG_DIR=%PREFIX%/lib/pkgconfig
  call :build_package %ZLIB% "!ZLIB_CMAKE_OPTS!" & if not !STATUS! == 0 exit /b !STATUS!
)

rem ------------------------------------------------------------------------------
rem
rem PCRE

rem Check for package and switch to source folder.
rem
call :check_package_source %PCRE%

if !STATUS! == 0 (
  rem Patch CMakeLists.txt to change man page install path, and that of cmake config files.
  rem
  perl -pi.bak -e ^" ^
    s~(^.+DESTINATION ^)(man^)~${1}share/${2}~; ^
    s~(^install.+DESTINATION ^)(cmake^)~${1}lib/${2}/pcre2-\x24\x7BPCRE2_MAJOR\x7D.\x24\x7BPCRE2_MINOR\x7D~; ^
    ^" CMakeLists.txt

  set PCRE_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DBUILD_SHARED_LIBS=ON -DPCRE_BUILD_TESTS=OFF -DPCRE_BUILD_PCRECPP=OFF -DPCRE_BUILD_PCREGREP=OFF -DPCRE_SUPPORT_PCREGREP_JIT=OFF -DPCRE_SUPPORT_UTF=ON -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON -DPCRE_NEWLINE=CRLF -DINSTALL_MSVC_PDB=%INSTALL_PDB%
  call :build_package %PCRE% "!PCRE_CMAKE_OPTS!" & if not !STATUS! == 0 exit /b !STATUS!
)

rem ------------------------------------------------------------------------------
rem
rem EXPAT

rem Check for package source folder.
rem
call :check_package_source %EXPAT%

if !STATUS! == 0 (
  set EXPAT_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
  call :build_package %EXPAT% "!EXPAT_CMAKE_OPTS!" & if not !STATUS! == 0 exit /b !STATUS!
)

rem ------------------------------------------------------------------------------
rem
rem OPENSSL

rem Check for package and switch to source folder.
rem
call :check_package_source %OPENSSL%

if !STATUS! == 0 (
  echo. & echo Building %OPENSSL%

  if /i "%PLATFORM%" == "x64" (
    set OS_COMPILER=VC-WIN64A
  ) else (
    set OS_COMPILER=VC-WIN32
  )

  set OPENSSL_CONFIGURE_OPTS=--prefix=%PREFIX% --libdir=lib --openssldir=%PREFIX%\conf --with-zlib-include=%PREFIX%\include shared zlib-dynamic enable-camellia no-idea no-mdc2

  perl Configure !OS_COMPILER! !OPENSSL_CONFIGURE_OPTS! & call :get_status
  if !STATUS! == 0 (
    if exist makefile (
      if /i "%INSTALL_PDB%"=="OFF" (
        perl -pi.bak -e ^" ^
          s~^(INSTALL_.*PDBS=^).*~${1}nul~; ^
          ^" makefile
      )
      rem Make clean not distclean, else Makefile gets deleted.
      rem
      nmake clean 2>nul
      nmake & call :get_status
      if !STATUS! == 0 (
        nmake install & call :get_status
        if not !STATUS! == 0 (
          echo nmake install for %OPENSSL% failed with status !STATUS!
          exit /b !STATUS!
        )
      ) else (
        echo nmake for %OPENSSL% failed with status !STATUS!
        exit /b !STATUS!
      )
    ) else (
      echo Cannot find Makefile for %OPENSSL% in !SRC_DIR!
      exit /b !STATUS!
    )
  ) else (
    echo perl configure for %OPENSSL% failed with status !STATUS!
    exit /b !STATUS!
  )
)

rem ------------------------------------------------------------------------------
rem
rem LIBXML2

rem Check for package and switch to source folder.
rem
call :check_package_source %LIBXML2%

if !STATUS! == 0 (
  echo. & echo Building %LIBXML2%

  rem Build from Makefile.msvc in win32 sub-folder.
  rem
  cd /d win32

  set LIBXML2_CONFIGURE_OPTS=compiler=msvc prefix=%PREFIX% include=%PREFIX%\include lib=%PREFIX%\lib iconv=no python=no zlib=yes

  nmake /f Makefile.msvc distclean 2>nul
  cscript configure.js !LIBXML2_CONFIGURE_OPTS! & call :get_status
  if !STATUS! == 0 (
    nmake /f Makefile.msvc & call :get_status
    if !STATUS! == 0 (
      nmake /f Makefile.msvc install-dist & call :get_status
      if not !STATUS! == 0 (
        echo nmake install-dist for %LIBXML2% failed with status !STATUS!
        exit /b !STATUS!
      )
    ) else (
      echo nmake for %LIBXML2% failed with status !STATUS!
      exit /b !STATUS!
    )
  ) else (
    echo cscript configure for %LIBXML2% failed with status !STATUS!
    exit /b !STATUS!
  )
)

rem ------------------------------------------------------------------------------
rem
rem JANSSON

rem Check for package and switch to source folder.
rem
call :check_package_source %JANSSON%

if !STATUS! == 0 (
  set JANSSON_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DJANSSON_BUILD_SHARED_LIBS=ON -DJANSSON_BUILD_DOCS=OFF -DJANSSON_INSTALL_CMAKE_DIR=lib/cmake/jansson
  call :build_package %JANSSON% "!JANSSON_CMAKE_OPTS!" & if not !STATUS! == 0 exit /b !STATUS!
)

rem ------------------------------------------------------------------------------
rem
rem BROTLI

rem Check for package and switch to source folder.
rem
call :check_package_source %BROTLI%

if !STATUS! == 0 (
  set BROTLI_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
  call :build_package %BROTLI% "!BROTLI_CMAKE_OPTS!" & if not !STATUS! == 0 exit /b !STATUS!
)

rem ------------------------------------------------------------------------------
rem
rem LUA

rem Check for package and switch to source folder.
rem
call :check_package_source %LUA%

if !STATUS! == 0 (
  rem Patch CMakeLists.txt to add LUA_COMPAT_5_3 to compile options.
  rem
  perl -pi.bak -e ^" ^
    s~( LUA_BUILD_AS_DLL ^)(^\^)^)~${1}LUA_COMPAT_5_3 ${2}~; ^
    ^" CMakeLists.txt

  set LUA_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
  call :build_package %LUA% "!LUA_CMAKE_OPTS!" & if not !STATUS! == 0 exit /b !STATUS!
)

rem ------------------------------------------------------------------------------
rem
rem APR

rem Check for package and switch to source folder.
rem
call :check_package_source %APR%

if !STATUS! == 0 (
  rem Patch apr.hw - _WIN32_WINT to 0x600 series
  perl -pi.bak -e ^" ^
    s~(#define _WIN32_WINNT ^)0x05\d\d$~${1}0x0600~; ^
    ^" include\apr.hw

  set APR_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DMIN_WINDOWS_VER=0x0600 -DAPR_HAVE_IPV6=ON -DAPR_INSTALL_PRIVATE_H=ON -DAPR_BUILD_TESTAPR=OFF -DINSTALL_PDB=%INSTALL_PDB%
  call :build_package %APR% "!APR_CMAKE_OPTS!" & if not !STATUS! == 0 exit /b !STATUS!
)

rem ------------------------------------------------------------------------------
rem
rem APR-ICONV

rem Note APR-ICONV makefiles rebuild APR since the above CMake puts the build files elsewhere.

rem Check for package and switch to source folder.
rem
call :check_package_source %APR-ICONV%

if !STATUS! == 0 (
  echo. & echo Building %APR-ICONV%

  rem Create non-version specific folder links to the APR, APR-ICONV and APR-UTIL sources.
  rem The various makefiles assume these exist.
  rem
  pushd "%BUILD_BASE%\..\src"
  mklink /d apr %APR% 1>nul 2>&1
  mklink /d apr-iconv %APR-ICONV% 1>nul 2>&1
  mklink /d apr-util %APR-UTIL% 1>nul 2>&1
  popd

  rem Copy apr.h and apr_escape_test_char.h from APR build into API source.
  rem
  copy "%BUILD_BASE%\apr\apr*.h" ".\include" 1>nul
  copy "%BUILD_BASE%\apr\apr_escape_test_char.h" "..\%APR%\include" 1>nul

  rem Choose platform options; reference as delayed expansion variables.
  rem
  if /i "%PLATFORM%" == "x64" (
    set BUILD_CFG=x64
    set BUILD_DIR=x64
  ) else (
    set BUILD_CFG=Win32
    set BUILD_DIR=.
  )

  rem Patch modules.mk.win for x64 Debug
  rem
  perl -pi.bak -e ^" ^
    m~(APR_SOURCE\^)\\^)(.+\\^)(Debug\\libapr-1^)~;{${2} ? $s=${2} : $s=$s}; ^
    s~(API_SOURCE\^)\\^)(Debug\\libapriconv-1^)~{$s ? ${1}.$s.${2} : $^&}~e; ^
    s~(CFG_OUTPUT  = ^)(Debug\\iconv^)~{$s ? ${1}.$s.${2} : $^&}~e; ^
    ^" build\modules.mk.win

  rmdir /s /q Debug LibD LibR Release x64 1>nul 2>&1
  nmake /f apriconv.mak CFG="apriconv - !BUILD_CFG! %BUILD_TYPE%" & call :get_status
  if not !STATUS! == 0 (
    echo nmake apriconv.mak for %APR-ICONV% failed with status !STATUS!
    exit /b !STATUS!
  )
  nmake /f libapriconv.mak CFG="libapriconv - !BUILD_CFG! %BUILD_TYPE%" & call :get_status
  if not !STATUS! == 0 (
    echo nmake libapriconv.mak for %APR-ICONV% failed with status !STATUS!
    exit /b !STATUS!
  )
  pushd ccs
  nmake /f Makefile.win BUILD_MODE="!BUILD_CFG! %BUILD_TYPE%" BIND_MODE="shared" & call :get_status
  if not !STATUS! == 0 (
    echo nmake ccs Makefile.win for %APR-ICONV% failed with status !STATUS!
    exit /b !STATUS!
  )
  popd
  pushd ces
  nmake /f Makefile.win BUILD_MODE="!BUILD_CFG! %BUILD_TYPE%" BIND_MODE="shared" & call :get_status
  if not !STATUS! == 0 (
    echo nmake ces Makefile.win for %APR-ICONV% failed with status !STATUS!
    exit /b !STATUS!
  )
  popd

  rem Manual install required with apr-iconv
  rem
  if exist "!BUILD_DIR!\LibD\apriconv-1.lib" (
    echo -- Installing: "%PREFIX%\lib\apriconv-1.lib"
    copy /b /y "!BUILD_DIR!\LibD\apriconv-1.lib" "%PREFIX%\lib" 1>nul 2>&1
  )
  if exist "!BUILD_DIR!\LibR\apriconv-1.lib" (
    echo -- Installing: "%PREFIX%\lib\apriconv-1.lib"
    copy /b /y "!BUILD_DIR!\LibR\apriconv-1.lib" "%PREFIX%\lib" 1>nul 2>&1
  )
  if exist "!BUILD_DIR!\%BUILD_TYPE%\libapriconv-1.lib" (
    echo -- Installing: "%PREFIX%\lib\libapriconv-1.lib"
    copy /b /y "!BUILD_DIR!\%BUILD_TYPE%\libapriconv-1.lib" "%PREFIX%\lib" 1>nul 2>&1
  )
  if exist "!BUILD_DIR!\%BUILD_TYPE%\libapriconv-1.dll" (
    echo -- Installing: "%PREFIX%\bin\libapriconv-1.dll"
    copy /b /y "!BUILD_DIR!\%BUILD_TYPE%\libapriconv-1.dll" "%PREFIX%\bin" 1>nul 2>&1
  )
  if exist "include\api_version.h" (
    echo -- Installing: "%PREFIX%\include\api_version.h"
    copy /b /y "include\api_version.h" "%PREFIX%\include" 1>nul 2>&1
  )
  if exist "include\apr_iconv.h" (
    echo -- Installing: "%PREFIX%\include\apr_iconv.h"
    copy /b /y "include\apr_iconv.h" "%PREFIX%\include" 1>nul 2>&1
  )
  if exist "!BUILD_DIR!\%BUILD_TYPE%\iconv" (
    echo -- Installing: "%PREFIX%\bin\iconv"
    xcopy "!BUILD_DIR!\%BUILD_TYPE%\iconv\*.so" "%PREFIX%\bin\iconv\" /c /d /i /y 1>nul 2>&1
  )
)

rem ------------------------------------------------------------------------------
rem
rem APR-UTIL

rem Check for package and switch to source folder.
rem
call :check_package_source %APR-UTIL%

if !STATUS! == 0 (
  rem Patch CMakelists.txt to support APR-ICONV if we've built it.
  rem
  if exist "%PREFIX%\lib\libapriconv-1.lib" (
    perl -pi.bak -e ^" ^
      s~^(SET.+APR_LIBRARIES[\s]+^)(\x22^)(.+libapr^)(-1.lib^)(.+ CACHE^)~${1}${2}${3}${4}${2} ${2}${3}iconv${4}${5}~; ^
      s~^(apu_have_apr_iconv_10^) 0~${1} 1~; ^
      ^" CMakeLists.txt
  )

  set APR-UTIL_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DOPENSSL_ROOT_DIR=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DAPU_HAVE_CRYPTO=ON -DAPR_BUILD_TESTAPR=OFF -DINSTALL_PDB=%INSTALL_PDB%
  call :build_package %APR-UTIL% "!APR-UTIL_CMAKE_OPTS!" & if not !STATUS! == 0 exit /b !STATUS!
)

rem ------------------------------------------------------------------------------
rem
rem NGHTTP2

rem Check for package and switch to source folder.
rem
call :check_package_source %NGHTTP2%

if !STATUS! == 0 (
  set NGHTTP2_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DSTATIC_LIB_SUFFIX=_static -DENABLE_LIB_ONLY=ON
  call :build_package %NGHTTP2% "!NGHTTP2_CMAKE_OPTS!" & if not !STATUS! == 0 exit /b !STATUS!
)

rem ------------------------------------------------------------------------------
rem
rem CURL - have to build twice to get both shared and static libs.

rem Check for package and switch to source folder.
rem
call :check_package_source %CURL%

if !STATUS! == 0 (
  if /i "%CURL_USE_OPENSSL%" == "ON" (
    rem Patch lib\url.c to force use of native CA store on Windows.
    rem
    perl -pi.bak -0777 -Mopen=OUT,:raw -e ^" ^
    s~(return result;\n#endif$^)\n  }~${1} \n#if defined(USE_WIN32_CRYPTO^)\n^
    /* Mandate Windows CA store to be used */\n^
    if(\x21set-\x3Essl.primary.CAfile \x26\x26 \x21set-\x3Essl.primary.CApath^) {\n^
      /* User and environment did not specify any CA file or path.\n^
       */\n^
      set-\x3Essl.native_ca_store = TRUE;\n^
    }\n#endif\n  }~smg; ^
    ^" lib\url.c
  ) else (
    rem Remove above lib\url.c patch if present.
    rem
    perl -pi.bak -0777 -Mopen=OUT,:raw -e ^" ^
    s~(return result;\n#endif^) \n.+native_ca_store = TRUE;\n    }\n#endif\n~${1}\n~smg; ^
    ^" lib\url.c
  )

  if /i "%CURL_USE_OPENSSL%" == "ON" if /i "%CURL_DEFAULT_SSL_BACKEND%" == "SCHANNEL" (
    rem Patch CMakeLists.txt to add a compiler definition for a default SSL backend of Schannel.
    rem
    perl -pi.bak -e ^" ^
      s~(USE_OPENSSL ON\^)^)\n~${1} \n  add_definitions(-DCURL_DEFAULT_SSL_BACKEND=\x22schannel\x22^)\n~m; ^
      ^" CMakeLists.txt
  ) else (
    rem Remove above CMakeLists.txt patch if present.
    rem
    perl -pi.bak -e ^" ^
      s~(USE_OPENSSL ON\^)^) \n~${1}\n~m; ^
      s~[ ]+add_definitions.+CURL_DEFAULT_SSL_BACKEND=.*\n~~m; ^
      ^" CMakeLists.txt
  )

  set CURL_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCURL_USE_OPENSSL=%CURL_USE_OPENSSL% -DCURL_USE_SCHANNEL=ON -DCURL_WINDOWS_SSPI=ON -DCURL_BROTLI=ON -DUSE_NGHTTP2=ON -DHAVE_LDAP_SSL=ON -DENABLE_UNICODE=ON -DCURL_STATIC_CRT=OFF -DUSE_WIN32_CRYPTO=ON

  call :build_package %CURL% "!CURL_CMAKE_OPTS! -DBUILD_SHARED_LIBS=ON" & if not !STATUS! == 0 exit /b !STATUS!
  call :build_package %CURL% "!CURL_CMAKE_OPTS! -DBUILD_SHARED_LIBS=OFF" & if not !STATUS! == 0 exit /b !STATUS!
)

rem ------------------------------------------------------------------------------
rem
rem HTTPD

rem Check for package and switch to source folder.
rem
call :check_package_source %HTTPD%

if !STATUS! == 0 (
  rem Patch CMakeLists.txt to build ApacheMonitor.
  rem
  perl -pi.bak -e ^" ^
    s~(^^# ^)(.+ApacheMonitor.+^)~${2}~; ^
    ^" CMakeLists.txt

  rem Patch ApacheMonitor.rc to comment out MANIFEST file reference.
  rem
  perl -pi.bak -e ^" ^
    s~(^^CREATEPROCESS_MANIFEST^)~// ${1}~; ^
    ^" support\win32\ApacheMonitor.rc

  set HTTPD_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DENABLE_MODULES=i -DINSTALL_PDB=%INSTALL_PDB% -DCURL_INCLUDE_DIR=%PREFIX%/include/curl -DCURL_LIBRARIES=%PREFIX%/lib/libcurl_imp.lib;%PREFIX%/lib/libcurl.lib
  call :build_package %HTTPD% "!HTTPD_CMAKE_OPTS!" & if not !STATUS! == 0 exit /b !STATUS!

  rem Install additional support scripts.
  rem
  perl -pe ^" ^
    s~#.+perlbin.+\n~~m; ^
    ^" !src_dir!\support\dbmmanage.in > %PREFIX%\bin\dbmmanage.pl

  copy !src_dir!\docs\cgi-examples\printenv %PREFIX%\cgi-bin\printenv.pl 1>nul 2>&1
)

rem ------------------------------------------------------------------------------
rem
rem MOD_FCGID

rem Check for package and switch to source folder.
rem
call :check_package_source %MOD_FCGID%

if !STATUS! == 0 (
  rem Package provides both NMake makefile and experimental CMake. We use the latter.

  set MOD_FCGID_CMAKE_OPTS=-DCMAKE_INSTALL_PREFIX=%PREFIX% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DINSTALL_PDB=NO
  call :build_package %MOD_FCGID% "!MOD_FCGID_CMAKE_OPTS!" modules\fcgid & if not !STATUS! == 0 exit /b !STATUS!
)
exit /b !STATUS!

rem ------------------------------------------------------------------------------
rem
rem Get current errorlevel value and assign it to the status variable.

:get_status
call doskey /exename=err err=%%errorlevel%%
for /f "usebackq tokens=2 delims== " %%i in (`doskey /m:err`) do (set STATUS=%%i)
exit /b !STATUS!

rem ------------------------------------------------------------------------------
rem
rem Get package and version from release variable passed as first parameter.

:get_package_details
set RELEASE=%~1
for /f "delims=-" %%i in ('echo(%RELEASE:-=^&echo(%') do call set "PACKAGE=%%RELEASE:-%%i=%%"
for %%i in (%RELEASE:-= %) do set VERSION=%%i
exit /b

rem ------------------------------------------------------------------------------
rem
rem Check package source folder exists, from release variable passed as first parameter.
rem
:check_package_source

set SRC_DIR=%BUILD_BASE%\..\src\%~1
if not exist "!SRC_DIR!" (
  echo Warning for package %~1
  echo Could not find package source folder "!SRC_DIR!"
  set STATUS=1
) else (
  cd /d "!SRC_DIR!"
  set STATUS=0
)
exit /b !STATUS!

rem ------------------------------------------------------------------------------
rem
rem Build subroutine.
rem Parameter one is the package release variable.
rem Parameter two is any required CMake options.
rem Parameter three (optional) is any package sub-folder to the CMakeLists.txt file.

:build_package

call :get_package_details %~1

rem Check source folder exists, else exit (non-fatal).

call :check_package_source %~1
if not !STATUS! == 0 (
  exit /b
) else (
  if not "%~3" == "" (
    set SRC_DIR=!SRC_DIR!\%~3
  )
)

rem Clean up any previous build.

if exist "%BUILD_BASE%\!PACKAGE!" rmdir /s /q "%BUILD_BASE%\!PACKAGE!" 1>nul 2>&1
mkdir "%BUILD_BASE%\!PACKAGE!" 1>nul 2>&1

rem Build, make and install.

if exist "%BUILD_BASE%\!PACKAGE!" (
  cd /d "%BUILD_BASE%\!PACKAGE!"
  echo. & echo Building %~1

  rem Patch CMakeLists.txt to remove debug suffix from libraries. Messes up other builds.
  rem Tried setting CMAKE_DEBUG_POSTFIX to an empty string on the CMake command line but
  rem this doesn't work with all packages, e.g. PCRE, EXPAT, etc.

  perl -pi -e ^" ^
    s~((DEBUG_POSTFIX^|POSTFIX_DEBUG^)\s+^)(\x22^)(.+^)(\x22^)~${1}${3}${5}~; ^
    ^" "!SRC_DIR!\CMakeLists.txt"

  rem Run CMake to create an NMake makefile, which we then process.

  cmake -G "NMake Makefiles" %~2 -S "!SRC_DIR!" -B . & call :get_status
  if !STATUS! == 0 (
    nmake & call :get_status
    if !STATUS! == 0 (
      nmake install & call :get_status
      if !STATUS! == 0 (
        exit /b !STATUS!
      ) else (
        echo nmake install for !PACKAGE! failed with exit status !STATUS!
        exit /b !STATUS!
      )
    ) else (
      echo nmake for !PACKAGE! failed with exit status !STATUS!
      exit /b !STATUS!
    )
  ) else (
    echo cmake for !PACKAGE! failed with exit status !STATUS!
    exit /b !STATUS!
  )
) else (
  echo Failed to make folder "%BUILD_BASE%\!PACKAGE!"
  exit /b 1
)
exit /b


Last edited by tangent on Sun 04 Feb '24 21:31; edited 14 times in total
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Tue 05 Jan '21 16:31    Post subject: Re: HOWTO: Building Apache and dependencies using CMake Reply with quote

tangent wrote:


Code:
C:\Development
   └ Apache24
      ├ src
      │   ├ apr-1.7.0
      │   ├ apr-iconv-1.2.2
      │   ├ apr-util-1.6.1
      │   ├ brotli-1.0.9
      │   ├ curl-7.74.0
      │   ├ expat-2.2.10
      │   ├ httpd-2.4.46
      │   ├ jansson-2.13.1
      │   ├ libxml2-2.9.10
      │   ├ mod_fcgid-2.3.9
      │   ├ nghttp2-1.42.0
      │   ├ openssl-1.1.1i
      │   ├ pcre-8.44
      │   └ zlib-1.2.11
      │
      └ build



Do you put lua in the src folder, too?
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 305
Location: UK

PostPosted: Tue 05 Jan '21 17:09    Post subject: Reply with quote

Apologies James; yes, you do. I've updated the source tree in the first post.

The batch file contains build code for LUA, but as mentioned the CMakeLists.txt file for LUA 5.3 is an extra from https://apaste.info/yOSR
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 305
Location: UK

PostPosted: Tue 16 Feb '21 21:04    Post subject: Reply with quote

Updated the above:

1) Patch CURL build support for OpenSSL to force use of native CA store on Windows.
2) Request CURL builds with LDAPS support (Schannel based).
3) Update build versions for CURL (7.75.0), NGHTTP2 (1.43.0) and OpenSSL (1.1.1j).
Back to top
nono303



Joined: 20 Dec 2016
Posts: 191
Location: Lille, FR, EU

PostPosted: Fri 26 Mar '21 18:18    Post subject: Reply with quote

Hi,
Quote:
e) If you require LUA 5.4 you will need to patch the mod_lua module source in httpd 2.4.46

Here is the working patch for lua 5.4 https://patch-diff.githubusercontent.com/raw/apache/httpd/pull/133.patch
Tested and validated on my side (see https://github.com/nono303/win-build-scripts/tree/1.1.4)
Back to top
admin
Site Admin


Joined: 15 Oct 2005
Posts: 677

PostPosted: Wed 23 Jun '21 12:01    Post subject: Reply with quote

Questions from @tanquang about expat and apr-iconv split to https://www.apachelounge.com/viewtopic.php?p=40257
Back to top
admin
Site Admin


Joined: 15 Oct 2005
Posts: 677

PostPosted: Wed 23 Jun '21 12:05    Post subject: Reply with quote

If you find any issues please report in the Building & Member Downloads forum (not in How-to's & Documentation & Tips NOR this topic)

Improvements or faults you can post here.
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 305
Location: UK

PostPosted: Fri 27 Aug '21 19:43    Post subject: Reply with quote

Bump code for release updates:
    CURL (7.78.0)
    EXPAT (2.4.1)
    HTTPD (2.4.48)
    LIBXML2 (2.9.12)
    LUA (5.4.3)
    NGHTTP2 (1.44.0)
    OPENSSL (1.1.1l)
    PCRE (8.45)
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 305
Location: UK

PostPosted: Mon 22 Nov '21 16:13    Post subject: Reply with quote

Bump code (somewhat belatedly) for package release updates:
    CURL (7.80.0)
    HTTPD (2.4.51)
    JANSSON (2.14)
    NGHTTP2 (1.46.0)
Note there are no changes to the batch file logic or patches for these later releases; just the version number references.
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Sat 25 Dec '21 10:52    Post subject: Reply with quote

In some of the previous instructions, they have instructions to remove section comment:
Code:
...
# getting duplicate manifest error with ApacheMonitor
# ADD_EXECUTABLE(ApacheMonitor support/win32/ApacheMonitor.c support/win32/ApacheMonitor.rc)
# SET(install_targets ${install_targets} ApacheMonitor)
# SET(install_bin_pdb ${install_bin_pdb} $<TARGET_PDB_FILE:ApacheMonitor>)
# SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES WIN32_EXECUTABLE TRUE)
# SET_TARGET_PROPERTIES(ApacheMonitor PROPERTIES COMPILE_FLAGS "-DAPP_FILE -DLONG_NAME=ApacheMonitor -DBIN_NAME=ApacheMonitor.exe ${EXTRA_COMPILE_FLAGS}")
# TARGET_LINK_LIBRARIES(ApacheMonitor ${EXTRA_LIBS} ${HTTPD_SYSTEM_LIBS} comctl32 wtsapi32)
...

In the CMakeLists.txt file of httpd. Now need to remove them before building anymore?
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 305
Location: UK

PostPosted: Tue 28 Dec '21 20:53    Post subject: Reply with quote

The CMakeLists.txt file in release HTTPD 2.4.52 still has ApacheMonitor as an optional build component, currently commented out.

See https://www.apachelounge.com/viewtopic.php?p=40789#40789
Back to top
tanquang



Joined: 21 Mar 2020
Posts: 58
Location: Vietnam

PostPosted: Wed 29 Dec '21 2:38    Post subject: Reply with quote

Yes, I still see it are commented.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3049
Location: Hilversum, NL, EU

PostPosted: Mon 03 Jan '22 13:39    Post subject: Reply with quote

nono303 wrote:
Hi,
Quote:
e) If you require LUA 5.4 you will need to patch the mod_lua module source in httpd 2.4.46

Here is the working patch for lua 5.4 https://patch-diff.githubusercontent.com/raw/apache/httpd/pull/133.patch
Tested and validated on my side (see https://github.com/nono303/win-build-scripts/tree/1.1.4)


Looks like the fix is in 2.4.52
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3049
Location: Hilversum, NL, EU

PostPosted: Mon 03 Jan '22 18:49    Post subject: Reply with quote

Above in LUA 5.4.3 is defined LUA_COMPAT_ALL , in the lua source I cannot find checking this flag. Mostly 5.4 is build with LUA_COMPAT_5_3 .

See https://www.lua.org/source/5.4/luaconf.h.html


Last edited by Steffen on Mon 03 Jan '22 18:59; edited 1 time in total
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3049
Location: Hilversum, NL, EU

PostPosted: Mon 03 Jan '22 18:56    Post subject: Reply with quote

Is ZLIB build with the asm from \zlib-1.2.11\contrib\masmx64 ?

Apache lounge builds zlib with:


bld_ml64.bat in contrib\masmx64 and copy inffas8664.c,
inffasx64.obj and gvmat64.obj in the top-level.

nmake -f win32\Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." OBJA="inffasx64.obj gvmat64.obj inffas8664.obj"
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 305
Location: UK

PostPosted: Sun 09 Jan '22 16:16    Post subject: Reply with quote

Sorry Steffen - I missed your posts over LUA and ZLIB.

Yes, I'd since noticed that LUA_COMPAT_ALL has gone from 5.4.3, so will edit the CMake build to pass LUA_COMPAT_5_3 instead.

The ZLIB build is currently the CMake default, so no, it's not using these additional assembler optimised functions. I'll look into adding these refinements in due course.

I've also been looking into adding the patch for the APR handle leak (PR 61165 [Ivan Zhakov]), which is done, plus bumping EXPAT to 2.4.2 and CURL to 7.81.0.

However, as released, CURL 7.81.0 has a problem when building support for OpenSSL alongside Schannel on Windows. Indeed, thanks to Jan-E who has already logged this issue with the CURL developers - https://github.com/curl/curl/pull/8240 and subsequent patch listed here https://github.com/curl/curl/pull/8246

I'll update the HowTo for these enhancements presently.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1248
Location: Amsterdam, NL, EU

PostPosted: Mon 10 Jan '22 2:51    Post subject: Reply with quote

tangent wrote:
However, as released, CURL 7.81.0 has a problem when building support for OpenSSL alongside Schannel on Windows. Indeed, thanks to Jan-E who has already logged this issue with the CURL developers - https://github.com/curl/curl/pull/8240 and subsequent patch listed here https://github.com/curl/curl/pull/8246
That only happened with OpenSSL 1.0.2, not with OpenSSL 1.1.1.
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 305
Location: UK

PostPosted: Mon 10 Jan '22 17:40    Post subject: Reply with quote

Hmm, for me the above CMake build of CURL 7.81.0 fails with OpenSSL 1.1.1m, when specifying both OpenSSL and Schannel (-DCURL_USE_OPENSSL=ON -DCURL_USE_SCHANNEL=ON), viz.
Code:
[ 63%] Building C object lib/CMakeFiles/libcurl.dir/vtls/mesalink.c.obj
mesalink.c
[ 63%] Building C object lib/CMakeFiles/libcurl.dir/vtls/nss.c.obj
nss.c
[ 63%] Building C object lib/CMakeFiles/libcurl.dir/vtls/openssl.c.obj
openssl.c
C:\Apache24\include\openssl/ocsp.h(81): error C2059: syntax error: '<parameter-list>'
C:\Apache24\include\openssl/ocsp.h(151): error C2059: syntax error: '<parameter-list>'
C:\Apache24\include\openssl/ocsp.h(152): error C2059: syntax error: '('
C:\Apache24\include\openssl/ocsp.h(152): error C2143: syntax error: missing ')' before '('

If I apply the openssl.h patch at https://github.com/curl/curl/pull/8246 then it builds without error, and I note this header file had been updated from release 7.80.0.

Different environments I guess, but I note the CURL developers have listed a lot of changes in this release. Indeed, I'm not surprised that supporting a number of alternative SSL backends causes some compatibility problems.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1248
Location: Amsterdam, NL, EU

PostPosted: Mon 10 Jan '22 17:48    Post subject: Reply with quote

Reported it bach: https://github.com/curl/curl/issues/8240#issuecomment-1009011204
Back to top


Reply to topic   Topic: HOWTO: Building Apache and dependencies using CMake View previous topic :: View next topic
Post new topic   Forum Index -> How-to's & Documentation & Tips Page 1, 2  Next