Add Linux build script

This commit is contained in:
Calyx Hikari 2025-11-15 23:45:48 +08:00
parent 7117d24dc0
commit 21d69a67cd
4 changed files with 425 additions and 0 deletions

111
generate.sh Normal file
View file

@ -0,0 +1,111 @@
#!/bin/bash
shopt -s nocasematch
cat << EOF > downloadLink.txt
https://get.msvc.win/favicon.ico
out=favicon.ico
https://download.microsoft.com/download/8/b/4/8b42259f-5d70-43f4-ac2e-4b208fd8d66a/vcredist_x86.exe
out=vcredist_2005_x86.exe
https://download.microsoft.com/download/8/b/4/8b42259f-5d70-43f4-ac2e-4b208fd8d66a/vcredist_x64.exe
out=vcredist_2005_x64.exe
https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe
out=vcredist_2008_x86.exe
https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x64.exe
out=vcredist_2008_x64.exe
https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe
out=vcredist_2010_x86.exe
https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe
out=vcredist_2010_x64.exe
https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe
out=vcredist_2012_x86.exe
https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe
out=vcredist_2012_x64.exe
https://aka.ms/highdpimfc2013x86enu
out=vcredist_2013_x86.exe
https://aka.ms/highdpimfc2013x64enu
out=vcredist_2013_x64.exe
EOF
if [[ $1 = "win7" || $1 = "win8" ]]; then
script=https://get.msvc.win/install_AtLeastWin7.nsi
cat << EOF >> downloadLink.txt
https://aka.ms/vs/17/release/vc_redist.x86.exe
out=vcredist_v14_nt63_x86.exe
https://aka.ms/vs/17/release/vc_redist.x64.exe
out=vcredist_v14_nt63_x64.exe
https://aka.ms/vc14/vc_redist.x86.exe
out=vcredist_v14_latest_x86.exe
https://aka.ms/vc14/vc_redist.x64.exe
out=vcredist_v14_latest_x64.exe
${script}
out=installer.nsi
EOF
elif [[ $1 = "win10" ]]; then
script=https://get.msvc.win/install_AtLeastWin10.nsi
cat << EOF >> downloadLink.txt
https://aka.ms/vc14/vc_redist.x86.exe
out=vcredist_v14_latest_x86.exe
https://aka.ms/vc14/vc_redist.x64.exe
out=vcredist_v14_latest_x64.exe
${script}
out=installer.nsi
EOF
else
script=https://get.msvc.win/install_AllOS.nsi
cat << EOF >> downloadLink.txt
https://download.visualstudio.microsoft.com/download/pr/566435ac-4e1c-434b-b93f-aecc71e8cffc/0D59EC7FDBF05DE813736BF875CEA5C894FFF4769F60E32E87BD48406BBF0A3A/VC_redist.x86.exe
out=vcredist_v14_nt52_x86.exe
https://download.visualstudio.microsoft.com/download/pr/566435ac-4e1c-434b-b93f-aecc71e8cffc/B75590149FA14B37997C35724BC93776F67E08BFF9BD5A69FACBF41B3846D084/VC_redist.x64.exe
out=vcredist_v14_nt52_x64.exe
https://download.visualstudio.microsoft.com/download/pr/ed95ef9e-da02-4735-9064-bd1f7f69b6ed/CF92A10C62FFAB83B4A2168F5F9A05E5588023890B5C0CC7BA89ED71DA527B0F/VC_redist.x86.exe
out=vcredist_v14_nt60_x86.exe
https://download.visualstudio.microsoft.com/download/pr/ed95ef9e-da02-4735-9064-bd1f7f69b6ed/CE6593A1520591E7DEA2B93FD03116E3FC3B3821A0525322B0A430FAA6B3C0B4/VC_redist.x64.exe
out=vcredist_v14_nt60_x64.exe
https://aka.ms/vs/17/release/vc_redist.x86.exe
out=vcredist_v14_nt63_x86.exe
https://aka.ms/vs/17/release/vc_redist.x64.exe
out=vcredist_v14_nt63_x64.exe
https://aka.ms/vc14/vc_redist.x86.exe
out=vcredist_v14_latest_x86.exe
https://aka.ms/vc14/vc_redist.x64.exe
out=vcredist_v14_latest_x64.exe
${script}
out=installer.nsi
fi
mkdir msvc_offline
aria2c --dir=msvc_offline --allow-overwrite=true --retry-wait=5 --max-connection-per-server=8 --split=8 --min-split-size=1M -i downloadLink.txt
pushd msvc_offline
makensis installer.nsi
rm vcredist*.exe
installerFileName=$(ls *.exe)
mv *.exe ../
popd
echo -e "Installer generated. "
echo -e "Filename: ${installerFileName}"

