diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-09-25 19:50:09 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-10-03 12:11:28 +0100 |
commit | 898cb090c8812704448ec4cb1c10d50df4b7d664 (patch) | |
tree | 526c5f4b47aee447d91af7ce83a819863f105804 /rules/build-prog.mk | |
parent | 58eaacc9967b7c627a66d49047fb447ac065706e (diff) | |
download | haskell-898cb090c8812704448ec4cb1c10d50df4b7d664.tar.gz |
Build the dynamic way by default on Linux/amd64
This required various build system changes to get the build to go
through.
In the inplace shell wrappers, we set LD_LIBRARY_PATH to allow programs
to find their libraries. In the future, we might change the inplace tree
to be the same shape as an installed tree instead. However, this would
mean changing the way we do installation, as currently we use cabal's
installation methods to install the libraries, but that only works if
the libraries are under libraries/foo/dist-install/build/..., rather
than in inplace/lib/...
Diffstat (limited to 'rules/build-prog.mk')
-rw-r--r-- | rules/build-prog.mk | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/rules/build-prog.mk b/rules/build-prog.mk index 462dcf7fcb..6e6d1c11f1 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -54,6 +54,26 @@ ifeq "$$($1_USES_CABAL)" "YES" $1_$2_USES_CABAL = YES endif +ifeq "$$(Windows)" "YES" +$1_$2_WANT_INPLACE_WRAPPER = NO +else ifneq "$$($1_$2_INSTALL_INPLACE)" "YES" +$1_$2_WANT_INPLACE_WRAPPER = NO +else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" +$1_$2_WANT_INPLACE_WRAPPER = YES +else +$1_$2_WANT_INPLACE_WRAPPER = NO +endif + +ifeq "$$(Windows)" "YES" +$1_$2_WANT_INSTALLED_WRAPPER = NO +else ifneq "$$($1_$2_INSTALL)" "YES" +$1_$2_WANT_INSTALLED_WRAPPER = NO +else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" +$1_$2_WANT_INSTALLED_WRAPPER = YES +else +$1_$2_WANT_INSTALLED_WRAPPER = NO +endif + $(call package-config,$1,$2,$3) $1_$2_depfile_base = $1/$2/build/.depend @@ -66,7 +86,7 @@ $1_$2_INPLACE = endif else # Where do we install the inplace version? -ifeq "$$($1_$2_SHELL_WRAPPER) $$(Windows)" "YES NO" +ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES" $1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG) else ifeq "$$($1_$2_TOPDIR)" "YES" @@ -93,7 +113,7 @@ $(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG)) # INPLACE_BIN might be empty if we're distcleaning ifeq "$(findstring clean,$(MAKECMDGOALS))" "" -ifneq "$$($1_$2_INSTALL_INPLACE)" "NO" +ifeq "$$($1_$2_INSTALL_INPLACE)" "YES" $$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/. "$$(CP)" -p $$< $$@ endif @@ -142,17 +162,25 @@ ifeq "$$($1_$2_v_HS_OBJS)" "" $1_$2_GHC_LD_OPTS = -no-auto-link-packages -no-hs-main endif +ifneq "$3" "0" +ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES" +$1_$2_GHC_LD_OPTS = \ + -fno-use-rpaths \ + $$(addprefix -optl-Wl$$(comma)-rpath -optl-Wl$$(comma),$$($1_$2_RPATHS)) +endif +endif + ifneq "$$(BINDIST)" "YES" # The quadrupled $'s here are because the _v_LIB variables aren't # necessarily set when this part of the makefile is read $1/$2/build/tmp/$$($1_$2_PROG) : \ $$(foreach dep,$$($1_$2_DEP_NAMES),\ $$(if $$(filter ghc,$$(dep)),\ - $(if $(filter 0,$3),$$(compiler_stage1_v_LIB),\ - $(if $(filter 1,$3),$$(compiler_stage2_v_LIB),\ - $(if $(filter 2,$3),$$(compiler_stage2_v_LIB),\ + $(if $(filter 0,$3),$$(compiler_stage1_PROGRAM_DEP_LIB),\ + $(if $(filter 1,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\ + $(if $(filter 2,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\ $$(error Bad build stage)))),\ - $$$$(libraries/$$(dep)_dist-$(if $(filter 0,$3),boot,install)_v_LIB))) + $$$$(libraries/$$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB))) ifeq "$$($1_$2_LINK_WITH_GCC)" "NO" $1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/. |