Skip to content

Commit a8cb5e6

Browse files
author
jld3103
authored
Merge pull request #163 from sidevesh/master
NSHighResolutionCapable true, local building of darwin packages
2 parents e427710 + d4e2eba commit a8cb5e6

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

assets/packaging/darwin-bundle/Info.plist.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<string>{{.description}}</string>
1111
<key>CFBundleIconFile</key>
1212
<string>icon.icns</string>
13+
<key>NSHighResolutionCapable</key>
14+
<true/>
1315
<key>CFBundleIdentifier</key>
1416
<string>{{.organizationName}}.{{.packageName}}</string>
1517
<key>CFBundleInfoDictionaryVersion</key>

cmd/packaging/darwin-bundle.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66
"os/exec"
77
"path/filepath"
8+
"runtime"
89
)
910

1011
// DarwinBundleTask packaging for darwin as bundle
@@ -21,7 +22,13 @@ var DarwinBundleTask = &packagingTask{
2122
if err != nil {
2223
return "", err
2324
}
24-
cmdPng2icns := exec.Command("png2icns", filepath.Join(outputFileName, "Contents", "Resources", "icon.icns"), filepath.Join(outputFileName, "Contents", "MacOS", "assets", "icon.png"))
25+
var cmdPng2icns *exec.Cmd
26+
switch os := runtime.GOOS; os {
27+
case "darwin":
28+
cmdPng2icns = exec.Command("png2icons", filepath.Join(outputFileName, "Contents", "MacOS", "assets", "icon.png"), filepath.Join(outputFileName, "Contents", "Resources", "icon"), "-icns")
29+
case "linux":
30+
cmdPng2icns = exec.Command("png2icns", filepath.Join(outputFileName, "Contents", "Resources", "icon.icns"), filepath.Join(outputFileName, "Contents", "MacOS", "assets", "icon.png"))
31+
}
2532
cmdPng2icns.Dir = tmpPath
2633
cmdPng2icns.Stdout = os.Stdout
2734
cmdPng2icns.Stderr = os.Stderr
@@ -32,6 +39,7 @@ var DarwinBundleTask = &packagingTask{
3239
return outputFileName, nil
3340
},
3441
requiredTools: map[string][]string{
35-
"linux": {"png2icns"},
42+
"linux": {"png2icns"},
43+
"darwin": {"png2icons"},
3644
},
3745
}

cmd/packaging/darwin-dmg.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66
"os/exec"
77
"path/filepath"
8+
"runtime"
89
)
910

1011
// DarwinDmgTask packaging for darwin as dmg
@@ -29,7 +30,14 @@ var DarwinDmgTask = &packagingTask{
2930
if err != nil {
3031
return "", err
3132
}
32-
cmdGenisoimage := exec.Command("genisoimage", "-V", packageName, "-D", "-R", "-apple", "-no-pad", "-o", outputFileName, "dmgdir")
33+
34+
var cmdGenisoimage *exec.Cmd
35+
switch os := runtime.GOOS; os {
36+
case "darwin":
37+
cmdGenisoimage = exec.Command("hdiutil", "create", "-volname", packageName, "-srcfolder", "dmgdir", "-ov", "-format", "UDBZ", outputFileName)
38+
case "linux":
39+
cmdGenisoimage = exec.Command("genisoimage", "-V", packageName, "-D", "-R", "-apple", "-no-pad", "-o", outputFileName, "dmgdir")
40+
}
3341
cmdGenisoimage.Dir = tmpPath
3442
cmdGenisoimage.Stdout = os.Stdout
3543
cmdGenisoimage.Stderr = os.Stderr
@@ -41,6 +49,7 @@ var DarwinDmgTask = &packagingTask{
4149
},
4250
skipAssertInitialized: true,
4351
requiredTools: map[string][]string{
44-
"linux": {"ln", "genisoimage"},
52+
"linux": {"ln", "genisoimage"},
53+
"darwin": {"ln", "hdiutil"},
4554
},
4655
}

cmd/packaging/darwin-pkg.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66
"os/exec"
77
"path/filepath"
8+
"runtime"
89

910
"github.com/pkg/errors"
1011
)
@@ -76,7 +77,13 @@ var DarwinPkgTask = &packagingTask{
7677
return "", err
7778
}
7879

79-
cmdMkbom := exec.Command("mkbom", "-u", "0", "-g", "80", filepath.Join("flat", "root"), filepath.Join("flat", "base.pkg", "Payload"))
80+
var cmdMkbom *exec.Cmd
81+
switch os := runtime.GOOS; os {
82+
case "darwin":
83+
cmdMkbom = exec.Command("mkbom", filepath.Join("flat", "root"), filepath.Join("flat", "base.pkg", "Payload"))
84+
case "linux":
85+
cmdMkbom = exec.Command("mkbom", "-u", "0", "-g", "80", filepath.Join("flat", "root"), filepath.Join("flat", "base.pkg", "Payload"))
86+
}
8087
cmdMkbom.Dir = tmpPath
8188
cmdMkbom.Stdout = os.Stdout
8289
cmdMkbom.Stderr = os.Stderr
@@ -109,6 +116,7 @@ var DarwinPkgTask = &packagingTask{
109116
return outputFileName, nil
110117
},
111118
requiredTools: map[string][]string{
112-
"linux": {"find", "cpio", "gzip", "mkbom", "xar"},
119+
"linux": {"find", "cpio", "gzip", "mkbom", "xar"},
120+
"darwin": {"find", "cpio", "gzip", "mkbom", "xar"},
113121
},
114122
}

0 commit comments

Comments
 (0)