Skip to content

Commit 47b8ab8

Browse files
authored
internal/fakecgo: add build tags 'darwin' (#29)
This enables to build purego with `./...` for Windows. Closes #28
1 parent 6ed67cd commit 47b8ab8

11 files changed

+33
-0
lines changed

internal/fakecgo/callbacks.go

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
//go:build darwin
6+
// +build darwin
7+
58
package fakecgo
69

710
import _ "unsafe"

internal/fakecgo/doc.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33

4+
//go:build darwin
5+
// +build darwin
6+
47
// Package fakecgo implements the Cgo runtime (runtime/cgo) entirely in Go.
58
// This allows code that calls into C to function properly when CGO_ENABLED=0.
69
//

internal/fakecgo/go_libinit.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33

4+
//go:build darwin
5+
// +build darwin
6+
47
package fakecgo
58

69
import (

internal/fakecgo/go_setenv.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33

4+
//go:build darwin
5+
// +build darwin
6+
47
package fakecgo
58

69
//go:nosplit

internal/fakecgo/go_util.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33

4+
//go:build darwin
5+
// +build darwin
6+
47
package fakecgo
58

69
import "unsafe"

internal/fakecgo/iscgo.go

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
//go:build darwin
6+
// +build darwin
7+
58
// The runtime package contains an uninitialized definition
69
// for runtime·iscgo. Override it to tell the runtime we're here.
710
// There are various function pointers that should be set too,

internal/fakecgo/libcgo.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33

4+
//go:build darwin
5+
// +build darwin
6+
47
package fakecgo
58

69
type size_t uintptr

internal/fakecgo/setenv.go

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
//go:build darwin
6+
// +build darwin
7+
58
package fakecgo
69

710
import _ "unsafe" // for go:linkname

internal/fakecgo/symbols.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33

4+
//go:build darwin
5+
// +build darwin
6+
47
package fakecgo
58

69
import "unsafe"

internal/fakecgo/trampolines_amd64.s

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33

4+
//go:build darwin
5+
// +build darwin
6+
47
/*
58
trampoline for emulating required C functions for cgo in go (see cgo.go)
69
(we convert cdecl calling convention to go and vice-versa)

internal/fakecgo/trampolines_arm64.s

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33

4+
//go:build darwin
5+
// +build darwin
6+
47
#include "textflag.h"
58
#include "go_asm.h"
69

0 commit comments

Comments
 (0)