Commit 723eb70f authored by Simon Marlow's avatar Simon Marlow

Fix #3642: m GHC builds using the Haskell Platform

parent 4ea81579
......@@ -426,7 +426,8 @@ else
fi
fi])
fp_prog_ar_args=$fp_cv_prog_ar_args
AC_SUBST([ArCmd], ["$fp_prog_ar $fp_prog_ar_args"])
AC_SUBST([ArCmd], ["$fp_prog_ar"])
AC_SUBST([ArArgs], ["$fp_prog_ar_args"])
])# FP_PROG_AR_ARGS
......
......@@ -563,6 +563,7 @@ HaveLibMingwEx = @HaveLibMingwEx@
# Other standard (ha!) Unix utilities
AR = @ArCmd@
AR_OPTS = @ArArgs@
ArSupportsInput = @ArSupportsInput@
# Yuckage: for ghc/utils/parallel -- todo: nuke this dependency!!
BASH = /usr/local/bin/bash
......
......@@ -114,7 +114,7 @@ $$(rts_$1_LIB) : $$(rts_$1_OBJS) rts/libs.depend
else
$$(rts_$1_LIB) : $$(rts_$1_OBJS)
"$$(RM)" $$(RM_OPTS) $$@
echo $$(rts_$1_OBJS) | $$(XARGS) $$(AR) $$(EXTRA_AR_ARGS) $$@
echo $$(rts_$1_OBJS) | $$(XARGS) "$$(AR)" $$(AR_OPTS) $$(EXTRA_AR_ARGS) $$@
endif
endef
......@@ -334,7 +334,7 @@ $(DYNWRAPPER_PROG): $(DYNWRAPPER_SRC)
# build the static lib containing the C main symbol
rts/dist/build/libHSrtsmain.a : rts/dist/build/Main.o
$(AR) $(EXTRA_AR_ARGS) $@ $<
"$(AR)" $(AR_OPTS) $(EXTRA_AR_ARGS) $@ $<
# -----------------------------------------------------------------------------
# The RTS package config
......
......@@ -54,11 +54,11 @@ else
ifeq "$$($1_$2_SplitObjs)" "YES"
$$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS)
"$$(RM)" $$(RM_OPTS) $$@
(echo $$($1_$2_$3_NON_HS_OBJS) `$$($1_$2_$3_MKSTUBOBJS)`; $$(FIND) $$(patsubst %.$$($3_osuf),%_$$($3_osuf)_split,$$($1_$2_$3_HS_OBJS)) -name '*.$$($3_osuf)' -print) | $$(XARGS) $$(AR) $$(EXTRA_AR_ARGS) $$@
(echo $$($1_$2_$3_NON_HS_OBJS) `$$($1_$2_$3_MKSTUBOBJS)`; $$(FIND) $$(patsubst %.$$($3_osuf),%_$$($3_osuf)_split,$$($1_$2_$3_HS_OBJS)) -name '*.$$($3_osuf)' -print) | $$(XARGS) "$$(AR)" $(AR_OPTS) $$(EXTRA_AR_ARGS) $$@
else
$$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS)
"$$(RM)" $$(RM_OPTS) $$@
echo $$($1_$2_$3_ALL_OBJS) `$$($1_$2_$3_MKSTUBOBJS)` | $$(XARGS) $$(AR) $$(EXTRA_AR_ARGS) $$@
echo $$($1_$2_$3_ALL_OBJS) `$$($1_$2_$3_MKSTUBOBJS)` | $$(XARGS) "$$(AR)" $(AR_OPTS) $$(EXTRA_AR_ARGS) $$@
endif
endif
......
......@@ -75,6 +75,10 @@ else
$1_$2_DEP_INCLUDE_DIRS_FLAG = -I
endif
# We have to do this mangling using the shell, because words may contain
# spaces and GNU make doesn't have any quoting interpretation.
$1_$2_CC_INC_FLAGS:=$$(shell for i in $$($1_$2_DEP_INCLUDE_DIRS); do echo $$($1_$2_DEP_INCLUDE_DIRS_FLAG)\"$$$$i\"; done)
$1_$2_DIST_CC_OPTS = \
$$(CONF_CC_OPTS) \
$$(SRC_CC_OPTS) \
......@@ -83,21 +87,26 @@ $1_$2_DIST_CC_OPTS = \
$$(foreach dir,$$(filter /%,$$($1_$2_INCLUDE_DIRS)),-I$$(dir)) \
$$($1_$2_CC_OPTS) \
$$($1_$2_CPP_OPTS) \
$$(foreach dir,$$($1_$2_DEP_INCLUDE_DIRS),$$($1_$2_DEP_INCLUDE_DIRS_FLAG)$$(dir)) \
$$($1_$2_CC_INC_FLAGS) \
$$($1_$2_DEP_CC_OPTS)
$1_$2_DIST_LD_LIB_DIRS:=$$(shell for i in $$($1_$2_DEP_LIB_DIRS); do echo \"-L$$$$i\"; done)
$1_$2_DIST_LD_OPTS = \
$$(CONF_LD_OPTS) \
$$(SRC_LD_OPTS) \
$$($1_LD_OPTS) \
$$($1_$2_LD_OPTS) \
$$(foreach opt,$$($1_$2_DEP_LIB_DIRS),-L$$(opt)) \
$$($1_$2_DIST_LD_LIB_DIRS) \
$$(foreach opt,$$($1_$2_DEP_EXTRA_LIBS),-l$$(opt)) \
$$($1_$2_DEP_LD_OPTS)
# c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs
# We use '' around cflags and lflags to handle paths with backslashes in
# on Windows
$1_$2_$3_HSC2HS_CC_OPTS:=$$(shell for i in $$($1_$2_DIST_CC_OPTS); do echo \'--cflag=$$$$i\'; done)
$1_$2_$3_HSC2HS_LD_OPTS:=$$(shell for i in $$($1_$2_DIST_LD_OPTS); do echo \'--lflag=$$$$i\'; done)
$1_$2_$3_ALL_HSC2HS_OPTS = \
--cc=$$(WhatGccIsCalled) \
--ld=$$(WhatGccIsCalled) \
......@@ -105,8 +114,8 @@ $1_$2_$3_ALL_HSC2HS_OPTS = \
$$(SRC_HSC2HS_OPTS) \
$$(WAY_$3_HSC2HS_OPTS) \
--cflag=-D__GLASGOW_HASKELL__=$$(ProjectVersionInt) \
$$(foreach opt,$$($1_$2_DIST_CC_OPTS),'--cflag=$$(opt)') \
$$(foreach opt,$$($1_$2_DIST_LD_OPTS),'--lflag=$$(opt)') \
$$($1_$2_$3_HSC2HS_CC_OPTS) \
$$($1_$2_$3_HSC2HS_LD_OPTS) \
$$($$(basename $$<)_HSC2HS_OPTS) \
$$(EXTRA_HSC2HS_OPTS)
......
......@@ -363,12 +363,12 @@ generate config_args distdir directory
variablePrefix ++ "_CC_OPTS = " ++ unwords (ccOptions bi),
variablePrefix ++ "_CPP_OPTS = " ++ unwords (cppOptions bi),
variablePrefix ++ "_LD_OPTS = " ++ unwords (ldOptions bi),
variablePrefix ++ "_DEP_INCLUDE_DIRS = " ++ unwords (forDeps Installed.includeDirs),
variablePrefix ++ "_DEP_INCLUDE_DIRS = " ++ unwords (wrap $ forDeps Installed.includeDirs),
variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions),
variablePrefix ++ "_DEP_LIB_DIRS = " ++ unwords (forDeps Installed.libraryDirs),
variablePrefix ++ "_DEP_LIB_DIRS = " ++ unwords (wrap $ forDeps Installed.libraryDirs),
variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries),
variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions)]
writeFile (distdir ++ "/package-data.mk") $ unlines xs
where
escape = foldr (\c xs -> if c == '#' then '\\':'#':xs else c:xs) []
wrap = map (\s -> "\'" ++ s ++ "\'")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment