From a937dfc897c101f028dd76539c890f33d99662f0 Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Fri, 9 Dec 2022 04:30:43 -0800 Subject: [PATCH] Don't include MSVC redist MSM in Windows MSI package (#4339) * Create Windows MSI package as part of GHA sanity build * Don't include MSVC redist MSM in Windows MSI package This approach is deprecated, and was probably never entirely correct to begin with. --- .github/workflows/actions.yml | 19 +++++++++++++++---- dist/msi/CMakeLists.txt | 17 +++++++++++++++-- dist/msi/Transmission.wxs | 14 ++++++++++---- dist/msi/TransmissionConfig.wxi.in | 4 ++++ dist/msi/UtilityFunctions.cmake | 10 ---------- 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index a925ef1d5..1c5de1a14 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -14,6 +14,7 @@ jobs: outputs: make-cli: ${{ steps.check-main-push.outputs.is-main-push == '1' || steps.check-diffs.outputs.cli-changed == '1' }} make-daemon: ${{ steps.check-main-push.outputs.is-main-push == '1' || steps.check-diffs.outputs.daemon-changed == '1' }} + make-dist: ${{ steps.check-main-push.outputs.is-main-push == '1' || steps.check-diffs.outputs.dist-changed == '1' }} make-docs: ${{ steps.check-main-push.outputs.is-main-push == '1' || steps.check-diffs.outputs.docs-changed == '1' }} make-gtk: ${{ steps.check-main-push.outputs.is-main-push == '1' || steps.check-diffs.outputs.gtk-changed == '1' }} make-mac: ${{ steps.check-main-push.outputs.is-main-push == '1' || steps.check-diffs.outputs.mac-changed == '1' }} @@ -56,6 +57,7 @@ jobs: get_changes any-code CMakeLists.txt Transmission.xcodeproj libtransmission cli daemon gtk macosx qt utils tests web third-party get_changes our-code CMakeLists.txt Transmission.xcodeproj libtransmission cli daemon gtk macosx qt utils tests web get_changes daemon CMakeLists.txt Transmission.xcodeproj third-party libtransmission daemon + get_changes dist dist get_changes docs docs get_changes gtk CMakeLists.txt third-party libtransmission gtk get_changes mac CMakeLists.txt Transmission.xcodeproj third-party libtransmission macosx Transmission.xcodeproj @@ -300,7 +302,7 @@ jobs: windows: needs: [ what-to-make ] runs-on: windows-2022 - if: ${{ needs.what-to-make.outputs.make-cli == 'true' || needs.what-to-make.outputs.make-daemon == 'true' || needs.what-to-make.outputs.make-qt == 'true' || needs.what-to-make.outputs.make-tests == 'true' || needs.what-to-make.outputs.make-utils == 'true' }} + if: ${{ needs.what-to-make.outputs.make-cli == 'true' || needs.what-to-make.outputs.make-daemon == 'true' || needs.what-to-make.outputs.make-dist == 'true' || needs.what-to-make.outputs.make-qt == 'true' || needs.what-to-make.outputs.make-tests == 'true' || needs.what-to-make.outputs.make-utils == 'true' }} strategy: fail-fast: false matrix: @@ -322,6 +324,7 @@ jobs: choco uninstall ` openssl.light (Join-Path $Env:ProgramFiles NASM) | Out-File $Env:GITHUB_PATH -Append + (Join-Path ${Env:ProgramFiles(x86)} 'WiX Toolset v3.11' bin) | Out-File $Env:GITHUB_PATH -Append Install-Module -Name Pscx -RequiredVersion 4.0.0-beta4 -AllowPrerelease -Force - name: Get Source @@ -365,12 +368,12 @@ jobs: -DCMAKE_INSTALL_PREFIX=pfx ` -DCMAKE_PREFIX_PATH="${Env:DepsPrefix}" ` -DENABLE_CLI=${{ (needs.what-to-make.outputs.make-cli == 'true') && 'ON' || 'OFF' }} ` - -DENABLE_DAEMON=${{ (needs.what-to-make.outputs.make-daemon == 'true') && 'ON' || 'OFF' }} ` + -DENABLE_DAEMON=${{ (needs.what-to-make.outputs.make-daemon == 'true' || needs.what-to-make.outputs.make-dist == 'true') && 'ON' || 'OFF' }} ` -DENABLE_GTK=OFF ` -DENABLE_MAC=OFF ` - -DENABLE_QT=${{ (needs.what-to-make.outputs.make-qt == 'true') && 'ON' || 'OFF' }} ` + -DENABLE_QT=${{ (needs.what-to-make.outputs.make-dist == 'true' || needs.what-to-make.outputs.make-qt == 'true') && 'ON' || 'OFF' }} ` -DENABLE_TESTS=ON ` - -DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} ` + -DENABLE_UTILS=${{ (needs.what-to-make.outputs.make-dist == 'true' || needs.what-to-make.outputs.make-utils == 'true') && 'ON' || 'OFF' }} ` -DENABLE_WEB=OFF ` -DRUN_CLANG_TIDY=OFF - name: Make @@ -382,10 +385,18 @@ jobs: run: cmake -E chdir obj ctest --build-config RelWithDebInfo --output-on-failure --timeout 600 - name: Install run: cmake --build obj --config RelWithDebInfo --target install + - name: Package + run: | + Import-VisualStudioVars -VisualStudioVersion 2022 -Architecture ${{ matrix.arch }} + cmake --build obj --config RelWithDebInfo --target pack-msi - uses: actions/upload-artifact@v3 with: name: binaries-${{ github.job }}-${{ matrix.arch }} path: pfx/**/* + - uses: actions/upload-artifact@v3 + with: + name: binaries-${{ github.job }}-${{ matrix.arch }}-msi + path: obj/dist/msi/*.msi make-source-tarball: runs-on: ubuntu-22.04 diff --git a/dist/msi/CMakeLists.txt b/dist/msi/CMakeLists.txt index 722e9eb91..bab65c14f 100644 --- a/dist/msi/CMakeLists.txt +++ b/dist/msi/CMakeLists.txt @@ -12,6 +12,21 @@ set(VERSION "${TR_USER_AGENT_PREFIX}") set(VERSION_MSI "${TR_VERSION_MAJOR}.${TR_VERSION_MINOR}.${TR_VERSION_PATCH}") set(VERSION_FULL "${TR_USER_AGENT_PREFIX} (${TR_VCS_REVISION})") +if(MSVC_TOOLSET_VERSION MATCHES "^([0-9]+)([0-9])$") + set(MSVC_TOOLSET_VERSION_MAJOR ${CMAKE_MATCH_1}) + set(MSVC_TOOLSET_VERSION_MINOR ${CMAKE_MATCH_2}) +endif() + +if(MSVC_TOOLSET_VERSION EQUAL 143) + set(MSVS_VERSION 17) +elseif(MSVC_TOOLSET_VERSION EQUAL 142) + set(MSVS_VERSION 16) +elseif(MSVC_TOOLSET_VERSION EQUAL 141) + set(MSVS_VERSION 15) +else() + message(FATAL_ERROR "Unsupported MSVC_TOOLSET_VERSION value: '${MSVC_TOOLSET_VERSION}'") +endif() + set(MSI_FILENAME_VERSION "${TR_SEMVER}") if(NOT TR_STABLE_RELEASE AND NOT "${TR_VCS_REVISION}" STREQUAL "") string(APPEND MSI_FILENAME_VERSION "+r${TR_VCS_REVISION}") @@ -25,8 +40,6 @@ if(NOT TR_QT_DIR) set(TR_QT_DIR "$/..") endif() -find_msvc_crt_msm(TR_MSVC_CRT_MSM_FILE) - set(TR_OPENSSL_ARCH) if(ARCH STREQUAL "x64") set(TR_OPENSSL_ARCH "-x64") diff --git a/dist/msi/Transmission.wxs b/dist/msi/Transmission.wxs index cf8f2cceb..b889e74a4 100644 --- a/dist/msi/Transmission.wxs +++ b/dist/msi/Transmission.wxs @@ -38,11 +38,20 @@ UCRTINSTALLED + + + + + + + + VCREDISTINSTALLED = "#1" AND VCREDISTVERSIONMINOR >= "#$(var.VcVerMinor)0" + + - @@ -53,9 +62,6 @@ - - - diff --git a/dist/msi/TransmissionConfig.wxi.in b/dist/msi/TransmissionConfig.wxi.in index f7a705faa..9e59cb4e1 100644 --- a/dist/msi/TransmissionConfig.wxi.in +++ b/dist/msi/TransmissionConfig.wxi.in @@ -5,4 +5,8 @@ + + + + diff --git a/dist/msi/UtilityFunctions.cmake b/dist/msi/UtilityFunctions.cmake index 4b5f0c0c2..0bcc382fb 100644 --- a/dist/msi/UtilityFunctions.cmake +++ b/dist/msi/UtilityFunctions.cmake @@ -7,16 +7,6 @@ function(find_msvc_crt_msm OUTPUT_VAR) message(STATUS "Looking for a CRT MSM:") - if(NOT MSVC_TOOLSET_VERSION) - if(MSVC_VERSION GREATER_EQUAL 1920) - set(MSVC_TOOLSET_VERSION 142) - elseif(MSVC_VERSION GREATER_EQUAL 1910) - set(MSVC_TOOLSET_VERSION 141) - elseif(MSVC_VERSION GREATER_EQUAL 1900) - set(MSVC_TOOLSET_VERSION 140) - endif() - endif() - set(MSM_FILE "Microsoft_VC${MSVC_TOOLSET_VERSION}_CRT_${ARCH}.msm") message(STATUS " * File name: ${MSM_FILE}")