-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for NetBSD #268
Merged
TotallyGamerJet
merged 61 commits into
ebitengine:main
from
TotallyGamerJet:issue-249_netbsd
Mar 8, 2025
Merged
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
10556e5
CGO support for Netbsd
TotallyGamerJet 5068751
missing build tag
TotallyGamerJet 92769ac
syscallArgs
TotallyGamerJet 000117c
syscall15Args
TotallyGamerJet b23644e
some more
TotallyGamerJet 68d652c
build tag
TotallyGamerJet cf0745d
test
TotallyGamerJet 3c3731e
build tag for netbsd
TotallyGamerJet e87d728
some more stuff needed fixing
TotallyGamerJet 0b92ec5
ignore tests
TotallyGamerJet 68c9fa4
github actions
TotallyGamerJet 4d82012
include go
TotallyGamerJet f37da23
examples/window: replace deprecated functions (#269)
hajimehoshi f8c7742
all: remove dependencies on golang.org/x/sys (#271)
hajimehoshi 128551e
Clarify Example section and Dl* windows equivalents (#274)
TotallyGamerJet 5ad9415
purego: mention LoadLibraryEx at Dlopen (#275)
hajimehoshi c3f4c9c
examples: remove depdencies on golang.org/x/sys/windows (#278)
hajimehoshi f091b66
all: release v0.9.0-alpha
hajimehoshi 570751c
test
TotallyGamerJet 4b324b2
fix install Go on freebsd
TotallyGamerJet 7ab8812
fix install Go on freebsd
TotallyGamerJet 3b55709
fix install Go
TotallyGamerJet ec53690
remove Go versions that dl doesn't have downloads for
TotallyGamerJet 49cf092
mkdir
TotallyGamerJet ae1d516
specify default shell
TotallyGamerJet 6c57d3f
disabled syncing to host VM
TotallyGamerJet ed60fb8
try installing bash
TotallyGamerJet c5caadb
prefix pkg_add
TotallyGamerJet d668211
try bash
TotallyGamerJet 85a72ad
remove some bash references
TotallyGamerJet 7773c24
go plugin not supported on netbsd
TotallyGamerJet 9ddd066
remove echo
TotallyGamerJet ea999fd
Merge branch 'refs/heads/main' into issue-249_netbsd
TotallyGamerJet 2a940f5
No Cgo on NetBSD?
TotallyGamerJet 83c4528
Merge branch 'main' into issue-249_netbsd
TotallyGamerJet daa834c
add netbsd to build tag in examples/libc
TotallyGamerJet 2a19c6e
update pipeline
TotallyGamerJet e7e52fe
enable tests
TotallyGamerJet 19cebb4
make code more in line with runtime/cgo
TotallyGamerJet 7d59f39
use -fPIC on all platforms
TotallyGamerJet bc9050f
build tags and copyright years
TotallyGamerJet 3e44d74
try merging freebsd and netbsd
TotallyGamerJet d1cfb86
another attempt at merging workflow
TotallyGamerJet d649054
fix spacing
TotallyGamerJet 7b5d581
try separate test script
TotallyGamerJet 25f17fc
fix misspelling
TotallyGamerJet 2a6247c
ls to debug
TotallyGamerJet 3b59667
ensure it is executable and then bash directly
TotallyGamerJet 75cbcfc
newline and license
TotallyGamerJet b0aba43
use "go version" for retrieving version
TotallyGamerJet e7e4a0e
fix misspelling
TotallyGamerJet 5fda596
don't run on version that aren't downloadable
TotallyGamerJet 9616e78
ls everything
TotallyGamerJet f6b5e0a
ls for freebsd
TotallyGamerJet d7c63f1
$GITHUB_WORKSPACE/
TotallyGamerJet a5d18b0
remove bash
TotallyGamerJet d0a90a9
ls inside "run:"
TotallyGamerJet f2e19f3
updates for freebsd
TotallyGamerJet 961e360
try bash again
TotallyGamerJet 19e4a72
yes install bash
TotallyGamerJet 74c6bf6
sh
TotallyGamerJet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/sh | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
# SPDX-FileCopyrightText: 2025 The Ebitengine Authors | ||
|
||
# FreeBSD & NetBSD tests run within QEMU on Ubuntu. | ||
# vmactions/freebsd-vm only supports a single "step" where it | ||
# brings down the VM at the end of the step, so all | ||
# the commands to run need to be put into this single block. | ||
|
||
echo "Running tests on $(uname -a) at $PWD" | ||
|
||
PATH=$PATH:/usr/local/go/bin/ | ||
|
||
# verify Go is available | ||
go version | ||
|
||
echo "=> go build" | ||
go build -v ./... | ||
# Compile without optimization to check potential stack overflow. | ||
# The option '-gcflags=all=-N -l' is often used at Visual Studio Code. | ||
# See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch and the issue hajimehoshi/ebiten#2120. | ||
go build "-gcflags=all=-N -l" -v ./... | ||
|
||
# Check cross-compiling Windows binaries. | ||
env GOOS=windows GOARCH=386 go build -v ./... | ||
env GOOS=windows GOARCH=amd64 go build -v ./... | ||
env GOOS=windows GOARCH=arm go build -v ./... | ||
env GOOS=windows GOARCH=arm64 go build -v ./... | ||
|
||
# Check cross-compiling macOS binaries. | ||
env GOOS=darwin GOARCH=amd64 go build -v ./... | ||
env GOOS=darwin GOARCH=arm64 go build -v ./... | ||
|
||
# Check cross-compiling Linux binaries. | ||
env GOOS=linux GOARCH=amd64 go build -v ./... | ||
env GOOS=linux GOARCH=arm64 go build -v ./... | ||
|
||
# Check cross-compiling FreeBSD binaries. | ||
env GOOS=freebsd GOARCH=amd64 go build -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -v ./... | ||
env GOOS=freebsd GOARCH=arm64 go build -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -v ./... | ||
|
||
# Check cross-compiling NetBSD binaries. | ||
env GOOS=netbsd GOARCH=amd64 go build -v ./... | ||
env GOOS=netbsd GOARCH=arm64 go build -v ./... | ||
|
||
echo "=> go build (plugin)" | ||
# Make sure that plugin buildmode works since we save the R15 register (#254) | ||
go build -buildmode=plugin ./examples/libc | ||
|
||
echo "=> go mod vendor" | ||
mkdir /tmp/vendoring | ||
cd /tmp/vendoring | ||
go mod init foo | ||
echo 'package main' > main.go | ||
echo 'import (' >> main.go | ||
echo ' _ "github.com/ebitengine/purego"' >> main.go | ||
echo ')' >> main.go | ||
echo 'func main() {}' >> main.go | ||
go mod edit -replace github.com/ebitengine/purego=$GITHUB_WORKSPACE | ||
go mod tidy | ||
go mod vendor | ||
go build -v . | ||
|
||
cd $GITHUB_WORKSPACE | ||
echo "=> go test CGO_ENABLED=0" | ||
env CGO_ENABLED=0 go test -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -shuffle=on -v -count=10 ./... | ||
|
||
echo "=> go test CGO_ENABLED=1" | ||
env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./... | ||
|
||
echo "=> go test CGO_ENABLED=0 w/o optimization" | ||
env CGO_ENABLED=0 go test "-gcflags=all=-N -l" -v ./... | ||
|
||
echo "=> go test CGO_ENABLED=1 w/o optimization" | ||
env CGO_ENABLED=1 go test "-gcflags=all=-N -l" -v ./... | ||
|
||
if [ -z "$(go version | grep '^1.1')" ]; then | ||
echo "=> go test race" | ||
go test -race -shuffle=on -v -count=10 ./... | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2025 The Ebitengine Authors | ||
|
||
package purego | ||
|
||
// Source for constants: https://github.com/NetBSD/src/blob/trunk/include/dlfcn.h | ||
|
||
const ( | ||
intSize = 32 << (^uint(0) >> 63) // 32 or 64 | ||
RTLD_DEFAULT = 1<<intSize - 2 // Pseudo-handle for dlsym so search for any loaded symbol | ||
RTLD_LAZY = 0x00000001 // Relocations are performed at an implementation-dependent time. | ||
RTLD_NOW = 0x00000002 // Relocations are performed when the object is loaded. | ||
RTLD_LOCAL = 0x00000000 // All symbols are not made available for relocation processing by other modules. | ||
RTLD_GLOBAL = 0x00000100 // All symbols are available for relocation processing of other modules. | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2025 The Ebitengine Authors | ||
|
||
package purego | ||
|
||
//go:cgo_import_dynamic purego_dlopen dlopen "libc.so" | ||
//go:cgo_import_dynamic purego_dlsym dlsym "libc.so" | ||
//go:cgo_import_dynamic purego_dlerror dlerror "libc.so" | ||
//go:cgo_import_dynamic purego_dlclose dlclose "libc.so" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add
set -e
to abort this script whenever any command fails.EDIT: Hmm this might work only with Bash.