]> gitweb @ CieloNegro.org - pkgsrc-ghc.git/commitdiff
7.0.1 for powerpc-apple-darwin (but crashes on --interactive)
authorPHO <pho@cielonegro.org>
Tue, 23 Nov 2010 22:54:57 +0000 (07:54 +0900)
committerPHO <pho@cielonegro.org>
Tue, 23 Nov 2010 22:54:57 +0000 (07:54 +0900)
Makefile
TODO
distinfo
patches/patch-aa
patches/patch-ab
patches/patch-ac [new file with mode: 0644]
patches/patch-af [deleted file]
patches/patch-ag [deleted file]
patches/patch-ah
patches/patch-aj [new file with mode: 0644]
patches/patch-al [new file with mode: 0644]

index 794adbf6bde0f2f90d009d75302a21c7ff4cab44..2a0cbfbbe0bea18fa52279125d74c3e8cfff3ade 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,17 @@
 # $NetBSD: Makefile,v 1.42 2008/07/07 14:58:00 kristerw Exp $
 
 DISTNAME=              ghc-${VERSION}
 # $NetBSD: Makefile,v 1.42 2008/07/07 14:58:00 kristerw Exp $
 
 DISTNAME=              ghc-${VERSION}
-VERSION=               6.12.3
+VERSION=               7.0.1
 CATEGORIES=            lang
 CATEGORIES=            lang
-MASTER_SITES=  http://darcs.haskell.org/download/dist/${VERSION}/
+MASTER_SITES=  http://new-www.haskell.org/ghc/dist/${VERSION}/
 MAINTAINER=            kristerw@NetBSD.org
 HOMEPAGE=              http://www.haskell.org/ghc/
 COMMENT=               Compiler for the functional language Haskell
 LICENSE=               modified-bsd
 
 DISTFILES=             ${DISTNAME}-src.tar.bz2
 MAINTAINER=            kristerw@NetBSD.org
 HOMEPAGE=              http://www.haskell.org/ghc/
 COMMENT=               Compiler for the functional language Haskell
 LICENSE=               modified-bsd
 
 DISTFILES=             ${DISTNAME}-src.tar.bz2
-DISTFILES+=            ${DISTNAME}-boot-i386-unknown-freebsd.tar.bz2
-DISTFILES+=            ${DISTNAME}-boot-i386-unknown-netbsd.tar.bz2
+#DISTFILES+=           ${DISTNAME}-boot-i386-unknown-freebsd.tar.bz2
+#DISTFILES+=           ${DISTNAME}-boot-i386-unknown-netbsd.tar.bz2
 DISTFILES+=            ${DISTNAME}-boot-powerpc-apple-darwin.tar.bz2
 
 
 DISTFILES+=            ${DISTNAME}-boot-powerpc-apple-darwin.tar.bz2
 
 
@@ -31,7 +31,8 @@ PKG_DESTDIR_SUPPORT=  user-destdir
 #
 # If you want to build HC packages yourself, follow instructions in
 # the ./TODO file.
 #
 # If you want to build HC packages yourself, follow instructions in
 # the ./TODO file.
-ONLY_FOR_PLATFORM= NetBSD-*-i386 FreeBSD-*-i386 Darwin-*-powerpc
+#ONLY_FOR_PLATFORM= NetBSD-*-i386 FreeBSD-*-i386 Darwin-*-powerpc
+ONLY_FOR_PLATFORM= Darwin-*-powerpc
 
 # We must provide the real pass to gcc to the ./configure script,
 # because GHC has a runtime dependency on it. Aren't there any ways
 
 # We must provide the real pass to gcc to the ./configure script,
 # because GHC has a runtime dependency on it. Aren't there any ways
@@ -83,8 +84,6 @@ PLATFORM           = i386-unknown-freebsd
 .elif ${MACHINE_ARCH} == "powerpc" && ${OPSYS} == "Darwin"
 BOOTSTRAP_BUILD_MK = ${PKGDIR}/files/bootstrap.mk
 PLATFORM           = powerpc-apple-darwin
 .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)
 
 # Existence of libelf makes LeadingUnderscore being "NO", which is
 # incorrect. See ghc-6.12.1/aclocal.m4 (FP_LEADING_UNDERSCORE)
