summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2008-07-05 13:42:08 +0000
committerIan Lynagh <igloo@earth.li>2008-07-05 13:42:08 +0000
commit98a18944251a82e0e2e8b6c25893eae0fd6811bb (patch)
treee8609f9dbaf423b0148ea8cea890cc5c706204fe /mk
parent7025dc693281254624b9cbbf84fd44b73c58eff5 (diff)
downloadhaskell-98a18944251a82e0e2e8b6c25893eae0fd6811bb.tar.gz
Build hsc2hs with Cabal
This is very rough around teh edges at the moment.
Diffstat (limited to 'mk')
-rw-r--r--mk/cabal-flags.mk68
-rw-r--r--mk/config.mk.in22
2 files changed, 87 insertions, 3 deletions
diff --git a/mk/cabal-flags.mk b/mk/cabal-flags.mk
new file mode 100644
index 0000000000..1d63e1a100
--- /dev/null
+++ b/mk/cabal-flags.mk
@@ -0,0 +1,68 @@
+
+nothing=
+space=$(nothing) $(nothing)
+
+# We rely on all the CONFIGURE_ARGS being quoted with '...', and there
+# being no 's inside the values.
+FLAGGED_CONFIGURE_ARGS = $(subst $(space)',\
+ $(space)--configure-option=',\
+ $(space)$(CONFIGURE_ARGS))
+
+COMMON_CONFIGURE_FLAGS = \
+ --libsubdir='$$pkgid' \
+ --with-ld=$(LD) \
+ $(addprefix --hsc2hs-option=,$(SRC_HSC2HS_OPTS))
+
+ifneq "$(HSCOLOUR)" ""
+COMMON_CONFIGURE_FLAGS += --with-hscolour=$(HSCOLOUR)
+endif
+
+ifneq "$(ALEX)" ""
+COMMON_CONFIGURE_FLAGS += --with-alex=$(ALEX)
+endif
+
+ifneq "$(HADDOCK)" ""
+COMMON_CONFIGURE_FLAGS += --with-haddock=$(HADDOCK)
+endif
+
+ifneq "$(HAPPY)" ""
+COMMON_CONFIGURE_FLAGS += --with-happy=$(HAPPY)
+endif
+
+COMMON_CONFIGURE_FLAGS += $(FLAGGED_CONFIGURE_ARGS) \
+ --configure-option=--with-cc=$(CC)
+
+# We put non-existant paths in when configuring things that we plan to
+# install, as we require that builds don't depend on these paths when
+# making bindists.
+INSTALL_CONFIGURE_FLAGS = \
+ --prefix=$(NONEXISTENT) \
+ --bindir=$(NONEXISTENT) \
+ --libdir=$(NONEXISTENT) \
+ --libexecdir=$(NONEXISTENT) \
+ --datadir=$(NONEXISTENT) \
+ --docdir=$(NONEXISTENT) \
+ --haddockdir=$(NONEXISTENT) \
+ --htmldir=$(NONEXISTENT) \
+ --with-compiler=$(FPTOOLS_TOP_ABS)/compiler/stage1/ghc-inplace \
+ --with-hc-pkg=$(FPTOOLS_TOP_ABS)/utils/ghc-pkg/ghc-pkg-inplace \
+ --with-hsc2hs=$(HSC2HS_INPLACE) \
+ $(COMMON_CONFIGURE_FLAGS)
+
+INPLACE_CONFIGURE_FLAGS = \
+ --prefix=`$(TOP)/utils/pwd/pwd forwardslash`/install-inplace \
+ --with-compiler=$(GHC) \
+ --with-hc-pkg=$(GHC_PKG) \
+ $(COMMON_CONFIGURE_FLAGS)
+
+# XXX
+# --bindir='$$prefix/bin' \
+# --libdir='$$prefix/lib' \
+# --libexecdir='$$prefix/libexec' \
+# --datadir='$$prefix/data' \
+# --docdir='$$prefix/doc' \
+# --haddockdir='$$prefix/haddock' \
+# --htmldir='$$prefix/html' \
+
+BUILD_FLAGS = $(addprefix --ghc-option=,$(SRC_HC_OPTS))
+
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 3749b3eda8..8afeb1ef8a 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -764,7 +764,7 @@ GHC_UNLIT_DIR = $(FPTOOLS_TOP)/$(GHC_UNLIT_DIR_REL)
GHC_HP2PS_DIR = $(FPTOOLS_TOP)/$(GHC_HP2PS_DIR_REL)
GHC_HSTAGS_DIR = $(FPTOOLS_TOP)/$(GHC_HSTAGS_DIR_REL)
GHC_GHCTAGS_DIR = $(FPTOOLS_TOP)/$(GHC_GHCTAGS_DIR_REL)
-GHC_HSC2HS_DIR = $(FPTOOLS_TOP)/$(GHC_HSC2HS_DIR_REL)
+GHC_HSC2HS_DIR = $(FPTOOLS_TOP_ABS)/$(GHC_HSC2HS_DIR_REL)
GHC_TOUCHY_DIR = $(FPTOOLS_TOP)/$(GHC_TOUCHY_DIR_REL)
GHC_PKG_DIR = $(FPTOOLS_TOP)/$(GHC_PKG_DIR_REL)
GHC_GENPRIMOP_DIR = $(FPTOOLS_TOP)/$(GHC_GENPRIMOP_DIR_REL)
@@ -812,7 +812,7 @@ GHC_UNLIT_PGM = unlit$(exeext)
GHC_HP2PS_PGM = hp2ps
GHC_HSTAGS_PGM = hasktags
GHC_GHCTAGS_INPLACE_PGM = ghctags-inplace
-GHC_HSC2HS_INPLACE_PGM = hsc2hs-inplace
+GHC_HSC2HS_INPLACE_PGM = hsc2hs
GHC_TOUCHY_PGM = touchy$(exeext)
GHC_MANGLER_PGM = ghc-asm
GHC_SPLIT_PGM = ghc-split
@@ -838,7 +838,7 @@ UNLIT = $(GHC_UNLIT_DIR)/$(GHC_UNLIT_PGM)
HP2PS = $(GHC_HP2PS_DIR)/$(GHC_HP2PS_PGM)
HSTAGS = $(GHC_HSTAGS_DIR)/$(GHC_HSTAGS_PGM)
GHCTAGS_INPLACE = $(GHC_GHCTAGS_DIR)/$(GHC_GHCTAGS_INPLACE_PGM)
-HSC2HS_INPLACE = $(GHC_HSC2HS_DIR)/$(GHC_HSC2HS_INPLACE_PGM)
+HSC2HS_INPLACE = $(GHC_HSC2HS_DIR)/install-inplace/bin/$(GHC_HSC2HS_INPLACE_PGM)
MANGLER = $(GHC_MANGLER_DIR)/$(GHC_MANGLER_PGM)
SPLIT = $(GHC_SPLIT_DIR)/$(GHC_SPLIT_PGM)
SYSMAN = $(GHC_SYSMAN_DIR)/$(GHC_SYSMAN_PGM)
@@ -963,6 +963,22 @@ ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
SRC_CC_OPTS += -G0
endif
+SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS)))
+SRC_HSC2HS_OPTS += --cc=$(CC)
+SRC_HSC2HS_OPTS += --ld=$(CC)
+SRC_HSC2HS_OPTS += --cflag=-D__GLASGOW_HASKELL__=$(ProjectVersionInt)
+SRC_HSC2HS_OPTS += --lflag=-no-link-haskell98
+SRC_HSC2HS_OPTS += -I$(GHC_INCLUDE_DIR_ABS)
+SRC_HSC2HS_OPTS += -I$(FPTOOLS_TOP_ABS)/gmp/gmpbuild
+
+# Given
+# foo bar
+# make
+# :\"-Ifoo\":\"-Ibar\"
+nothing=
+space=$(nothing) $(nothing)
+SRC_HSC2HS_OPTS += $(subst $(space),,$(foreach d,$(GMP_INCLUDE_DIRS),:\"-I$(d)\"))
+
#-----------------------------------------------------------------------------
# GMP Library (version 2.0.x or above)
#