Skip to content

Commit

Permalink
Fix Issue 12205: update posix.mak to use local, recently-built drunti…
Browse files Browse the repository at this point in the history
…me and phobos.

This fixes https://d.puremagic.com/issues/show_bug.cgi?id=12205
by adding library/include paths to the locations where druntime
and phobos have been built, plus a flag to prevent/suppress
alignment errors in one of the builds.

In the event that the user wishes to build using the system dmd
instead of the locally-built ../dmd/src/dmd, this is trivial to
achieve by overriding with DMD=dmd.  DFLAGS will also then be
overridden with those from the system dmd.conf.
  • Loading branch information
WebDrake committed Feb 21, 2014
1 parent a4294fa commit 0db1890
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions posix.mak
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
DMD = ../dmd/src/dmd
CC = gcc
INSTALL_DIR = ../install
DRUNTIME_PATH = ../druntime
PHOBOS_PATH = ../phobos

WITH_DOC = no
DOC = ../dlang.org/web
Expand Down Expand Up @@ -48,6 +50,25 @@ MODEL_FLAG=-m$(MODEL)
ROOT_OF_THEM_ALL = generated
ROOT = $(ROOT_OF_THEM_ALL)/$(OS)/$(MODEL)

# Set DRUNTIME name and full path
ifeq (,$(findstring win,$(OS)))
DRUNTIME = $(DRUNTIME_PATH)/lib/libdruntime-$(OS)$(MODEL).a
DRUNTIMESO = $(DRUNTIME_PATH)/lib/libdruntime-$(OS)$(MODEL)so.a
else
DRUNTIME = $(DRUNTIME_PATH)/lib/druntime.lib
endif

# Set PHOBOS name and full path
ifeq (,$(findstring win,$(OS)))
PHOBOS = $(PHOBOS_PATH)/generated/$(OS)/release/$(MODEL)/libphobos2.a
PHOBOSSO = $(PHOBOS_PATH)/generated/$(OS)/release/$(MODEL)/libphobos2.so
endif

# Set DFLAGS
ifneq (dmd,$(DMD))
DFLAGS = -I$(DRUNTIME_PATH)/import -I$(PHOBOS_PATH) -L-L$(PHOBOS_PATH)/generated/$(OS)/release/$(MODEL) -L--no-warn-search-mismatch $(DMDEXTRAFLAGS) -w
endif

TOOLS = \
$(ROOT)/rdmd \
$(ROOT)/ddemangle \
Expand Down Expand Up @@ -97,12 +118,12 @@ dman: $(ROOT)/dman
dustmite: $(ROOT)/dustmite

$(ROOT)/dustmite: DustMite/dustmite.d DustMite/dsplit.d
$(DMD) $(MODEL_FLAG) DustMite/dustmite.d DustMite/dsplit.d -of$(@)
$(DMD) $(MODEL_FLAG) $(DFLAGS) DustMite/dustmite.d DustMite/dsplit.d -of$(@)

#dreadful custom step because of libcurl dmd linking problem (Bugzilla 7044)
$(CURL_TOOLS): $(ROOT)/%: %.d
$(DMD) -c -of$(@).o $(<)
($(DMD) -v -of$(@) $(@).o 2>/dev/null | grep '\-Xlinker' | cut -f2- -d' ' ; echo -lcurl ) | xargs $(CC)
$(DMD) $(MODEL_FLAG) $(DFLAGS) -c -of$(@).o $(<)
($(DMD) $(MODEL_FLAG) $(DFLAGS) -v -of$(@) $(@).o 2>/dev/null | grep '\-Xlinker' | cut -f2- -d' ' ; echo -lcurl ) | xargs $(CC)

$(TOOLS) $(DOC_TOOLS): $(ROOT)/%: %.d
$(DMD) $(MODEL_FLAG) $(DFLAGS) -of$(@) $(<)
Expand Down

1 comment on commit 0db1890

@Orvid
Copy link

@Orvid Orvid commented on 0db1890 Feb 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--no-warn-search-mismatch prevents the makefile from compiling successfully on OSX due to the fact that OSX's ld needs it passed as -L-no_arch_warnings

Please sign in to comment.