Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
a4628167
Commit
a4628167
authored
Dec 21, 2011
by
Alex Brainman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: multiple fixes to make "go install" work on windows
R=rsc CC=golang-dev
https://golang.org/cl/5502054
parent
eecb6a79
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
5 deletions
+50
-5
buildscript_windows_386.sh
src/buildscript_windows_386.sh
+1
-1
buildscript_windows_amd64.sh
src/buildscript_windows_amd64.sh
+1
-1
build.go
src/cmd/go/build.go
+41
-1
main.go
src/cmd/go/main.go
+1
-1
pkg.go
src/cmd/go/pkg.go
+3
-0
type_unix.go
src/pkg/mime/type_unix.go
+2
-0
trigger.go
src/pkg/runtime/cgo/trigger.go
+1
-1
No files found.
src/buildscript_windows_386.sh
View file @
a4628167
...
...
@@ -545,4 +545,4 @@ mkdir -p $WORK/cmd/go/_obj/
gopack grc
$WORK
/cmd/go.a
$WORK
/cmd/go/_obj/_go_.6
8l
-o
$WORK
/cmd/go/_obj/a.out
-L
$WORK
$WORK
/cmd/go.a
mkdir
-p
$GOBIN
/
cp
$WORK
/cmd/go/_obj/a.out
$GOBIN
/go
cp
$WORK
/cmd/go/_obj/a.out
$GOBIN
/go
.exe
src/buildscript_windows_amd64.sh
View file @
a4628167
...
...
@@ -544,4 +544,4 @@ mkdir -p $WORK/cmd/go/_obj/
gopack grc
$WORK
/cmd/go.a
$WORK
/cmd/go/_obj/_go_.6
6l
-o
$WORK
/cmd/go/_obj/a.out
-L
$WORK
$WORK
/cmd/go.a
mkdir
-p
$GOBIN
/
cp
$WORK
/cmd/go/_obj/a.out
$GOBIN
/go
cp
$WORK
/cmd/go/_obj/a.out
$GOBIN
/go
.exe
src/cmd/go/build.go
View file @
a4628167
...
...
@@ -15,6 +15,7 @@ import (
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"
"sync"
)
...
...
@@ -518,6 +519,33 @@ func (b *builder) install(a *action) error {
return
b
.
copyFile
(
dst
,
src
,
perm
)
}
// removeByRenaming removes file name by moving it to a tmp
// directory and deleting the target if possible.
func
removeByRenaming
(
name
string
)
error
{
f
,
err
:=
ioutil
.
TempFile
(
""
,
""
)
if
err
!=
nil
{
return
err
}
tmpname
:=
f
.
Name
()
f
.
Close
()
err
=
os
.
Remove
(
tmpname
)
if
err
!=
nil
{
return
err
}
err
=
os
.
Rename
(
name
,
tmpname
)
if
err
!=
nil
{
// assume name file does not exists,
// otherwise later code will fail.
return
nil
}
err
=
os
.
Remove
(
tmpname
)
if
err
!=
nil
{
// TODO(brainman): file is locked and can't be deleted.
// We need to come up with a better way of doing it.
}
return
nil
}
// copyFile is like 'cp src dst'.
func
(
b
*
builder
)
copyFile
(
dst
,
src
string
,
perm
uint32
)
error
{
if
b
.
nflag
||
b
.
xflag
{
...
...
@@ -535,7 +563,19 @@ func (b *builder) copyFile(dst, src string, perm uint32) error {
os
.
Remove
(
dst
)
df
,
err
:=
os
.
OpenFile
(
dst
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
perm
)
if
err
!=
nil
{
return
err
if
runtime
.
GOOS
!=
"windows"
{
return
err
}
// Windows does not allow to replace binary file
// while it is executing. We will cheat.
err
=
removeByRenaming
(
dst
)
if
err
!=
nil
{
return
err
}
df
,
err
=
os
.
OpenFile
(
dst
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
perm
)
if
err
!=
nil
{
return
err
}
}
_
,
err
=
io
.
Copy
(
df
,
sf
)
df
.
Close
()
...
...
src/cmd/go/main.go
View file @
a4628167
...
...
@@ -285,7 +285,7 @@ func allPackages() []string {
if
err
!=
nil
{
return
nil
}
name
:=
path
[
len
(
src
)
:
]
name
:=
filepath
.
ToSlash
(
path
[
len
(
src
)
:
])
if
!
have
[
name
]
{
pkgs
=
append
(
pkgs
,
name
)
have
[
name
]
=
true
...
...
src/cmd/go/pkg.go
View file @
a4628167
...
...
@@ -113,6 +113,9 @@ func scanPackage(ctxt *build.Context, t *build.Tree, arg, importPath, dir string
if
info
.
Package
==
"main"
{
_
,
elem
:=
filepath
.
Split
(
importPath
)
targ
=
filepath
.
Join
(
t
.
BinDir
(),
elem
)
if
ctxt
.
GOOS
==
"windows"
{
targ
+=
".exe"
}
}
else
{
targ
=
filepath
.
Join
(
t
.
PkgDir
(),
filepath
.
FromSlash
(
importPath
)
+
".a"
)
}
...
...
src/pkg/mime/type_unix.go
View file @
a4628167
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin freebsd linux openbsd plan9
package
mime
import
(
...
...
src/pkg/runtime/cgo/trigger.go
View file @
a4628167
...
...
@@ -14,7 +14,7 @@ package cgo
#cgo linux LDFLAGS: -lpthread
#cgo netbsd LDFLAGS: -lpthread
#cgo openbsd LDFLAGS: -lpthread
#cgo windows LDFLAGS: -lm -
l
mthreads
#cgo windows LDFLAGS: -lm -mthreads
*/
import
"C"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment