Merge pull request #3035 from MartinNowak/sharedFBSD

use shared libraries on FreeBSD
This commit is contained in:
Walter Bright 2015-10-02 03:41:17 -07:00
commit caba1d1f12
2 changed files with 7 additions and 3 deletions

View file

@ -9,6 +9,7 @@ $(BUGSTITLE Library Changes,
$(LI $(RELATIVE_LINK2 more-rangified-functions, More phobos functions were rangified.)) $(LI $(RELATIVE_LINK2 more-rangified-functions, More phobos functions were rangified.))
$(LI $(RELATIVE_LINK2 std-algorithm-moveEmplace, `moveEmplace` was added)) $(LI $(RELATIVE_LINK2 std-algorithm-moveEmplace, `moveEmplace` was added))
$(LI $(RELATIVE_LINK2 curl-dynamic-loading, libcurl is now loaded dynamically)) $(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)).)
) )

View file

@ -226,12 +226,15 @@ OBJS = $(addsuffix $(DOTOBJ),$(addprefix $(ROOT)/,$(C_MODULES)))
MAKEFILE = $(firstword $(MAKEFILE_LIST)) 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 # Rules begin here
################################################################################ ################################################################################
# Main target (builds the dll on linux, too) # Main target (builds the dll on linux, too)
ifeq (linux,$(OS)) ifeq (1,$(SHARED))
all : lib dll all : lib dll
else else
all : lib all : lib
@ -306,7 +309,7 @@ $(UT_D_OBJS): $(ROOT)/unittest/%.o: %.d
@rm $(@:.o=.deps.tmp) @rm $(@:.o=.deps.tmp)
# $(DMD) $(DFLAGS) -unittest -c -of$@ $*.d # $(DMD) $(DFLAGS) -unittest -c -of$@ $*.d
ifneq (linux,$(OS)) ifneq (1,$(SHARED))
$(UT_D_OBJS): $(DRUNTIME) $(UT_D_OBJS): $(DRUNTIME)
@ -370,7 +373,7 @@ install2 : all
$(eval lib_dir=$(if $(filter $(OS),osx), lib, lib$(MODEL))) $(eval lib_dir=$(if $(filter $(OS),osx), lib, lib$(MODEL)))
mkdir -p $(INSTALL_DIR)/$(OS)/$(lib_dir) mkdir -p $(INSTALL_DIR)/$(OS)/$(lib_dir)
cp $(LIB) $(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)/ cp -P $(LIBSO) $(INSTALL_DIR)/$(OS)/$(lib_dir)/
ln -sf $(notdir $(LIBSO)) $(INSTALL_DIR)/$(OS)/$(lib_dir)/libphobos2.so ln -sf $(notdir $(LIBSO)) $(INSTALL_DIR)/$(OS)/$(lib_dir)/libphobos2.so
endif endif