- ${CP} -r ${DISTNAME} bootstrap && \
- cd bootstrap/${DISTNAME} && \
- ${LN} -sf ${PWD_CMD} utils/ghc-pwd/ghc-pwd && \
- ${ECHO} "====> Configuring for bootstrap compiler" && \
- ${ENV} ${CONFIGURE_ENV} ./configure --enable-hc-boot ${CONFIGURE_ARGS} && \
- ${ECHO} "====> Extracting bootstrap HC archive" && \
- (cd .. && bsdtar jxfm ${DISTDIR}/${BOOTSTRAP_TARBALL}) && \
- ${SH} mkfiles && \
- ${ECHO} "====> Building bootstrap compiler" && \
- ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" ${BUILD_MK} > mk/build.mk && \
+ ${GTAR} -cf - ${DISTNAME} | ${GTAR} -C bootstrap -xf - && \
+ ${CP} ${BOOTSTRAP_MAIN_C} bootstrap/${DISTNAME}/rts/bootstrap-main.c && \
+ ${CP} ${BOOTSTRAP_CAPI_C} bootstrap/${DISTNAME}/rts/capi-wrappers.c && \
+ ${TOUCH} ${.TARGET}
+
+${WRKDIR}/stamp-configure-hc-boot: ${WRKDIR}/stamp-prepare-bootstrap
+ ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
+ ${PHASE_MSG} "Configuring bootstrapping compiler for ${PKGNAME}" && \
+ ${SETENV} ${CONFIGURE_ENV} ./configure --enable-hc-boot --with-ghc="" ${CONFIGURE_ARGS} && \
+ ${TOUCH} ${.TARGET}
+
+${WRKDIR}/stamp-extract-hc: ${WRKDIR}/stamp-configure-hc-boot
+ ${RUN} cd ${WRKDIR}/bootstrap && \
+ ${PHASE_MSG} "Extracting bootstrap HC archive for ${PKGNAME}" && \
+ if ${TEST} "`${DATE} '+%Y%m%d%H%M'`" -le 200001010000; then \
+ ${FAIL_MSG} "Adjust your system clock: `${DATE}`"; \
+ fi && \
+ ${FIND} ${DISTNAME} -type d -o -type f | ${XARGS} ${TOUCH} -t 200001010000 && \
+ ${GTAR} -jxf ${DISTDIR}/${BOOTSTRAP_TARBALL} && \
+ (cd ${DISTNAME} && ${SH} mkfiles) && \
+ ${TOUCH} ${.TARGET}
+
+${WRKDIR}/stamp-rewrite-hc-paths: ${WRKDIR}/stamp-extract-hc
+ ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
+ ${PHASE_MSG} "Rewriting source paths in bootstrapping compiler for ${PKGNAME}" && \
+ ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" ${BOOTSTRAP_BUILD_MK} > mk/build.mk
+.if ${MACHINE_ARCH} == "i386" && ${OPSYS} == "NetBSD"
+# Unregisterised stage0 compiler gets too large (.text section being
+# over 64 MiB) without dead-code elimination, exceeding NetBSD/i386's
+# kernel default limitation.
+# Note that stage1 currently doesn't bloat that much (about 42.6
+# MiB), but when it does we have to append
+# CONF_CC_OPTS_STAGE1="-fdata..." and
+# CONF_GCC_LINKER_OPTS_STAGE1="-Wl,--gc-sections" to CONFIGURE_ENV as
+# well. I guess that's a matter of time :(
+ ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
+ ${ECHO} "EXTRA_CC_OPTS += -fdata-sections -ffunction-sections" >> mk/build.mk && \
+ ${ECHO} "EXTRA_CC_OPTS += -Wl,--gc-sections" >> mk/build.mk
+.endif
+ ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \