$NetBSD: patch-Makefile,v 1.2 2024/05/05 09:31:37 nia Exp $

Unbundle d0_blind_id.

--- Makefile.orig	2023-05-31 03:40:30.000000000 +0000
+++ Makefile
@@ -1,30 +1,15 @@
 DPSRC = source/darkplaces
-D0SRC = source/d0_blind_id
 CLIENT = xonotic-local-sdl
 SERVER = xonotic-local-dedicated
 
 # CC and MAKEFLAGS are always set so ?= has no effect, therefore
 # we use CFLAGS to set default optimisations which users may override
 CFLAGS ?= -pipe -march=native -mtune=native -flto=auto
-# user can override this with make -j
-MAKEFLAGS := -j$(shell nproc)
+CFLAGS += $$(pkg-config --cflags d0_blind_id d0_rijndael)
+LDFLAGS += $$(pkg-config --libs d0_blind_id d0_rijndael)
 # DP makefile overrides CFLAGS (exporting CFLAGS does work for d0_blind_id but so does this)
 export CC += $(CFLAGS)
 
-# d0_blind_id header location
-export CC += -I$(PWD)/source/
-# d0_blind_id static libs location
-export CC += -L$(PWD)/$(D0SRC)/.libs/
-# Player IDs: DP_LINK_CRYPTO needs to be set (else it defaults to "dlopen"),
-# it should be set to "shared" but then LIB_CRYPTO gets overridden in DP makefile,
-# and we need to set LIB_CRYPTO such that libgmp gets linked
-export DP_LINK_CRYPTO=foo
-export CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
-export LIB_CRYPTO=-ld0_blind_id -lgmp
-# AES
-export DP_LINK_CRYPTO_RIJNDAEL=shared
-
-
 .PHONY: help
 help:
 	@echo
@@ -78,17 +63,13 @@ update-beta:
 $(D0SRC)/Makefile:
 	( cd $(D0SRC) && ./autogen.sh && ./configure --enable-static --disable-shared )
 
-.PHONY: d0_blind_id
-d0_blind_id: $(D0SRC)/Makefile
-	$(MAKE) -C $(D0SRC)
-
 .PHONY: server
-server: d0_blind_id
+server:
 	$(MAKE) -C $(DPSRC) sv-release
 	cp -v $(DPSRC)/darkplaces-dedicated $(SERVER)
 
 .PHONY: client
-client: d0_blind_id
+client:
 	$(MAKE) -C $(DPSRC) sdl-release
 	cp -v $(DPSRC)/darkplaces-sdl $(CLIENT)
 
