Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2025 go-webgpu contributors
Copyright (c) 2025-2026 Andrey Kolkov and GoGPU Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 13 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
goffi
Copyright 2025-2026 Andrey Kolkov and GoGPU Contributors

This project is licensed under the MIT License (see LICENSE).

Portions of this software (internal/fakecgo/) are derived from
ebitengine/purego (https://github.com/ebitengine/purego), licensed
under the Apache License, Version 2.0. Original copyright:

Copyright 2022 The Ebitengine Authors

The Apache-2.0 licensed files retain their original SPDX headers
with dual copyright attribution.
2 changes: 1 addition & 1 deletion ffi/struct_e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2026 The Goffi Authors
// SPDX-FileCopyrightText: 2026 Andrey Kolkov and GoGPU Contributors

//go:build (linux || darwin || freebsd || windows) && (amd64 || arm64)

Expand Down
2 changes: 1 addition & 1 deletion ffi/struct_return_e2e_amd64_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2026 The Goffi Authors
// SPDX-FileCopyrightText: 2026 Andrey Kolkov and GoGPU Contributors

//go:build (linux || darwin || freebsd || windows) && amd64

Expand Down
2 changes: 1 addition & 1 deletion ffi/variadic_e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2026 The Goffi Authors
// SPDX-FileCopyrightText: 2026 Andrey Kolkov and GoGPU Contributors

//go:build (linux || darwin || freebsd || windows) && (amd64 || arm64)

Expand Down
2 changes: 1 addition & 1 deletion internal/arch/arm64/fakecgo_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2026 The Goffi Authors
// SPDX-FileCopyrightText: 2026 Andrey Kolkov and GoGPU Contributors

//go:build arm64 && !cgo

Expand Down
2 changes: 1 addition & 1 deletion internal/dl/cgo.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2026 The Goffi Authors
// SPDX-FileCopyrightText: 2026 Andrey Kolkov and GoGPU Contributors

//go:build cgo && (darwin || freebsd || linux || netbsd)

Expand Down
15 changes: 8 additions & 7 deletions internal/fakecgo/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo && (darwin || freebsd || linux || netbsd)

Expand All @@ -15,17 +16,17 @@
//
// # Support
//
// Currently, fakecgo only supports macOS on amd64 & arm64. It also cannot
// be used with -buildmode=c-archive because that requires special initialization
// that fakecgo does not implement at the moment.
// Currently, fakecgo supports Linux, macOS, FreeBSD, and NetBSD on amd64 & arm64.
// It cannot be used with -buildmode=c-archive because that requires special
// initialization that fakecgo does not implement at the moment.
//
// # Usage
//
// Using fakecgo is easy just import _ "github.com/go-webgpu/goffi/internal/fakecgo" and then
// Using fakecgo is easy: just import _ "github.com/go-webgpu/goffi/internal/fakecgo" and then
// set the environment variable CGO_ENABLED=0.
// The recommended usage for fakecgo is to prefer using runtime/cgo if possible
// but if cross-compiling or fast build times are important fakecgo is available.
// Purego will pick which ever Cgo runtime is available and prefer the one that
// The recommended usage is to prefer runtime/cgo if possible, but if
// cross-compiling or fast build times are important, fakecgo is available.
// goffi will pick whichever Cgo runtime is available and prefer the one that
// comes with Go (runtime/cgo).
package fakecgo

Expand Down
8 changes: 6 additions & 2 deletions internal/fakecgo/gen.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build ignore

Expand All @@ -19,6 +20,7 @@ const templateSymbols = `// Code generated by 'go generate' with gen.go. DO NOT

// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo && (darwin || freebsd || linux || netbsd)

Expand Down Expand Up @@ -86,6 +88,7 @@ const templateTrampolinesStubs = `// Code generated by 'go generate' with gen.go

// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo && (darwin || freebsd || linux || netbsd)

Expand All @@ -94,7 +97,7 @@ const templateTrampolinesStubs = `// Code generated by 'go generate' with gen.go
// these stubs are here because it is not possible to go:linkname directly the C functions on darwin arm64
{{ range . }}
TEXT _{{.Name}}(SB), NOSPLIT|NOFRAME, $0-0
JMP purego_{{.Name}}(SB)
JMP goffi_{{.Name}}(SB)
RET
{{ end -}}
`
Expand All @@ -103,14 +106,15 @@ const templateSymbolsGoos = `// Code generated by 'go generate' with gen.go. DO

// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo

package fakecgo

{{- range $location := . }}
{{- range .Symbols }}
//go:cgo_import_dynamic purego_{{ .Name }} {{ .Name }} "{{ $location.SharedObject }}"
//go:cgo_import_dynamic goffi_{{ .Name }} {{ .Name }} "{{ $location.SharedObject }}"
{{- end }}
{{- end }}
`
Expand Down
1 change: 1 addition & 0 deletions internal/fakecgo/go_libinit.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo && (darwin || freebsd || linux || netbsd)

Expand Down
1 change: 1 addition & 0 deletions internal/fakecgo/go_setenv.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo && (darwin || freebsd || linux || netbsd)

Expand Down
1 change: 1 addition & 0 deletions internal/fakecgo/go_util.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo && (darwin || freebsd || linux || netbsd)

Expand Down
1 change: 1 addition & 0 deletions internal/fakecgo/libcgo.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo && (darwin || freebsd || linux || netbsd)

Expand Down
1 change: 1 addition & 0 deletions internal/fakecgo/libcgo_darwin.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo

Expand Down
1 change: 1 addition & 0 deletions internal/fakecgo/libcgo_freebsd.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo

Expand Down
1 change: 1 addition & 0 deletions internal/fakecgo/libcgo_linux.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo

Expand Down
1 change: 1 addition & 0 deletions internal/fakecgo/libcgo_netbsd.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2025 The Ebitengine Authors
// SPDX-FileCopyrightText: 2025-2026 Andrey Kolkov and GoGPU Contributors

//go:build !cgo

Expand Down
1 change: 1 addition & 0 deletions internal/fakecgo/symbols.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 22 additions & 21 deletions internal/fakecgo/symbols_darwin.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 22 additions & 21 deletions internal/fakecgo/symbols_freebsd.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 22 additions & 21 deletions internal/fakecgo/symbols_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading