Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
219 changes: 12 additions & 207 deletions .github/workflows/win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,210 +38,34 @@ jobs:
libs/mpir.lib
libs/yaml.lib
libs/xml2.lib
key: win-libs-${{ hashFiles('.github/workflows/win.yml') }}-msvc-${{ env.VSCMD_VER }}
- name: Download libgc
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: ivmai/bdwgc
ref: v8.2.2
path: bdwgc
- name: Download libatomic_ops
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: ivmai/libatomic_ops
ref: v7.6.14
path: bdwgc/libatomic_ops
key: win-libs-${{ hashFiles('.github/workflows/win.yml', 'etc/win-ci/*.ps1') }}-msvc-${{ env.VSCMD_VER }}
- name: Build libgc
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./bdwgc
run: |
cmake . -DBUILD_SHARED_LIBS=OFF -Denable_large_config=ON -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Download libpcre
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
iwr https://cs.stanford.edu/pub/exim/pcre/pcre-8.45.zip -OutFile pcre.zip
(Get-FileHash -Algorithm SHA256 .\pcre.zip).hash -eq "5b709aa45ea3b8bb73052947200ad187f651a2049158fb5bbfed329e4322a977"
7z x pcre.zip
mv pcre-* pcre
run: .\etc\win-ci\build-gc.ps1 -BuildTree deps\gc -Version 8.2.2 -AtomicOpsVersion 7.8.0
- name: Build libpcre
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./pcre
run: |
cmake . -DBUILD_SHARED_LIBS=OFF -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON -DPCRE_SUPPORT_JIT=ON -DPCRE_STATIC_RUNTIME=ON -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Download libpcre2
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: PCRE2Project/pcre2
ref: pcre2-10.42
path: pcre2
run: .\etc\win-ci\build-pcre.ps1 -BuildTree deps\pcre -Version 8.45
- name: Build libpcre2
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./pcre2
run: |
cmake . -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DPCRE2_STATIC_RUNTIME=ON -DPCRE2_BUILD_PCRE2GREP=OFF -DPCRE2_BUILD_TESTS=OFF -DPCRE2_SUPPORT_UNICODE=ON -DPCRE2_SUPPORT_JIT=ON -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Download libiconv
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: pffang/libiconv-for-Windows
ref: 1353455a6c4e15c9db6865fd9c2bf7203b59c0ec # master@{2022-10-11}
path: libiconv
run: .\etc\win-ci\build-pcre2.ps1 -BuildTree deps\pcre2 -Version 10.42
- name: Build libiconv
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./libiconv
run: |
sed -i 's|__declspec (dllimport) ||' libiconv\include\iconv.h

echo '<Project>
<PropertyGroup>
<ForceImportAfterCppTargets>$(MsbuildThisFileDirectory)\Override.props</ForceImportAfterCppTargets>
</PropertyGroup>
</Project>' > 'Directory.Build.props'

echo '<Project>
<ItemDefinitionGroup>
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
</ItemDefinitionGroup>
</Project>' > 'Override.props'

MSBuild.exe /p:Platform=x64 /p:Configuration=ReleaseStatic libiconv.vcxproj
- name: Download libffi
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: winlibs/libffi
ref: libffi-3.3
path: libffi
run: .\etc\win-ci\build-iconv.ps1 -BuildTree deps\iconv
- name: Build libffi
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./libffi
run: |
echo '<Project>
<PropertyGroup>
<ForceImportAfterCppTargets>$(MsbuildThisFileDirectory)\Override.props</ForceImportAfterCppTargets>
</PropertyGroup>
</Project>' > 'Directory.Build.props'

echo '<Project>
<ItemDefinitionGroup Label="Configuration">
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
</Project>' > 'Override.props'

MSBuild.exe /p:PlatformToolset=v143 /p:Platform=x64 /p:Configuration=Release win32\vs16_x64\libffi-msvc.sln -target:libffi:Rebuild
- name: Download zlib
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
iwr https://github.com/madler/zlib/archive/v1.2.13.zip -OutFile zlib.zip
(Get-FileHash -Algorithm SHA256 .\zlib.zip).hash -eq "C2856951BBF30E30861ACE3765595D86BA13F2CF01279D901F6C62258C57F4FF"
7z x zlib.zip
mv zlib-* zlib
run: .\etc\win-ci\build-ffi.ps1 -BuildTree deps\ffi -Version 3.3
- name: Build zlib
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./zlib
run: |
cmake . -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Download mpir
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: BrianGladman/mpir
ref: 28d01062f62de1218d511c4574da4006f92be3bd # master@{2022-10-12}
path: mpir
run: .\etc\win-ci\build-z.ps1 -BuildTree deps\z -Version 1.2.13
- name: Build mpir
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./mpir
run: |
$VsVersion = "vs$((& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -property displayName) -replace '.*\b\d\d(\d\d)\b.*', '$1')"

