forked from zyedidia/micro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo-plist.go
45 lines (41 loc) · 995 Bytes
/
info-plist.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//go:build ignore
// +build ignore
package main
import (
"fmt"
"os"
"runtime"
)
func main() {
if runtime.GOOS != "darwin" {
return
}
if len(os.Args) != 3 {
panic("missing arguments")
}
if os.Args[1] != "darwin" {
return
}
rawInfoPlist := `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>io.github.micro-editor</string>
<key>CFBundleName</key>
<string>micro</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>` + os.Args[2] + `</string>
</dict>
</plist>
`
err := os.WriteFile("/tmp/micro-info.plist", []byte(rawInfoPlist), 0644)
if err != nil {
panic(err)
}
fmt.Println("-linkmode external -extldflags -Wl,-sectcreate,__TEXT,__info_plist,/tmp/micro-info.plist")
}