Skip to content

Commit 3495a25

Browse files
committed
fix: openssl install
1 parent 43a476b commit 3495a25

3 files changed

Lines changed: 119 additions & 143 deletions

File tree

.github/workflows/windows-msvc.yml

Lines changed: 113 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,24 @@ jobs:
1313
os: windows-2022
1414
build_type: Release
1515
compiler_type: msvc2019_64
16+
build_arch: x64
1617
msvc_arch: x64
1718
qt_arch: win64_msvc2019_64
1819
qt_version: 5.15.2
1920
qt_target: desktop
20-
openssl_arch: x64
2121
openssl_root: C:\Program Files\OpenSSL-Win64
22-
bonjour_file: BonjourPSSetup.exe
23-
vcredist_file: vc_redist.x64.exe
24-
artifact_suffix: win64
2522
cmake_gen: Visual Studio 17 2022
26-
vcpkg_triplet: x64-windows
23+
vcpkg_triplet: x64-windows-release
2724
- name: win32_msvc
2825
os: windows-2022
2926
build_type: Release
3027
compiler_type: msvc2019
28+
build_arch: x86
3129
msvc_arch: Win32
3230
qt_arch: win32_msvc2019
3331
qt_version: 5.15.2
3432
qt_target: desktop
35-
openssl_arch: x86
3633
openssl_root: C:\Program Files (x86)\OpenSSL-Win32
37-
bonjour_file: BonjourPSSetup.exe
38-
vcredist_file: vc_redist.x86.exe
39-
artifact_suffix: win32
4034
cmake_gen: Visual Studio 17 2022
4135
vcpkg_triplet: x86-windows
4236
runs-on: ${{ matrix.os }}
@@ -49,95 +43,57 @@ jobs:
4943
OPENSSL_CRYPTO_LIBRARY: ${{ matrix.openssl_root }}\lib
5044
steps:
5145
# Cache OpenSSL to speed up builds
52-
- name: '⚙️ Cache OpenSSL'
53-
id: cache-openssl
54-
uses: actions/cache@v3
55-
with:
56-
path: ${{ matrix.openssl_root }}
57-
key: Windows-OpenSSL-${{ matrix.openssl_arch }}-3.2.6
58-
59-
# Install OpenSSL 3.2.6 for both x86 and x64 architectures
60-
- name: Install OpenSSL ${{ matrix.openssl_arch }}
61-
if: steps.cache-openssl.outputs.cache-hit != 'true'
62-
run: |
63-
choco install openssl --version 3.2.6 --allow-downgrade -y
64-
# shell: pwsh
65-
# run: |
66-
# $arch = "${{ matrix.openssl_arch }}"
67-
# $version = "3_2_6"
68-
# $opensslUrl = if ($arch -eq "x64") {
69-
# "https://slproweb.com/download/Win64OpenSSL-${version}.msi"
70-
# } else {
71-
# "https://slproweb.com/download/Win32OpenSSL-${version}.msi"
72-
# }
73-
# $installerPath = "$env:TEMP\OpenSSL-${version}_${arch}.msi"
74-
# $installDir = "${{ matrix.openssl_root }}"
75-
76-
# Write-Host "Downloading OpenSSL ${version} for ${arch}..."
77-
# Write-Host "URL: $opensslUrl"
78-
# Invoke-WebRequest -Uri $opensslUrl -OutFile $installerPath -UseBasicParsing
79-
80-
# Write-Host "Downloaded file size: $(Get-Item $installerPath).Length bytes"
81-
82-
# Write-Host "Installing OpenSSL ${version} for ${arch}..."
83-
# Write-Host "Target directory: $installDir"
84-
85-
# # Create target directory if it doesn't exist
86-
# if (-not (Test-Path $installDir)) {
87-
# New-Item -ItemType Directory -Path $installDir -Force | Out-Null
88-
# Write-Host "Created directory: $installDir"
89-
# }
90-
91-
# $installArgs = @(
92-
# "/i",
93-
# "`"$installerPath`"",
94-
# "/quiet",
95-
# "INSTALLDIR=`"$installDir`"",
96-
# "/norestart",
97-
# "/L*v", # Enable verbose logging
98-
# "`"$env:TEMP\openssl_install.log`""
99-
# )
100-
101-
# Write-Host "Running: msiexec $($installArgs -join ' ')"
102-
# $process = Start-Process msiexec -ArgumentList $installArgs -Wait -PassThru
103-
104-
# Write-Host "MSI install exit code: $($process.ExitCode)"
105-
106-
# # Wait for installation to complete
107-
# Start-Sleep -Seconds 5
108-
109-
# # Check if installation succeeded
110-
# $opensslExe = "$installDir\bin\openssl.exe"
111-
# Write-Host "Checking for OpenSSL at: $opensslExe"
112-
113-
# if (Test-Path $opensslExe) {
114-
# Write-Host "✓ OpenSSL installed successfully"
115-
# & $opensslExe version
116-
# } else {
117-
# Write-Host "✗ OpenSSL not found at expected location"
118-
# Write-Host "Listing install directory contents:"
119-
# Get-ChildItem -Path $installDir -Recurse -ErrorAction SilentlyContinue | Select-Object -First 20 FullName
120-
# Write-Host "Install log (last 50 lines):"
121-
# Get-Content "$env:TEMP\openssl_install.log" -Tail 50 -ErrorAction SilentlyContinue
122-
# exit 1
123-
# }
46+
# - name: '⚙️ Cache OpenSSL'
47+
# id: cache-openssl
48+
# uses: actions/cache@v3
49+
# with:
50+
# path: ${{ matrix.openssl_root }}
51+
# key: Windows-OpenSSL-${{ matrix.build_arch }}-3.2.6
52+
53+
# # Install OpenSSL 3.2.6 for both x86 and x64 architectures
54+
# - name: Install OpenSSL ${{ matrix.build_arch }}
55+
# shell: pwsh
56+
# run: |
57+
# $arch = "${{ matrix.build_arch }}"
58+
# $version = "3_2_6"
59+
# $opensslUrl = if ($arch -eq "x64") {
60+
# "https://slproweb.com/download/Win64OpenSSL-${version}.msi"
61+
# } else {
62+
# "https://slproweb.com/download/Win32OpenSSL-${version}.msi"
63+
# }
64+
# $installerPath = "$env:TEMP\OpenSSL-${version}_${arch}.msi"
65+
# $installDir = "${{ matrix.openssl_root }}"
66+
67+
# # 下载安装包
68+
# Invoke-WebRequest -Uri $opensslUrl -OutFile $installerPath
69+
70+
# # 静默安装到指定目录并等待完成
71+
# Start-Process msiexec.exe -ArgumentList "/i $installerPath /quiet /qn INSTALLDIR=$installDir"
72+
73+
# # 等待安装完全完成
74+
# Start-Sleep -Seconds 10
75+
76+
# - name: Verify OpenSSL installation
77+
# run: |
78+
# openssl version
79+
# echo "OPENSSL_ROOT_DIR is: $env:OPENSSL_ROOT_DIR"
12480

