From aa9d2c15739afa9020a1052c9efccba4a8d33935 Mon Sep 17 00:00:00 2001 From: lily Date: Thu, 21 Oct 2021 14:28:29 -0700 Subject: [PATCH 1/5] v3.3/glfw: add openbsd support partially fixes #288 change freebsd specific code to be more general add openbsd specific build tags where necessary --- v3.3/glfw/build.go | 10 ++++++---- v3.3/glfw/{c_glfw_freebsd.go => c_glfw_bsd.go} | 2 +- v3.3/glfw/native_linbsd.go | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) rename v3.3/glfw/{c_glfw_freebsd.go => c_glfw_bsd.go} (97%) diff --git a/v3.3/glfw/build.go b/v3.3/glfw/build.go index b60c631d..1ffc208e 100644 --- a/v3.3/glfw/build.go +++ b/v3.3/glfw/build.go @@ -38,16 +38,18 @@ package glfw #cgo linux,!wayland LDFLAGS: -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama -ldl -lrt #cgo linux,wayland LDFLAGS: -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon -lm -ldl -lrt -// FreeBSD Build Tags +// BSD Build Tags // ---------------- // GLFW Options: -#cgo freebsd pkg-config: glfw3 -#cgo freebsd CFLAGS: -D_GLFW_HAS_DLOPEN -#cgo freebsd,!wayland CFLAGS: -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB +#cgo freebsd openbsd pkg-config: glfw3 +#cgo freebsd openbsd CFLAGS: -D_GLFW_HAS_DLOPEN +#cgo freebsd,!wayland openbsd CFLAGS: -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB #cgo freebsd,wayland CFLAGS: -D_GLFW_WAYLAND +#cgo openbsd CFLAGS: -I/usr/X11R6/include // Linker Options: #cgo freebsd,!wayland LDFLAGS: -lm -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lXinerama #cgo freebsd,wayland LDFLAGS: -lm -lGL -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon +#cgo openbsd LDFLAGS: -L/usr/X11R6/lib -lm -lX11 -lxcb -lXau -lXdmcp */ import "C" diff --git a/v3.3/glfw/c_glfw_freebsd.go b/v3.3/glfw/c_glfw_bsd.go similarity index 97% rename from v3.3/glfw/c_glfw_freebsd.go rename to v3.3/glfw/c_glfw_bsd.go index 01122739..668848a3 100644 --- a/v3.3/glfw/c_glfw_freebsd.go +++ b/v3.3/glfw/c_glfw_bsd.go @@ -1,4 +1,4 @@ -// +build freebsd +// +build freebsd openbsd package glfw diff --git a/v3.3/glfw/native_linbsd.go b/v3.3/glfw/native_linbsd.go index 39d9f0c9..ac3bbc79 100644 --- a/v3.3/glfw/native_linbsd.go +++ b/v3.3/glfw/native_linbsd.go @@ -1,4 +1,4 @@ -// +build linux,!wayland freebsd,!wayland +// +build linux,!wayland freebsd,!wayland openbsd package glfw From 56186b8ab1ef7444ffc7657836da31a4daf4d7bc Mon Sep 17 00:00:00 2001 From: lily Date: Fri, 22 Oct 2021 12:15:05 -0700 Subject: [PATCH 2/5] v3.3/glfw: remove redundant openbsd CFLAGS since pkg-config gets CFLAGS for glfw3, we don't need to explicitly specify the openbsd x11 include path --- v3.3/glfw/build.go | 1 - 1 file changed, 1 deletion(-) diff --git a/v3.3/glfw/build.go b/v3.3/glfw/build.go index 1ffc208e..3c617adc 100644 --- a/v3.3/glfw/build.go +++ b/v3.3/glfw/build.go @@ -45,7 +45,6 @@ package glfw #cgo freebsd openbsd CFLAGS: -D_GLFW_HAS_DLOPEN #cgo freebsd,!wayland openbsd CFLAGS: -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB #cgo freebsd,wayland CFLAGS: -D_GLFW_WAYLAND -#cgo openbsd CFLAGS: -I/usr/X11R6/include // Linker Options: #cgo freebsd,!wayland LDFLAGS: -lm -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lXinerama From 5778a4f3ef3dd2f5e64f15267f9b5f7a6252df72 Mon Sep 17 00:00:00 2001 From: lily Date: Sat, 23 Oct 2021 08:08:25 -0700 Subject: [PATCH 3/5] remove external glfw3 dependency for openbsd simply include standard X11 paths so that the included glfw source compiles on openbsd --- v3.3/glfw/build.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v3.3/glfw/build.go b/v3.3/glfw/build.go index 3c617adc..97e3468f 100644 --- a/v3.3/glfw/build.go +++ b/v3.3/glfw/build.go @@ -41,10 +41,11 @@ package glfw // BSD Build Tags // ---------------- // GLFW Options: -#cgo freebsd openbsd pkg-config: glfw3 +#cgo freebsd pkg-config: glfw3 #cgo freebsd openbsd CFLAGS: -D_GLFW_HAS_DLOPEN #cgo freebsd,!wayland openbsd CFLAGS: -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB #cgo freebsd,wayland CFLAGS: -D_GLFW_WAYLAND +#cgo openbsd CFLAGS: -I/usr/X11R6/include // Linker Options: #cgo freebsd,!wayland LDFLAGS: -lm -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lXinerama From d93197326fce65a2233d69d2ab2d6ba48a825448 Mon Sep 17 00:00:00 2001 From: lily Date: Sat, 23 Oct 2021 08:21:04 -0700 Subject: [PATCH 4/5] pkg-config X11 dependencies on openbsd removes the need to explicitly specify standard X11 directories --- v3.3/glfw/build.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v3.3/glfw/build.go b/v3.3/glfw/build.go index 97e3468f..fa4d7635 100644 --- a/v3.3/glfw/build.go +++ b/v3.3/glfw/build.go @@ -41,15 +41,15 @@ package glfw // BSD Build Tags // ---------------- // GLFW Options: +#cgo openbsd pkg-config: x11 xau xcb xdmcp #cgo freebsd pkg-config: glfw3 #cgo freebsd openbsd CFLAGS: -D_GLFW_HAS_DLOPEN #cgo freebsd,!wayland openbsd CFLAGS: -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB #cgo freebsd,wayland CFLAGS: -D_GLFW_WAYLAND -#cgo openbsd CFLAGS: -I/usr/X11R6/include // Linker Options: #cgo freebsd,!wayland LDFLAGS: -lm -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lXinerama #cgo freebsd,wayland LDFLAGS: -lm -lGL -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon -#cgo openbsd LDFLAGS: -L/usr/X11R6/lib -lm -lX11 -lxcb -lXau -lXdmcp +#cgo openbsd LDFLAGS: -lm */ import "C" From abcb53100442d1c44f11802a5a7e2038f3a95583 Mon Sep 17 00:00:00 2001 From: lily Date: Sat, 23 Oct 2021 08:28:12 -0700 Subject: [PATCH 5/5] alphabetize bsd soup sort bsd pkg-config lines for readability --- v3.3/glfw/build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v3.3/glfw/build.go b/v3.3/glfw/build.go index fa4d7635..3a48706a 100644 --- a/v3.3/glfw/build.go +++ b/v3.3/glfw/build.go @@ -41,8 +41,8 @@ package glfw // BSD Build Tags // ---------------- // GLFW Options: -#cgo openbsd pkg-config: x11 xau xcb xdmcp #cgo freebsd pkg-config: glfw3 +#cgo openbsd pkg-config: x11 xau xcb xdmcp #cgo freebsd openbsd CFLAGS: -D_GLFW_HAS_DLOPEN #cgo freebsd,!wayland openbsd CFLAGS: -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB #cgo freebsd,wayland CFLAGS: -D_GLFW_WAYLAND