Skip to content

Commit

Permalink
Merge pull request #488 from Chilledheart/win32_provide_nsis_system_i…
Browse files Browse the repository at this point in the history
…nstaller

tools: generate nsis system installer
  • Loading branch information
Chilledheart committed Dec 5, 2023
2 parents 9eb7daa + 7f86598 commit 6ca0788
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tools/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,19 @@ func generateNSIS(output string) {
cmdRun([]string{"C:\\Program Files (x86)\\NSIS\\makensis.exe", "/XSetCompressor /FINAL lzma", "yass.nsi"}, true)
}

func generateNSISSystemInstaller(output string) {
glog.Info("Feeding CPack NSIS compiler...")
cmdRun([]string{"C:\\Program Files\\CMake\\bin\\cpack.exe"}, true)

if msvcTargetArchFlag == "x86" {
os.Rename(fmt.Sprintf("yass-%s-win32.exe", tagFlag), output)
} else if msvcTargetArchFlag == "x64" {
os.Rename(fmt.Sprintf("yass-%s-win64.exe", tagFlag), output)
} else {
glog.Fatalf("Unsupported msvc arch: %s for nsis builder", msvcTargetArchFlag)
}
}

func generateOpenWrtMakefile(archive string, pkg_version string) {
archive_dir, _ := filepath.Abs("..")
archive_dir += "/"
Expand Down Expand Up @@ -1256,13 +1269,15 @@ func postStateArchives() map[string][]string {
}

msiArchive := fmt.Sprintf(archiveFormat, APPNAME, "", ".msi")
nsisArchive := fmt.Sprintf(archiveFormat, APPNAME, "-installer", ".exe")
nsisArchive := fmt.Sprintf(archiveFormat, APPNAME, "-user-installer", ".exe")
debugArchive := fmt.Sprintf(archiveFormat, APPNAME, "-debuginfo", ext)
nsisSystemArchive := fmt.Sprintf(archiveFormat, APPNAME, "-system-installer", ".exe")

archive = filepath.Join("..", archive)
msiArchive = filepath.Join("..", msiArchive)
nsisArchive = filepath.Join("..", nsisArchive)
debugArchive = filepath.Join("..", debugArchive)
nsisSystemArchive = filepath.Join("..", nsisSystemArchive)

archives := map[string][]string{}

Expand Down Expand Up @@ -1300,6 +1315,8 @@ func postStateArchives() map[string][]string {
if systemNameFlag == "windows" && msvcTargetArchFlag != "arm64" {
generateNSIS(nsisArchive)
archives[nsisArchive] = []string{nsisArchive}
generateNSISSystemInstaller(nsisSystemArchive)
archives[nsisSystemArchive] = []string{nsisSystemArchive}
}
// debuginfo file
if systemNameFlag == "windows" {
Expand Down
2 changes: 2 additions & 0 deletions yass.nsi
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
!include "MUI.nsh"

!define MUI_ABORTWARNING # This will warn the user if they exit from the installer.
!define MUI_ICON "..\src\win32\yass.ico"
!define MUI_UNICON "..\src\win32\yass.ico"

!insertmacro MUI_PAGE_WELCOME # Welcome to the installer page.
!insertmacro MUI_PAGE_LICENSE "..\GPL-2.0.rtf"
Expand Down

0 comments on commit 6ca0788

Please sign in to comment.