125-
# Write-Host "OpenSSL ${version} (${arch}) installation completed"
12681

127-
128-
- name: Verify OpenSSL cached
129-
if: steps.cache-openssl.outputs.cache-hit == 'true'
130-
shell: pwsh
131-
run: |
132-
Write-Host "Using cached OpenSSL:"
133-
& "${{ matrix.openssl_root }}\bin\openssl.exe" version
82+
# - name: Verify OpenSSL cached
83+
# if: steps.cache-openssl.outputs.cache-hit == 'true'
84+
# shell: pwsh
85+
# run: |
86+
# Write-Host "Using cached OpenSSL:"
87+
# & "${{ matrix.openssl_root }}\bin\openssl.exe" version
13488

13589
- name: '⚙️ Cache Qt'
13690
id: cache-qt
13791
uses: actions/cache@v3
13892
with:
139-
path: ..\Qt
140-
key: Windows-QtCache-${{ env.QT_VERSION }}
93+
path: ${{ env.HOME }}/Qt
94+
key: Windows-${{ matrix.os }}-Qt-${{ env.QT_VERSION }}-${{ matrix.qt_arch }}
95+
restore-keys: |
96+
Windows-${{ matrix.os }}-Qt-${{ env.QT_VERSION }}-
14197
14298
- name: Install Qt ${{ env.QT_VERSION }}
14399
uses: jurplel/install-qt-action@v3
@@ -147,28 +103,8 @@ jobs:
147103
target: ${{ matrix.qt_target }}
148104
arch: ${{ matrix.qt_arch }}
149105
# modules: 'qt5compat'
150-
# cached: 'false'
151106
cached: ${{ steps.cache-qt.outputs.cache-hit }}
152107