117
install_AllOS.nsi Normal file
View file

@ -0,0 +1,117 @@
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!include "WinVer.nsh"
!include "x64.nsh"
!define /date BUILD_YEAR "%Y"
!define /date BUILD_MONTH "%m"
!define /date BUILD_DAY "%d"
Name "MSVC Redistributable Runtime Offline Installer"
Icon "favicon.ico"
OutFile "MSVC_Offline_Setup_${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}_AllOS.exe"
InstallDir $TEMP
VIProductVersion "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0"
VIAddVersionKey /LANG=0x0409 "ProductName" "MSVC Offline Installer"
VIAddVersionKey /LANG=0x0409 "FileDescription" "MSVC Offline Installer"
VIAddVersionKey /LANG=0x0409 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0"
VIAddVersionKey /LANG=0x0409 "LegalCopyright" "msvc.win Project"
VIAddVersionKey /LANG=0x0804 "ProductName" "MSVC 运行时离线安装程序"
VIAddVersionKey /LANG=0x0804 "FileDescription" "MSVC 运行时离线安装程序"
VIAddVersionKey /LANG=0x0804 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0"
VIAddVersionKey /LANG=0x0804 "LegalCopyright" "msvc.win Project"
SetCompressor /solid /final lzma
RequestExecutionLevel admin
Function .onInit
${IfNot} ${AtLeastWinXP}
MessageBox MB_ICONSTOP "This installer requires Windows XP or newer."
Abort
${EndIf}
FunctionEnd
Section "MSVC Install"
; Create a temp folder
SetOutPath $TEMP\vcredist
; --- VC++ 2005 ---
File "vcredist_2005_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2005_x86.exe" /Q'
${If} ${RunningX64}
File "vcredist_2005_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2005_x64.exe" /Q'
${EndIf}
; --- VC++ 2008 ---
File "vcredist_2008_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2008_x86.exe" /Q'
${If} ${RunningX64}
File "vcredist_2008_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2008_x64.exe" /Q'
${EndIf}
; --- VC++ 2010 ---
File "vcredist_2010_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2010_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_2010_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2010_x64.exe" /quiet /norestart'
${EndIf}
; --- VC++ 2012 ---
File "vcredist_2012_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2012_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_2012_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2012_x64.exe" /quiet /norestart'
${EndIf}
; --- VC++ 2013 ---
File "vcredist_2013_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2013_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_2013_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2013_x64.exe" /quiet /norestart'
${EndIf}
; --- VC++ 14 ---
${If} ${AtMostWin2003}
File /r "vcredist_v14_nt52_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_nt52_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File /r "vcredist_v14_nt52_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_nt52_x64.exe" /quiet /norestart'
${EndIf}
${ElseIf} ${IsWinVista}
File "vcredist_v14_nt60_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_nt60_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_v14_nt60_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_nt60_x64.exe" /quiet /norestart'
${EndIf}
${ElseIf} ${AtMostWin8}
File "vcredist_v14_nt63_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_nt63_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_v14_nt63_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_nt63_x64.exe" /quiet /norestart'
${EndIf}
${Else}
File "vcredist_v14_latest_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_v14_latest_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x64.exe" /quiet /norestart'
${EndIf}
${EndIf}
; Cleanup
RMDir /r $TEMP\vcredist
SectionEnd

94
install_AtLeastWin10.nsi Normal file
View file

