internal/fakecgo: add build tags 'darwin' (#29)
This enables to build purego with `./...` for Windows. Closes #28
- commit
- 47b8ab81ba519c7212acad2020708056e414fbbc
- author
- Hajime Hoshi · · 2022-08-29 18:33 UTC
- committer
- GitHub · · 2022-08-29 18:33 UTC
- parent
- 6ed67cd
- signature
- GPG Unverified
4AEE18F83AFDEB23The key is unknown
11 files · +33 -0
M internal/fakecgo/callbacks.go +3 -0
| @@ -2,6 +2,9 @@ | |||
| 2 | 2 | // Use of this source code is governed by a BSD-style | |
| 3 | 3 | // license that can be found in the LICENSE file. | |
| 4 | 4 | ||
| 5 | + | //go:build darwin | |
| 6 | + | // +build darwin | |
| 7 | + | ||
| 5 | 8 | package fakecgo | |
| 6 | 9 | ||
| 7 | 10 | import _ "unsafe" | |
| @@ -2,6 +2,9 @@ | |||||
| 2 | // Use of this source code is governed by a BSD-style | 2 | // Use of this source code is governed by a BSD-style | ||
| 3 | // license that can be found in the LICENSE file. | 3 | // license that can be found in the LICENSE file. | ||
| 4 | 4 | ||||
| 5 | + | //go:build darwin | |||
| 6 | + | // +build darwin | |||
| 7 | + | ||||
| 5 | package fakecgo | 8 | package fakecgo | ||
| 6 | 9 | ||||
| 7 | import _ "unsafe" | 10 | import _ "unsafe" | ||
M internal/fakecgo/doc.go +3 -0
| @@ -1,6 +1,9 @@ | |||
| 1 | 1 | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |
| 3 | 3 | ||
| 4 | + | //go:build darwin | |
| 5 | + | // +build darwin | |
| 6 | + | ||
| 4 | 7 | // Package fakecgo implements the Cgo runtime (runtime/cgo) entirely in Go. | |
| 5 | 8 | // This allows code that calls into C to function properly when CGO_ENABLED=0. | |
| 6 | 9 | // | |
| @@ -1,6 +1,9 @@ | |||||
| 1 | // SPDX-License-Identifier: Apache-2.0 | 1 | // SPDX-License-Identifier: Apache-2.0 | ||
| 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | ||
| 3 | 3 | ||||
| 4 | + | //go:build darwin | |||
| 5 | + | // +build darwin | |||
| 6 | + | ||||
| 4 | // Package fakecgo implements the Cgo runtime (runtime/cgo) entirely in Go. | 7 | // Package fakecgo implements the Cgo runtime (runtime/cgo) entirely in Go. | ||
| 5 | // This allows code that calls into C to function properly when CGO_ENABLED=0. | 8 | // This allows code that calls into C to function properly when CGO_ENABLED=0. | ||
| 6 | // | 9 | // | ||
M internal/fakecgo/go_libinit.go +3 -0
| @@ -1,6 +1,9 @@ | |||
| 1 | 1 | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |
| 3 | 3 | ||
| 4 | + | //go:build darwin | |
| 5 | + | // +build darwin | |
| 6 | + | ||
| 4 | 7 | package fakecgo | |
| 5 | 8 | ||
| 6 | 9 | import ( | |
| @@ -1,6 +1,9 @@ | |||||
| 1 | // SPDX-License-Identifier: Apache-2.0 | 1 | // SPDX-License-Identifier: Apache-2.0 | ||
| 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | ||
| 3 | 3 | ||||
| 4 | + | //go:build darwin | |||
| 5 | + | // +build darwin | |||
| 6 | + | ||||
| 4 | package fakecgo | 7 | package fakecgo | ||
| 5 | 8 | ||||
| 6 | import ( | 9 | import ( | ||
M internal/fakecgo/go_setenv.go +3 -0
| @@ -1,6 +1,9 @@ | |||
| 1 | 1 | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |
| 3 | 3 | ||
| 4 | + | //go:build darwin | |
| 5 | + | // +build darwin | |
| 6 | + | ||
| 4 | 7 | package fakecgo | |
| 5 | 8 | ||
| 6 | 9 | //go:nosplit | |
| @@ -1,6 +1,9 @@ | |||||
| 1 | // SPDX-License-Identifier: Apache-2.0 | 1 | // SPDX-License-Identifier: Apache-2.0 | ||
| 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | ||
| 3 | 3 | ||||
| 4 | + | //go:build darwin | |||
| 5 | + | // +build darwin | |||
| 6 | + | ||||
| 4 | package fakecgo | 7 | package fakecgo | ||
| 5 | 8 | ||||
| 6 | //go:nosplit | 9 | //go:nosplit | ||
M internal/fakecgo/go_util.go +3 -0
| @@ -1,6 +1,9 @@ | |||
| 1 | 1 | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |
| 3 | 3 | ||
| 4 | + | //go:build darwin | |
| 5 | + | // +build darwin | |
| 6 | + | ||
| 4 | 7 | package fakecgo | |
| 5 | 8 | ||
| 6 | 9 | import "unsafe" | |
| @@ -1,6 +1,9 @@ | |||||
| 1 | // SPDX-License-Identifier: Apache-2.0 | 1 | // SPDX-License-Identifier: Apache-2.0 | ||
| 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | ||
| 3 | 3 | ||||
| 4 | + | //go:build darwin | |||
| 5 | + | // +build darwin | |||
| 6 | + | ||||
| 4 | package fakecgo | 7 | package fakecgo | ||
| 5 | 8 | ||||
| 6 | import "unsafe" | 9 | import "unsafe" | ||
M internal/fakecgo/iscgo.go +3 -0
| @@ -2,6 +2,9 @@ | |||
| 2 | 2 | // Use of this source code is governed by a BSD-style | |
| 3 | 3 | // license that can be found in the LICENSE file. | |
| 4 | 4 | ||
| 5 | + | //go:build darwin | |
| 6 | + | // +build darwin | |
| 7 | + | ||
| 5 | 8 | // The runtime package contains an uninitialized definition | |
| 6 | 9 | // for runtime·iscgo. Override it to tell the runtime we're here. | |
| 7 | 10 | // There are various function pointers that should be set too, | |
| @@ -2,6 +2,9 @@ | |||||
| 2 | // Use of this source code is governed by a BSD-style | 2 | // Use of this source code is governed by a BSD-style | ||
| 3 | // license that can be found in the LICENSE file. | 3 | // license that can be found in the LICENSE file. | ||
| 4 | 4 | ||||
| 5 | + | //go:build darwin | |||
| 6 | + | // +build darwin | |||
| 7 | + | ||||
| 5 | // The runtime package contains an uninitialized definition | 8 | // The runtime package contains an uninitialized definition | ||
| 6 | // for runtime·iscgo. Override it to tell the runtime we're here. | 9 | // for runtime·iscgo. Override it to tell the runtime we're here. | ||
| 7 | // There are various function pointers that should be set too, | 10 | // There are various function pointers that should be set too, | ||
M internal/fakecgo/libcgo.go +3 -0
| @@ -1,6 +1,9 @@ | |||
| 1 | 1 | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |
| 3 | 3 | ||
| 4 | + | //go:build darwin | |
| 5 | + | // +build darwin | |
| 6 | + | ||
| 4 | 7 | package fakecgo | |
| 5 | 8 | ||
| 6 | 9 | type size_t uintptr | |
| @@ -1,6 +1,9 @@ | |||||
| 1 | // SPDX-License-Identifier: Apache-2.0 | 1 | // SPDX-License-Identifier: Apache-2.0 | ||
| 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | ||
| 3 | 3 | ||||
| 4 | + | //go:build darwin | |||
| 5 | + | // +build darwin | |||
| 6 | + | ||||
| 4 | package fakecgo | 7 | package fakecgo | ||
| 5 | 8 | ||||
| 6 | type size_t uintptr | 9 | type size_t uintptr | ||
M internal/fakecgo/setenv.go +3 -0
| @@ -2,6 +2,9 @@ | |||
| 2 | 2 | // Use of this source code is governed by a BSD-style | |
| 3 | 3 | // license that can be found in the LICENSE file. | |
| 4 | 4 | ||
| 5 | + | //go:build darwin | |
| 6 | + | // +build darwin | |
| 7 | + | ||
| 5 | 8 | package fakecgo | |
| 6 | 9 | ||
| 7 | 10 | import _ "unsafe" // for go:linkname | |
| @@ -2,6 +2,9 @@ | |||||
| 2 | // Use of this source code is governed by a BSD-style | 2 | // Use of this source code is governed by a BSD-style | ||
| 3 | // license that can be found in the LICENSE file. | 3 | // license that can be found in the LICENSE file. | ||
| 4 | 4 | ||||
| 5 | + | //go:build darwin | |||
| 6 | + | // +build darwin | |||
| 7 | + | ||||
| 5 | package fakecgo | 8 | package fakecgo | ||
| 6 | 9 | ||||
| 7 | import _ "unsafe" // for go:linkname | 10 | import _ "unsafe" // for go:linkname | ||
M internal/fakecgo/symbols.go +3 -0
| @@ -1,6 +1,9 @@ | |||
| 1 | 1 | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |
| 3 | 3 | ||
| 4 | + | //go:build darwin | |
| 5 | + | // +build darwin | |
| 6 | + | ||
| 4 | 7 | package fakecgo | |
| 5 | 8 | ||
| 6 | 9 | import "unsafe" | |
| @@ -1,6 +1,9 @@ | |||||
| 1 | // SPDX-License-Identifier: Apache-2.0 | 1 | // SPDX-License-Identifier: Apache-2.0 | ||
| 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | ||
| 3 | 3 | ||||
| 4 | + | //go:build darwin | |||
| 5 | + | // +build darwin | |||
| 6 | + | ||||
| 4 | package fakecgo | 7 | package fakecgo | ||
| 5 | 8 | ||||
| 6 | import "unsafe" | 9 | import "unsafe" | ||
M internal/fakecgo/trampolines_amd64.s +3 -0
| @@ -1,6 +1,9 @@ | |||
| 1 | 1 | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |
| 3 | 3 | ||
| 4 | + | //go:build darwin | |
| 5 | + | // +build darwin | |
| 6 | + | ||
| 4 | 7 | /* | |
| 5 | 8 | trampoline for emulating required C functions for cgo in go (see cgo.go) | |
| 6 | 9 | (we convert cdecl calling convention to go and vice-versa) | |
| @@ -1,6 +1,9 @@ | |||||
| 1 | // SPDX-License-Identifier: Apache-2.0 | 1 | // SPDX-License-Identifier: Apache-2.0 | ||
| 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | ||
| 3 | 3 | ||||
| 4 | + | //go:build darwin | |||
| 5 | + | // +build darwin | |||
| 6 | + | ||||
| 4 | /* | 7 | /* | ||
| 5 | trampoline for emulating required C functions for cgo in go (see cgo.go) | 8 | trampoline for emulating required C functions for cgo in go (see cgo.go) | ||
| 6 | (we convert cdecl calling convention to go and vice-versa) | 9 | (we convert cdecl calling convention to go and vice-versa) | ||
M internal/fakecgo/trampolines_arm64.s +3 -0
| @@ -1,6 +1,9 @@ | |||
| 1 | 1 | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | |
| 3 | 3 | ||
| 4 | + | //go:build darwin | |
| 5 | + | // +build darwin | |
| 6 | + | ||
| 4 | 7 | #include "textflag.h" | |
| 5 | 8 | #include "go_asm.h" | |
| 6 | 9 | ||
| @@ -1,6 +1,9 @@ | |||||
| 1 | // SPDX-License-Identifier: Apache-2.0 | 1 | // SPDX-License-Identifier: Apache-2.0 | ||
| 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | 2 | // SPDX-FileCopyrightText: 2022 The Ebitengine Authors | ||
| 3 | 3 | ||||
| 4 | + | //go:build darwin | |||
| 5 | + | // +build darwin | |||
| 6 | + | ||||
| 4 | #include "textflag.h" | 7 | #include "textflag.h" | ||
| 5 | #include "go_asm.h" | 8 | #include "go_asm.h" | ||
| 6 | 9 | ||||