[commit: ghc] master: Make dynamic GHC no Windows installable too (c6a05a7)

Ian Lynagh igloo at earth.li
Fri May 17 16:06:04 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/c6a05a72d237cba0f17ea202f7c38ca0ac54aeb7

>---------------------------------------------------------------

commit c6a05a72d237cba0f17ea202f7c38ca0ac54aeb7
Author: Ian Lynagh <ian at well-typed.com>
Date:   Thu May 16 12:58:42 2013 +0100

    Make dynamic GHC no Windows installable too
    
    We need different paths in the wrapper, as teh installed tree is a
    different shape to the build tree.

>---------------------------------------------------------------

 driver/utils/dynwrapper.c |  4 +---
 rules/build-prog.mk       | 43 ++++++++++++++++++++++++++++++++-----------
 2 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/driver/utils/dynwrapper.c b/driver/utils/dynwrapper.c
index a84b5ae..a9250f5 100644
--- a/driver/utils/dynwrapper.c
+++ b/driver/utils/dynwrapper.c
@@ -82,7 +82,7 @@ void setPath(void) {
     n = s - exePath;
 
     for (dir = path_dirs; *dir != NULL; dir++) {
-        len += n + 7/* /../../ */ + lstrlen(*dir) + 1/* semicolon */;
+        len += n + lstrlen(*dir) + 1/* semicolon */;
     }
     len++; // NUL
 
@@ -94,8 +94,6 @@ void setPath(void) {
     for (dir = path_dirs; *dir != NULL; dir++) {
         StrCpy(s, exePath);
         s += n;
-        StrCpy(s, "/../../");
-        s += 7;
         StrCpy(s, *dir);
         s += lstrlen(*dir);
         s[0] = ';';
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index d362d42..32cac3f 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -132,14 +132,6 @@ endif
 $(call all-target,$1,all_$1_$2)
 $(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))" ""
-ifeq "$$($1_$2_INSTALL_INPLACE)" "YES"
-$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
-	"$$(CP)" -p $$< $$@
-endif
-endif
-
 $(call shell-wrapper,$1,$2)
 
 ifeq "$$($1_$2_PROGRAM_WAY)" ""
@@ -205,9 +197,11 @@ $1/$2/build/tmp/$$($1_$2_PROG) $1/$2/build/tmp/$$($1_$2_PROG).dll : \
         $$$$($$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB)))
 
 $1_$2_PROG_NEEDS_C_WRAPPER = NO
+$1_$2_PROG_INPLACE = $$($1_$2_PROG)
 ifeq "$$(Windows_Host) $$($1_$2_PROGRAM_WAY)" "YES dyn"
 ifneq "$$($1_$2_HS_SRCS)" ""
 $1_$2_PROG_NEEDS_C_WRAPPER = YES
+$1_$2_PROG_INPLACE = inplace-$$($1_$2_PROG)
 endif
 endif
 
@@ -233,15 +227,31 @@ $1/$2/build/tmp/$$($1_$2_PROG)-inplace-wrapper.c: driver/utils/dynwrapper.c | $$
 	echo '#include <Windows.h>' >> $$@
 	echo '#include "Rts.h"' >> $$@
 	echo 'LPTSTR path_dirs[] = {' >> $$@
-	$$(foreach d,$$($1_$2_DEP_LIB_REL_DIRS),$$(call make-command,echo '    TEXT("$$d")$$(comma)' >> $$@))
-	echo '    TEXT("$1/$2/build/tmp/"),' >> $$@
+	$$(foreach d,$$($1_$2_DEP_LIB_REL_DIRS),$$(call make-command,echo '    TEXT("/../../$$d")$$(comma)' >> $$@))
+	echo '    TEXT("/../../$1/$2/build/tmp/"),' >> $$@
 	echo '    NULL};' >> $$@
 	echo 'LPTSTR progDll = TEXT("../../$1/$2/build/tmp/$$($1_$2_PROG).dll");' >> $$@
 	echo 'LPTSTR rtsDll = TEXT("$$($$(WINDOWS_DYN_PROG_RTS))");' >> $$@
 	echo 'int rtsOpts = $$($1_$2_RTS_OPTS);' >> $$@
 	cat driver/utils/dynwrapper.c >> $$@
 
-$1/$2/build/tmp/$$($1_$2_PROG) : $1/$2/build/tmp/$$($1_$2_PROG)-inplace-wrapper.c $1/$2/build/tmp/$$($1_$2_PROG).dll | $$$$(dir $$$$@)/.
+$1/$2/build/tmp/$$($1_$2_PROG)-wrapper.c: driver/utils/dynwrapper.c | $$$$(dir $$$$@)/.
+	$$(call removeFiles,$$@)
+	echo '#include <Windows.h>' >> $$@
+	echo '#include "Rts.h"' >> $$@
+	echo 'LPTSTR path_dirs[] = {' >> $$@
+	$$(foreach p,$$($1_$2_TRANSITIVE_DEPS),$$(call make-command,echo '    TEXT("/../lib/$$p")$$(comma)' >> $$@))
+	echo '    TEXT("/../lib/"),' >> $$@
+	echo '    NULL};' >> $$@
+	echo 'LPTSTR progDll = TEXT("../lib/$$($1_$2_PROG).dll");' >> $$@
+	echo 'LPTSTR rtsDll = TEXT("$$($$(WINDOWS_DYN_PROG_RTS))");' >> $$@
+	echo 'int rtsOpts = $$($1_$2_RTS_OPTS);' >> $$@
+	cat driver/utils/dynwrapper.c >> $$@
+
+$1/$2/build/tmp/$$($1_$2_PROG_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG)-inplace-wrapper.c $1/$2/build/tmp/$$($1_$2_PROG).dll | $$$$(dir $$$$@)/.
+	$$(call cmd,$1_$2_HC) -no-hs-main -optc-g -optc-O0 $$< -o $$@
+
+$1/$2/build/tmp/$$($1_$2_PROG) : $1/$2/build/tmp/$$($1_$2_PROG)-wrapper.c $1/$2/build/tmp/$$($1_$2_PROG).dll | $$$$(dir $$$$@)/.
 	$$(call cmd,$1_$2_HC) -no-hs-main -optc-g -optc-O0 $$< -o $$@
 
 $1/$2/build/tmp/$$($1_$2_PROG).dll : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
@@ -290,7 +300,18 @@ $(call all-target,$1_$2,$$($1_$2_INPLACE))
 endif
 $(call clean-target,$1,$2_inplace,$$($1_$2_INPLACE))
 
+# INPLACE_BIN might be empty if we're distcleaning
+ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifeq "$$($1_$2_INSTALL_INPLACE)" "YES"
+$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG_INPLACE) | $$$$(dir $$$$@)/.
+	"$$(CP)" -p $$< $$@
+endif
+endif
+
 ifeq "$$($1_$2_INSTALL)" "YES"
+ifeq "$$($1_$2_PROG_NEEDS_C_WRAPPER)" "YES"
+INSTALL_LIBS     += $1/$2/build/tmp/$$($1_$2_PROG).dll
+endif
 ifeq "$$($1_$2_WANT_INSTALLED_WRAPPER)" "YES"
 INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG)
 else ifeq "$$($1_$2_TOPDIR)" "YES"





More information about the ghc-commits mailing list