@@ -96,19 +95,34 @@ PKG_FAIL_REASON+=   "internal error: unsupported platform"
 
 BOOTSTRAP_TARBALL = ${DISTNAME}-boot-${PLATFORM}.tar.bz2
 
 
 BOOTSTRAP_TARBALL = ${DISTNAME}-boot-${PLATFORM}.tar.bz2
 
-pre-configure:
+pre-configure: ${WRKDIR}/stamp-bootstrap-ghc
+
+${WRKDIR}/stamp-prepare-bootstrap:
        ${RUN} cd ${WRKDIR} && \
                ${ECHO} "====> Preparing bootstrap compiler" && \
        ${RUN} cd ${WRKDIR} && \
                ${ECHO} "====> Preparing bootstrap compiler" && \
+               ${RM} -rf bootstrap && \
                ${MKDIR} bootstrap && \
                ${CP} -r ${DISTNAME} bootstrap && \
                cd bootstrap/${DISTNAME} && \
                ${LN} -sf ${PWD_CMD} utils/ghc-pwd/ghc-pwd && \
                ${MKDIR} bootstrap && \
                ${CP} -r ${DISTNAME} bootstrap && \
                cd bootstrap/${DISTNAME} && \
                ${LN} -sf ${PWD_CMD} utils/ghc-pwd/ghc-pwd && \
+               ${TOUCH} $@
+
+${WRKDIR}/stamp-configure-hc-boot: ${WRKDIR}/stamp-prepare-bootstrap
+       ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
                ${ECHO} "====> Configuring for bootstrap compiler" && \
                ${SETENV} ${CONFIGURE_ENV} ./configure --enable-hc-boot --with-ghc="" ${CONFIGURE_ARGS} && \
                ${ECHO} "====> Configuring for bootstrap compiler" && \
                ${SETENV} ${CONFIGURE_ENV} ./configure --enable-hc-boot --with-ghc="" ${CONFIGURE_ARGS} && \
+               ${TOUCH} $@
+
+${WRKDIR}/stamp-extract-hc: ${WRKDIR}/stamp-configure-hc-boot
+       ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
                ${ECHO} "====> Extracting bootstrap HC archive" && \
                (cd .. && bsdtar jxfm ${DISTDIR}/${BOOTSTRAP_TARBALL}) && \
                ${SH} mkfiles && \
                ${ECHO} "====> Extracting bootstrap HC archive" && \
                (cd .. && bsdtar jxfm ${DISTDIR}/${BOOTSTRAP_TARBALL}) && \
                ${SH} mkfiles && \
