]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: fix build again
authorRuss Cox <rsc@golang.org>
Fri, 2 Aug 2013 19:20:42 +0000 (15:20 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 2 Aug 2013 19:20:42 +0000 (15:20 -0400)
I am really bad at this. Didn't hg add this file.

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/12372043

src/cmd/dist/buildgo.c [new file with mode: 0644]

diff --git a/src/cmd/dist/buildgo.c b/src/cmd/dist/buildgo.c
new file mode 100644 (file)
index 0000000..a7602d9
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright 2012 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include "a.h"
+
+/*
+ * Helpers for building cmd/go and cmd/cgo.
+ */
+
+// mkzdefaultcc writes zdefaultcc.go:
+//
+//     package main
+//     const defaultCC = <defaultcc>
+//
+// It is invoked to write cmd/go/zdefaultcc.go
+// but we also write cmd/cgo/zdefaultcc.go.
+void
+mkzdefaultcc(char *dir, char *file)
+{
+       Buf b, out;
+       
+       USED(dir);
+
+       binit(&out);
+       bprintf(&out,
+               "// auto generated by go tool dist\n"
+               "\n"
+               "package main\n"
+               "\n"
+               "const defaultCC = `%s`\n",
+               defaultcc);
+
+       writefile(&out, file, 0);
+
+       // Convert file name to replace.
+       binit(&b);      
+       bwritestr(&b, file);
+       bsubst(&b, "/go/zdefaultcc.go", "/cgo/zdefaultcc.go");
+       writefile(&out, bstr(&b), 0);
+
+       bfree(&b);
+       bfree(&out);
+}