$NetBSD: patch-Makerules,v 1.1 2024/08/14 05:55:32 adam Exp $

- Handle the various operating systems in the same way avoiding hardcoding
- Avoid to use objcopy by setting HAVE_OBJCOPY to no (if `yes', and with
  `USE_TOOLS+= objcopy' the objcopy-ing fails as follow:
    OBJCOPY build/release/resources/fonts/urw/Dingbats.cff.o
    build/release/resources/fonts/urw/Dingbats.cff.o:1: warning: NUL character seen; rest of line ignored
    build/release/resources/fonts/urw/Dingbats.cff.o:1: *** missing separator.  Stop.
  (also for other fonts)).  This needs to be investigated further.
- Avoid internal version of freeglut and try to pick it up via pkg-config and
  set SYS_GLUT_{CFLAGS,LIBS} accordingly.

--- Makerules.orig	2024-03-19 15:31:58.000000000 +0000
+++ Makerules
@@ -48,30 +48,6 @@ endif
 
 # System specific features
 
-ifeq ($(findstring -fembed-bitcode,$(XCFLAGS)),)
-  # clang does not support these in combination with -fembed-bitcode
-  CFLAGS += -ffunction-sections -fdata-sections
-endif
-
-ifeq ($(OS),MACOS)
-  LDREMOVEUNREACH := -Wl,-dead_strip
-  SO := dylib
-else
-  LDREMOVEUNREACH := -Wl,--gc-sections
-  ifeq ($(OS),MINGW)
-    SO := dll
-    EXE := .exe
-  else
-    SO := so
-  endif
-endif
-
-ifeq "$(OS)" "ios"
-  NEONFLAGS =
-else
-  NEONFLAGS = -mneon
-endif
-
 SANITIZE_FLAGS += -fsanitize=address
 SANITIZE_FLAGS += -fsanitize=leak
 
@@ -178,37 +154,7 @@ ifeq ($(OS),OpenBSD)
     LINUX_OR_OPENBSD := yes
 endif
 
-ifeq ($(OS),MINGW)
-  WINDRES := windres
-  HAVE_WIN32 := yes
-
-else ifeq ($(OS),MACOS)
-  HAVE_GLUT := yes
-  SYS_GLUT_CFLAGS := -Wno-deprecated-declarations
-  SYS_GLUT_LIBS := -framework GLUT -framework OpenGL
-  CC = xcrun cc
-  AR = xcrun ar
-  LD = xcrun ld
-  RANLIB = xcrun ranlib
-
-  ifneq ($(ARCHFLAGS),)
-    $(warning "MacOS with ARCHFLAGS set. Assuming we are building for arm64, and setting HAVE_LIBCRYPTO to no.")
-    HAVE_LIBCRYPTO := no
-  else ifeq (, $(shell command -v pkg-config))
-    $(warning "No pkg-config found, install it for proper integration of libcrypto")
-  else
-    HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)
-    ifeq ($(HAVE_LIBCRYPTO),yes)
-	  LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO
-	  LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
-    endif
-  endif
-
-else ifeq ($(LINUX_OR_OPENBSD),yes)
-
-  ifeq ($(OS),Linux)
-    HAVE_OBJCOPY := yes
-  endif
+HAVE_OBJCOPY := no
 
   ifeq ($(shell pkg-config --exists freetype2 && echo yes),yes)
 	SYS_FREETYPE_CFLAGS := $(shell pkg-config --cflags freetype2)
@@ -263,15 +209,9 @@ else ifeq ($(LINUX_OR_OPENBSD),yes)
 	SYS_CURL_LIBS := $(shell pkg-config --libs libcurl)
   endif
 
-  HAVE_GLUT := yes
   ifeq ($(HAVE_GLUT),yes)
-    ifeq ($(OS),OpenBSD)
       SYS_GLUT_CFLAGS := $(shell pkg-config --cflags glut gl)
       SYS_GLUT_LIBS := $(shell pkg-config --libs glut gl)
-    else
-      SYS_GLUT_CFLAGS :=
-      SYS_GLUT_LIBS := -lglut -lGL
-    endif
   endif
 
   HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes)
@@ -294,8 +234,6 @@ else ifeq ($(LINUX_OR_OPENBSD),yes)
 	PTHREAD_LIBS := -lpthread
   endif
 
-endif
-
 # The following section has various cross compilation configurations.
 #
 # Invoke these as:
