]> git.lizzy.rs Git - micro.git/commitdiff
Fix cross compilation from macOS
authorZachary Yedidia <zyedidia@gmail.com>
Fri, 15 Jul 2022 18:40:32 +0000 (11:40 -0700)
committerZachary Yedidia <zyedidia@gmail.com>
Fri, 15 Jul 2022 18:40:32 +0000 (11:40 -0700)
Makefile
tools/info-plist.go

index af3fc9872c25d9b3a84eeb63135b98f3379f6605..0034173a828c17ed6f2b7a98d258f0105354e468 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ DATE = $(shell GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) \
        go run tools/build-date.go)
 ADDITIONAL_GO_LINKER_FLAGS = $(shell GOOS=$(shell go env GOHOSTOS) \
        GOARCH=$(shell go env GOHOSTARCH) \
-       go run tools/info-plist.go "$(VERSION)")
+       go run tools/info-plist.go "$(GOOS)" "$(VERSION)")
 GOBIN ?= $(shell go env GOPATH)/bin
 GOVARS = -X github.com/zyedidia/micro/v2/internal/util.Version=$(VERSION) -X github.com/zyedidia/micro/v2/internal/util.CommitHash=$(HASH) -X 'github.com/zyedidia/micro/v2/internal/util.CompileDate=$(DATE)'
 DEBUGVAR = -X github.com/zyedidia/micro/v2/internal/util.Debug=ON
index b2beee786dfe10af98a32459eba5ed09b65f8468..d57a7b2479b4b30a6aba87a8698e71b7094bc392 100644 (file)
@@ -1,4 +1,5 @@
-//+build ignore
+//go:build ignore
+// +build ignore
 
 package main
 
@@ -6,7 +7,6 @@ import (
        "fmt"
        "io/ioutil"
        "os"
-       "runtime"
 )
 
 func check(e error) {
@@ -16,32 +16,32 @@ func check(e error) {
 }
 
 func main() {
-       if runtime.GOOS == "darwin" {
-               if len(os.Args) == 2 {
+       if len(os.Args) == 3 {
+               if os.Args[1] == "darwin" {
                        rawInfoPlistString := `<?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[1] + `</string>
-</dict>
-</plist>
-`
+       <!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>
+       `
                        infoPlistData := []byte(rawInfoPlistString)
 
                        err := ioutil.WriteFile("/tmp/micro-info.plist", infoPlistData, 0644)
                        check(err)
                        fmt.Println("-linkmode external -extldflags -Wl,-sectcreate,__TEXT,__info_plist,/tmp/micro-info.plist")
-               } else {
-                       panic("missing argument for version number!")
                }
+       } else {
+               panic("missing arguments")
        }
 }