Skip to content

Commit

Permalink
add CK_OPENSSL_VARIABLE and CK_K4W_PATH environment variables
Browse files Browse the repository at this point in the history
These variables contain current architecture value to simplify scripts
  • Loading branch information
jmalak committed Nov 28, 2024
1 parent 767a5fb commit 329b356
Showing 1 changed file with 65 additions and 56 deletions.
121 changes: 65 additions & 56 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
# so we switched fetching zlib from ftp.zx.net.nz instead. As of 2024-08-16 it seems to be
# fine, so we've switched back to zlib.net.
ZLIB_VERSION: 1.3.1
# Expected filename: https://github.com/openssl/openssl/releases/download/openssl-${{env.OPENSSL_VERSION}}/openssl-${{env.OPENSSL_VERSION}}.tar.gz
# Expected filename: https://github.com/openssl/openssl/releases/download/openssl-${{env.CK_OPENSSL_VERSION}}/openssl-${{env.CK_OPENSSL_VERSION}}.tar.gz
OPENSSL_VERSION: 3.4.0
# OpenSSL 3.0 and 3.1 aren't properly compatible with Windows on ARM, so we've
# got to use 3.2 or newer for that.
Expand Down Expand Up @@ -203,6 +203,18 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Select env configuration ARM
if: matrix.arch == 'x64_arm' || matrix.arch == 'x64_arm64'
run: |
echo "CK_OPENSSL_VERSION=${{ env.OPENSSL_ARM_VERSION }}" >> "$GITHUB_ENV"
echo "CK_K4W_PATH=." >> "$GITHUB_ENV"
shell: bash
- name: Select env configuration
if: ${{ ! (matrix.arch == 'x64_arm' || matrix.arch == 'x64_arm64') }}
run: |
echo "CK_OPENSSL_VERSION=${{ env.OPENSSL_VERSION }}" >> "$GITHUB_ENV"
echo "CK_K4W_PATH=kerberos\kfw\Kerberos" >> "$GITHUB_ENV"
shell: bash
# temporary setup Windows SDK version for 32-bit ARM to 10.0.22621.0 because
# latest SDK version 10.0.26100.0 doesn't contains 32-bit ARM files
- name: Enable Developer Command Prompt
Expand Down Expand Up @@ -250,15 +262,6 @@ jobs:
- name: Get dependencies
if: steps.cache-optional-dependencies.outputs.cache-hit != 'true'
run: |
# Figure out what OPENSSL version we're using
$openssl_version = "${{env.OPENSSL_VERSION}}"
if ("${{matrix.arch}}" -eq "x64_arm" -Or "${{matrix.arch}}" -eq "x64_arm64") {
echo "Targeting Windows on ARM, using OpenSSL ${{env.OPENSSL_ARM_VERSION}}"
$openssl_version = "${{env.OPENSSL_ARM_VERSION}}"
}
$openssl_url = "https://github.com/openssl/openssl/releases/download/openssl-${openssl_version}/openssl-${openssl_version}.tar.gz"
# Get and unpack zlib
mkdir zlib
cd zlib
Expand All @@ -275,10 +278,10 @@ jobs:
# Get and unpack openssl
cd openssl
wget $openssl_url -outfile openssl-${openssl_version}.tar.gz
7z x openssl-${openssl_version}.tar.gz
7z x openssl-${openssl_version}.tar
ren openssl-${openssl_version} ${openssl_version}
wget "https://github.com/openssl/openssl/releases/download/openssl-${{ env.CK_OPENSSL_VERSION }}/openssl-${{ env.CK_OPENSSL_VERSION }}.tar.gz" -outfile openssl-${{ env.CK_OPENSSL_VERSION }}.tar.gz
7z x openssl-${{ env.CK_OPENSSL_VERSION }}.tar.gz
7z x openssl-${{ env.CK_OPENSSL_VERSION }}.tar
ren openssl-${{ env.CK_OPENSSL_VERSION }} ${{ env.CK_OPENSSL_VERSION }}
del *.tar
del *.gz
cd ..
Expand Down Expand Up @@ -389,7 +392,7 @@ jobs:
run: |
set PATH=%PATH%;${{github.workspace}}\tools\jom;${{github.workspace}}\tools\nasm
echo %PATH%
cd openssl\${{env.OPENSSL_VERSION}}
cd openssl\${{env.CK_OPENSSL_VERSION}}
perl Configure VC-WIN32 zlib-dynamic --with-zlib-include=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}} ${{env.OPENSSL_EXTRA_BUILD_FLAGS}}
REM The linker by default marks the subsystem version too high for XP
Expand All @@ -405,7 +408,7 @@ jobs:
run: |
set PATH=%PATH%;${{github.workspace}}\tools\jom;${{github.workspace}}\tools\nasm
echo %PATH%
cd openssl\${{env.OPENSSL_VERSION}}
cd openssl\${{env.CK_OPENSSL_VERSION}}
perl Configure VC-WIN64A zlib-dynamic --with-zlib-include=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}} ${{env.OPENSSL_EXTRA_BUILD_FLAGS}}
REM The linker by default marks the subsystem version too high for XP
Expand All @@ -421,7 +424,7 @@ jobs:
run: |
set PATH=%PATH%;${{github.workspace}}\tools\jom;${{github.workspace}}\tools\nasm
echo %PATH%
cd openssl\${{env.OPENSSL_ARM_VERSION}}
cd openssl\${{env.CK_OPENSSL_VERSION}}
perl Configure VC-WIN32-ARM zlib-dynamic --with-zlib-include=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}} ${{env.OPENSSL_EXTRA_BUILD_FLAGS}}
${{env.OPENSSL_MAKE}}
Expand All @@ -432,7 +435,7 @@ jobs:
run: |
set PATH=%PATH%;${{github.workspace}}\tools\jom;${{github.workspace}}\tools\nasm
echo %PATH%
cd openssl\${{env.OPENSSL_ARM_VERSION}}
cd openssl\${{env.CK_OPENSSL_VERSION}}
perl Configure VC-WIN64-ARM zlib-dynamic --with-zlib-include=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}} ${{env.OPENSSL_EXTRA_BUILD_FLAGS}}
${{env.OPENSSL_MAKE}}
Expand All @@ -442,7 +445,7 @@ jobs:
env:
ROOT: ${{ github.workspace }}
run: |
set openssl_root_override=${{github.workspace}}\openssl\${{env.OPENSSL_VERSION}}
set openssl_root_override=${{github.workspace}}\openssl\${{env.CK_OPENSSL_VERSION}}
set zlib_root_override=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}}
call setenv.bat
cd ${{ github.workspace }}\libssh
Expand All @@ -460,9 +463,9 @@ jobs:
env:
ROOT: ${{ github.workspace }}
run: |
set openssl_root_override=${{github.workspace}}\openssl\${{env.OPENSSL_VERSION}}
set openssl_root_override=${{github.workspace}}\openssl\${{env.CK_OPENSSL_VERSION}}
set zlib_root_override=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}}
set k4w_root_override=${{github.workspace}}\kerberos\kfw\Kerberos
set k4w_root_override=${{github.workspace}}\${{ env.CK_K4W_PATH }}
call setenv.bat
cd ${{ github.workspace }}\libssh
Expand All @@ -481,7 +484,7 @@ jobs:
env:
ROOT: ${{ github.workspace }}
run: |
set openssl_root_override=${{github.workspace}}\openssl\${{env.OPENSSL_VERSION}}
set openssl_root_override=${{github.workspace}}\openssl\${{env.CK_OPENSSL_VERSION}}
set zlib_root_override=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}}
call setenv.bat
cd ${{ github.workspace }}\libssh
Expand All @@ -501,9 +504,9 @@ jobs:
env:
ROOT: ${{ github.workspace }}
run: |
set openssl_root_override=${{github.workspace}}\openssl\${{env.OPENSSL_VERSION}}
set openssl_root_override=${{github.workspace}}\openssl\${{env.CK_OPENSSL_VERSION}}
set zlib_root_override=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}}
set k4w_root_override=${{github.workspace}}\kerberos\kfw\Kerberos
set k4w_root_override=${{github.workspace}}\${{ env.CK_K4W_PATH }}
call setenv.bat
cd ${{ github.workspace }}\libssh
Expand All @@ -523,7 +526,7 @@ jobs:
shell: powershell
run: |
cd libssh\${{env.LIBSSH_VERSION}}\build
cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=${{github.workspace}}\openssl\${{env.OPENSSL_ARM_VERSION}}\ -DZLIB_ROOT:PATH=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}} -DWITH_DSA=ON -DCMAKE_C_STANDARD_LIBRARIES="kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib"
cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=${{github.workspace}}\openssl\${{env.CK_OPENSSL_VERSION}}\ -DZLIB_ROOT:PATH=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}} -DWITH_DSA=ON -DCMAKE_C_STANDARD_LIBRARIES="kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib"
nmake
# zlib is currently disabled for ARM builds as it doesn't currently build for ARM
Expand All @@ -532,7 +535,7 @@ jobs:
shell: powershell
run: |
cd libssh\${{env.LIBSSH_VERSION}}\build
cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=${{github.workspace}}\openssl\${{env.OPENSSL_ARM_VERSION}}\ -DZLIB_ROOT:PATH=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}} -DWITH_DSA=ON
cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=${{github.workspace}}\openssl\${{env.CK_OPENSSL_VERSION}}\ -DZLIB_ROOT:PATH=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}} -DWITH_DSA=ON
nmake
- name: Build libdes
Expand Down Expand Up @@ -649,22 +652,13 @@ jobs:
##########################################################################
- name: Full Build
run: |
set k4w_root_override=${{github.workspace}}\kerberos\kfw\Kerberos
set openssl_root_override=${{github.workspace}}\openssl\${{env.OPENSSL_VERSION}}
set k4w_root_override=${{github.workspace}}\${{ env.CK_K4W_PATH }}
set openssl_root_override=${{github.workspace}}\openssl\${{env.CK_OPENSSL_VERSION}}
set zlib_root_override=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}}
set libssh_root_override=${{github.workspace}}\libssh\${{env.LIBSSH_VERSION}}
set libssh_build_override=%libssh_root_override%\build
set rexx_root_override=${{github.workspace}}\rexx\regina\
REM We're currently using a different version of Openssl on ARM Windows
REM as the current LTS release isn't compatible.
if "${{matrix.arch}}" == "x64_arm" set openssl_root_override=${{github.workspace}}\openssl\${{env.OPENSSL_ARM_VERSION}}
if "${{matrix.arch}}" == "x64_arm64" set openssl_root_override=${{github.workspace}}\openssl\${{env.OPENSSL_ARM_VERSION}}
REM No Kerberos on ARM Windows yet
if "${{matrix.arch}}" == "x64_arm" set k4w_root_override=${{github.workspace}}
if "${{matrix.arch}}" == "x64_arm64" set k4w_root_override=${{github.workspace}}
call ..\setenv.bat
set PATH=%PATH%;${{github.workspace}}\tools\jom
Expand Down Expand Up @@ -795,6 +789,9 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Select env configuration
run: echo "CK_OPENSSL_VERSION=${{ env.OPENSSL_VERSION }}" >> "$GITHUB_ENV"
shell: bash
##########################################################################
# Fetch the compiler #
##########################################################################
Expand Down Expand Up @@ -836,22 +833,22 @@ jobs:
with:
path: |
${{github.workspace}}\zlib
${{github.workspace}}\openssl\${{env.OPENSSL_VERSION}}
${{github.workspace}}\openssl\${{env.CK_OPENSSL_VERSION}}
${{github.workspace}}\libssh
${{github.workspace}}\libdes\des
${{github.workspace}}\libdes\Release
${{github.workspace}}\libdes\Debug
${{github.workspace}}\tools
key: platform-sdk-71-optdepts-${{ matrix.arch }}+nasm+openssl-${{env.OPENSSL_VERSION}}+libdes+v3
key: platform-sdk-71-optdepts-${{ matrix.arch }}+nasm+openssl-${{env.CK_OPENSSL_VERSION}}+libdes+v3
- name: Get dependencies
if: steps.cache-optional-dependencies.outputs.cache-hit != 'true'
run: |
# Get and unpack openssl
cd openssl
wget https://github.com/openssl/openssl/releases/download/openssl-${{env.OPENSSL_VERSION}}/openssl-${{env.OPENSSL_VERSION}}.tar.gz -outfile openssl-${{env.OPENSSL_VERSION}}.tar.gz
7z x openssl-${{env.OPENSSL_VERSION}}.tar.gz
7z x openssl-${{env.OPENSSL_VERSION}}.tar
ren openssl-${{env.OPENSSL_VERSION}} ${{env.OPENSSL_VERSION}}
wget https://github.com/openssl/openssl/releases/download/openssl-${{env.CK_OPENSSL_VERSION}}/openssl-${{env.CK_OPENSSL_VERSION}}.tar.gz -outfile openssl-${{env.CK_OPENSSL_VERSION}}.tar.gz
7z x openssl-${{env.CK_OPENSSL_VERSION}}.tar.gz
7z x openssl-${{env.CK_OPENSSL_VERSION}}.tar
ren openssl-${{env.CK_OPENSSL_VERSION}} ${{env.CK_OPENSSL_VERSION}}
del *.tar
del *.gz
cd ..
Expand Down Expand Up @@ -900,7 +897,7 @@ jobs:
set PATH=%PATH%;${{github.workspace}}\tools\jom
call vc10.cmd /release /xp /${{matrix.arch}}
cd openssl\${{env.OPENSSL_VERSION}}
cd openssl\${{env.CK_OPENSSL_VERSION}}
perl Configure VC-WIN64I -D"_WIN32_WINNT=0x502"
REM The perl configure script doesn't work quite right for cross-compiling to IA64
Expand All @@ -916,7 +913,7 @@ jobs:
SET PlatformToolset=100
call vc10.cmd /release /xp /${{matrix.arch}}
cd openssl\${{env.OPENSSL_VERSION}}
cd openssl\${{env.CK_OPENSSL_VERSION}}
set PATH=%PATH%;${{github.workspace}}\tools\nasm;${{github.workspace}}\tools\jom
perl Configure VC-WIN64A -D"_WIN32_WINNT=0x502"
Expand All @@ -934,7 +931,7 @@ jobs:
SET PlatformToolset=100
call vc10.cmd /release /xp /${{matrix.arch}}
cd openssl\${{env.OPENSSL_VERSION}}
cd openssl\${{env.CK_OPENSSL_VERSION}}
set PATH=%PATH%;${{github.workspace}}\tools\nasm;${{github.workspace}}\tools\jom
Expand Down Expand Up @@ -971,7 +968,7 @@ jobs:
call vc10.cmd /release /xp /${{matrix.arch}}
echo Configure build environment...
set openssl_root_override=${{github.workspace}}\openssl\${{env.OPENSSL_VERSION}}
set openssl_root_override=${{github.workspace}}\openssl\${{env.CK_OPENSSL_VERSION}}
call setenv.bat
set PATH=%PATH%;${{github.workspace}}\tools\jom
Expand Down Expand Up @@ -1968,6 +1965,9 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Select env configuration
run: echo "CK_OPENSSL_VERSION=${{ env.OPENSSL_VERSION }}" >> "$GITHUB_ENV"
shell: bash