-               ${ECHO} "====> Building bootstrap compiler" && \
+               ${TOUCH} $@
+
+${WRKDIR}/stamp-rewrite-hc-paths: ${WRKDIR}/stamp-extract-hc
+       ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
+               ${ECHO} "====> Rewriting GHC source paths" && \
                ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" ${BOOTSTRAP_BUILD_MK} > mk/build.mk && \
                for c in libraries/*/configure; do \
                        (cd `${DIRNAME} $$c` && ${SETENV} ${CONFIGURE_ENV} ${SH} configure ${CONFIGURE_ARGS}); \
                ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" ${BOOTSTRAP_BUILD_MK} > mk/build.mk && \
                for c in libraries/*/configure; do \
                        (cd `${DIRNAME} $$c` && ${SETENV} ${CONFIGURE_ENV} ${SH} configure ${CONFIGURE_ARGS}); \
@@ -118,13 +132,19 @@ pre-configure:
                        ${MV} -f $$i.tmp $$i; \
                done && \
                ${TOUCH} -r inplace/lib/package.conf.d */*/package-data.mk */*/*/package-data.mk && \
                        ${MV} -f $$i.tmp $$i; \
                done && \
                ${TOUCH} -r inplace/lib/package.conf.d */*/package-data.mk */*/*/package-data.mk && \
+               ${TOUCH} $@
+
+${WRKDIR}/stamp-bootstrap-ghc: ${WRKDIR}/stamp-rewrite-hc-paths
+       ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
+               ${ECHO} "====> Building bootstrap compiler" && \
                ${GMAKE} bootstrapping-files && \
                ${GMAKE} all_ghc_stage2 && \
                ${GMAKE} inplace/bin/ghc-pkg && \
                ${GMAKE} inplace/lib/unlit && \
                inplace/bin/ghc-pkg recache && \
                ${GMAKE} bootstrapping-files && \
                ${GMAKE} all_ghc_stage2 && \
                ${GMAKE} inplace/bin/ghc-pkg && \
                ${GMAKE} inplace/lib/unlit && \
                inplace/bin/ghc-pkg recache && \
-               ${CP} inplace/bin/ghc-stage2 ${BUILDLINK_DIR}/bin/ghc && \
-               ${CP} inplace/bin/ghc-pkg ${BUILDLINK_DIR}/bin/ghc-pkg
+               ${CP} -f inplace/bin/ghc-stage2 ${BUILDLINK_DIR}/bin/ghc && \
+               ${CP} -f inplace/bin/ghc-pkg ${BUILDLINK_DIR}/bin/ghc-pkg && \
+               ${TOUCH} $@
 
 do-configure:
        ${RUN} cd ${WRKSRC} && \
 
 do-configure:
        ${RUN} cd ${WRKSRC} && \
@@ -139,7 +159,7 @@ do-configure:
        ${RUN} ${ECHO} "libraries/terminfo_CONFIGURE_OPTS += \
                --configure-option=--with-curses-includes=${PREFIX}/include \
                --configure-option=--with-curses-libraries=${PREFIX}/lib" >> ${WRKSRC}/mk/build.mk
        ${RUN} ${ECHO} "libraries/terminfo_CONFIGURE_OPTS += \
                --configure-option=--with-curses-includes=${PREFIX}/include \
                --configure-option=--with-curses-libraries=${PREFIX}/lib" >> ${WRKSRC}/mk/build.mk
-# The ghc compiler does normally split the generated C files into small
+# The ghc compiler does normally split the generated asm files into small
 # parts before sending them to gcc, to enable the linker to eliminate
 # unused parts.  This does however not play nice with the pkgsrc
 # framework, and the result is that the build takes more than 5 times
 # parts before sending them to gcc, to enable the linker to eliminate
 # unused parts.  This does however not play nice with the pkgsrc
 # framework, and the result is that the build takes more than 5 times
diff --git a/TODO b/TODO
index f4464bdecd03c360d452e63ca092c349855dbcfe..5ee5ead1993df8c97eaec2fbdda9d260bb68ecc6 100644 (file)
--- a/TODO
+++ b/TODO
@@ -74,7 +74,7 @@ Create an intermediate tarball::
     $ find . -name package-data.mk >> list
     $ find . -name package.conf.d >> list
     $ find . -name package.conf.inplace >> list
     $ find . -name package-data.mk >> list
     $ find . -name package.conf.d >> list
     $ find . -name package.conf.inplace >> list
-    $ echo compiler/main/Config.hs >> list
+    $ ls compiler/stage?/build/Config.hs >> list
     $ echo compiler/prelude/primops.txt >> list
     $ ls compiler/primop-*.hs-incl >> list
     $ find . -name .depend | sed -e 's/^/mkdir -p `dirname /' -e 's/$/`/' >> mkfiles
     $ echo compiler/prelude/primops.txt >> list
     $ ls compiler/primop-*.hs-incl >> list
     $ find . -name .depend | sed -e 's/^/mkdir -p `dirname /' -e 's/$/`/' >> mkfiles
index c15e82cc8cd53228fed70f61e1cfcdf2868ea79c..5499cbeb745c1f3f52bf6c98ac8a370e23e2fcd7 100644 (file)
--- a/distinfo
+++ b/distinfo
@@ -1,19 +1,14 @@
 $NetBSD: distinfo,v 1.22 2008/07/07 14:58:00 kristerw Exp $
 
 $NetBSD: distinfo,v 1.22 2008/07/07 14:58:00 kristerw Exp $
 
-SHA1 (ghc-6.12.3-boot-i386-unknown-freebsd.tar.bz2) = 2fa261055724f74e37ffc38eb854f22911a1cf10
-RMD160 (ghc-6.12.3-boot-i386-unknown-freebsd.tar.bz2) = 25f2d840f52a132bb7b6db2c7dace407767d8c03
-Size (ghc-6.12.3-boot-i386-unknown-freebsd.tar.bz2) = 19546151 bytes
-SHA1 (ghc-6.12.3-boot-i386-unknown-netbsd.tar.bz2) = f69f7261cb498b536231a110a5006af4d41db0d2
-RMD160 (ghc-6.12.3-boot-i386-unknown-netbsd.tar.bz2) = 6e8485050ee418ecda4414b474652da973203e24
-Size (ghc-6.12.3-boot-i386-unknown-netbsd.tar.bz2) = 19538526 bytes
-SHA1 (ghc-6.12.3-boot-powerpc-apple-darwin.tar.bz2) = 618f6edd5907c62235d8c2c3baccea027379944e
-RMD160 (ghc-6.12.3-boot-powerpc-apple-darwin.tar.bz2) = ff5d6938d363f59a26de4d9dbfe3335326094a6e
-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
+SHA1 (ghc-7.0.1-boot-powerpc-apple-darwin.tar.bz2) = 48ef53eeac7c7b3dacf942602cf533f8209dd0b4
+RMD160 (ghc-7.0.1-boot-powerpc-apple-darwin.tar.bz2) = 1e0f77678677ba27a5549bddcc88458ab746d3b3
+Size (ghc-7.0.1-boot-powerpc-apple-darwin.tar.bz2) = 21831376 bytes
+SHA1 (ghc-7.0.1-src.tar.bz2) = fdd71deaa4e9a14ac71dfc9ab355947547529a5c
+RMD160 (ghc-7.0.1-src.tar.bz2) = 433cd3878e14831bc0e8472bf616a47538df7689
+Size (ghc-7.0.1-src.tar.bz2) = 23701770 bytes
+SHA1 (patch-aa) = a79c842bd5b7c22596d5a1067fb0fb506d461500
+SHA1 (patch-ab) = cb46e6599a512a1f9a1311cebc15865d123a961f
+SHA1 (patch-ac) = d3bd1c6c8ac7d8271aa9584579353a5bed93a277
+SHA1 (patch-ah) = 1c9a8941856921b740da1e46d6942460b55033c5
+SHA1 (patch-aj) = 3fe647fd631baef37b0b5bcc9d06eef9afd08648
+SHA1 (patch-al) = 029726b76619a3059671ef6090cffcdb5612788a
index 9304dc9f4eb7e8a3bf54c7b094a99ab11042dd92..99bbc74402e71154f02f1800568995c32f09898b 100644 (file)
@@ -1,22 +1,18 @@
 $NetBSD$
 
 $NetBSD$
 
---- libraries/integer-gmp/configure.orig       2010-10-05 12:46:12.000000000 +0000
+--- libraries/integer-gmp/configure.orig       2010-11-12 18:10:51.000000000 +0000
 +++ libraries/integer-gmp/configure
 +++ libraries/integer-gmp/configure
-@@ -2961,68 +2961,6 @@ fi
+@@ -3070,42 +3070,6 @@ fi
  fi
  
  
 -case $target_os in
 -  darwin*)
  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; }
+-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GMP.framework" >&5
+-$as_echo_n "checking for GMP.framework... " >&6; }
 -    save_libs="$LIBS"
 -    LIBS="-framework GMP"
 -    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
+-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 -/* end confdefs.h.  */
 -
 -/* Override any GCC internal prototype to avoid an error.
 -/* end confdefs.h.  */
 -
 -/* Override any GCC internal prototype to avoid an error.
@@ -34,40 +30,18 @@ $NetBSD$
 -  return 0;
 -}
 -_ACEOF
 -  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
+-if ac_fn_c_try_link "$LINENO"; then :
 -  HaveFrameworkGMP=YES; GMP_FRAMEWORK=GMP; GMP_LIBS=
 -else
 -  HaveFrameworkGMP=YES; GMP_FRAMEWORK=GMP; GMP_LIBS=
 -else
--  echo "$as_me: failed program was:" >&5
--sed 's/^/| /' conftest.$ac_ext >&5
--
--      HaveFrameworkGMP=NO
+-  HaveFrameworkGMP=NO
 -fi
 -fi
--
--rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
--      conftest$ac_exeext conftest.$ac_ext
+-rm -f core conftest.err conftest.$ac_objext \
+-    conftest$ac_exeext conftest.$ac_ext
 -    LIBS="$save_libs"
 -    LIBS="$save_libs"
--    { echo "$as_me:$LINENO: result: $HaveFrameworkGMP" >&5
--echo "${ECHO_T}$HaveFrameworkGMP" >&6; }
+-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HaveFrameworkGMP" >&5
+-$as_echo "$HaveFrameworkGMP" >&6; }
 -    ;;
 -esac
 -    ;;
 -esac
--
  ac_ext=c
  ac_cpp='$CPP $CPPFLAGS'
  ac_ext=c
  ac_cpp='$CPP $CPPFLAGS'
- ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
index 148725673132a23ac817d3564d5d6a7849c12e1f..864fccc4f12b8e753770e83cc1d916ce12e9bd9d 100644 (file)
@@ -1,14 +1,29 @@
 $NetBSD$
 
 $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
+--- configure.orig     2010-11-12 18:10:41.000000000 +0000
++++ configure
+@@ -6181,7 +6181,7 @@ fi
+ if test -n "$DtraceCmd"; then
+-  if test "x$TargetOS_CPP-$TargetVendor_CPP" == "xdarwin-apple"; then
++  if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple"; then
+     HaveDtrace=YES
+   fi
+ fi
+@@ -6507,6 +6507,7 @@ $as_echo "$as_me: WARNING: cannot find h
+ fi
++if test "$BootingFromHc" = "NO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ghc-pkg matching $WithGhc" >&5
+ $as_echo_n "checking for ghc-pkg matching $WithGhc... " >&6; }
+ if test "${fp_cv_matching_ghc_pkg+set}" = set; then :
+@@ -6528,6 +6529,7 @@ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fp_cv_matching_ghc_pkg" >&5
+ $as_echo "$fp_cv_matching_ghc_pkg" >&6; }
+ GhcPkgCmd=$fp_cv_matching_ghc_pkg
++fi
diff --git a/patches/patch-ac b/patches/patch-ac
new file mode 100644 (file)
index 0000000..fd64225
--- /dev/null
@@ -0,0 +1,143 @@
+$NetBSD$
+
+--- rts/Linker.c.orig  2010-11-12 18:10:05.000000000 +0000
++++ rts/Linker.c
+@@ -69,7 +69,15 @@
+ #include <sys/wait.h>
+ #endif
+-#if defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(darwin_HOST_OS)
++#if defined(linux_HOST_OS    ) || defined(freebsd_HOST_OS) || \
++    defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \
++    defined(openbsd_HOST_OS  ) || \
++    ( defined(darwin_HOST_OS ) && !defined(powerpc_HOST_ARCH) )
++/* Don't use mmap on powerpc-apple-darwin as mmap doesn't support
++ * reallocating but we need to allocate jump islands just after each
++ * object images. Otherwise relative branches to jump islands can fail
++ * due to 24-bits displacement overflow.
++ */
+ #define USE_MMAP
+ #include <fcntl.h>
+ #include <sys/mman.h>
+@@ -1684,6 +1692,9 @@ loadArchive( char *path )
+    size_t fileSize;
+    int isObject;
+    char tmp[12];
++#if !defined(USE_MMAP) && defined(darwin_HOST_OS)
++   int misalignment;
++#endif
+    IF_DEBUG(linker, debugBelch("loadArchive `%s'\n", path));
+@@ -1763,6 +1774,7 @@ loadArchive( char *path )
+        if (isObject) {
+            char *archiveMemberName;
++#if defined(USE_MMAP)
+            /* We can't mmap from the archive directly, as object
+               files need to be 8-byte aligned but files in .ar
+               archives are 2-byte aligned, and if we malloc the
+@@ -1770,9 +1782,17 @@ loadArchive( char *path )
+               mmap some anonymous memory and use that. We could
+               do better here. */
+            image = mmapForLinker(imageSize, MAP_ANONYMOUS, -1);
++#elif defined(darwin_HOST_OS)
++           // See loadObj()
++           misalignment = machoGetMisalignment(f);
++           image = stgMallocBytes(imageSize + misalignment, "loadArchive(file)");
++           image += misalignment;
++#else
++           image = stgMallocBytes(imageSize, "loadArchive(file)");
++#endif
+            n = fread ( image, 1, imageSize, f );
+            if (n != imageSize)
+-               barf("loadObj: error whilst reading `%s'", path);
++               barf("loadArchive: error whilst reading `%s'", path);
+            archiveMemberName = stgMallocBytes(strlen(path) + fileNameSize + 3, "loadArchive(file)");
+            sprintf(archiveMemberName, "%s(%.*s)", path, (int)fileNameSize, file);
+@@ -1780,7 +1800,7 @@ loadArchive( char *path )
+            oc = mkOc(path, image, imageSize, archiveMemberName
+ #ifndef USE_MMAP
+ #ifdef darwin_HOST_OS
+-                    , 0
++                    , misalignment
+ #endif
+ #endif
+                     );
+@@ -1841,7 +1861,11 @@ loadObj( char *path )
+    int fd;
+ #else
+    FILE *f;
++#  if defined(darwin_HOST_OS)
++   int misalignment;
++#  endif
+ #endif
++
+    IF_DEBUG(linker, debugBelch("loadObj %s\n", path));
+    initLinker();
+@@ -1914,12 +1938,12 @@ loadObj( char *path )
+     // We calculate the correct alignment from the header before
+     // reading the file, and then we misalign image on purpose so
+     // that the actual sections end up aligned again.
+-   misalignment = machoGetMisalignment(f);
+-   image = stgMallocBytes(fileSize + misalignment, "loadObj(image)");
+-   image += misalignment;
+-#  else
+-   image = stgMallocBytes(fileSize, "loadObj(image)");
+-#  endif
++    misalignment = machoGetMisalignment(f);
++    image = stgMallocBytes(fileSize + misalignment, "loadObj(image)");
++    image += misalignment;
++#   else
++    image = stgMallocBytes(fileSize, "loadObj(image)");
++#   endif
+    {
+        int n;
+@@ -2203,6 +2227,12 @@ static int ocAllocateSymbolExtras( Objec
+      */
+     if( m > n ) // we need to allocate more pages
+     {
++#if !defined(x86_64_HOST_ARCH)
++        errorBelch("%s: WARNING: Allocating jump islands separately from "
++                   "the object image itself. This may interfere with "
++                   "relative branches to them.",
++                   OC_INFORMATIVE_FILENAME(oc));
++#endif
+         oc->symbol_extras = mmapForLinker(sizeof(SymbolExtra) * count, 
+                                           MAP_ANONYMOUS, -1);
+     }
+@@ -5211,20 +5241,23 @@ static int machoGetMisalignment( FILE * 
+     struct mach_header header;
+     int misalignment;
+     
+-    fread(&header, sizeof(header), 1, f);
+-    rewind(f);
++    {
++        int n = fread(&header, sizeof(header), 1, f);
++        if (n != 1) {
++            barf("machoGetMisalignment: can't read the Mach-O header");
++        }
++    }
++    fseek(f, -sizeof(header), SEEK_CUR);
+ #if x86_64_HOST_ARCH || powerpc64_HOST_ARCH
+     if(header.magic != MH_MAGIC_64) {
+-        errorBelch("Bad magic. Expected: %08x, got: %08x.\n",
+-                   MH_MAGIC_64, header->magic);
+-        return 0;
++        barf("Bad magic. Expected: %08x, got: %08x.",
++             MH_MAGIC_64, header.magic);
+     }
+ #else
+     if(header.magic != MH_MAGIC) {
+-        errorBelch("Bad magic. Expected: %08x, got: %08x.\n",
+-                   MH_MAGIC, header->magic);
+-        return 0;
++        barf("Bad magic. Expected: %08x, got: %08x.",
++             MH_MAGIC, header.magic);
+     }
+ #endif
diff --git a/patches/patch-af b/patches/patch-af
deleted file mode 100644 (file)
index 9bddce2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-$NetBSD$
-
---- libraries/base/cbits/PrelIOUtils.c.orig    2009-12-11 03:23:43.000000000 +0900
-+++ libraries/base/cbits/PrelIOUtils.c
-@@ -27,9 +27,18 @@ void debugBelch2(const char*s, char *t)
- // Use a C wrapper for this because we avoid hsc2hs in base
- #if HAVE_LANGINFO_H
- #include <langinfo.h>
-+#include <string.h>
- char *localeEncoding (void)
- {
--    return nl_langinfo(CODESET);
-+    char* ret = nl_langinfo(CODESET);
-+
-+    if (strcmp(ret, "646") == 0) {
-+      /* Workaround for NetBSD/OpenBSD nl_langinfo() returning "646" for ascii. */
-+        return (char*)"ASCII";
-+    }
-+    else {
-+        return ret;
-+    }
- }
- #endif
diff --git a/patches/patch-ag b/patches/patch-ag
deleted file mode 100644 (file)
index f5021b0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
---- rts/Linker.c.orig  2010-04-20 18:10:07.000000000 +0000
-+++ rts/Linker.c
-@@ -4122,7 +4122,8 @@ static int relocateSection(
-                   else if(scat->r_type == PPC_RELOC_SECTDIFF
-                       || scat->r_type == PPC_RELOC_LO16_SECTDIFF
-                       || scat->r_type == PPC_RELOC_HI16_SECTDIFF
--                      || scat->r_type == PPC_RELOC_HA16_SECTDIFF)
-+                      || scat->r_type == PPC_RELOC_HA16_SECTDIFF
-+                      || scat->r_type == PPC_RELOC_LOCAL_SECTDIFF)
- #else
-                     else if(scat->r_type == GENERIC_RELOC_SECTDIFF
-                         || scat->r_type == GENERIC_RELOC_LOCAL_SECTDIFF)
index e2a384bd2bd1d2ce8fda5ca77a86aeb0763ee278..7034d3d60e45d5a6ce7ae1e66beb30a4c58acf59 100644 (file)
@@ -1,13 +1,13 @@
 $NetBSD$
 
 $NetBSD$
 
---- libraries/terminfo/configure.orig  2009-12-11 03:31:59.000000000 +0900
+--- libraries/terminfo/configure.orig  2010-11-12 18:10:58.000000000 +0000
 +++ libraries/terminfo/configure
 +++ libraries/terminfo/configure
-@@ -3568,7 +3568,7 @@ echo "$as_me: error: curses headers coul
- See \`config.log' for more details." >&2;}
   { (exit 1); exit 1; }; }
+@@ -3254,7 +3254,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':"
+ as_fn_error "curses headers could not be found, so this package cannot be built
See \`config.log' for more details." "$LINENO" 5; }
  else
 -    TERMINFO_INCLUDES="$CursesIncludes term.h"
 +    TERMINFO_INCLUDES="$CursesIncludes"
  fi
  
  else
 -    TERMINFO_INCLUDES="$CursesIncludes term.h"
 +    TERMINFO_INCLUDES="$CursesIncludes"
  fi
  
- { echo "$as_me:$LINENO: checking for setupterm in -lncursesw" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setupterm in -lncursesw" >&5
diff --git a/patches/patch-aj b/patches/patch-aj
new file mode 100644 (file)
index 0000000..be0c148
--- /dev/null
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- rules/hs-suffix-rules-srcdir.mk.orig       2010-11-23 10:12:17.000000000 +0000
++++ rules/hs-suffix-rules-srcdir.mk
+@@ -55,6 +55,9 @@ $1/$2/build/%.$$($3_osuf) : $1/$4/%.hc i
+ $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hc includes/ghcautoconf.h includes/ghcplatform.h
+       "$$(CC)" $$($1_$2_$3_ALL_CC_OPTS) -Iincludes -x c -c $$< -o $$@
++$1/$2/build/%.$$($3_osuf) : $1/$2/build/autogen/%.hc includes/ghcautoconf.h includes/ghcplatform.h
++      "$$(CC)" $$($1_$2_$3_ALL_CC_OPTS) -Iincludes -x c -c $$< -o $$@
++
+ # $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.$$($3_way_)hc
+ #     "$$($1_$2_HC)" $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
+ #
diff --git a/patches/patch-al b/patches/patch-al
new file mode 100644 (file)
index 0000000..155bfe4
--- /dev/null
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- rts/ghc.mk.orig    2010-11-23 11:49:14.000000000 +0000
++++ rts/ghc.mk
+@@ -425,12 +425,14 @@ rts_dist_MKDEPENDC_OPTS += -DPROFILING -
+ ifeq "$(HaveDtrace)" "YES"
+ rts_dist_MKDEPENDC_OPTS += -Irts/dist/build
++rts_CC_OPTS += -Irts/dist/build
+ endif
+ $(eval $(call build-dependencies,rts,dist,1))
+ $(rts_dist_depfile_c_asm) : libffi/dist-install/build/ffi.h $(DTRACEPROBES_H)
++rts/Trace.h : $(DTRACEPROBES_H)
+ #-----------------------------------------------------------------------------
+ # libffi stuff
+@@ -450,7 +452,7 @@ rts_HC_OPTS                += -DDTRACE
+ DTRACEPROBES_SRC = rts/RtsProbes.d
+ $(DTRACEPROBES_H): $(DTRACEPROBES_SRC) includes/ghcplatform.h | $(dir $@)/.
+-      "$(DTRACE)" $(filter -I%,$(rts_CC_OPTS)) -C -h -o $@ -s $<
++      env PATH=/usr/bin "$(DTRACE)" $(filter -I%,$(rts_CC_OPTS)) -C -h -o $@ -s $<
+ endif