Skip to content

Commit

Permalink
fix : baking the redist into the installer breaks GPL, download at ru…
Browse files Browse the repository at this point in the history
…ntime instead

Signed-off-by: Rachel Powers <[email protected]>
  • Loading branch information
Ryex committed Sep 28, 2024
1 parent 00f4221 commit ed15a28
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ jobs:
- name: Package (Windows, installer)
if: runner.os == 'Windows'
run: |
New-Item -Name NSISPlugins -ItemType Directory
Invoke-Webrequest https://github.com/negrutiu/nsis-nscurl/releases/latest/download/NScurl.zip -OutFile NSISPlugins\NScurl.zip
Expand-Archive -Path NSISPlugins\NScurl.zip -DestinationPath NSISPlugins\NSIScurl
cd ${{ env.INSTALL_DIR }}
makensis -NOCD "${{ github.workspace }}/${{ env.BUILD_DIR }}/program_info/win_install.nsi"
Expand Down
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,6 @@ include(ECMQtDeclareLoggingCategory)
####################################### Program Info #######################################

set(Launcher_APP_BINARY_NAME "prismlauncher" CACHE STRING "Name of the Launcher binary")
if(MSVC)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP true)
include(InstallRequiredSystemLibraries)
endif()
add_subdirectory(program_info)

####################################### Install layout #######################################
Expand All @@ -376,9 +372,6 @@ endif()
if(NOT (UNIX AND APPLE))
# Install "portable.txt" if selected component is "portable"
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${Launcher_Portable_File}" DESTINATION "." COMPONENT portable EXCLUDE_FROM_ALL)
if (MSVC)
install(FILES "${MSVC_REDIST_DIR}/vc_redist.x64.exe" DESTINATION "vc_redist/." COMPONENT portable EXCLUDE_FROM_ALL )
endif()
endif()

if(UNIX AND APPLE)
Expand Down
25 changes: 15 additions & 10 deletions program_info/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,21 @@ configure_file(prismlauncher.manifest.in prismlauncher.manifest @ONLY)
configure_file(prismlauncher.ico prismlauncher.ico COPYONLY)

if(MSVC)
include(InstallRequiredSystemLibraries)
file(TO_NATIVE_PATH ${MSVC_REDIST_DIR} Native_MSVC_REDIST_DIR)
set(Launcher_MSVC_Redist_NSIS_Section "\
Section \"Visual Studio Runtime\"
SetOutPath \"$INSTDIR\\vc_redist\"
File \"${Native_MSVC_REDIST_DIR}\\vc_redist.x64.exe\"
ExecWait \"$INSTDIR\\vc_redist\\vc_redist.x64.exe /install /passive /norestart\"
; Delete \"$INSTDIR\\vc_redist\\vc_redist.x64.exe\"
SectionEnd\
")
set(Launcher_MSVC_Redist_NSIS_Section [=[
!ifdef haveNSIScurl
Section "Visual Studio Runtime"
DetailPrint 'Downloading Microsoft Visual C++ Redistributable...'
NScurl::http GET "https://aka.ms/vs/17/release/vc_redist.x64.exe" "$INSTDIR\vc_redist\vc_redist.x64.exe" /INSIST /CANCEL /Zone.Identifier /END
Pop $0
${If} $0 == "OK"
DetailPrint "Download successful"
ExecWait "$INSTDIR\vc_redist\vc_redist.x64.exe /install /passive /norestart\"
${Else}
DetailPrint "Download failed with error $0"
${EndIf}
SectionEnd
!endif
]=])
endif()

configure_file(win_install.nsi.in win_install.nsi @ONLY)
Expand Down
23 changes: 23 additions & 0 deletions program_info/win_install.nsi.in
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "@Launcher_Copyright@"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "@Launcher_VERSION_NAME4@"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "@Launcher_VERSION_NAME4@"

;--------------------------------
; Conditional comp with file exist

!macro CompileTimeIfFileExist path define
!tempfile tmpinc
!system 'IF EXIST "${path}" echo !define ${define} > "${tmpinc}"'
!include "${tmpinc}"
!delfile "${tmpinc}"
!undef tmpinc
!macroend

;--------------------------------
; Shell Associate Macros
Expand Down Expand Up @@ -336,6 +346,19 @@ Section "" UninstallPrevious

SectionEnd

;------------------------------------
; include nice plugins

; NSIScurl - curl in NSIS
; used for MSVS redist download
; extract to ../NSISPlugins/NSIScurl
; https://github.com/negrutiu/nsis-nscurl/releases/latest/download/NScurl.zip
!insertmacro CompileTimeIfFileExist "../NSISPlugins/NSIScurl/Plugins/" haveNSIScurl
!ifdef haveNSIScurl
!AddPluginDir /x86-unicode "../NSISPlugins/NSIScurl/Plugins/x86-unicode"
!AddPluginDir /x86-ansi "../NSISPlugins/NSIScurl/Plugins/x86-ansi"
!AddPluginDir /amd64-unicode "../NSISPlugins/NSIScurl/Plugins/amd64-unicode"
!endif

;------------------------------------

Expand Down

0 comments on commit ed15a28

Please sign in to comment.