- name: Install MinGW-w64
run: sudo apt install -y g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix binutils-mingw-w64-x86-64
Expand All @@ -1980,25 +1980,34 @@ jobs:
${{github.workspace}}/openssl
${{github.workspace}}/libssh
${{github.workspace}}/zlib
key: deps-openssl-${{env.OPENSSL_VERSION}}-parallel
key: deps-openssl-${{env.CK_OPENSSL_VERSION}}-parallel

- name: Build OpenSSL
- name: Get OpenSSL
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
mkdir -p openssl
cd openssl
wget https://github.com/openssl/openssl/releases/download/openssl-${{env.CK_OPENSSL_VERSION}}/openssl-${{env.CK_OPENSSL_VERSION}}.tar.gz
tar zxf openssl-${{env.CK_OPENSSL_VERSION}}.tar.gz
rm openssl-${{env.CK_OPENSSL_VERSION}}.tar.gz
cd openssl-${{env.CK_OPENSSL_VERSION}}
# Install perl modules required by OpenSSL build
sudo cpan -i Text::Template
shell: bash

- name: Build OpenSSL
if: steps.cache-dependencies.outputs.cache-hit != 'true'
env:
CXX: /usr/bin/x86_64-w64-mingw32-c++
CC: /usr/bin/x86_64-w64-mingw32-gcc
RC: /usr/bin/x86_64-w64-mingw32-windres
working-directory: openssl/openssl-${{env.CK_OPENSSL_VERSION}}
run: |
mkdir -p openssl
cd openssl
wget https://github.com/openssl/openssl/releases/download/openssl-${{env.OPENSSL_VERSION}}/openssl-${{env.OPENSSL_VERSION}}.tar.gz
tar zxf openssl-${{env.OPENSSL_VERSION}}.tar.gz
rm openssl-${{env.OPENSSL_VERSION}}.tar.gz
cd openssl-${{env.OPENSSL_VERSION}}
perl Configure mingw64
make depend
make -j 2
shell: bash

- name: Build
shell: bash
Expand All @@ -2007,7 +2016,7 @@ jobs:
CC: /usr/bin/x86_64-w64-mingw32-gcc
run: |
cd kermit/k95
make -j 2 RC=/usr/bin/x86_64-w64-mingw32-windres OPENSSL=../../openssl/openssl-${{env.OPENSSL_VERSION}}/
make -j 2 RC=/usr/bin/x86_64-w64-mingw32-windres OPENSSL=../../openssl/openssl-${{env.CK_OPENSSL_VERSION}}/
- name: Make Distribution
shell: bash
run: |
Expand Down

0 comments on commit 329b356

Please sign in to comment.