From d7693eea09ac76c67f5f3aa538bb911ce2291e2c Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sun, 29 Aug 2021 09:13:49 +1000 Subject: [PATCH 1/6] Makefile: don't strip in install step As discussed in Issue #310 stripping the binaries is done by the link targets, not needed for the install step. Along the lines of a Yocto batch by Ross Burton --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 04af44c..db698e9 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,6 @@ DIST_DIR := $(shell mktemp -d /tmp/glew.XXXXXX)/$(DIST_NAME) # To disable stripping of linked binaries either: # - use STRIP= on gmake command-line # - edit this makefile to set STRIP to the empty string -# (Note: STRIP does not affect the strip in the install step) # # To disable symlinks: # - use LN= on gmake command-line @@ -228,7 +227,7 @@ endif install.bin: glew.bin $(INSTALL) -d -m 0755 "$(DESTDIR)$(BINDIR)" - $(INSTALL) -s -m 0755 bin/$(GLEWINFO.BIN) bin/$(VISUALINFO.BIN) "$(DESTDIR)$(BINDIR)/" + $(INSTALL) -m 0755 bin/$(GLEWINFO.BIN) bin/$(VISUALINFO.BIN) "$(DESTDIR)$(BINDIR)/" install.include: $(INSTALL) -d -m 0755 "$(DESTDIR)$(INCDIR)" From 247baa9e2030aee20f0af6c48e64dc4fff7ae6d9 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sun, 29 Aug 2021 09:30:13 +1000 Subject: [PATCH 2/6] For SYSTEM linux-mingw32 and linux-mingw64 default GLEW_DEST more appropriately --- config/Makefile.linux-mingw32 | 8 +++++--- config/Makefile.linux-mingw64 | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config/Makefile.linux-mingw32 b/config/Makefile.linux-mingw32 index e4e4d5f..5b298a5 100644 --- a/config/Makefile.linux-mingw32 +++ b/config/Makefile.linux-mingw32 @@ -1,17 +1,19 @@ # For cross-compiling from Linux to Windows 32-bit using mingw32 # http://mingw-w64.org/ # +# Ubuntu/Debian: # $ sudo apt install mingw-w64 # $ make SYSTEM=linux-mingw32 -NAME := glew32 -HOST := i686-w64-mingw32 +NAME := glew32 +HOST := i686-w64-mingw32 +GLEW_DEST ?= /usr/local/$(HOST) CC := $(HOST)-gcc LD := $(HOST)-ld LN := STRIP := LDFLAGS.GL = -L/usr/$(HOST)/lib -lopengl32 -lgdi32 -luser32 -lkernel32 -CFLAGS.EXTRA += -fno-builtin -fno-stack-protector +CFLAGS.EXTRA += -fno-builtin -fno-stack-protector -Wno-cast-function-type WARN = -Wall -W POPT = -O2 BIN.SUFFIX = .exe diff --git a/config/Makefile.linux-mingw64 b/config/Makefile.linux-mingw64 index 33db444..4168df6 100644 --- a/config/Makefile.linux-mingw64 +++ b/config/Makefile.linux-mingw64 @@ -1,17 +1,19 @@ # For cross-compiling from Linux to Windows 64-bit using mingw64 # http://mingw-w64.org/ # +# Ubuntu/Debian: # $ sudo apt install mingw-w64 # $ make SYSTEM=linux-mingw64 -NAME := glew32 -HOST := x86_64-w64-mingw32 +NAME := glew32 +HOST := x86_64-w64-mingw32 +GLEW_DEST ?= /usr/local/$(HOST) CC := $(HOST)-gcc LD := $(HOST)-ld LN := STRIP := LDFLAGS.GL = -L/usr/$(HOST)/lib -lopengl32 -lgdi32 -luser32 -lkernel32 -CFLAGS.EXTRA += -fno-builtin -fno-stack-protector +CFLAGS.EXTRA += -fno-builtin -fno-stack-protector -Wno-cast-function-type WARN = -Wall -W POPT = -O2 BIN.SUFFIX = .exe From 9e6361b357e99f0527d7da5c07f42ccf4327a5e9 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sun, 29 Aug 2021 18:18:50 +1000 Subject: [PATCH 3/6] visualinfo: EGL not supported yet, error out more clearly Also, remove GLEW_MX support from visualinfo --- src/visualinfo.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/src/visualinfo.c b/src/visualinfo.c index 6879f78..1de1fa7 100644 --- a/src/visualinfo.c +++ b/src/visualinfo.c @@ -4,7 +4,7 @@ ** Copyright (C) Nate Robins, 1997 ** Michael Wimmer, 1999 ** Milan Ikits, 2002-2008 -** Nigel Stewart, 2008-2019 +** Nigel Stewart, 2008-2021 ** ** visualinfo is a small utility that displays all available visuals, ** aka. pixelformats, in an OpenGL system along with renderer version @@ -48,18 +48,6 @@ #include #endif -#ifdef GLEW_MX -GLEWContext _glewctx; -# define glewGetContext() (&_glewctx) -# ifdef _WIN32 -WGLEWContext _wglewctx; -# define wglewGetContext() (&_wglewctx) -# elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX) -GLXEWContext _glxewctx; -# define glxewGetContext() (&_glxewctx) -# endif -#endif /* GLEW_MX */ - typedef struct GLContextStruct { #if defined(GLEW_OSMESA) @@ -123,6 +111,13 @@ main (int argc, char** argv) return 1; } +#if defined(GLEW_EGL) + { + fprintf(stderr, "Error [main]: EGL not supported by visualinfo.\n"); + return 1; + } +#endif + /* ---------------------------------------------------------------------- */ /* create OpenGL rendering context */ InitContext(&ctx); @@ -136,16 +131,7 @@ main (int argc, char** argv) /* ---------------------------------------------------------------------- */ /* initialize GLEW */ glewExperimental = GL_TRUE; -#ifdef GLEW_MX - err = glewContextInit(glewGetContext()); -# ifdef _WIN32 - err = err || wglewContextInit(wglewGetContext()); -# elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX) - err = err || glxewContextInit(glxewGetContext()); -# endif -#else err = glewInit(); -#endif if (GLEW_OK != err) { fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err)); From 037635a19261f936a9abc98ae4f82f354ba3a90f Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sun, 29 Aug 2021 18:21:18 +1000 Subject: [PATCH 4/6] Disable stripping in debug-mode builds --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index db698e9..9a6b9ef 100644 --- a/Makefile +++ b/Makefile @@ -76,6 +76,7 @@ DOS2UNIX ?= dos2unix -q ifneq (,$(filter debug,$(MAKECMDGOALS))) OPT = -g +STRIP := else OPT = $(POPT) endif From 8e2e31e69bb655717bea6c81a2d36b3228acdae5 Mon Sep 17 00:00:00 2001 From: Vanfanel Date: Thu, 28 Oct 2021 16:47:08 +0200 Subject: [PATCH 5/6] Add support for building against vendor-neutral GLVND instead of GLX on Linux/EGL --- config/Makefile.linux-egl-glvnd | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 config/Makefile.linux-egl-glvnd diff --git a/config/Makefile.linux-egl-glvnd b/config/Makefile.linux-egl-glvnd new file mode 100644 index 0000000..1f6f930 --- /dev/null +++ b/config/Makefile.linux-egl-glvnd @@ -0,0 +1,4 @@ +include config/Makefile.linux + +LDFLAGS.GL = -lEGL -lOpenGL +CFLAGS.EXTRA += -DGLEW_EGL From 062067f2bad84610622f25d03265d22e4872d55c Mon Sep 17 00:00:00 2001 From: Vanfanel Date: Thu, 28 Oct 2021 23:51:03 +0200 Subject: [PATCH 6/6] Specify that EGL/GLVND doesn't use GLU. --- config/Makefile.linux-egl-glvnd | 1 + 1 file changed, 1 insertion(+) diff --git a/config/Makefile.linux-egl-glvnd b/config/Makefile.linux-egl-glvnd index 1f6f930..dbd6328 100644 --- a/config/Makefile.linux-egl-glvnd +++ b/config/Makefile.linux-egl-glvnd @@ -2,3 +2,4 @@ include config/Makefile.linux LDFLAGS.GL = -lEGL -lOpenGL CFLAGS.EXTRA += -DGLEW_EGL +GLEW_NO_GLU = -DGLEW_NO_GLU