From 6c2af7a9e78b9a7fa23710be97688432d32c33c2 Mon Sep 17 00:00:00 2001 From: PHO Date: Wed, 6 Oct 2010 07:30:18 +0900 Subject: [PATCH] Darwin-*-powerpc: rethink about the way to avoid the "ld -r" problem. This shall be solved in the next major release GHC 7.0. --- Makefile | 20 ++----------- distinfo | 2 ++ patches/patch-aa | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ patches/patch-ab | 14 ++++++++++ 4 files changed, 91 insertions(+), 18 deletions(-) create mode 100644 patches/patch-aa create mode 100644 patches/patch-ab diff --git a/Makefile b/Makefile index ded3b80..b44037c 100644 --- a/Makefile +++ b/Makefile @@ -80,6 +80,8 @@ PLATFORM = i386-unknown-freebsd .elif ${MACHINE_ARCH} == "powerpc" && ${OPSYS} == "Darwin" BOOTSTRAP_BUILD_MK = ${PKGDIR}/files/bootstrap.mk PLATFORM = powerpc-apple-darwin +WARNINGS+= "You won't be able to use GHCi library for GHC itself\ +because of Mach-O limitation." # Existence of libelf makes LeadingUnderscore being "NO", which is # incorrect. See ghc-6.12.1/aclocal.m4 (FP_LEADING_UNDERSCORE) @@ -153,24 +155,6 @@ do-configure: ${RUN} ${ECHO} "GhcRtsCcOpts = -O0 -g" >> ${WRKSRC}/mk/build.mk .endif -pre-build: -# We have to sacrifice the GHCi library for GHC itself to work around -# for powerpc ld bug. See -# http://hackage.haskell.org/trac/ghc/ticket/3260 -.if ${MACHINE_ARCH} == "powerpc" - ${RUN} ${MKDIR} ${WRKSRC}/compiler/stage1/build - ${RUN} ${TOUCH} -t `expr \`date '+%Y'\` + 1`12310000 \ - ${WRKSRC}/compiler/stage1/build/HS${DISTNAME}.o - ${RUN} ${MKDIR} ${WRKSRC}/compiler/stage2/build - ${RUN} ${TOUCH} -t `expr \`date '+%Y'\` + 1`12310000 \ - ${WRKSRC}/compiler/stage2/build/HS${DISTNAME}.o -.endif - -.if ${MACHINE_ARCH} == "powerpc" -WARNINGS+= "You won't be able to use GHCi library for GHC itself\ -because of powerpc ld bug." -.endif - # Some unused scripts don't pass the portability test. CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw diff --git a/distinfo b/distinfo index 65244c8..c15e82c 100644 --- a/distinfo +++ b/distinfo @@ -12,6 +12,8 @@ Size (ghc-6.12.3-boot-powerpc-apple-darwin.tar.bz2) = 19649010 bytes SHA1 (ghc-6.12.3-src.tar.bz2) = d811be2131d4403ea452aa94fe71edd1b6bd0a79 RMD160 (ghc-6.12.3-src.tar.bz2) = 021619aec4c820009e77745657bfdf0d9705f3e7 Size (ghc-6.12.3-src.tar.bz2) = 26592939 bytes +SHA1 (patch-aa) = f029560e9207d220b1f0363fe0c1464cd4fdd8b7 +SHA1 (patch-ab) = 14730563d0ca7ace04898d02449c658ee469e94c SHA1 (patch-af) = 81ae37eeaca5992868f6955b99113aaae010df22 SHA1 (patch-ag) = 96c074d0d765c0f2de57d26aa145ad109b7cf043 SHA1 (patch-ah) = 5470ab2e1bb746ef3009e5f02ac0b28b8e9d9688 diff --git a/patches/patch-aa b/patches/patch-aa new file mode 100644 index 0000000..9304dc9 --- /dev/null +++ b/patches/patch-aa @@ -0,0 +1,73 @@ +$NetBSD$ + +--- libraries/integer-gmp/configure.orig 2010-10-05 12:46:12.000000000 +0000 ++++ libraries/integer-gmp/configure +@@ -2961,68 +2961,6 @@ fi + fi + + +-case $target_os in +- darwin*) +- { echo "$as_me:$LINENO: checking for GMP.framework" >&5 +-echo $ECHO_N "checking for GMP.framework... $ECHO_C" >&6; } +- save_libs="$LIBS" +- LIBS="-framework GMP" +- cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF +-/* end confdefs.h. */ +- +-/* Override any GCC internal prototype to avoid an error. +- Use char because int might match the return type of a GCC +- builtin and then its argument prototype would still apply. */ +-#ifdef __cplusplus +-extern "C" +-#endif +-char __gmpz_fdiv_qr (); +-int +-main () +-{ +-return __gmpz_fdiv_qr (); +- ; +- return 0; +-} +-_ACEOF +-rm -f conftest.$ac_objext conftest$ac_exeext +-if { (ac_try="$ac_link" +-case "(($ac_try" in +- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +- *) ac_try_echo=$ac_try;; +-esac +-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +- (eval "$ac_link") 2>conftest.er1 +- ac_status=$? +- grep -v '^ *+' conftest.er1 >conftest.err +- rm -f conftest.er1 +- cat conftest.err >&5 +- echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); } && { +- test -z "$ac_c_werror_flag" || +- test ! -s conftest.err +- } && test -s conftest$ac_exeext && +- $as_test_x conftest$ac_exeext; then +- HaveFrameworkGMP=YES; GMP_FRAMEWORK=GMP; GMP_LIBS= +-else +- echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +- HaveFrameworkGMP=NO +-fi +- +-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ +- conftest$ac_exeext conftest.$ac_ext +- LIBS="$save_libs" +- { echo "$as_me:$LINENO: result: $HaveFrameworkGMP" >&5 +-echo "${ECHO_T}$HaveFrameworkGMP" >&6; } +- ;; +-esac +- + ac_ext=c + ac_cpp='$CPP $CPPFLAGS' + ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' diff --git a/patches/patch-ab b/patches/patch-ab new file mode 100644 index 0000000..1487256 --- /dev/null +++ b/patches/patch-ab @@ -0,0 +1,14 @@ +$NetBSD$ + +--- rules/build-package-way.mk.orig 2010-10-05 12:43:54.000000000 +0000 ++++ rules/build-package-way.mk +@@ -84,7 +84,8 @@ ifneq "$4" "0" + BINDIST_LIBS += $$($1_$2_GHCI_LIB) + endif + $$($1_$2_GHCI_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS) +- "$$(LD)" -r -o $$@ $$(EXTRA_LD_OPTS) $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) `$$($1_$2_$3_MKSTUBOBJS)` $$($1_$2_EXTRA_OBJS) ++ "$$(LD)" -r -o $$@ $$(EXTRA_LD_OPTS) $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) `$$($1_$2_$3_MKSTUBOBJS)` $$($1_$2_EXTRA_OBJS) \ ++ || (touch empty.c && $$(CC) -o $$@ -c empty.c) + + $(call all-target,$1_$2,$$($1_$2_GHCI_LIB)) + endif -- 2.40.0