153-
- name: '⚙️ Cache vcpkg'
154-
id: cache-vcpkg
155-
uses: actions/cache@v3
156-
with:
157-
path: |
158-
${{ github.workspace }}/vcpkg
159-
~/.vcpkg
160-
key: Windows-vcpkg-${{ matrix.vcpkg_triplet }}-${{ hashFiles('**/vcpkg.json') }}
161-
restore-keys: |
162-
Windows-vcpkg-${{ matrix.vcpkg_triplet }}-
163-
164-
- name: Install vcpkg
165-
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
166-
shell: pwsh
167-
run: |
168-
git clone https://github.com/Microsoft/vcpkg.git
169-
.\vcpkg\bootstrap-vcpkg.bat -disableMetrics
170-
echo "VCPKG_INSTALLED_DIR=$env:GITHUB_WORKSPACE\vcpkg" >> $env:GITHUB_ENV
171-
172108
# Use CMake 3.31.x for better OpenSSL 3.x compatibility while supporting VS 2019
173109
- name: Setup cmake
174110
uses: lukka/get-cmake@latest
@@ -182,14 +118,23 @@ jobs:
182118
path: source
183119
fetch-depth: 0
184120

121+
- name: Build and cache vcpkg
122+
id: vcpkg
123+
uses: johnwason/vcpkg-action@v7
124+
with:
125+
pkgs: zlib openssl
126+
# manifest-dir: ${{ github.workspace }}\source
127+
extra-args: --classic --host-triplet=${{matrix.vcpkg_triplet}}
128+
triplet: ${{matrix.vcpkg_triplet}}
129+
token: ${{ github.token }}
130+
revision: master
131+
185132
- name: msvc-build
186133
id: build
187134
shell: cmd
188135
env:
136+
build_arch: ${{ matrix.build_arch }}
189137
vc_arch: ${{ matrix.msvc_arch }}
190-
openssl_arch: ${{ matrix.openssl_arch }}
191-
bonjour_file: ${{ matrix.bonjour_file }}
192-
vcredist_file: ${{ matrix.vcredist_file }}
193138
cmake_gen: ${{ matrix.cmake_gen }}
194139
COO_PROJECT: dde-cooperation
195140
DT_PROJECT: data-transfer
@@ -202,7 +147,7 @@ jobs:
202147
exit /b 1
203148
)
204149
echo Using Visual Studio 2022 at: %VS2022_PATH%
205-
call "%VS2022_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %vc_arch%
150+
call "%VS2022_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %build_arch%
206151
207152
REM Initialize OpenSSL environment (based on start.bat logic)
208153
echo ============== OpenSSL Initialization ==============
@@ -234,28 +179,26 @@ jobs:
234179
echo Using vcpkg triplet: ${{ matrix.vcpkg_triplet }}
235180
echo Vcpkg toolchain file: %GITHUB_WORKSPACE%\vcpkg\scripts\buildsystems\vcpkg.cmake
236181
237-
if exist "%GITHUB_WORKSPACE%\source\CMakeLists.txt" (
238-
echo Found CMakeLists.txt in source directory
239-
cmake -G "%cmake_gen%" -A %vc_arch% -D CMAKE_BUILD_TYPE=%BUILD_TYPE% ^
240-
-D CMAKE_TOOLCHAIN_FILE="%GITHUB_WORKSPACE%\vcpkg\scripts\buildsystems\vcpkg.cmake" ^
241-
-D VCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} ^
242-
-D APP_VERSION="${{ github.ref_name }}" "%GITHUB_WORKSPACE%\source"
243-
) else (
244-
echo ERROR: CMakeLists.txt not found in source directory
245-
dir "%GITHUB_WORKSPACE%\source"
246-
exit /b 1
247-
)
182+
cmake -G "%cmake_gen%" -A %vc_arch% -D CMAKE_BUILD_TYPE=%BUILD_TYPE% ^
183+
-D CMAKE_TOOLCHAIN_FILE="%GITHUB_WORKSPACE%\vcpkg\scripts\buildsystems\vcpkg.cmake" ^
184+
-D VCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} ^
185+
-D APP_VERSION="${{ github.ref_name }}" "%GITHUB_WORKSPACE%\source"
186+
248187
cmake --build . --config %BUILD_TYPE%
249188
250189
echo ------------copy files to output directory------------
251190
252191
REM Set architecture-specific file names
253-
if "%openssl_arch%"=="x86" (
192+
if "%build_arch%"=="x86" (
254193
set OPENSSL_CRYPTO=libcrypto-3.dll
255194
set OPENSSL_SSL=libssl-3.dll
195+
set BONJOUR_FILE=BonjourPSSetup.exe
196+
set VCREDIST_FILE=vc_redist.x86.exe
256197
) else (
257198
set OPENSSL_CRYPTO=libcrypto-3-x64.dll
258199
set OPENSSL_SSL=libssl-3-x64.dll
200+
set BONJOUR_FILE=BonjourPSSetup.exe
201+
set VCREDIST_FILE=vc_redist.x64.exe
259202
)
260203
261204
if exist output\%BUILD_TYPE% (
@@ -266,29 +209,29 @@ jobs:
266209
copy "%OPENSSL_ROOT_DIR%\%OPENSSL_SSL%" output\%COO_PROJECT%\%BUILD_TYPE%\ > NUL
267210
268211
mkdir installer-inno\%COO_PROJECT%
269-
copy "%BONJOUR_SDK%\%bonjour_file%" installer-inno\%COO_PROJECT%\ > NUL
212+
copy "%BONJOUR_SDK%\%BONJOUR_FILE%" installer-inno\%COO_PROJECT%\ > NUL
270213
REM Copy VC Redist from dependencies directory if it exists there
271-
if exist "%BONJOUR_SDK%\%vcredist_file%" (
272-
copy "%BONJOUR_SDK%\%vcredist_file%" installer-inno\%COO_PROJECT%\ > NUL
214+
if exist "%BONJOUR_SDK%\%VCREDIST_FILE%" (
215+
copy "%BONJOUR_SDK%\%VCREDIST_FILE%" installer-inno\%COO_PROJECT%\ > NUL
273216
)
274217
REM If VC Redist was copied to output directory, move it
275-
if exist output\%COO_PROJECT%\%BUILD_TYPE%\%vcredist_file% (
276-
move output\%COO_PROJECT%\%BUILD_TYPE%\%vcredist_file% installer-inno\%COO_PROJECT%\ > NUL
218+
if exist output\%COO_PROJECT%\%BUILD_TYPE%\%VCREDIST_FILE% (
219+
move output\%COO_PROJECT%\%BUILD_TYPE%\%VCREDIST_FILE% installer-inno\%COO_PROJECT%\ > NUL
277220
)
278221
279222
copy output\%BUILD_TYPE%\quazip* output\%DT_PROJECT%\%BUILD_TYPE%\ > NUL
280223
281224
copy "%OPENSSL_ROOT_DIR%\%OPENSSL_CRYPTO%" output\%DT_PROJECT%\%BUILD_TYPE%\ > NUL
282225
copy "%OPENSSL_ROOT_DIR%\%OPENSSL_SSL%" output\%DT_PROJECT%\%BUILD_TYPE%\ > NUL
283226
mkdir installer-inno\%DT_PROJECT%
284-
copy "%BONJOUR_SDK%\%bonjour_file%" installer-inno\%DT_PROJECT%\ > NUL
227+
copy "%BONJOUR_SDK%\%BONJOUR_FILE%" installer-inno\%DT_PROJECT%\ > NUL
285228
REM Copy VC Redist from dependencies directory if it exists there
286-
if exist "%BONJOUR_SDK%\%vcredist_file%" (
287-
copy "%BONJOUR_SDK%\%vcredist_file%" installer-inno\%DT_PROJECT%\ > NUL
229+
if exist "%BONJOUR_SDK%\%VCREDIST_FILE%" (
230+
copy "%BONJOUR_SDK%\%VCREDIST_FILE%" installer-inno\%DT_PROJECT%\ > NUL
288231
)
289232
REM If VC Redist was copied to output directory, move it
290-
if exist output\%DT_PROJECT%\%BUILD_TYPE%\%vcredist_file% (
291-
move output\%DT_PROJECT%\%BUILD_TYPE%\%vcredist_file% installer-inno\%DT_PROJECT%\ > NUL
233+
if exist output\%DT_PROJECT%\%BUILD_TYPE%\%VCREDIST_FILE% (
234+
move output\%DT_PROJECT%\%BUILD_TYPE%\%VCREDIST_FILE% installer-inno\%DT_PROJECT%\ > NUL
292235
)
293236
) else (
294237
echo Remember to copy supporting binaries and configuration files!
@@ -307,11 +250,40 @@ jobs:
307250
filepath: build/dde-cooperation-setup.iss
308251

309252
- name: Make Installer Directories
253+
shell: pwsh
310254
run: |
311-
move build/installer-inno/deepin-cooperation-* build/installer-inno/dde-cooperation/ > NUL
312-
powershell -Command "Compress-Archive -Path build/installer-inno/dde-cooperation/* -DestinationPath build/installer-inno/dde-cooperation.zip"
313-
move build/installer-inno/deepin-datatransfer-* build/installer-inno/data-transfer/ > NUL
314-
powershell -Command "Compress-Archive -Path build/installer-inno/data-transfer/* -DestinationPath build/installer-inno/deepin-data-transfer.zip"
255+
$archSuffix = "${{ matrix.build_arch }}"
256+
$cooperationDir = "build/installer-inno/dde-cooperation"
257+
$transferDir = "build/installer-inno/data-transfer"
258+
$cooperationZip = "build/installer-inno/dde-cooperation-${archSuffix}.zip"
259+
$transferZip = "build/installer-inno/deepin-data-transfer-${archSuffix}.zip"
260+
261+
# Move cooperation files
262+
if (Test-Path "build/installer-inno/deepin-cooperation-*") {
263+
Move-Item -Path "build/installer-inno/deepin-cooperation-*" -Destination $cooperationDir -Force
264+
Write-Host "Moved cooperation files to: $cooperationDir"
265+
}
266+
267+
# Move data-transfer files
268+
if (Test-Path "build/installer-inno/deepin-datatransfer-*") {
269+
Move-Item -Path "build/installer-inno/deepin-datatransfer-*" -Destination $transferDir -Force
270+
Write-Host "Moved data-transfer files to: $transferDir"
271+
}
272+
273+
# Create archives
274+
if (Test-Path $cooperationDir) {
275+
Compress-Archive -Path "$cooperationDir/*" -DestinationPath $cooperationZip -Force
276+
Write-Host "Created: $cooperationZip"
277+
}
278+
279+
if (Test-Path $transferDir) {
280+
Compress-Archive -Path "$transferDir/*" -DestinationPath $transferZip -Force
281+
Write-Host "Created: $transferZip"
282+
}
283+
284+
# List created files
285+
Write-Host "Installer archives:"
286+
Get-ChildItem -Path "build/installer-inno/*.zip" | Select-Object Name, Length, LastWriteTime
315287
316288
- name: Create Release
317289
uses: softprops/action-gh-release@v1

cmake/vcpkg.json.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
44
"name": "dde-cooperation",
55
"version": "@APP_VERSION@",
6+
"builtin-baseline": "74ec888e385d189b42d6b398d0bbaa6f1b1d3b0e",
67
"dependencies": [
7-
"zlib"
8+
{
9+
"name": "zlib"
10+
}
811
]
912
}

dist/inno/setup.iss.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
#else
1717
#define RuntimeDepend "vc_redist.x86.exe"
1818
#define BonjourDepend "BonjourPSSetup.exe"
19-
#define ArchitectureFlags "ArchitecturesAllowed=x86"
19+
; x86 packages can install on both x86 and x64 systems (via WOW64)
20+
#define ArchitectureFlags ""
2021
#endif
2122

2223
[Setup]

0 commit comments

Comments
 (0)