Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions docker/boost-mingw-14/README.md
Original file line number Diff line number Diff line change
@@ -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
```
30 changes: 30 additions & 0 deletions docker/boost-mingw-14/scripts/build.ps1
Original file line number Diff line number Diff line change
@@ -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"
}
26 changes: 26 additions & 0 deletions docker/boost-mingw-14/scripts/deploy.ps1
Original file line number Diff line number Diff line change
@@ -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"
}
17 changes: 17 additions & 0 deletions docker/boost-mingw-14/scripts/test.ps1
Original file line number Diff line number Diff line change
@@ -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"
}
23 changes: 23 additions & 0 deletions docker/boost-mingw-14/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
37 changes: 37 additions & 0 deletions docker/boost-mingw-14/src/app/bootstrap.bat
Original file line number Diff line number Diff line change
@@ -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%
27 changes: 27 additions & 0 deletions docker/boost-mingw-14/src/app/build.bat
Original file line number Diff line number Diff line change
@@ -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%
11 changes: 11 additions & 0 deletions docker/boost-mingw-14/src/app/patches/boost-1.80.0.patch
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions docker/boost-mingw-14/src/app/patches/boost-1.83.0.patch
Original file line number Diff line number Diff line change
@@ -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 <boost/core/noncopyable.hpp>
#include <boost/stacktrace/detail/to_dec_array.hpp>
#include <boost/stacktrace/detail/to_hex_array.hpp>
+
+#ifdef WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#else
+// Prevent inclusion of extra Windows SDK headers which can cause conflict
+// with other code using Windows SDK
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#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)")
}

###
Loading