Somebody claiming to be Stephen Paul Weber wrote:
The attached patches are needed to cross-compile with GHC for QNXNTO
And I forgot to attach... Attached now. -- Stephen Paul Weber, @singpolyma See <http://singpolyma.net> for how I prefer to be contacted edition right joseph
>From aac2690dbe47c58da3a2d4bb91cdcd52512039b8 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber <singpol...@singpolyma.net> Date: Sat, 8 Dec 2012 13:34:40 -0500 Subject: [PATCH 1/3] Set up for QNXNTO OS This tells GHC some things about how to build for BlackBerry 10 --- aclocal.m4 | 6 ++++++ compiler/main/DriverPipeline.hs | 2 +- compiler/utils/Platform.hs | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index 78e758e..94e1887 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -238,6 +238,9 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS], osf3) test -z "[$]2" || eval "[$]2=OSOsf3" ;; + nto-qnx) + test -z "[$]2" || eval "[$]2=OSQNXNTO" + ;; dragonfly|osf1|hpux|linuxaout|freebsd2|cygwin32|gnu|nextstep2|nextstep3|sunos4|ultrix|irix|aix) test -z "[$]2" || eval "[$]2=OSUnknown" ;; @@ -1820,6 +1823,9 @@ case "$1" in # i686-gentoo-freebsd8.2 $2="freebsd" ;; + nto-qnx*) + $2="nto-qnx" + ;; *) echo "Unknown OS $1" exit 1 diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index d0e1ca8..fd5694f 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1748,7 +1748,7 @@ linkBinary dflags o_files dep_packages = do let os = platformOS (targetPlatform dflags) in if os == OSOsf3 then ["-lpthread", "-lexc"] else if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD, - OSNetBSD, OSHaiku] + OSNetBSD, OSHaiku, OSQNXNTO] then [] else ["-lpthread"] | otherwise = [] diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs index 76c9fa3..661e03a 100644 --- a/compiler/utils/Platform.hs +++ b/compiler/utils/Platform.hs @@ -69,6 +69,7 @@ data OS | OSKFreeBSD | OSHaiku | OSOsf3 + | OSQNXNTO deriving (Read, Show, Eq) -- | ARM Instruction Set Architecture, Extensions and ABI @@ -110,6 +111,7 @@ osElfTarget OSKFreeBSD = True osElfTarget OSHaiku = True osElfTarget OSOsf3 = False -- I don't know if this is right, but as -- per comment below it's safe +osElfTarget OSQNXNTO = False osElfTarget OSUnknown = False -- Defaulting to False is safe; it means don't rely on any -- ELF-specific functionality. It is important to have a default for -- 1.7.10.4
>From 02d3e695d227690f9036abaab7ceea47e2538be3 Mon Sep 17 00:00:00 2001 From: Gabor Greif <ggr...@gmail.com> Date: Mon, 9 Jan 2012 21:35:34 +0100 Subject: [PATCH 2/3] when we have TARGETPLATFORM != HOSTPLATFORM we have to switch in different tools/options Conflicts: rules/build-package-way.mk rules/hs-suffix-rules-srcdir.mk rules/shell-wrapper.mk --- rules/build-dependencies.mk | 3 +++ rules/build-package-data.mk | 7 +++++++ rules/distdir-way-opts.mk | 4 ++++ rules/hs-suffix-rules-srcdir.mk | 5 +++++ rules/shell-wrapper.mk | 7 +++++++ 5 files changed, 26 insertions(+) diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk index 4a4f563..a3ae398 100644 --- a/rules/build-dependencies.mk +++ b/rules/build-dependencies.mk @@ -24,6 +24,9 @@ $1_$2_C_FILES_DEPS = $$(filter-out $$($1_$2_C_FILES_NODEPS),$$($1_$2_C_FILES)) $1_$2_MKDEPENDHS_FLAGS = -dep-makefile $$($1_$2_depfile_haskell).tmp $$(foreach way,$$($1_$2_WAYS),-dep-suffix "$$(patsubst %o,%,$$($$(way)_osuf))") $1_$2_MKDEPENDHS_FLAGS += -include-pkg-deps +ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)" +$1_$2_MKDEPENDHS_FLAGS += -DCOMPILING_GHC +endif ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES" diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk index bbe8652..0cc8c96 100644 --- a/rules/build-package-data.mk +++ b/rules/build-package-data.mk @@ -74,6 +74,13 @@ ifeq "$3" "0" $1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS) endif +ifeq "$3" "1" +ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)" +$1_$2_CONFIGURE_OPTS += --configure-option=--host=$(HOSTPLATFORM) +$1_$2_CONFIGURE_OPTS += --configure-option=--target=$(TARGETPLATFORM) +endif +endif + $1_$2_CONFIGURE_OPTS += --with-gcc="$$(CC_STAGE$3)" $1_$2_CONFIGURE_OPTS += --configure-option=--with-cc="$$(CC_STAGE$3)" $1_$2_CONFIGURE_OPTS += --with-ar="$$(AR_STAGE$3)" diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk index 4d27bbf..e71b9d4 100644 --- a/rules/distdir-way-opts.mk +++ b/rules/distdir-way-opts.mk @@ -194,6 +194,10 @@ ifneq ($$(strip $$($1_$2_DIST_LD_OPTS)),) $1_$2_$3_HSC2HS_LD_OPTS:=$$(shell for i in $$($1_$2_DIST_LD_OPTS); do echo \'--lflag=$$$$i\'; done) endif +ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)" +$1_$2_$3_HSC2HS_CC_OPTS += -DCOMPILING_GHC +endif + $1_$2_$3_ALL_HSC2HS_OPTS = \ --cc=$$(WhatGccIsCalled) \ --ld=$$(WhatGccIsCalled) \ diff --git a/rules/hs-suffix-rules-srcdir.mk b/rules/hs-suffix-rules-srcdir.mk index 94a41d5..9553bc3 100644 --- a/rules/hs-suffix-rules-srcdir.mk +++ b/rules/hs-suffix-rules-srcdir.mk @@ -40,6 +40,11 @@ $1/$2/build/%_hsc.c $1/$2/build/%_hsc.h $1/$2/build/%.hs : $1/$4/%.hsc $$(HSC2HS # Compiling Haskell source +ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)" +--CROSS-OPTS-- = -DCOMPILING_GHC +endif + + $1/$2/build/%.$$($3_osuf) : $1/$4/%.hs $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP) $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ diff --git a/rules/shell-wrapper.mk b/rules/shell-wrapper.mk index 450c989..3e42381 100644 --- a/rules/shell-wrapper.mk +++ b/rules/shell-wrapper.mk @@ -30,6 +30,13 @@ endif all_$1_$2 : $$(INPLACE_WRAPPER) +ifneq "$(TARGETPLATFORM)" "$(HOSTPLATFORM)" +$1_$2_PGMGCC = $$(CC_STAGE1) +else +$1_$2_PGMGCC = $$(WhatGccIsCalled) +endif + + $$(INPLACE_BIN)/$$($1_$2_PROG): WRAPPER=$$@ ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" $$(INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME) -- 1.7.10.4
>From e5b7bfa4fad4d1d39c4b9ac30efc1862b555f1b4 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber <singpol...@singpolyma.net> Date: Tue, 11 Dec 2012 18:24:40 -0500 Subject: [PATCH 3/3] Pass through linker Needed for cross-compiling --- rules/build-package-data.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk index 0cc8c96..38b5457 100644 --- a/rules/build-package-data.mk +++ b/rules/build-package-data.mk @@ -82,6 +82,7 @@ endif endif $1_$2_CONFIGURE_OPTS += --with-gcc="$$(CC_STAGE$3)" +$1_$2_CONFIGURE_OPTS += --with-ld="$$(CC_STAGE$3)" $1_$2_CONFIGURE_OPTS += --configure-option=--with-cc="$$(CC_STAGE$3)" $1_$2_CONFIGURE_OPTS += --with-ar="$$(AR_STAGE$3)" $1_$2_CONFIGURE_OPTS += --with-ranlib="$$(RANLIB)" -- 1.7.10.4
_______________________________________________ Cvs-ghc mailing list Cvs-ghc@haskell.org http://www.haskell.org/mailman/listinfo/cvs-ghc