2 Commits

Author SHA1 Message Date
f630ed1e53 compatibility fixes 2025-07-07 12:53:00 -05:00
7c8a7dd54c Compile OpenSSL in-action (#134) 2025-07-07 11:27:04 -05:00
2 changed files with 107 additions and 20 deletions

View File

@ -30,6 +30,7 @@ jobs:
build: build:
runs-on: windows-latest runs-on: windows-latest
strategy: strategy:
fail-fast: false
matrix: matrix:
arch: [x64, x86, arm64] arch: [x64, x86, arm64]
steps: steps:
@ -50,6 +51,19 @@ jobs:
$env:PATH = 'C:\TDM-GCC-64\bin;' + $env:PATH $env:PATH = 'C:\TDM-GCC-64\bin;' + $env:PATH
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine)
- name: Setup MSYS2
if: matrix.arch != 'arm64'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.arch == 'x86' && 'MINGW32' || 'MINGW64' }}
update: true
install: >-
mingw-w64-${{ matrix.arch == 'x86' && 'i686' || 'x86_64' }}-gcc
mingw-w64-${{ matrix.arch == 'x86' && 'i686' || 'x86_64' }}-make
mingw-w64-x86_64-perl
perl
git
- name: Setup MSVC for ARM64 - name: Setup MSVC for ARM64
if: matrix.arch == 'arm64' if: matrix.arch == 'arm64'
uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1
@ -59,28 +73,99 @@ jobs:
- name: Checkout Source Tree - name: Checkout Source Tree
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download OpenSSL-TDM release asset - name: Cache OpenSSL 3.1.2 (32-bit)
if: matrix.arch != 'arm64' uses: actions/cache/restore@v4
if: matrix.arch == 'x86'
id: cache-openssl-32
with:
path: |
${{ github.workspace }}/OpenSSL-TDM-32
key: openssl-3.1.2-x86-${{ hashFiles('**/CMakeLists.txt') }}
- name: Cache OpenSSL 3.1.2 (64-bit)
uses: actions/cache/restore@v4
if: matrix.arch == 'x64'
id: cache-openssl-64
with:
path: |
${{ github.workspace }}/OpenSSL-TDM-64
key: openssl-3.1.2-x64-${{ hashFiles('**/CMakeLists.txt') }}
- name: Checkout and Compile OpenSSL 3.1.2
if: matrix.arch != 'arm64' && steps.cache-openssl-32.outputs.cache-hit != 'true' && steps.cache-openssl-64.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
# Clone UMSKT's OpenSSL fork
echo "Cloning UMSKT OpenSSL fork..."
git clone https://github.com/UMSKT/openssl.git --depth 1 openssl-3.1.2
- name: Checkout and Compile OpenSSL 3.1.2 (32-bit)
if: matrix.arch == 'x86' && steps.cache-openssl-32.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
# Set up proper MSYS2 environment
export MSYS=winsymlinks:nativestrict
export MSYS2_PATH_TYPE=strict
export LANG=en_US.UTF-8
export PATH="/usr/bin:/mingw64/bin:$PATH"
export PATH="/c/TDM-GCC-64/bin:$PATH"
export MSYSTEM=MINGW32
echo "Compiling 32-bit OpenSSL..."
cd openssl-3.1.2
/usr/bin/perl Configure mingw --prefix=$(cygpath -u "$GITHUB_WORKSPACE")/OpenSSL-TDM-32 --openssldir=$(cygpath -u "$GITHUB_WORKSPACE")/OpenSSL-TDM-32 no-tests no-sse2 no-asm no-threads -DOPENSSL_DEV_NO_ATOMICS -mno-mmx -mno-sse -mno-sse2 -march=i386 -mtune=generic
mingw32-make -j
mingw32-make install_sw
cd ..
- name: Checkout and Compile OpenSSL 3.1.2 (64-bit)
if: matrix.arch == 'x64' && steps.cache-openssl-64.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
# Set up proper MSYS2 environment
export MSYS=winsymlinks:nativestrict
export MSYS2_PATH_TYPE=strict
export LANG=en_US.UTF-8
export PATH="/usr/bin:/mingw64/bin:$PATH"
export PATH="/c/TDM-GCC-64/bin:$PATH"
export MSYSTEM=MINGW64
echo "Compiling 64-bit OpenSSL..."
cd openssl-3.1.2
/usr/bin/perl Configure mingw64 --prefix=$(cygpath -u "$GITHUB_WORKSPACE")/OpenSSL-TDM-64 --openssldir=$(cygpath -u "$GITHUB_WORKSPACE")/OpenSSL-TDM-64 no-tests no-asm -DOPENSSL_DEV_NO_ATOMICS -mno-mmx
mingw32-make -j
mingw32-make install_sw
cd ..
- name: Save OpenSSL 3.1.2 (32-bit)
if: matrix.arch == 'x86' && steps.cache-openssl-32.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
${{ github.workspace }}/OpenSSL-TDM-32
key: openssl-3.1.2-x86-${{ hashFiles('**/CMakeLists.txt') }}
- name: Save OpenSSL 3.1.2 (64-bit)
if: matrix.arch == 'x64' && steps.cache-openssl-64.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
${{ github.workspace }}/OpenSSL-TDM-64
key: openssl-3.1.2-x64-${{ hashFiles('**/CMakeLists.txt') }}
- name: Set OpenSSL Environment (32-bit)
if: matrix.arch == 'x86'
shell: pwsh shell: pwsh
run: | run: |
if ('${{ matrix.arch }}' -eq 'x64') { echo "OPENSSL_ROOT=$env:GITHUB_WORKSPACE/OpenSSL-TDM-32" | Out-File -FilePath $env:GITHUB_ENV -Append
$url = "https://github.com/UMSKT/winactiontest/releases/download/openssl/OpenSSL-TDM-64.zip" echo "OPENSSL_LIBDIR=lib" | Out-File -FilePath $env:GITHUB_ENV -Append
$dest = "$env:GITHUB_WORKSPACE/OpenSSL-TDM-64" echo "CMAKE_FLAGS=-m32" | Out-File -FilePath $env:GITHUB_ENV -Append
$libdir = "lib64"
$cmake_flags = "-m64" - name: Set OpenSSL Environment (64-bit)
$openssl_root = "$env:GITHUB_WORKSPACE/OpenSSL-TDM-64" if: matrix.arch == 'x64'
} else { shell: pwsh
$url = "https://github.com/UMSKT/winactiontest/releases/download/openssl/OpenSSL-TDM-32.zip" run: |
$dest = "$env:GITHUB_WORKSPACE/OpenSSL-TDM-32" echo "OPENSSL_ROOT=$env:GITHUB_WORKSPACE/OpenSSL-TDM-64" | Out-File -FilePath $env:GITHUB_ENV -Append
$libdir = "lib32" echo "OPENSSL_LIBDIR=lib" | Out-File -FilePath $env:GITHUB_ENV -Append
$cmake_flags = "-m32" echo "CMAKE_FLAGS=-m64" | Out-File -FilePath $env:GITHUB_ENV -Append
$openssl_root = "$env:GITHUB_WORKSPACE/OpenSSL-TDM-32"
}
Invoke-WebRequest -Uri $url -OutFile "OpenSSL-TDM.zip"
Expand-Archive -Path "OpenSSL-TDM.zip" -DestinationPath $env:GITHUB_WORKSPACE
echo "OPENSSL_ROOT=$openssl_root" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "OPENSSL_LIBDIR=$libdir" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "CMAKE_FLAGS=$cmake_flags" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Setup vcpkg for ARM64 - name: Setup vcpkg for ARM64
if: matrix.arch == 'arm64' if: matrix.arch == 'arm64'

View File

@ -36,6 +36,8 @@ if (WIN32 AND NOT MSVC)
# Match resource architecture with target architecture # Match resource architecture with target architecture
if(CMAKE_SIZEOF_VOID_P EQUAL 4) if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -F pe-i386") set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -F pe-i386")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i386 -mtune=generic -mno-sse -mno-sse2 -mno-mmx -mno-3dnow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i386 -mtune=generic -mno-sse -mno-sse2 -mno-mmx -mno-3dnow")
else() else()
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -F pe-x86-64") set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -F pe-x86-64")
endif() endif()