Skip to content
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
merged 61 commits into from
Mar 8, 2025
Merged
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
10556e5
CGO support for Netbsd
TotallyGamerJet Aug 16, 2024
5068751
missing build tag
TotallyGamerJet Aug 16, 2024
92769ac
syscallArgs
TotallyGamerJet Aug 16, 2024
000117c
syscall15Args
TotallyGamerJet Aug 16, 2024
b23644e
some more
TotallyGamerJet Aug 16, 2024
68d652c
build tag
TotallyGamerJet Aug 16, 2024
cf0745d
test
TotallyGamerJet Aug 16, 2024
3c3731e
build tag for netbsd
TotallyGamerJet Aug 16, 2024
e87d728
some more stuff needed fixing
TotallyGamerJet Aug 17, 2024
0b92ec5
ignore tests
TotallyGamerJet Aug 17, 2024
68c9fa4
github actions
TotallyGamerJet Aug 18, 2024
4d82012
include go
TotallyGamerJet Aug 18, 2024
f37da23
examples/window: replace deprecated functions (#269)
hajimehoshi Aug 22, 2024
f8c7742
all: remove dependencies on golang.org/x/sys (#271)
hajimehoshi Aug 22, 2024
128551e
Clarify Example section and Dl* windows equivalents (#274)
TotallyGamerJet Aug 25, 2024
5ad9415
purego: mention LoadLibraryEx at Dlopen (#275)
hajimehoshi Aug 25, 2024
c3f4c9c
examples: remove depdencies on golang.org/x/sys/windows (#278)
hajimehoshi Sep 3, 2024
f091b66
all: release v0.9.0-alpha
hajimehoshi Sep 23, 2024
570751c
test
TotallyGamerJet Aug 25, 2024
4b324b2
fix install Go on freebsd
TotallyGamerJet Oct 14, 2024
7ab8812
fix install Go on freebsd
TotallyGamerJet Oct 14, 2024
3b55709
fix install Go
TotallyGamerJet Oct 15, 2024
ec53690
remove Go versions that dl doesn't have downloads for
TotallyGamerJet Oct 15, 2024
49cf092
mkdir
TotallyGamerJet Oct 15, 2024
ae1d516
specify default shell
TotallyGamerJet Oct 15, 2024
6c57d3f
disabled syncing to host VM
TotallyGamerJet Oct 15, 2024
ed60fb8
try installing bash
TotallyGamerJet Oct 15, 2024
c5caadb
prefix pkg_add
TotallyGamerJet Oct 15, 2024
d668211
try bash
TotallyGamerJet Oct 15, 2024
85a72ad
remove some bash references
TotallyGamerJet Oct 15, 2024
7773c24
go plugin not supported on netbsd
TotallyGamerJet Oct 15, 2024
9ddd066
remove echo
TotallyGamerJet Oct 15, 2024
ea999fd
Merge branch 'refs/heads/main' into issue-249_netbsd
TotallyGamerJet Oct 15, 2024
2a940f5
No Cgo on NetBSD?
TotallyGamerJet Mar 6, 2025
83c4528
Merge branch 'main' into issue-249_netbsd
TotallyGamerJet Mar 6, 2025
daa834c
add netbsd to build tag in examples/libc
TotallyGamerJet Mar 6, 2025
2a19c6e
update pipeline
TotallyGamerJet Mar 6, 2025
e7e52fe
enable tests
TotallyGamerJet Mar 6, 2025
19cebb4
make code more in line with runtime/cgo
TotallyGamerJet Mar 8, 2025
7d59f39
use -fPIC on all platforms
TotallyGamerJet Mar 8, 2025
bc9050f
build tags and copyright years
TotallyGamerJet Mar 8, 2025
3e44d74
try merging freebsd and netbsd
TotallyGamerJet Mar 8, 2025
d1cfb86
another attempt at merging workflow
TotallyGamerJet Mar 8, 2025
d649054
fix spacing
TotallyGamerJet Mar 8, 2025
7b5d581
try separate test script
TotallyGamerJet Mar 8, 2025
25f17fc
fix misspelling
TotallyGamerJet Mar 8, 2025
2a6247c
ls to debug
TotallyGamerJet Mar 8, 2025
3b59667
ensure it is executable and then bash directly
TotallyGamerJet Mar 8, 2025
75cbcfc
newline and license
TotallyGamerJet Mar 8, 2025
b0aba43
use "go version" for retrieving version
TotallyGamerJet Mar 8, 2025
e7e4a0e
fix misspelling
TotallyGamerJet Mar 8, 2025
5fda596
don't run on version that aren't downloadable
TotallyGamerJet Mar 8, 2025
9616e78
ls everything
TotallyGamerJet Mar 8, 2025
f6b5e0a
ls for freebsd
TotallyGamerJet Mar 8, 2025
d7c63f1
$GITHUB_WORKSPACE/
TotallyGamerJet Mar 8, 2025
a5d18b0
remove bash
TotallyGamerJet Mar 8, 2025
d0a90a9
ls inside "run:"
TotallyGamerJet Mar 8, 2025
f2e19f3
updates for freebsd
TotallyGamerJet Mar 8, 2025
961e360
try bash again
TotallyGamerJet Mar 8, 2025
19e4a72
yes install bash
TotallyGamerJet Mar 8, 2025
74c6bf6
sh
TotallyGamerJet Mar 8, 2025
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
Prev Previous commit
Next Next commit
another attempt at merging workflow
TotallyGamerJet committed Mar 8, 2025
commit d1cfb861d08b2fc1086ffcd62171056e0d55a45e
154 changes: 76 additions & 78 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -149,82 +149,6 @@ jobs:
run:
shell: bash
steps:
- &shared_run
run: |
# 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"
# 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 "$(echo ${{matrix.go}} | grep '^1.1')" ]; then
echo "=> go test race"
go test -race -shuffle=on -v -count=10 ./...
fi
- uses: actions/checkout@v4
- name: Run in freebsd
if: matrix.os == 'FreeBSD'
@@ -235,7 +159,81 @@ jobs:
fetch https://go.dev/dl/go${{matrix.go}}.freebsd-amd64.tar.gz
rm -fr /usr/local/go && tar -C /usr/local -xf go${{matrix.go}}.freebsd-amd64.tar.gz
ln -s /usr/local/go/bin/go /usr/local/bin
<<: *shared_run
run: &shared_run |
# FreeBSD & NetBSD tests run within QEMU on Ubuntu.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove one space char before &. (or just BSD)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just learned GitHub doesn't support anchors so the tests didn't run :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be possible to create a shell script file and source it?

# 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"

# 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 "$(echo ${{matrix.go}} | grep '^1.1')" ]; then
echo "=> go test race"
go test -race -shuffle=on -v -count=10 ./...
fi
- name: Run in netbsd
if: matrix.os == 'NetBSD'
uses: vmactions/netbsd-vm@v1
@@ -248,4 +246,4 @@ jobs:
rm -fr /usr/local/go && tar -C /usr/local -xf go${{matrix.go}}.netbsd-amd64.tar.gz
ln -s /usr/local/go/bin/go /usr/local/bin
export PATH=$PATH:/usr/local/go/bin/
<<: *shared_run
run: *shared_run