Skip to content

Commit

Permalink
Fix build on BSD
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jtbx authored and WebFreak001 committed Dec 23, 2023
1 parent 15ea4b3 commit 57794ca
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions common/src/dcd/common/socket.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 8 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,7 +35,6 @@ CLIENT_SRC := \
DMD_CLIENT_FLAGS := -Imsgpack-d/src\
-Imsgpack-d/src\
-Jbin\
-inline\
-O\
-wi\
-ofbin/dcd-client
Expand All @@ -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)
Expand All @@ -76,7 +77,6 @@ DMD_SERVER_FLAGS := -Icontainers/src\
-wi\
-O\
-release\
-inline\
-ofbin/dcd-server

DEBUG_SERVER_FLAGS := -Icontainers/src\
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/dcd/server/server.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down

0 comments on commit 57794ca

Please sign in to comment.