diff --git a/docker/boost-mingw-14/README.md b/docker/boost-mingw-14/README.md new file mode 100644 index 00000000..eacc5041 --- /dev/null +++ b/docker/boost-mingw-14/README.md @@ -0,0 +1,73 @@ +# Builder of Boost C++ Libraries with MinGW-w64 14 + +Docker image for building [Boost C++ Libraries](http://www.boost.org/) with MinGW-w64 14. + +## Building + +```bash +docker build -t abrarov/boost-mingw-14 docker/boost-mingw/src +``` + +## Usage + +### Environment variable + +| Name | Meaning of variable | Possible values | Default value | Comments | +|------|---------------------|-----------------|---------------|----------| +| BOOST_VERSION | Version of Boost to build | `1.80.0`, `1.83.0` | `1.83.0` | +| BOOST_ADDRESS_MODEL | CPU architecture | One of: `32`, `64` | Undefined | When undefined then both `64` and `32` (in the same order) are built | +| BOOST_LINKAGE | Linkage of built libraries | One of: `shared`, `static` | Undefined | When undefined then both `shared` and `static` (in the same order) are built | +| BOOST_RUNTIME_LINKAGE | Linkage of C/C++ runtime | One of: `shared`, `static` | Undefined | When undefined then both `shared` and `static` (in the same order) are built, when `BOOST_LINKAGE` is `shared` then `static` value of `BOOST_RUNTIME_LINKAGE` is ignored | +| B2_OPTIONS | Extra options for Boost.Jam | Any extra options separated with space and passed to Boost.Jam | `--without-python --without-mpi --without-graph_parallel` | | + +### Paths and volumes + +| Path in Docker image | Meaning of path | Comments | +|----------------------|-----------------|----------| +| C:\target | Location of built Boost libraries, i.e. output directory | Usually is mapped to external directory to retrieve results of build | +| C:\download | Location of downloaded Boost source archive | May be mapped to external directory for caching / speedup | +| C:\build | Location where the building of Boost is performed | May be mapped to external directory for debug | + +### Examples + +Download source archive, build all combinations (x86, x64, shared and static libraries, shared and static C/C++ runtime) +and put results of build into `C:\Users\Public\Documents\boost-mingw-target` folder of Docker Host: + +```bash +docker run --rm \ +-v C:/Users/Public/Documents/boost-mingw-target:C:/target \ +abrarov/boost-mingw-14 +``` + +Use pre-downloaded source archive located at `C:\Users\Public\Documents\boost-mingw\download\boost_1_74_0.zip` file +on Docker Host, build all combinations and put results of build into `C:\Users\Public\Documents\boost-mingw\target` +folder of Docker Host: + +```bash +docker run --rm \ +-v C:/Users/Public/Documents/boost-mingw/target:C:/target \ +-v C:/Users/Public/Documents/boost-mingw/download/boost_1_74_0.zip:C:/download/boost_1_74_0.zip \ +abrarov/boost-mingw-14 +``` + +Download source archive, build all combinations for x64 platform (shared and static libraries, shared and static C/C++ runtime) +and put results of build into `C:\Users\Public\Documents\boost-mingw\target` folder of Docker Host: + +```bash +docker run --rm \ +-e BOOST_ADDRESS_MODEL=64 \ +-v C:/Users/Public/Documents/boost-mingw/target:C:/target \ +abrarov/boost-mingw-14 +``` + +Download source archive, build static libraries with shared C/C++ runtime for x64 platform and put results of build into +`C:\Users\Public\Documents\boost-mingw\target` folder of Docker Host: + +```bash +docker run --rm \ +-e BOOST_ADDRESS_MODEL=64 \ +-e BOOST_LINKAGE=static \ +-e BOOST_RUNTIME_LINKAGE=shared \ +-v C:/Users/Public/Documents/boost-mingw/target:C:/target \ +abrarov/boost-mingw-14 +``` diff --git a/docker/boost-mingw-14/scripts/build.ps1 b/docker/boost-mingw-14/scripts/build.ps1 new file mode 100644 index 00000000..5f30fa51 --- /dev/null +++ b/docker/boost-mingw-14/scripts/build.ps1 @@ -0,0 +1,30 @@ +# +# Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +$project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName +$image_repository = "${env:DOCKER_USER}/$(Split-Path "${project_dir}" -Leaf)" +#TODO: find way to deal with tags and versions +$image_version = "2.17.0" +$image_revision = "$(git -C "${project_dir}" rev-parse --verify HEAD)" + +Write-Host "Building ${image_repository}:${image_version} image with ${image_revision} revision" +docker build ` + -t "${image_repository}:${image_version}" ` + --build-arg "image_version=${image_version}" ` + --build-arg "image_revision=${image_revision}" ` + "${project_dir}\src" +if (${LastExitCode} -ne 0) { + throw "Failed to build ${image_repository} image" +} + +Write-Host "Tagging ${image_repository}:${image_version} image as latest" +docker tag "${image_repository}:${image_version}" "${image_repository}:latest" +if (${LastExitCode} -ne 0) { + throw "Failed to tag ${image_repository}:${image_version} image as ${image_repository}:latest" +} diff --git a/docker/boost-mingw-14/scripts/deploy.ps1 b/docker/boost-mingw-14/scripts/deploy.ps1 new file mode 100644 index 00000000..7fb9e9bc --- /dev/null +++ b/docker/boost-mingw-14/scripts/deploy.ps1 @@ -0,0 +1,26 @@ +# +# Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +$project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName +$image_repository = "${env:DOCKER_USER}/$(Split-Path "${project_dir}" -Leaf)" + +$image_version = $(docker inspect "${image_repository}:latest" --format '{{ index .Config.Labels \"version\" }}') +Write-Host "Detected version of ${image_repository}:latest image is ${image_version}" + +Write-Host "Pushing ${image_repository}:${image_version} image" +docker push "${image_repository}:${image_version}" +if (${LastExitCode} -ne 0) { + throw "Failed to push ${image_repository}:${image_version} image" +} + +Write-Host "Pushing ${image_repository}:latest image" +docker push "${image_repository}:latest" +if (${LastExitCode} -ne 0) { + throw "Failed to push ${image_repository}:latest image" +} diff --git a/docker/boost-mingw-14/scripts/test.ps1 b/docker/boost-mingw-14/scripts/test.ps1 new file mode 100644 index 00000000..4e61dddf --- /dev/null +++ b/docker/boost-mingw-14/scripts/test.ps1 @@ -0,0 +1,17 @@ +# +# Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +$project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName +$image_repository = "${env:DOCKER_USER}/$(Split-Path "${project_dir}" -Leaf)" + +Write-Host "Build Boost C++ Libraries using default configuration and ${image_repository}:latest image" +docker run --rm "${image_repository}:latest" +if (${LastExitCode} -ne 0) { + throw "Failed to build Boost C++ Libraries" +} diff --git a/docker/boost-mingw-14/src/Dockerfile b/docker/boost-mingw-14/src/Dockerfile new file mode 100644 index 00000000..20ecdcc5 --- /dev/null +++ b/docker/boost-mingw-14/src/Dockerfile @@ -0,0 +1,23 @@ +# +# Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +FROM abrarov/mingw-14:2.17.0 + +ENV BOOST_VERSION="1.83.0" \ + BOOST_RELEASE_URL="https://archives.boost.io/release" \ + B2_OPTIONS="--without-python --without-mpi --without-graph_parallel" + +ADD ["app", "C:/app/"] + +CMD ["powershell", "-ExecutionPolicy", "Bypass", "-File", "C:\\app\\start.ps1"] + +ARG image_version="" +ARG image_revision="" + +LABEL name="abrarov/boost-mingw" \ + version="${image_version}" \ + revision="${image_revision}" \ + description="Builder of Boost C++ Libraries with MinGW-w64 14" diff --git a/docker/boost-mingw-14/src/app/bootstrap.bat b/docker/boost-mingw-14/src/app/bootstrap.bat new file mode 100644 index 00000000..15c07d63 --- /dev/null +++ b/docker/boost-mingw-14/src/app/bootstrap.bat @@ -0,0 +1,37 @@ +@echo off + +rem +rem Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +rem +rem Distributed under the MIT License (see accompanying LICENSE) +rem + +set exit_code=0 + +if not "--%BOOST_PATCH_FILE%" == "--" ( + setlocal + set "PATH=%MSYS_HOME%\usr\bin;%PATH%" + + patch -uNf -p0 -i "%BOOST_PATCH_FILE%" + set exit_code=%errorlevel% + if %exit_code% neq 0 ( + if %exit_code% neq 1 ( + endlocal + goto exit + ) + ) + + endlocal + + rem Reset errorlevel to zero + cmd /c "exit /b 0" +) + +set "PATH=%MINGW_HOME%\bin;%PATH%" + +call "%BOOST_BOOTSTRAP%" gcc +set exit_code=%errorlevel% +if %exit_code% neq 0 goto exit + +:exit +exit /B %exit_code% diff --git a/docker/boost-mingw-14/src/app/build.bat b/docker/boost-mingw-14/src/app/build.bat new file mode 100644 index 00000000..406f15c3 --- /dev/null +++ b/docker/boost-mingw-14/src/app/build.bat @@ -0,0 +1,27 @@ +@echo off + +rem +rem Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +rem +rem Distributed under the MIT License (see accompanying LICENSE) +rem + +set exit_code=0 + +set "PATH=%MINGW_HOME%\bin;%PATH%" + +"%B2_BIN%" ^ + --toolset="%B2_TOOLSET%" ^ + address-model="%BOOST_ADDRESS_MODEL%" ^ + debug release ^ + link="%BOOST_LINKAGE%" ^ + runtime-link="%BOOST_RUNTIME_LINKAGE%" ^ + threading=multi ^ + install ^ + --prefix="%BOOST_INSTALL_DIR%" ^ + %B2_OPTIONS% +set exit_code=%errorlevel% +if %exit_code% neq 0 goto exit + +:exit +exit /B %exit_code% diff --git a/docker/boost-mingw-14/src/app/patches/boost-1.80.0.patch b/docker/boost-mingw-14/src/app/patches/boost-1.80.0.patch new file mode 100644 index 00000000..c0ee2c12 --- /dev/null +++ b/docker/boost-mingw-14/src/app/patches/boost-1.80.0.patch @@ -0,0 +1,11 @@ +--- ./bootstrap.bat 2020-12-03 08:01:08 +0300 ++++ ./bootstrap.bat 2020-12-03 08:01:08 +0300 +@@ -12,7 +12,7 @@ + if exist ".\tools\build\src\engine\b2.exe" del tools\build\src\engine\b2.exe + pushd tools\build\src\engine + +-call .\build.bat ++call .\build.bat %* + @ECHO OFF + + popd diff --git a/docker/boost-mingw-14/src/app/patches/boost-1.83.0.patch b/docker/boost-mingw-14/src/app/patches/boost-1.83.0.patch new file mode 100644 index 00000000..b83fccfb --- /dev/null +++ b/docker/boost-mingw-14/src/app/patches/boost-1.83.0.patch @@ -0,0 +1,45 @@ +--- ./boost/stacktrace/detail/frame_msvc.ipp 2023-08-09 00:03:01.000000000 +0300 ++++ ./boost/stacktrace/detail/frame_msvc.ipp 2025-04-13 10:50:34.038053000 +0300 +@@ -18,7 +18,17 @@ + #include + #include + #include ++ ++#ifdef WIN32_LEAN_AND_MEAN ++#include ++#else ++// Prevent inclusion of extra Windows SDK headers which can cause conflict ++// with other code using Windows SDK ++#define WIN32_LEAN_AND_MEAN + #include ++#undef WIN32_LEAN_AND_MEAN ++#endif ++ + #include "dbgeng.h" + + #ifdef BOOST_MSVC +@@ -28,9 +38,13 @@ + + + #ifdef __CRT_UUID_DECL // for __MINGW32__ ++#if !defined(__MINGW32__) || \ ++ (!defined(__clang__) && __GNUC__ < 12) || \ ++ (defined(__clang__) && __clang_major__ < 16) + __CRT_UUID_DECL(IDebugClient,0x27fe5639,0x8407,0x4f47,0x83,0x64,0xee,0x11,0x8f,0xb0,0x8a,0xc8) + __CRT_UUID_DECL(IDebugControl,0x5182e668,0x105e,0x416e,0xad,0x92,0x24,0xef,0x80,0x04,0x24,0xba) + __CRT_UUID_DECL(IDebugSymbols,0x8c31e98c,0x983a,0x48a5,0x90,0x16,0x6f,0xe5,0xd6,0x67,0xa9,0x50) ++#endif + #elif defined(DEFINE_GUID) && !defined(BOOST_MSVC) + DEFINE_GUID(IID_IDebugClient,0x27fe5639,0x8407,0x4f47,0x83,0x64,0xee,0x11,0x8f,0xb0,0x8a,0xc8); + DEFINE_GUID(IID_IDebugControl,0x5182e668,0x105e,0x416e,0xad,0x92,0x24,0xef,0x80,0x04,0x24,0xba); +--- ./tools/build/src/tools/gcc.jam 2023-08-09 00:03:02.000000000 +0300 ++++ ./tools/build/src/tools/gcc.jam 2025-04-13 11:30:00.194278900 +0300 +@@ -1093,7 +1093,7 @@ + # + actions piecemeal archive + { +- "$(.AR)" $(AROPTIONS) $(.ARFLAGS) "$(<)" @($(<[-1]:T).rsp:O=FC:<=@":>=":E="$(>)") ++ "$(.AR)" $(AROPTIONS) $(.ARFLAGS) "$(<)" @($(<[-1]:T).rsp:O=FC:<=@":>=":E="$(>:T)") + } + + ### diff --git a/docker/boost-mingw-14/src/app/start.ps1 b/docker/boost-mingw-14/src/app/start.ps1 new file mode 100644 index 00000000..f9b8fc4a --- /dev/null +++ b/docker/boost-mingw-14/src/app/start.ps1 @@ -0,0 +1,134 @@ +# +# Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +# Enable all versions of TLS +[System.Net.ServicePointManager]::SecurityProtocol = @("Tls12","Tls11","Tls","Ssl3") + +$boost_version_underscore = "${env:BOOST_VERSION}" -replace "\.", '_' +$env:BOOST_ROOT_DIR = "${env:BUILD_DIR}\boost_${boost_version_underscore}" +Write-Host "Assuming root folder for sources is: ${env:BOOST_ROOT_DIR}" + +if (Test-Path -Path "${env:BOOST_ROOT_DIR}") { + Write-Host "Found existing folder ${env:BOOST_ROOT_DIR}, assuming that sources are in place and skipping downloading and unpacking of sources" +} else { + # Boost sources were not mounted or were not deployed yet + $boost_archive_file = "${env:DOWNLOAD_DIR}\boost_${boost_version_underscore}.zip" + if (Test-Path -Path "${boost_archive_file}") { + Write-Host "Found existing file ${boost_archive_file}, assuming that sources are downloaded and skipping downloading of sources" + } else { + # Download Boost C++ Libraries + $boost_download_url = "${env:BOOST_RELEASE_URL}/${env:BOOST_VERSION}/source/boost_${boost_version_underscore}.zip" + Write-Host "Downloading Boost C++ Libraries (source code archive) from: ${boost_download_url} into: ${boost_archive_file}" + (New-Object System.Net.WebClient).DownloadFile("${boost_download_url}", "${boost_archive_file}") + } + # Unpack Boost C++ Libraries + Write-Host "Extracting source code archive to: ${env:BUILD_DIR}" + & "${env:SEVEN_ZIP_HOME}\7z.exe" x "${boost_archive_file}" -o"${env:BUILD_DIR}" -aoa -y -bd | out-null + if (${LastExitCode} -ne 0) { + throw "Failed to extract Boost from ${boost_archive_file} to ${env:BUILD_DIR}" + } + Write-Host "Extracted source code archive" +} + +$env:B2_BIN = "${env:BOOST_ROOT_DIR}\b2.exe" +$env:B2_TOOLSET = "gcc" + +# Prepare patch for Boost +if (-not (Test-Path env:BOOST_PATCH_FILE)) { + $env:BOOST_PATCH_FILE = "${PSScriptRoot}\patches\boost-${env:BOOST_VERSION}.patch" +} +if (-not (Test-Path -Path "${env:BOOST_PATCH_FILE}")) { + Write-Warning "Patch for chosen version of Boost (${env:BOOST_VERSION}) was not found at ${env:BOOST_PATCH_FILE}" + $env:BOOST_PATCH_FILE = "" +} + +# Build Boost C++ Libraries +$address_models = @("64", "32") +$boost_linkages = @("shared", "static") +$runtime_linkages = @("shared", "static") + +# Limit build configurations if user asked for that +if (Test-Path env:BOOST_ADDRESS_MODEL) { + $address_models = @("${env:BOOST_ADDRESS_MODEL}") +} +if (Test-Path env:BOOST_LINKAGE) { + $boost_linkages = @("${env:BOOST_LINKAGE}") +} +if (Test-Path env:BOOST_RUNTIME_LINKAGE) { + $runtime_linkages = @("${env:BOOST_RUNTIME_LINKAGE}") +} + +if (!(Test-Path env:B2_OPTIONS)) { + $env:B2_OPTIONS = "" +} + +foreach ($address_model in ${address_models}) { + $env:BOOST_ADDRESS_MODEL = ${address_model} + + # Determine parameters dependent on address model + switch (${env:BOOST_ADDRESS_MODEL}) { + "32" { + $env:MINGW_HOME = "${env:MINGW32_HOME}" + $target_dir_suffix = "x86" + } + "64" { + $env:MINGW_HOME = "${env:MINGW64_HOME}" + $target_dir_suffix = "x64" + } + default { + throw "Unsupported address model: ${env:BOOST_ADDRESS_MODEL}" + } + } + + $mingw_version_suffix = "${env:MINGW_VERSION}" -replace "([0-9]+)\.([0-9]+)\.([0-9]+)", '$1$2' + $env:BOOST_INSTALL_DIR = "${env:TARGET_DIR}\boost-${env:BOOST_VERSION}-${target_dir_suffix}-mingw${mingw_version_suffix}" + + $boost_build_bin_dir = "${env:BOOST_ROOT_DIR}\bin.v2" + if (Test-Path -Path "${boost_build_bin_dir}") { + Write-Host "Removing Boost bin directory: ${boost_build_bin_dir}" + Remove-Item -Path "${boost_build_bin_dir}" -Recurse -Force + } + + # Build Boost.Build + $env:BOOST_BOOTSTRAP = "${env:BOOST_ROOT_DIR}\bootstrap.bat" + Set-Location -Path "${env:BOOST_ROOT_DIR}" + Write-Host "Building Boost.Build engine" + Write-Host "BOOST_PATCH_FILE: ${env:BOOST_PATCH_FILE}" + & "${PSScriptRoot}\bootstrap.bat" + if (${LastExitCode} -ne 0) { + throw "Failed to build Boost.Build" + } + + foreach ($boost_linkage in ${boost_linkages}) { + $env:BOOST_LINKAGE = ${boost_linkage} + foreach ($runtime_linkage in ${runtime_linkages}) { + if (${runtime_linkage} -eq "static" -and -not (${boost_linkage} -eq "static")) { + # Nothing to do with this type of configuration - just skip it + continue + } + $env:BOOST_RUNTIME_LINKAGE = ${runtime_linkage} + Set-Location -Path "${env:BOOST_ROOT_DIR}" + Write-Host "Building Boost C++ Libraries with these parameters:" + Write-Host "MINGW_HOME : ${env:MINGW_HOME}" + Write-Host "B2_BIN : ${env:B2_BIN}" + Write-Host "B2_TOOLSET : ${env:B2_TOOLSET}" + Write-Host "BOOST_INSTALL_DIR : ${env:BOOST_INSTALL_DIR}" + Write-Host "BOOST_ADDRESS_MODEL : ${env:BOOST_ADDRESS_MODEL}" + Write-Host "BOOST_LINKAGE : ${env:BOOST_LINKAGE}" + Write-Host "BOOST_RUNTIME_LINKAGE: ${env:BOOST_RUNTIME_LINKAGE}" + Write-Host "B2_OPTIONS : ${env:B2_OPTIONS}" + & "${PSScriptRoot}\build.bat" + if (${LastExitCode} -ne 0) { + throw "Failed to build Boost with BOOST_ADDRESS_MODEL = ${env:BOOST_ADDRESS_MODEL}, BOOST_LINKAGE = ${env:BOOST_LINKAGE}, BOOST_RUNTIME_LINKAGE = ${env:BOOST_RUNTIME_LINKAGE}" + } + } + } +} + +Write-Host "Build completed successfully" diff --git a/docker/boost-mingw/README.md b/docker/boost-mingw/README.md index 91f17750..214a9fd7 100644 --- a/docker/boost-mingw/README.md +++ b/docker/boost-mingw/README.md @@ -14,7 +14,7 @@ docker build -t abrarov/boost-mingw docker/boost-mingw/src | Name | Meaning of variable | Possible values | Default value | Comments | |------|---------------------|-----------------|---------------|----------| -| BOOST_VERSION | Version of Boost to build | One of: `1.70.0`, `1.71.0`, `1.72.0`, `1.73.0`, `1.74.0`, `1.75.0`, `1.76.0`, `1.77.0`, `1.78.0`, `1.79.0`, `1.80.0`, `1.82.0` | `1.82.0` | +| BOOST_VERSION | Version of Boost to build | One of: `1.70.0`, `1.71.0`, `1.72.0`, `1.73.0`, `1.74.0`, `1.75.0`, `1.76.0`, `1.77.0`, `1.78.0`, `1.79.0`, `1.80.0`, `1.82.0`, `1.83.0` | `1.83.0` | | BOOST_ADDRESS_MODEL | CPU architecture | One of: `32`, `64` | Undefined | When undefined then both `64` and `32` (in the same order) are built | | BOOST_LINKAGE | Linkage of built libraries | One of: `shared`, `static` | Undefined | When undefined then both `shared` and `static` (in the same order) are built | | BOOST_RUNTIME_LINKAGE | Linkage of C/C++ runtime | One of: `shared`, `static` | Undefined | When undefined then both `shared` and `static` (in the same order) are built, when `BOOST_LINKAGE` is `shared` then `static` value of `BOOST_RUNTIME_LINKAGE` is ignored | diff --git a/docker/boost-mingw/src/Dockerfile b/docker/boost-mingw/src/Dockerfile index 7c04c222..8a231ac3 100644 --- a/docker/boost-mingw/src/Dockerfile +++ b/docker/boost-mingw/src/Dockerfile @@ -6,10 +6,9 @@ FROM abrarov/mingw:2.17.0 -ENV BOOST_VERSION="1.82.0" \ +ENV BOOST_VERSION="1.83.0" \ BOOST_RELEASE_URL="https://archives.boost.io/release" \ - B2_OPTIONS="--without-python --without-mpi --without-graph_parallel" \ - BOOST_MINGW_HOME="C:\MinGW" + B2_OPTIONS="--without-python --without-mpi --without-graph_parallel" ADD ["app", "C:/app/"] diff --git a/docker/boost-mingw/src/app/patches/boost-1.83.0.patch b/docker/boost-mingw/src/app/patches/boost-1.83.0.patch new file mode 100644 index 00000000..b83fccfb --- /dev/null +++ b/docker/boost-mingw/src/app/patches/boost-1.83.0.patch @@ -0,0 +1,45 @@ +--- ./boost/stacktrace/detail/frame_msvc.ipp 2023-08-09 00:03:01.000000000 +0300 ++++ ./boost/stacktrace/detail/frame_msvc.ipp 2025-04-13 10:50:34.038053000 +0300 +@@ -18,7 +18,17 @@ + #include + #include + #include ++ ++#ifdef WIN32_LEAN_AND_MEAN ++#include ++#else ++// Prevent inclusion of extra Windows SDK headers which can cause conflict ++// with other code using Windows SDK ++#define WIN32_LEAN_AND_MEAN + #include ++#undef WIN32_LEAN_AND_MEAN ++#endif ++ + #include "dbgeng.h" + + #ifdef BOOST_MSVC +@@ -28,9 +38,13 @@ + + + #ifdef __CRT_UUID_DECL // for __MINGW32__ ++#if !defined(__MINGW32__) || \ ++ (!defined(__clang__) && __GNUC__ < 12) || \ ++ (defined(__clang__) && __clang_major__ < 16) + __CRT_UUID_DECL(IDebugClient,0x27fe5639,0x8407,0x4f47,0x83,0x64,0xee,0x11,0x8f,0xb0,0x8a,0xc8) + __CRT_UUID_DECL(IDebugControl,0x5182e668,0x105e,0x416e,0xad,0x92,0x24,0xef,0x80,0x04,0x24,0xba) + __CRT_UUID_DECL(IDebugSymbols,0x8c31e98c,0x983a,0x48a5,0x90,0x16,0x6f,0xe5,0xd6,0x67,0xa9,0x50) ++#endif + #elif defined(DEFINE_GUID) && !defined(BOOST_MSVC) + DEFINE_GUID(IID_IDebugClient,0x27fe5639,0x8407,0x4f47,0x83,0x64,0xee,0x11,0x8f,0xb0,0x8a,0xc8); + DEFINE_GUID(IID_IDebugControl,0x5182e668,0x105e,0x416e,0xad,0x92,0x24,0xef,0x80,0x04,0x24,0xba); +--- ./tools/build/src/tools/gcc.jam 2023-08-09 00:03:02.000000000 +0300 ++++ ./tools/build/src/tools/gcc.jam 2025-04-13 11:30:00.194278900 +0300 +@@ -1093,7 +1093,7 @@ + # + actions piecemeal archive + { +- "$(.AR)" $(AROPTIONS) $(.ARFLAGS) "$(<)" @($(<[-1]:T).rsp:O=FC:<=@":>=":E="$(>)") ++ "$(.AR)" $(AROPTIONS) $(.ARFLAGS) "$(<)" @($(<[-1]:T).rsp:O=FC:<=@":>=":E="$(>:T)") + } + + ### diff --git a/docker/boost-mingw/src/app/start.ps1 b/docker/boost-mingw/src/app/start.ps1 index 8c3afd42..f9b8fc4a 100644 --- a/docker/boost-mingw/src/app/start.ps1 +++ b/docker/boost-mingw/src/app/start.ps1 @@ -89,6 +89,12 @@ foreach ($address_model in ${address_models}) { $mingw_version_suffix = "${env:MINGW_VERSION}" -replace "([0-9]+)\.([0-9]+)\.([0-9]+)", '$1$2' $env:BOOST_INSTALL_DIR = "${env:TARGET_DIR}\boost-${env:BOOST_VERSION}-${target_dir_suffix}-mingw${mingw_version_suffix}" + $boost_build_bin_dir = "${env:BOOST_ROOT_DIR}\bin.v2" + if (Test-Path -Path "${boost_build_bin_dir}") { + Write-Host "Removing Boost bin directory: ${boost_build_bin_dir}" + Remove-Item -Path "${boost_build_bin_dir}" -Recurse -Force + } + # Build Boost.Build $env:BOOST_BOOTSTRAP = "${env:BOOST_ROOT_DIR}\bootstrap.bat" Set-Location -Path "${env:BOOST_ROOT_DIR}" diff --git a/docker/mingw-14/README.md b/docker/mingw-14/README.md new file mode 100644 index 00000000..cc55b734 --- /dev/null +++ b/docker/mingw-14/README.md @@ -0,0 +1,28 @@ +# MinGW-w64 14 + +Docker image with MinGW-w64 from [niXman mingw-builds](https://github.com/niXman/mingw-builds-binaries). + +Contains: + +1. MinGW-w64 targeting Win32 +1. MinGW-w64 targeting Win64 + +## Building + +```bash +docker build -t abrarov/mingw-14 docker/mingw-14/src +``` + +## Usage + +Get version of MinGW x64 compiler: + +```bash +docker run --rm abrarov/mingw-14 "C:\mingw64\bin\g++" --version +``` + +Get version of MinGW x86 compiler: + +```bash +docker run --rm abrarov/mingw-14 "C:\mingw32\bin\g++" --version +``` diff --git a/docker/mingw-14/scripts/build.ps1 b/docker/mingw-14/scripts/build.ps1 new file mode 100644 index 00000000..f792923a --- /dev/null +++ b/docker/mingw-14/scripts/build.ps1 @@ -0,0 +1,30 @@ +# +# Copyright (c) 2024 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +$project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName +$image_repository = "${env:DOCKER_USER}/$(Split-Path "${project_dir}" -Leaf)" +#TODO: find way to deal with tags and versions +$image_version = "2.17.0" +$image_revision = "$(git -C "${project_dir}" rev-parse --verify HEAD)" + +Write-Host "Building ${image_repository}:${image_version} image with ${image_revision} revision" +docker build ` + -t "${image_repository}:${image_version}" ` + --build-arg "image_version=${image_version}" ` + --build-arg "image_revision=${image_revision}" ` + "${project_dir}\src" +if (${LastExitCode} -ne 0) { + throw "Failed to build ${image_repository} image" +} + +Write-Host "Tagging ${image_repository}:${image_version} image as latest" +docker tag "${image_repository}:${image_version}" "${image_repository}:latest" +if (${LastExitCode} -ne 0) { + throw "Failed to tag ${image_repository}:${image_version} image as ${image_repository}:latest" +} diff --git a/docker/mingw-14/scripts/deploy.ps1 b/docker/mingw-14/scripts/deploy.ps1 new file mode 100644 index 00000000..03ef813d --- /dev/null +++ b/docker/mingw-14/scripts/deploy.ps1 @@ -0,0 +1,26 @@ +# +# Copyright (c) 2024 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +$project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName +$image_repository = "${env:DOCKER_USER}/$(Split-Path "${project_dir}" -Leaf)" + +$image_version = $(docker inspect "${image_repository}:latest" --format '{{ index .Config.Labels \"version\" }}') +Write-Host "Detected version of ${image_repository}:latest image is ${image_version}" + +Write-Host "Pushing ${image_repository}:${image_version} image" +docker push "${image_repository}:${image_version}" +if (${LastExitCode} -ne 0) { + throw "Failed to push ${image_repository}:${image_version} image" +} + +Write-Host "Pushing ${image_repository}:latest image" +docker push "${image_repository}:latest" +if (${LastExitCode} -ne 0) { + throw "Failed to push ${image_repository}:latest image" +} diff --git a/docker/mingw-14/scripts/test.ps1 b/docker/mingw-14/scripts/test.ps1 new file mode 100644 index 00000000..d11c82a8 --- /dev/null +++ b/docker/mingw-14/scripts/test.ps1 @@ -0,0 +1,23 @@ +# +# Copyright (c) 2024 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +$project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName +$image_repository = "${env:DOCKER_USER}/$(Split-Path "${project_dir}" -Leaf)" + +Write-Host "Get version of MinGW x64 in container created from ${image_repository}:latest image" +docker run --rm "${image_repository}:latest" "C:\mingw64\bin\g++" --version +if (${LastExitCode} -ne 0) { + throw "Failed to get version of MinGW x64" +} + +Write-Host "Get version of MinGW x86 in container created from ${image_repository}:latest image" +docker run --rm "${image_repository}:latest" "C:\mingw32\bin\g++" --version +if (${LastExitCode} -ne 0) { + throw "Failed to get version of MinGW x86" +} diff --git a/docker/mingw-14/src/Dockerfile b/docker/mingw-14/src/Dockerfile new file mode 100644 index 00000000..61e5fe7b --- /dev/null +++ b/docker/mingw-14/src/Dockerfile @@ -0,0 +1,35 @@ +# +# Copyright (c) 2024 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +FROM abrarov/windows-dev:2.17.0 + +ENV MINGW_VERSION="14.2.0" \ + MINGW_RT_FILE_SUFFIX="12" \ + MINGW_REVISON="2" \ + MINGW_URL="https://github.com/niXman/mingw-builds-binaries/releases/download" \ + MINGW_64_TARGET="x86_64" \ + MINGW_64_THREADS="posix" \ + MINGW_64_EXCEPTIONS="seh" \ + MINGW_64_MSVCRT="msvcrt" \ + MINGW_32_TARGET="i686" \ + MINGW_32_THREADS="posix" \ + MINGW_32_EXCEPTIONS="dwarf" \ + MINGW_32_MSVCRT="msvcrt" \ + MINGW64_HOME="C:\mingw64" \ + MINGW32_HOME="C:\mingw32" + +ADD ["app", "C:/app/"] + +RUN powershell -ExecutionPolicy Bypass -File "C:\app\install.ps1" && \ + powershell "Remove-Item -Path 'C:\app' -Recurse -Force" + +ARG image_version="" +ARG image_revision="" + +LABEL name="abrarov/mingw" \ + version="${image_version}" \ + revision="${image_revision}" \ + description="MinGW-w64 14" diff --git a/docker/mingw-14/src/app/install.ps1 b/docker/mingw-14/src/app/install.ps1 new file mode 100644 index 00000000..e3197caa --- /dev/null +++ b/docker/mingw-14/src/app/install.ps1 @@ -0,0 +1,37 @@ +# +# Copyright (c) 2024 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +# Enable all versions of TLS +[System.Net.ServicePointManager]::SecurityProtocol = @("Tls12","Tls11","Tls","Ssl3") + +# Download MinGW-w64 x64 +$mingw64_dist_name = "${env:MINGW_64_TARGET}-${env:MINGW_VERSION}-release-${env:MINGW_64_THREADS}-${env:MINGW_64_EXCEPTIONS}-${env:MINGW_64_MSVCRT}-rt_v${env:MINGW_RT_FILE_SUFFIX}-rev${env:MINGW_REVISON}.7z" +$mingw64_url = "${env:MINGW_URL}/${env:MINGW_VERSION}-rt_v${env:MINGW_RT_FILE_SUFFIX}-rev${env:MINGW_REVISON}/${mingw64_dist_name}" +$mingw64_dist = "${env:TMP}\${mingw64_dist_name}" +Write-Host "Downloading MinGW-w64 x64 from ${mingw64_url} into ${mingw64_dist}" +(New-Object System.Net.WebClient).DownloadFile("${mingw64_url}", "${mingw64_dist}") +# Extract MinGW-w64 x64 and install it into C:\mingw64 +Write-Host "Extracting MinGW-w64 x64 from ${mingw64_dist} into ${env:MINGW64_HOME}" +& "${env:SEVEN_ZIP_HOME}\7z.exe" x "${mingw64_dist}" -o"C:" -aoa -y -bd | out-null +Write-Host "MinGW-w64 x64 ${env:MINGW_VERSION} installed into ${env:MINGW64_HOME}" + +# Download MinGW-w64 x86 +$mingw32_dist_name = "${env:MINGW_32_TARGET}-${env:MINGW_VERSION}-release-${env:MINGW_32_THREADS}-${env:MINGW_32_EXCEPTIONS}-${env:MINGW_32_MSVCRT}-rt_v${env:MINGW_RT_FILE_SUFFIX}-rev${env:MINGW_REVISON}.7z" +$mingw32_url = "${env:MINGW_URL}/${env:MINGW_VERSION}-rt_v${env:MINGW_RT_FILE_SUFFIX}-rev${env:MINGW_REVISON}/${mingw32_dist_name}" +$mingw32_dist = "${env:TMP}\${mingw32_dist_name}" +Write-Host "Downloading MinGW-w64 x86 from ${mingw32_url} into ${mingw32_dist}" +(New-Object System.Net.WebClient).DownloadFile("${mingw32_url}", "${mingw32_dist}") +# Extract MinGW-w64 x86 and install it into C:\mingw32 +Write-Host "Extracting MinGW-w64 x86 from ${mingw32_dist} into ${env:MINGW32_HOME}" +& "${env:SEVEN_ZIP_HOME}\7z.exe" x "${mingw32_dist}" -o"C:" -aoa -y -bd | out-null +Write-Host "MinGW-w64 x86 ${env:MINGW_VERSION} installed into ${env:MINGW32_HOME}" + +# Cleanup +Write-Host "Removing all files and directories from ${env:TMP}" +Remove-Item -Path "${env:TMP}\*" -Recurse -Force diff --git a/docker/openssl-mingw-14/.gitattributes b/docker/openssl-mingw-14/.gitattributes new file mode 100644 index 00000000..328853a8 --- /dev/null +++ b/docker/openssl-mingw-14/.gitattributes @@ -0,0 +1 @@ +*.patch text eol=crlf diff --git a/docker/openssl-mingw-14/README.md b/docker/openssl-mingw-14/README.md new file mode 100644 index 00000000..99721af7 --- /dev/null +++ b/docker/openssl-mingw-14/README.md @@ -0,0 +1,51 @@ +# Builder of OpenSSL with MinGW 14 + +Docker image for building [OpenSSL](https://www.openssl.org/) with MinGW 14. + +## Building + +```bash +docker build -t abrarov/openssl-mingw-14 docker/openssl-mingw-14/src +``` + +## Usage + +### Environment variable + +| Name | Meaning of variable | Possible values | Default value | Comments | +|------|---------------------|-----------------|---------------|----------| +| OPENSSL_VERSION | Version of OpenSSL to build | One of: `1.0.2q` | `1.0.2q` | | +| OPENSSL_ADDRESS_MODEL | CPU architecture | One of: `32`, `64` | Undefined | When undefined then both `64` and `32` (in the same order) are built | +| OPENSSL_LINKAGE | Linkage of built libraries | One of: `shared`, `static` | Undefined | When undefined then both `shared` and `static` (in the same order) are built, `static` build uses static C/C++ runtime | +| OPENSSL_PATCH_FILE | Path to file in container with path applied to OpenSSL before building | | Undefined | When undefined then patch is chosen among embedded patches based on version of OpenSSL. Embedded patches are located in `C:\app\patches` directory of image | +| OPENSSL_TEST | Flag to run tests during build | Any value or empty string | Empty string | When is not empty string then tests are executed during build with `test` goal of Makefile executed before `install` goal | + +### Paths and volumes + +| Path in Docker image | Meaning of path | Comments | +|----------------------|-----------------|----------| +| C:\target | Location of built OpenSSL, i.e. output directory | Usually is mapped to external directory to retrieve results of build | +| C:\download | Location of downloaded OpenSSL source archive | May be mapped to external directory for caching / speedup | +| C:\build | Location where the building of OpenSSL is performed | May be mapped to external directory for debug | + +### Examples + +Download source archive, build all combinations (x86, x64, shared and static libraries) and put results of build into +`C:\Users\Public\openssl-mingw\target` folder of Docker Host: + +```bash +docker run --rm \ +-v C:/Users/Public/openssl-mingw-14/target:C:/target \ +abrarov/openssl-mingw-14 +``` + +Download source archive, build x64 shared libraries and put results of build into `C:\Users\Public\openssl-mingw\target` +folder of Docker Host: + +```bash +docker run --rm \ +-e OPENSSL_ADDRESS_MODEL=64 \ +-e OPENSSL_LINKAGE=shared \ +-v C:/Users/Public/openssl-mingw-14/target:C:/target \ +abrarov/openssl-mingw-14 +``` diff --git a/docker/openssl-mingw-14/scripts/build.ps1 b/docker/openssl-mingw-14/scripts/build.ps1 new file mode 100644 index 00000000..5f30fa51 --- /dev/null +++ b/docker/openssl-mingw-14/scripts/build.ps1 @@ -0,0 +1,30 @@ +# +# Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +$project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName +$image_repository = "${env:DOCKER_USER}/$(Split-Path "${project_dir}" -Leaf)" +#TODO: find way to deal with tags and versions +$image_version = "2.17.0" +$image_revision = "$(git -C "${project_dir}" rev-parse --verify HEAD)" + +Write-Host "Building ${image_repository}:${image_version} image with ${image_revision} revision" +docker build ` + -t "${image_repository}:${image_version}" ` + --build-arg "image_version=${image_version}" ` + --build-arg "image_revision=${image_revision}" ` + "${project_dir}\src" +if (${LastExitCode} -ne 0) { + throw "Failed to build ${image_repository} image" +} + +Write-Host "Tagging ${image_repository}:${image_version} image as latest" +docker tag "${image_repository}:${image_version}" "${image_repository}:latest" +if (${LastExitCode} -ne 0) { + throw "Failed to tag ${image_repository}:${image_version} image as ${image_repository}:latest" +} diff --git a/docker/openssl-mingw-14/scripts/deploy.ps1 b/docker/openssl-mingw-14/scripts/deploy.ps1 new file mode 100644 index 00000000..7fb9e9bc --- /dev/null +++ b/docker/openssl-mingw-14/scripts/deploy.ps1 @@ -0,0 +1,26 @@ +# +# Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +$project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName +$image_repository = "${env:DOCKER_USER}/$(Split-Path "${project_dir}" -Leaf)" + +$image_version = $(docker inspect "${image_repository}:latest" --format '{{ index .Config.Labels \"version\" }}') +Write-Host "Detected version of ${image_repository}:latest image is ${image_version}" + +Write-Host "Pushing ${image_repository}:${image_version} image" +docker push "${image_repository}:${image_version}" +if (${LastExitCode} -ne 0) { + throw "Failed to push ${image_repository}:${image_version} image" +} + +Write-Host "Pushing ${image_repository}:latest image" +docker push "${image_repository}:latest" +if (${LastExitCode} -ne 0) { + throw "Failed to push ${image_repository}:latest image" +} diff --git a/docker/openssl-mingw-14/scripts/test.ps1 b/docker/openssl-mingw-14/scripts/test.ps1 new file mode 100644 index 00000000..364b052e --- /dev/null +++ b/docker/openssl-mingw-14/scripts/test.ps1 @@ -0,0 +1,17 @@ +# +# Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +$project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName +$image_repository = "${env:DOCKER_USER}/$(Split-Path "${project_dir}" -Leaf)" + +Write-Host "Build OpenSSL using default configuration and ${image_repository}:latest image" +docker run --rm "${image_repository}:latest" +if (${LastExitCode} -ne 0) { + throw "Failed to build OpenSSL" +} diff --git a/docker/openssl-mingw-14/src/Dockerfile b/docker/openssl-mingw-14/src/Dockerfile new file mode 100644 index 00000000..5e894259 --- /dev/null +++ b/docker/openssl-mingw-14/src/Dockerfile @@ -0,0 +1,23 @@ +# +# Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +FROM abrarov/mingw-14:2.17.0 + +ENV OPENSSL_VERSION="1.0.2q" \ + OPENSSL_URL="https://www.openssl.org/source" \ + OPENSSL_TEST="" + +ADD ["app", "C:/app/"] + +CMD ["powershell", "-ExecutionPolicy", "Bypass", "-File", "C:\\app\\start.ps1"] + +ARG image_version="" +ARG image_revision="" + +LABEL name="abrarov/openssl-mingw-14" \ + version="${image_version}" \ + revision="${image_revision}" \ + description="Builder of OpenSSL with MinGW 14" diff --git a/docker/openssl-mingw-14/src/app/build.bat b/docker/openssl-mingw-14/src/app/build.bat new file mode 100644 index 00000000..1d485e9c --- /dev/null +++ b/docker/openssl-mingw-14/src/app/build.bat @@ -0,0 +1,42 @@ +@echo off + +rem +rem Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +rem +rem Distributed under the MIT License (see accompanying LICENSE) +rem + +set exit_code=0 + +set "PATH=%MINGW_HOME%\bin;%MSYS_HOME%\usr\bin;%PATH%" + +if not "--%OPENSSL_PATCH_FILE%" == "--" ( + patch -uNf -p0 -i "%OPENSSL_PATCH_FILE%" + set exit_code=%errorlevel% + if %exit_code% neq 0 goto exit +) + +perl Configure --prefix="%OPENSSL_STAGE_MSYS_DIR%" "%OPENSSL_TOOLSET%" enable-static-engine "%OPENSSL_CONFIGURE_LINKAGE%" +set exit_code=%errorlevel% +if %exit_code% neq 0 goto exit + +make depend +set exit_code=%errorlevel% +if %exit_code% neq 0 goto exit + +make +set exit_code=%errorlevel% +if %exit_code% neq 0 goto exit + +if not "--%OPENSSL_TEST%" == "--" ( + make test + set exit_code=%errorlevel% + if %exit_code% neq 0 goto exit +) + +make install +set exit_code=%errorlevel% +if %exit_code% neq 0 goto exit + +:exit +exit /B %exit_code% diff --git a/docker/openssl-mingw-14/src/app/patches/openssl-1.0.2q.patch b/docker/openssl-mingw-14/src/app/patches/openssl-1.0.2q.patch new file mode 100644 index 00000000..4df771f5 --- /dev/null +++ b/docker/openssl-mingw-14/src/app/patches/openssl-1.0.2q.patch @@ -0,0 +1,89 @@ +--- ./util/mk1mf.pl 2019-02-13 21:00:00 +0300 ++++ ./util/mk1mf.pl 2019-02-13 21:10:00 +0300 +@@ -1236,6 +1236,8 @@ + "shlib" => \$shlib, + "dll" => \$shlib, + "shared" => 0, +++ "debug_lib" => \$debug_lib, +++ "static_lib" => \$static_lib, + "no-sctp" => 0, + "no-srtp" => 0, + "no-gmp" => 0, + +--- ./util/mkdef.pl 2019-02-13 21:00:00 +0300 ++++ ./util/mkdef.pl 2019-02-13 21:10:00 +0300 +@@ -55,6 +55,8 @@ + # + + my $debug=0; ++my $debug_lib=0; ++my $static_lib=0; + + my $crypto_num= "util/libeay.num"; + my $ssl_num= "util/ssleay.num"; +@@ -157,6 +159,8 @@ + foreach (@ARGV, split(/ /, $options)) + { + $debug=1 if $_ eq "debug"; ++ $debug_lib=1 if $_ eq "debug_lib"; ++ $static_lib=1 if $_ eq "static_lib"; + $W32=1 if $_ eq "32"; + $W16=1 if $_ eq "16"; + if($_ eq "NT") { +@@ -1323,6 +1327,19 @@ + $description = "\@#$http_vendor:$version#\@$what; DLL for library $name. Build for EMX -Zmtd"; + } + ++ $libsuffix=""; ++ if ($static_lib) { ++ $libsuffix="MT"; ++ } else { ++ $libsuffix="MD"; ++ } ++ ++ if ($debug_lib) { ++ $libsuffix=$libsuffix."d"; ++ } ++ ++ $libname=$libname.$libsuffix; ++ + print OUT <<"EOF"; + ; + ; Definition file for the DLL version of the $name library from OpenSSL + +--- ./util/pl/VC-32.pl 2019-02-13 21:00:00 +0300 ++++ ./util/pl/VC-32.pl 2019-02-13 21:10:00 +0300 +@@ -16,6 +16,20 @@ + $crypto="libeay32"; + } + ++$libsuffix=""; ++if ($static_lib) { ++ $libsuffix="MT"; ++} else { ++ $libsuffix="MD"; ++} ++ ++if ($debug_lib) { ++ $libsuffix=$libsuffix."d"; ++} ++ ++$ssl=$ssl.$libsuffix; ++$crypto=$crypto.$libsuffix; ++ + $o='\\'; + $cp='$(PERL) util/copy.pl'; + $mkdir='$(PERL) util/mkdir-p.pl'; +@@ -154,9 +168,9 @@ + $cflags=$opt_cflags.$base_cflags; + } + +-# generate symbols.pdb unconditionally +-$app_cflag.=" /Zi /Fd\$(TMP_D)/app"; +-$lib_cflag.=" /Zi /Fd\$(TMP_D)/lib"; ++# Do not generate symbols.pdb because it depends on path used for building and that path is incorporated into PDB ++$app_cflag.=" /Zi"; ++$lib_cflag.=" /Zi"; + $lflags.=" /debug"; + + $obj='.obj'; diff --git a/docker/openssl-mingw-14/src/app/start.ps1 b/docker/openssl-mingw-14/src/app/start.ps1 new file mode 100644 index 00000000..61047757 --- /dev/null +++ b/docker/openssl-mingw-14/src/app/start.ps1 @@ -0,0 +1,146 @@ +# +# Copyright (c) 2017 Marat Abrarov (abrarov@gmail.com) +# +# Distributed under the MIT License (see accompanying LICENSE) +# + +# Stop immediately if any error happens +$ErrorActionPreference = "Stop" + +# Enable all versions of TLS +[System.Net.ServicePointManager]::SecurityProtocol = @("Tls12","Tls11","Tls","Ssl3") + +$openssl_archive_file = "${env:DOWNLOAD_DIR}\openssl-${env:OPENSSL_VERSION}.tar.gz" +$openssl_download_url = "${env:OPENSSL_URL}/openssl-${env:OPENSSL_VERSION}.tar.gz" + +# Prepare patch for OpenSSL +if (-not (Test-Path env:OPENSSL_PATCH_FILE)) { + $env:OPENSSL_PATCH_FILE = "${PSScriptRoot}\patches\openssl-${env:OPENSSL_VERSION}.patch" +} +if (-not (Test-Path -Path "${env:OPENSSL_PATCH_FILE}")) { + Write-Warning "Patch for chosen version of OpenSSL (${env:OPENSSL_VERSION}) was not found at ${env:OPENSSL_PATCH_FILE}" + $env:OPENSSL_PATCH_FILE = "" +} + +# Build OpenSSL +$address_models = @("64", "32") +$openssl_linkages = @("shared", "static") + +# Limit build configurations if user asked for that +if (Test-Path env:OPENSSL_ADDRESS_MODEL) { + $address_models = @("${env:OPENSSL_ADDRESS_MODEL}") +} +if (Test-Path env:OPENSSL_LINKAGE) { + $openssl_linkages = @("${env:OPENSSL_LINKAGE}") +} + +$openssl_downloaded = $false + +foreach ($address_model in ${address_models}) { + $env:OPENSSL_ADDRESS_MODEL = ${address_model} + + # Determine parameters dependent on address model + switch (${env:OPENSSL_ADDRESS_MODEL}) { + "32" { + $env:MINGW_HOME = "${env:MINGW32_HOME}" + $env:OPENSSL_TOOLSET = "mingw" + $address_model_target_dir_suffix = "x86" + } + "64" { + $env:MINGW_HOME = "${env:MINGW64_HOME}" + $env:OPENSSL_TOOLSET = "mingw64" + $address_model_target_dir_suffix = "x64" + } + default { + throw "Unsupported address model: ${env:OPENSSL_ADDRESS_MODEL}" + } + } + + $mingw_version_suffix = "${env:MINGW_VERSION}" -replace "([0-9]+)\.([0-9]+)\.([0-9]+)", '$1$2' + + foreach ($openssl_linkage in ${openssl_linkages}) { + $env:OPENSSL_LINKAGE = ${openssl_linkage} + + # Determine parameters dependent on linkage + switch (${env:OPENSSL_LINKAGE}) { + "shared" { + $env:OPENSSL_CONFIGURE_LINKAGE = "shared" + } + "static" { + $env:OPENSSL_CONFIGURE_LINKAGE = "no-shared" + } + default { + throw "Unsupported linkage: ${env:OPENSSL_LINKAGE}" + } + } + + $env:OPENSSL_BUILD_DIR = "${env:BUILD_DIR}\openssl-${env:OPENSSL_VERSION}\${address_model}\${env:OPENSSL_LINKAGE}" + $env:OPENSSL_HOME = "${env:OPENSSL_BUILD_DIR}\openssl-${env:OPENSSL_VERSION}" + Write-Host "Assuming root folder for sources is: ${env:OPENSSL_HOME}" + + if (Test-Path -Path "${env:OPENSSL_HOME}") { + Write-Host "Found existing folder ${env:OPENSSL_HOME}, assuming that sources are in place and skipping downloading and unpacking of sources" + } else { + if (-not ${openssl_downloaded}) { + if (Test-Path -Path "${openssl_archive_file}") { + Write-Host "Found existing file ${openssl_archive_file}, assuming that sources are downloaded and skipping downloading of sources" + } else { + # Download OpenSSL + Write-Host "Downloading OpenSSL (source code archive) from: ${openssl_download_url} into: ${openssl_archive_file}" + (New-Object System.Net.WebClient).DownloadFile("${openssl_download_url}", "${openssl_archive_file}") + } + $openssl_downloaded = $true + } + + if (-not (Test-Path -Path "${env:OPENSSL_BUILD_DIR}")) { + New-Item -Path "${env:OPENSSL_BUILD_DIR}" -ItemType "directory" | out-null + } + + # Unpack OpenSSL + Write-Host "Extracting source code archive from ${openssl_archive_file} to ${env:OPENSSL_BUILD_DIR}" + Set-Location -Path "${env:OPENSSL_BUILD_DIR}" + $openssl_archive_msys_file = "${openssl_archive_file}" -replace "\\", "/" + $openssl_archive_msys_file = "${openssl_archive_msys_file}" -replace "^(C):", "/c" + # Path is required to be changed for Gnu tar shipped with MSYS2 + $path_backup = "${env:PATH}" + $env:PATH = "${env:MSYS_HOME}\usr\bin;${env:PATH}" + & tar.exe xzf "${openssl_archive_msys_file}" + $tar_exit_code = ${LastExitCode} + $env:PATH = "${path_backup}" + if (${tar_exit_code} -ne 0) { + throw "Failed to extract OpenSSL from ${openssl_archive_file} to ${env:OPENSSL_BUILD_DIR}" + } + Write-Host "Extracted source code archive" + } + + $env:OPENSSL_INSTALL_DIR = "${env:TARGET_DIR}\openssl-${env:OPENSSL_VERSION}-${address_model_target_dir_suffix}-mingw${mingw_version_suffix}-${env:OPENSSL_LINKAGE}" + $env:OPENSSL_STAGE_DIR = "${env:OPENSSL_HOME}\dist" + $env:OPENSSL_STAGE_MSYS_DIR = "${env:OPENSSL_STAGE_DIR}" -replace "\\", "/" + $env:OPENSSL_STAGE_MSYS_DIR = "${env:OPENSSL_STAGE_MSYS_DIR}" -replace "^(C):", "/c" + + Set-Location -Path "${env:OPENSSL_HOME}" + + Write-Host "Building OpenSSL with these parameters:" + Write-Host "MINGW_HOME : ${env:MINGW_HOME}" + Write-Host "MSYS_HOME : ${env:MSYS_HOME}" + Write-Host "OPENSSL_HOME : ${env:OPENSSL_HOME}" + Write-Host "OPENSSL_INSTALL_DIR : ${env:OPENSSL_INSTALL_DIR}" + Write-Host "OPENSSL_STAGE_DIR : ${env:OPENSSL_STAGE_DIR}" + Write-Host "OPENSSL_STAGE_MSYS_DIR : ${env:OPENSSL_STAGE_MSYS_DIR}" + Write-Host "OPENSSL_TOOLSET : ${env:OPENSSL_TOOLSET}" + Write-Host "OPENSSL_ADDRESS_MODEL : ${env:OPENSSL_ADDRESS_MODEL}" + Write-Host "OPENSSL_LINKAGE : ${env:OPENSSL_LINKAGE}" + Write-Host "OPENSSL_CONFIGURE_LINKAGE: ${env:OPENSSL_CONFIGURE_LINKAGE}" + Write-Host "OPENSSL_PATCH_FILE : ${env:OPENSSL_PATCH_FILE}" + + & "${PSScriptRoot}\build.bat" + if (${LastExitCode} -ne 0) { + throw "Failed to build OpenSSL with OPENSSL_ADDRESS_MODEL = ${env:OPENSSL_ADDRESS_MODEL}, OPENSSL_LINKAGE = ${env:OPENSSL_LINKAGE}" + } + + Write-Host "Copying built OpenSSL from ${env:OPENSSL_STAGE_DIR} to ${env:OPENSSL_INSTALL_DIR}" + Copy-Item -Force -Recurse -Path "${env:OPENSSL_STAGE_DIR}" -Destination "${env:OPENSSL_INSTALL_DIR}" + } +} + +Write-Host "Build completed successfully" diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 976e0410..2bc16515 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -12,10 +12,13 @@ $project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName $dirs = @( "docker\windows-dev", "docker\mingw", + "docker\mingw-14", "docker\msvc-2017", "docker\boost-mingw", + "docker\boost-mingw-14", "docker\boost-msvc-2017", "docker\openssl-mingw", + "docker\openssl-mingw-14", "docker\openssl-msvc-2017", "docker\msvc-2019", "docker\boost-msvc-2019", diff --git a/scripts/deploy.ps1 b/scripts/deploy.ps1 index 5556c6f7..f87b0207 100644 --- a/scripts/deploy.ps1 +++ b/scripts/deploy.ps1 @@ -33,10 +33,13 @@ $auth64 = [Convert]::ToBase64String($auth) $dirs = @( "docker\windows-dev", "docker\mingw", + "docker\mingw-14", "docker\msvc-2017", "docker\boost-mingw", + "docker\boost-mingw-14", "docker\boost-msvc-2017", "docker\openssl-mingw", + "docker\openssl-mingw-14", "docker\openssl-msvc-2017", "docker\msvc-2019", "docker\boost-msvc-2019", diff --git a/scripts/test.ps1 b/scripts/test.ps1 index 7c200bb3..e5dd5c0a 100644 --- a/scripts/test.ps1 +++ b/scripts/test.ps1 @@ -12,10 +12,13 @@ $project_dir = (Get-Item "${PSScriptRoot}").Parent.FullName $dirs = @( "docker\windows-dev", "docker\mingw", + "docker\mingw-14", "docker\msvc-2017", "docker\boost-mingw", + "docker\boost-mingw-14", "docker\boost-msvc-2017", "docker\openssl-mingw", + "docker\openssl-mingw-14", "docker\openssl-msvc-2017", "docker\msvc-2019", "docker\boost-msvc-2019",