From 262f4826bd9d13a361b5cfed96fdfd57b6e77d29 Mon Sep 17 00:00:00 2001 From: Martin Nowak Date: Fri, 2 Oct 2015 09:53:01 +0200 Subject: [PATCH] use shared libraries on FreeBSD --- changelog.dd | 1 + posix.mak | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/changelog.dd b/changelog.dd index 010b5f516..1d5ec899b 100644 --- a/changelog.dd +++ b/changelog.dd @@ -9,6 +9,7 @@ $(BUGSTITLE Library Changes, $(LI $(RELATIVE_LINK2 more-rangified-functions, More phobos functions were rangified.)) $(LI $(RELATIVE_LINK2 std-algorithm-moveEmplace, `moveEmplace` was added)) $(LI $(RELATIVE_LINK2 curl-dynamic-loading, libcurl is now loaded dynamically)) +$(LI FreeBSD now also ships with a shared libphobos2.so library ($(LINK2 http://dlang.org/dll-linux.html, usage info)).) ) diff --git a/posix.mak b/posix.mak index 643fa817d..63dcd76a0 100644 --- a/posix.mak +++ b/posix.mak @@ -226,12 +226,15 @@ OBJS = $(addsuffix $(DOTOBJ),$(addprefix $(ROOT)/,$(C_MODULES))) MAKEFILE = $(firstword $(MAKEFILE_LIST)) +# build with shared library support (defaults to true on supported platforms) +SHARED=$(if $(findstring $(OS),linux freebsd),1,) + ################################################################################ # Rules begin here ################################################################################ # Main target (builds the dll on linux, too) -ifeq (linux,$(OS)) +ifeq (1,$(SHARED)) all : lib dll else all : lib @@ -306,7 +309,7 @@ $(UT_D_OBJS): $(ROOT)/unittest/%.o: %.d @rm $(@:.o=.deps.tmp) # $(DMD) $(DFLAGS) -unittest -c -of$@ $*.d -ifneq (linux,$(OS)) +ifneq (1,$(SHARED)) $(UT_D_OBJS): $(DRUNTIME) @@ -370,7 +373,7 @@ install2 : all $(eval lib_dir=$(if $(filter $(OS),osx), lib, lib$(MODEL))) mkdir -p $(INSTALL_DIR)/$(OS)/$(lib_dir) cp $(LIB) $(INSTALL_DIR)/$(OS)/$(lib_dir)/ -ifneq (,$(findstring $(OS),linux)) +ifeq (1,$(SHARED)) cp -P $(LIBSO) $(INSTALL_DIR)/$(OS)/$(lib_dir)/ ln -sf $(notdir $(LIBSO)) $(INSTALL_DIR)/$(OS)/$(lib_dir)/libphobos2.so endif