Skip to content

NSHighResolutionCapable true, local building of darwin packages #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions assets/packaging/darwin-bundle/Info.plist.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<string>{{.description}}</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CFBundleIdentifier</key>
<string>{{.organizationName}}.{{.packageName}}</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand Down
12 changes: 10 additions & 2 deletions cmd/packaging/darwin-bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
)

// DarwinBundleTask packaging for darwin as bundle
Expand All @@ -21,7 +22,13 @@ var DarwinBundleTask = &packagingTask{
if err != nil {
return "", err
}
cmdPng2icns := exec.Command("png2icns", filepath.Join(outputFileName, "Contents", "Resources", "icon.icns"), filepath.Join(outputFileName, "Contents", "MacOS", "assets", "icon.png"))
var cmdPng2icns *exec.Cmd
switch os := runtime.GOOS; os {
case "darwin":
cmdPng2icns = exec.Command("png2icons", filepath.Join(outputFileName, "Contents", "MacOS", "assets", "icon.png"), filepath.Join(outputFileName, "Contents", "Resources", "icon"), "-icns")
case "linux":
cmdPng2icns = exec.Command("png2icns", filepath.Join(outputFileName, "Contents", "Resources", "icon.icns"), filepath.Join(outputFileName, "Contents", "MacOS", "assets", "icon.png"))
}
cmdPng2icns.Dir = tmpPath
cmdPng2icns.Stdout = os.Stdout
cmdPng2icns.Stderr = os.Stderr
Expand All @@ -32,6 +39,7 @@ var DarwinBundleTask = &packagingTask{
return outputFileName, nil
},
requiredTools: map[string][]string{
"linux": {"png2icns"},
"linux": {"png2icns"},
"darwin": {"png2icons"},
},
}
13 changes: 11 additions & 2 deletions cmd/packaging/darwin-dmg.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
)

// DarwinDmgTask packaging for darwin as dmg
Expand All @@ -29,7 +30,14 @@ var DarwinDmgTask = &packagingTask{
if err != nil {
return "", err
}
cmdGenisoimage := exec.Command("genisoimage", "-V", packageName, "-D", "-R", "-apple", "-no-pad", "-o", outputFileName, "dmgdir")

var cmdGenisoimage *exec.Cmd
switch os := runtime.GOOS; os {
case "darwin":
cmdGenisoimage = exec.Command("hdiutil", "create", "-volname", packageName, "-srcfolder", "dmgdir", "-ov", "-format", "UDBZ", outputFileName)
case "linux":
cmdGenisoimage = exec.Command("genisoimage", "-V", packageName, "-D", "-R", "-apple", "-no-pad", "-o", outputFileName, "dmgdir")
}
cmdGenisoimage.Dir = tmpPath
cmdGenisoimage.Stdout = os.Stdout
cmdGenisoimage.Stderr = os.Stderr
Expand All @@ -41,6 +49,7 @@ var DarwinDmgTask = &packagingTask{
},
skipAssertInitialized: true,
requiredTools: map[string][]string{
"linux": {"ln", "genisoimage"},
"linux": {"ln", "genisoimage"},
"darwin": {"ln", "hdiutil"},
},
}
12 changes: 10 additions & 2 deletions cmd/packaging/darwin-pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"

"github.com/pkg/errors"
)
Expand Down Expand Up @@ -76,7 +77,13 @@ var DarwinPkgTask = &packagingTask{
return "", err
}

cmdMkbom := exec.Command("mkbom", "-u", "0", "-g", "80", filepath.Join("flat", "root"), filepath.Join("flat", "base.pkg", "Payload"))
var cmdMkbom *exec.Cmd
switch os := runtime.GOOS; os {
case "darwin":
cmdMkbom = exec.Command("mkbom", filepath.Join("flat", "root"), filepath.Join("flat", "base.pkg", "Payload"))
case "linux":
cmdMkbom = exec.Command("mkbom", "-u", "0", "-g", "80", filepath.Join("flat", "root"), filepath.Join("flat", "base.pkg", "Payload"))
}
cmdMkbom.Dir = tmpPath
cmdMkbom.Stdout = os.Stdout
cmdMkbom.Stderr = os.Stderr
Expand Down Expand Up @@ -109,6 +116,7 @@ var DarwinPkgTask = &packagingTask{
return outputFileName, nil
},
requiredTools: map[string][]string{
"linux": {"find", "cpio", "gzip", "mkbom", "xar"},
"linux": {"find", "cpio", "gzip", "mkbom", "xar"},
"darwin": {"find", "cpio", "gzip", "mkbom", "xar"},
},
}