summaryrefslogtreecommitdiff
path: root/rules/shell-wrapper.mk
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-09-25 19:50:09 +0100
committerIan Lynagh <ian@well-typed.com>2012-10-03 12:11:28 +0100
commit898cb090c8812704448ec4cb1c10d50df4b7d664 (patch)
tree526c5f4b47aee447d91af7ce83a819863f105804 /rules/shell-wrapper.mk
parent58eaacc9967b7c627a66d49047fb447ac065706e (diff)
downloadhaskell-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/shell-wrapper.mk')
-rw-r--r--rules/shell-wrapper.mk61
1 files changed, 24 insertions, 37 deletions
diff --git a/rules/shell-wrapper.mk b/rules/shell-wrapper.mk
index 34b803e063..8085ad150a 100644
--- a/rules/shell-wrapper.mk
+++ b/rules/shell-wrapper.mk
@@ -16,56 +16,43 @@ $(call profStart, shell-wrapper($1,$2))
# $1 = dir
# $2 = distdir
-ifeq "$$(Windows)" "YES"
-$1_$2_WANT_INPLACE_WRAPPER = NO
-else ifeq "$$($1_$2_INSTALL_INPLACE)" "NO"
-$1_$2_WANT_INPLACE_WRAPPER = NO
-else ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES"
-# We need to set LD_LIBRARY_PATH for all programs, so always need
-# a shell wrapper
-$1_$2_WANT_INPLACE_WRAPPER = YES
-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 ifeq "$$($1_$2_INSTALL)" "NO"
-$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
+ifeq "$$($1_$2_SHELL_WRAPPER_NAME)" ""
+$1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROG).wrapper
endif
-
ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES"
-ifeq "$$($1_$2_SHELL_WRAPPER_NAME)" ""
-$1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROG).wrapper
+ifeq "$$($1_$2_TOPDIR)" "YES"
+INPLACE_WRAPPER = $$(INPLACE_LIB)/$$($1_$2_PROG)
+else
+INPLACE_WRAPPER = $$(INPLACE_BIN)/$$($1_$2_PROG)
endif
-all_$1_$2 : $$(INPLACE_BIN)/$$($1_$2_PROG)
+all_$1_$2 : $$(INPLACE_WRAPPER)
$$(INPLACE_BIN)/$$($1_$2_PROG): WRAPPER=$$@
-$$(INPLACE_BIN)/$$($1_$2_PROG): $$($1_$2_INPLACE) $$($1_$2_SHELL_WRAPPER_NAME)
- $$(call removeFiles, $$@)
- echo '#!$$(SHELL)' >> $$@
- echo 'executablename="$$(TOP)/$$<"' >> $$@
- echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@
- echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@
- echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@
- echo 'pgmgcc="$$(WhatGccIsCalled)"' >> $$@
+ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
+$$(INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME)
+endif
+$$(INPLACE_WRAPPER): $$($1_$2_INPLACE)
+ $$(call removeFiles, $$@)
+ echo '#!$$(SHELL)' >> $$@
+ echo 'executablename="$$(TOP)/$$<"' >> $$@
+ echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@
+ echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@
+ echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@
+ echo 'pgmgcc="$$(WhatGccIsCalled)"' >> $$@
$$($1_$2_SHELL_WRAPPER_EXTRA)
$$($1_$2_INPLACE_SHELL_WRAPPER_EXTRA)
+ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES"
+ echo 'export LD_LIBRARY_PATH="$$($1_$2_DEP_LIB_DIRS_SEARCHPATH)"' >> $$@
+endif
ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
- cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@
+ cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@
else
- echo 'exec "$executablename" $$$${1+"$$$$@"}' >> $$@
+ echo 'exec "$$$$executablename" $$$${1+"$$$$@"}' >> $$@
endif
- $$(EXECUTABLE_FILE) $$@
+ $$(EXECUTABLE_FILE) $$@
endif