@ -0,0 +1,94 @@
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!include "WinVer.nsh"
!include "x64.nsh"
!define /date BUILD_YEAR "%Y"
!define /date BUILD_MONTH "%m"
!define /date BUILD_DAY "%d"
Name "MSVC Redistributable Runtime Offline Installer"
Icon "favicon.ico"
OutFile "MSVC_Offline_Setup_${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}_Win10_11.exe"
InstallDir $TEMP
VIProductVersion "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0"
VIAddVersionKey /LANG=0x0409 "ProductName" "MSVC Offline Installer"
VIAddVersionKey /LANG=0x0409 "FileDescription" "MSVC Offline Installer"
VIAddVersionKey /LANG=0x0409 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0"
VIAddVersionKey /LANG=0x0409 "LegalCopyright" "msvc.win Project"
VIAddVersionKey /LANG=0x0804 "ProductName" "MSVC 运行时离线安装程序"
VIAddVersionKey /LANG=0x0804 "FileDescription" "MSVC 运行时离线安装程序"
VIAddVersionKey /LANG=0x0804 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0"
VIAddVersionKey /LANG=0x0804 "LegalCopyright" "msvc.win Project"
SetCompressor /solid /final lzma
RequestExecutionLevel admin
Function .onInit
${IfNot} ${AtLeastWin10}
MessageBox MB_ICONSTOP "This installer requires Windows 10 or newer."
Abort
${EndIf}
FunctionEnd
Section "MSVC Install"
; Create a temp folder
SetOutPath $TEMP\vcredist
; --- VC++ 2005 ---
File "vcredist_2005_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2005_x86.exe" /Q'
${If} ${RunningX64}
File "vcredist_2005_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2005_x64.exe" /Q'
${EndIf}
; --- VC++ 2008 ---
File "vcredist_2008_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2008_x86.exe" /Q'
${If} ${RunningX64}
File "vcredist_2008_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2008_x64.exe" /Q'
${EndIf}
; --- VC++ 2010 ---
File "vcredist_2010_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2010_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_2010_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2010_x64.exe" /quiet /norestart'
${EndIf}
; --- VC++ 2012 ---
File "vcredist_2012_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2012_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_2012_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2012_x64.exe" /quiet /norestart'
${EndIf}
; --- VC++ 2013 ---
File "vcredist_2013_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2013_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_2013_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2013_x64.exe" /quiet /norestart'
${EndIf}
; --- VC++ 14 ---
File "vcredist_v14_latest_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_v14_latest_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x64.exe" /quiet /norestart'
${EndIf}
; Cleanup
RMDir /r $TEMP\vcredist
SectionEnd

103
install_AtLeastWin7.nsi Normal file
View file

@ -0,0 +1,103 @@
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!include "WinVer.nsh"
!include "x64.nsh"
!define /date BUILD_YEAR "%Y"
!define /date BUILD_MONTH "%m"
!define /date BUILD_DAY "%d"
Name "MSVC Redistributable Runtime Offline Installer"
Icon "favicon.ico"
OutFile "MSVC_Offline_Setup_${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}_Win7.exe"
InstallDir $TEMP
VIProductVersion "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0"
VIAddVersionKey /LANG=0x0409 "ProductName" "MSVC Offline Installer"
VIAddVersionKey /LANG=0x0409 "FileDescription" "MSVC Offline Installer"
VIAddVersionKey /LANG=0x0409 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0"
VIAddVersionKey /LANG=0x0409 "LegalCopyright" "msvc.win Project"
VIAddVersionKey /LANG=0x0804 "ProductName" "MSVC 运行时离线安装程序"
VIAddVersionKey /LANG=0x0804 "FileDescription" "MSVC 运行时离线安装程序"
VIAddVersionKey /LANG=0x0804 "FileVersion" "${BUILD_YEAR}.${BUILD_MONTH}.${BUILD_DAY}.0"
VIAddVersionKey /LANG=0x0804 "LegalCopyright" "msvc.win Project"
SetCompressor /solid /final lzma
RequestExecutionLevel admin
Function .onInit
${IfNot} ${AtLeastWin7}
MessageBox MB_ICONSTOP "This installer requires Windows 7 or newer."
Abort
${EndIf}
FunctionEnd
Section "MSVC Install"
; Create a temp folder
SetOutPath $TEMP\vcredist
; --- VC++ 2005 ---
File "vcredist_2005_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2005_x86.exe" /Q'
${If} ${RunningX64}
File "vcredist_2005_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2005_x64.exe" /Q'
${EndIf}
; --- VC++ 2008 ---
File "vcredist_2008_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2008_x86.exe" /Q'
${If} ${RunningX64}
File "vcredist_2008_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2008_x64.exe" /Q'
${EndIf}
; --- VC++ 2010 ---
File "vcredist_2010_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2010_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_2010_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2010_x64.exe" /quiet /norestart'
${EndIf}
; --- VC++ 2012 ---
File "vcredist_2012_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2012_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_2012_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2012_x64.exe" /quiet /norestart'
${EndIf}
; --- VC++ 2013 ---
File "vcredist_2013_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_2013_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_2013_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_2013_x64.exe" /quiet /norestart'
${EndIf}
; --- VC++ 14 ---
${If} ${AtMostWin8}
File "vcredist_v14_nt63_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_nt63_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_v14_nt63_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_nt63_x64.exe" /quiet /norestart'
${EndIf}
${Else}
File "vcredist_v14_latest_x86.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x86.exe" /quiet /norestart'
${If} ${RunningX64}
File "vcredist_v14_latest_x64.exe"
ExecWait '"$TEMP\vcredist\vcredist_v14_latest_x64.exe" /quiet /norestart'
${EndIf}
${EndIf}
; Cleanup
RMDir /r $TEMP\vcredist
SectionEnd