echo '<Project>
<PropertyGroup>
<ForceImportAfterCppTargets>$(MsbuildThisFileDirectory)\Override.props</ForceImportAfterCppTargets>
</PropertyGroup>
</Project>' > 'msvc\Directory.Build.props'

echo '<Project>
<ItemDefinitionGroup Label="Configuration">
<ClCompile>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
</ItemDefinitionGroup>
</Project>' > 'msvc\Override.props'

MSBuild.exe /p:Platform=x64 /p:Configuration=Release /p:DefineConstants=MSC_BUILD_DLL ".\msvc\$VsVersion\lib_mpir_gc\lib_mpir_gc.vcxproj"
- name: Download libyaml
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
iwr https://github.com/yaml/libyaml/archive/0.2.5.zip -OutFile libyaml.zip
(Get-FileHash -Algorithm SHA256 .\libyaml.zip).hash -eq "14605BAA6DFC0C4D3AB943A46A627413C0388736E453B67FE4E90C9683C8CBC8"
7z x libyaml.zip
mv libyaml-* libyaml
run: .\etc\win-ci\build-mpir.ps1 -BuildTree deps\mpir
- name: Build libyaml
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./libyaml
run: |
cmake . -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF
cmake --build . --config Release
- name: Download libxml2
if: steps.cache-libs.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: GNOME/libxml2
ref: f507d167f1755b7eaea09fb1a44d29aab828b6d1 # v2.10.3
path: libxml2
run: .\etc\win-ci\build-yaml.ps1 -BuildTree deps\yaml -Version 0.2.5
- name: Build libxml2
if: steps.cache-libs.outputs.cache-hit != 'true'
working-directory: ./libxml2
run: |
cmake . -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_PROGRAMS=OFF -DLIBXML2_WITH_HTTP=OFF -DLIBXML2_WITH_FTP=OFF -DLIBXML2_WITH_TESTS=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_ZLIB=OFF

echo '<Project>
<PropertyGroup>
<ForceImportAfterCppTargets>$(MsbuildThisFileDirectory)\Override.props</ForceImportAfterCppTargets>
</PropertyGroup>
</Project>' > 'Directory.Build.props'

echo '<Project>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>LIBXML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
</Project>' > 'Override.props'

cmake --build . --config Release
- name: Gather libraries
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
mkdir libs
mv pcre/Release/pcre.lib libs/
mv pcre2/Release/pcre2-8-static.lib libs/pcre2-8.lib
mv libiconv/output/x64/ReleaseStatic/libiconvStatic.lib libs/iconv.lib
mv bdwgc/Release/gc.lib libs/
mv libffi/win32/vs16_x64/x64/Release/libffi.lib libs/ffi.lib
mv zlib/Release/zlibstatic.lib libs/z.lib
mv mpir/lib/x64/Release/mpir.lib libs/
mv libyaml/Release/yaml.lib libs/
mv libxml2/Release/libxml2s.lib libs/xml2.lib
run: .\etc\win-ci\build-xml2.ps1 -BuildTree deps\xml2 -Version 2.11.3

