From 7e13b1eaf8454d1671131a12461a61f5e3b8acd5 Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Fri, 22 Dec 2023 13:39:37 +1300 Subject: [PATCH] Fix build on BSD Added extra version statements for OpenBSD, NetBSD and DragonflyBSD, as these are not included in the BSD version identifier. Also removed the line `SHELL:=/usr/bin/env bash' from the top of the makefile because most BSDs don't include bash in the base system, and the build doesn't need it anyway. On OpenBSD, using -inline with dmd causes the compiler to crash because of insufficient memory (with 8 GB), so I added a couple of ifneq's to use -inline only if the build is not running on OpenBSD. --- common/src/dcd/common/socket.d | 3 +++ makefile | 12 ++++++++---- src/dcd/server/server.d | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/common/src/dcd/common/socket.d b/common/src/dcd/common/socket.d index 9be42467..9e008374 100644 --- a/common/src/dcd/common/socket.d +++ b/common/src/dcd/common/socket.d @@ -27,6 +27,9 @@ version (OSX) version = haveUnixSockets; version (linux) version = haveUnixSockets; version (BSD) version = haveUnixSockets; version (FreeBSD) version = haveUnixSockets; +version (OpenBSD) version = haveUnixSockets; +version (NetBSD) version = haveUnixSockets; +version (DragonflyBSD) version = haveUnixSockets; enum DEFAULT_PORT_NUMBER = 9166; diff --git a/makefile b/makefile index 90e0587c..eb9e46cc 100644 --- a/makefile +++ b/makefile @@ -13,8 +13,6 @@ LDC := ldc2 DPARSE_DIR := libdparse DSYMBOL_DIR := dsymbol -SHELL:=/usr/bin/env bash - githash: @mkdir -p bin git describe --tags > bin/githash.txt @@ -37,7 +35,6 @@ CLIENT_SRC := \ DMD_CLIENT_FLAGS := -Imsgpack-d/src\ -Imsgpack-d/src\ -Jbin\ - -inline\ -O\ -wi\ -ofbin/dcd-client @@ -56,6 +53,10 @@ LDC_CLIENT_FLAGS := -Imsgpack-d/src\ -oq\ -of=bin/dcd-client +ifneq ($(shell uname), OpenBSD) + override DMD_CLIENT_FLAGS += -inline +endif + override DMD_CLIENT_FLAGS += $(DFLAGS) override LDC_CLIENT_FLAGS += $(DFLAGS) override GDC_CLIENT_FLAGS += $(DFLAGS) @@ -76,7 +77,6 @@ DMD_SERVER_FLAGS := -Icontainers/src\ -wi\ -O\ -release\ - -inline\ -ofbin/dcd-server DEBUG_SERVER_FLAGS := -Icontainers/src\ @@ -106,6 +106,10 @@ LDC_SERVER_FLAGS := -Icontainers/src\ -O5\ -release +ifneq ($(shell uname), OpenBSD) + DMD_SERVER_FLAGS += -inline +endif + override DMD_SERVER_FLAGS += $(DFLAGS) override LDC_SERVER_FLAGS += $(DFLAGS) override GDC_SERVER_FLAGS += $(DFLAGS) diff --git a/src/dcd/server/server.d b/src/dcd/server/server.d index 10b36510..0095ffe5 100644 --- a/src/dcd/server/server.d +++ b/src/dcd/server/server.d @@ -35,6 +35,9 @@ enum CONFIG_FILE_NAME = "dcd.conf"; version(linux) version = useXDG; version(BSD) version = useXDG; version(FreeBSD) version = useXDG; +version(OpenBSD) version = useXDG; +version(NetBSD) version = useXDG; +version(DragonflyBSD) version = useXDG; version(OSX) version = useXDG; /**