micro/tools/info-plist.go

46 lines
995 B
Go
Raw Normal View History

2022-07-15 18:40:32 +00:00
//go:build ignore
// +build ignore
2021-08-21 22:07:43 +00:00
package main
import (
2017-02-21 18:07:37 +00:00
"fmt"
"os"
2022-07-22 00:46:23 +00:00
"runtime"
)
func main() {
2022-07-22 00:54:01 +00:00
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"?>
2022-07-15 18:40:32 +00:00
<!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>
`
2017-02-21 18:07:37 +00:00
err := os.WriteFile("/tmp/micro-info.plist", []byte(rawInfoPlist), 0666)
if err != nil {
panic(err)
2017-02-21 18:07:37 +00:00
}
fmt.Println("-linkmode external -extldflags -Wl,-sectcreate,__TEXT,__info_plist,/tmp/micro-info.plist")
}