- name: Cache OpenSSL
id: cache-openssl
Expand All @@ -251,32 +75,13 @@ jobs:
libs/crypto.lib
libs/ssl.lib
libs/openssl_VERSION
key: win-openssl-libs-3.0.7-msvc-${{ env.VSCMD_VER }}
key: win-openssl-libs-3.1.0-${{ hashFiles('etc/win-ci/build-openssl.ps1') }}-msvc-${{ env.VSCMD_VER }}
- name: Set up NASM
if: steps.cache-openssl.outputs.cache-hit != 'true'
uses: ilammy/setup-nasm@321e6ed62a1fc77024a3bd853deb33645e8b22c4 # v1.4.0
- name: Download OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: |
iwr https://www.openssl.org/source/openssl-3.0.7.tar.gz -OutFile openssl.tar.gz
(Get-FileHash -Algorithm SHA256 .\openssl.tar.gz).hash -eq "83049d042a260e696f62406ac5c08bf706fd84383f945cf21bd61e9ed95c396e"
7z x openssl.tar.gz
7z x openssl.tar
mv openssl-* openssl
- name: Build OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
working-directory: ./openssl
run: |
sed -i 's|/Zi /Fd.*\.pdb||' Configurations/10-main.conf
sed -i 's|/debug|/debug:none|' Configurations/10-main.conf
perl Configure VC-WIN64A /MT -static no-tests --with-zlib-lib=..\zlib\Release --with-zlib-include=..\zlib
nmake
- name: Gather OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: |
cp openssl/libcrypto.lib libs/crypto.lib
cp openssl/libssl.lib libs/ssl.lib
[IO.File]::WriteAllLines("libs/openssl_VERSION", "3.0.7")
run: .\etc\win-ci\build-openssl.ps1 -BuildTree deps\openssl -Version 3.1.0

- name: Cache LLVM
id: cache-llvm
Expand Down
55 changes: 55 additions & 0 deletions etc/win-ci/build-ffi.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
param(
[Parameter(Mandatory)] [string] $BuildTree,
[Parameter(Mandatory)] [string] $Version,
[switch] $Dynamic
)

. "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\setup.ps1"

[void](New-Item -Name (Split-Path -Parent $BuildTree) -ItemType Directory -Force)
Setup-Git -Path $BuildTree -Url https://github.com/winlibs/libffi.git -Ref libffi-$Version

Run-InDirectory $BuildTree {
if ($Dynamic) {
Replace-Text win32\vs16_x64\libffi\libffi.vcxproj 'StaticLibrary' 'DynamicLibrary'
}

echo '<Project>
<PropertyGroup>
<ForceImportAfterCppTargets>$(MsbuildThisFileDirectory)\Override.props</ForceImportAfterCppTargets>
</PropertyGroup>
</Project>' > 'Directory.Build.props'

echo "<Project>
<PropertyGroup>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
$(if ($Dynamic) {
'<PreprocessorDefinitions>FFI_BUILDING_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>'
} else {
'<RuntimeLibrary>MultiThreaded</RuntimeLibrary>'
})
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
</Project>" > 'Override.props'

MSBuild.exe /p:PlatformToolset=v143 /p:Platform=x64 /p:Configuration=Release win32\vs16_x64\libffi-msvc.sln -target:libffi:Rebuild
if (-not $?) {
Write-Host "Error: Failed to build libffi" -ForegroundColor Red
Exit 1
}
}

if ($Dynamic) {
mv -Force $BuildTree\win32\vs16_x64\x64\Release\libffi.lib libs\ffi-dynamic.lib
mv -Force $BuildTree\win32\vs16_x64\x64\Release\libffi.dll dlls\
} else {
mv -Force $BuildTree\win32\vs16_x64\x64\Release\libffi.lib libs\ffi.lib
}
35 changes: 35 additions & 0 deletions etc/win-ci/build-gc.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
param(
[Parameter(Mandatory)] [string] $BuildTree,
[Parameter(Mandatory)] [string] $Version,
[Parameter(Mandatory)] [string] $AtomicOpsVersion,
[switch] $Dynamic
)

. "$(Split-Path -Parent $MyInvocation.MyCommand.Path)\setup.ps1"

[void](New-Item -Name (Split-Path -Parent $BuildTree) -ItemType Directory -Force)
Setup-Git -Path $BuildTree -Url https://github.com/ivmai/bdwgc.git -Ref v$Version
Setup-Git -Path $BuildTree\libatomic_ops -Url https://github.com/ivmai/libatomic_ops.git -Ref v$AtomicOpsVersion

Run-InDirectory $BuildTree {
$args = "-Dbuild_cord=OFF -Denable_large_config=ON -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF"
if ($Dynamic) {
$args = "-DBUILD_SHARED_LIBS=ON $args"
} else {
$args = "-DBUILD_SHARED_LIBS=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded $args"
}
& $cmake . $args.split(' ')
& $cmake --build . --config Release
if (-not $?) {
Write-Host "Error: Failed to build libgc" -ForegroundColor Red
Exit 1
}
}

if ($Dynamic) {
mv -Force $BuildTree\Release\gc.lib libs\gc-dynamic.lib
mv -Force $BuildTree\Release\gc.dll dlls\
} else {
mv -Force $BuildTree\Release\gc.lib libs\
}

Loading