mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-27 03:55:36 +00:00
f18beaa1e4
Given recent changes in corp, I originally thought we could remove all of the syso files, but then I realized that we still need them so that binaries built purely from OSS (without going through corp) will still receive a manifest. We can remove the arm32 one though, since we don't support 32-bit ARM on Windows. Updates https://github.com/tailscale/corp/issues/9576 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
52 lines
1.2 KiB
Go
52 lines
1.2 KiB
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
// The mkmanifest command is a simple helper utility to create a '.syso' file
|
|
// that contains a Windows manifest file.
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/tc-hib/winres"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) != 4 {
|
|
log.Fatalf("usage: %s arch manifest.xml output.syso", os.Args[0])
|
|
}
|
|
|
|
arch := winres.Arch(os.Args[1])
|
|
switch arch {
|
|
case winres.ArchAMD64, winres.ArchARM64, winres.ArchI386:
|
|
default:
|
|
log.Fatalf("unsupported arch: %s", arch)
|
|
}
|
|
|
|
manifest, err := os.ReadFile(os.Args[2])
|
|
if err != nil {
|
|
log.Fatalf("error reading manifest file %q: %v", os.Args[2], err)
|
|
}
|
|
|
|
out := os.Args[3]
|
|
|
|
// Start by creating an empty resource set
|
|
rs := winres.ResourceSet{}
|
|
|
|
// Add resources
|
|
rs.Set(winres.RT_MANIFEST, winres.ID(1), 0, manifest)
|
|
|
|
// Compile to a COFF object file
|
|
f, err := os.Create(out)
|
|
if err != nil {
|
|
log.Fatalf("error creating output file %q: %v", out, err)
|
|
}
|
|
if err := rs.WriteObject(f, arch); err != nil {
|
|
log.Fatalf("error writing object: %v", err)
|
|
}
|
|
if err := f.Close(); err != nil {
|
|
log.Fatalf("error writing output file %q: %v", out, err)
|
|
}
|
|
}
|