3 # Build an unregisterised bootstrap compiler and install it directly
4 # into the .buildlink directory. But we can't use "make install"
5 # because we don't build it in a standard way (./configure && make).
7 # To install it, we just copy ghc and ghc-pkg from
8 # "work/bootstrap/ghc-${VERSION}/inplace/bin" to
9 # "${BUILDLINK_DIR}/bin". Note that in-place ghc isn't usable until we
10 # run "ghc-pkg recache".
12 .if ${MACHINE_ARCH} == "i386" && ${OPSYS} == "NetBSD"
13 BOOTSTRAP_BUILD_MK = ${PKGDIR}/files/bootstrap-bsd.mk
14 BOOTSTRAP_CAPI_C = ${PKGDIR}/files/capi-wrappers-netbsd-i386.c
15 BOOTSTRAP_TARBALL = ${DISTNAME}-boot-i386-unknown-netbsdelf6.99.1.tar.bz2
16 PLATFORM = i386-unknown-netbsd
18 .elif ${MACHINE_ARCH} == "i386" && ${OPSYS} == "FreeBSD"
19 BOOTSTRAP_BUILD_MK = ${PKGDIR}/files/bootstrap-bsd.mk
20 BOOTSTRAP_CAPI_C = ${PKGDIR}/files/capi-wrappers-freebsd-i386.c
21 BOOTSTRAP_TARBALL = ${DISTNAME}-boot-i386-unknown-freebsd8.0.tar.bz2
22 PLATFORM = i386-unknown-freebsd
24 .elif ${MACHINE_ARCH} == "powerpc" && ${OPSYS} == "Darwin"
25 BOOTSTRAP_BUILD_MK = ${PKGDIR}/files/bootstrap.mk
26 BOOTSTRAP_CAPI_C = ${PKGDIR}/files/capi-wrappers-darwin-powerpc.c
27 BOOTSTRAP_TARBALL = ${DISTNAME}-boot-i386-unknown-darwin9.8.0.tar.bz2
28 PLATFORM = powerpc-apple-darwin
29 # Existence of libelf makes LeadingUnderscore being "NO", which is
30 # incorrect for this platform. See ghc-6.12.1/aclocal.m4
31 # (FP_LEADING_UNDERSCORE)
32 CONFLICTS= libelf-[0-9]*
35 PKG_FAIL_REASON+= "internal error: unsupported platform"
38 BOOTSTRAP_MAIN_C= ${PKGDIR}/files/bootstrap-main.c
40 pre-configure: ${WRKDIR}/stamp-bootstrap-ghc
42 ${WRKDIR}/stamp-autoreconf:
43 ${RUN} cd ${WRKSRC} && \
44 ${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" && \
48 ${WRKDIR}/stamp-prepare-bootstrap: ${WRKDIR}/stamp-autoreconf
49 ${RUN} cd ${WRKDIR} && \
50 ${PHASE_MSG} "Preparing bootstrapping compiler for ${PKGNAME}" && \
51 ${RM} -rf bootstrap && \
52 ${MKDIR} bootstrap && \
53 ${GTAR} -cf - ${DISTNAME} | ${GTAR} -C bootstrap -xf - && \
54 ${CP} ${BOOTSTRAP_MAIN_C} bootstrap/${DISTNAME}/rts/bootstrap-main.c && \
55 ${CP} ${BOOTSTRAP_CAPI_C} bootstrap/${DISTNAME}/rts/capi-wrappers.c && \
58 ${WRKDIR}/stamp-configure-hc-boot: ${WRKDIR}/stamp-prepare-bootstrap
59 ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
60 ${PHASE_MSG} "Configuring bootstrapping compiler for ${PKGNAME}" && \
61 ${SETENV} ${CONFIGURE_ENV} ./configure --enable-hc-boot --with-ghc="" ${CONFIGURE_ARGS} && \
64 ${WRKDIR}/stamp-extract-hc: ${WRKDIR}/stamp-configure-hc-boot
65 ${RUN} cd ${WRKDIR}/bootstrap && \
66 ${PHASE_MSG} "Extracting bootstrap HC archive for ${PKGNAME}" && \
67 if ${TEST} "`${DATE} '+%Y%m%d%H%M'`" -le 200001010000; then \
68 ${FAIL_MSG} "Adjust your system clock: `${DATE}`"; \
70 ${FIND} ${DISTNAME} -type d -o -type f | ${XARGS} ${TOUCH} -t 200001010000 && \
71 ${GTAR} -jxf ${DISTDIR}/${BOOTSTRAP_TARBALL} && \
72 (cd ${DISTNAME} && ${SH} mkfiles) && \
75 ${WRKDIR}/stamp-rewrite-hc-paths: ${WRKDIR}/stamp-extract-hc
76 ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
77 ${PHASE_MSG} "Rewriting source paths in bootstrapping compiler for ${PKGNAME}" && \
78 ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" ${BOOTSTRAP_BUILD_MK} > mk/build.mk && \
79 for c in libraries/*/configure; do \
80 (cd `${DIRNAME} $$c` && ${SETENV} ${CONFIGURE_ENV} ${SH} configure ${CONFIGURE_ARGS}); \
82 for i in inplace/lib/package.conf.d/*.conf \
83 */package.conf.inplace \
85 */*/*/package-data.mk \
86 */*/*/*/package-data.mk; do \
87 ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" \
88 -e "s#\\[\\[GHC_SOURCE_PATH\\]\\]#`${PWD_CMD}`#g" $$i > $$i.tmp; \
89 ${MV} -f $$i.tmp $$i; \
91 ${TOUCH} -r inplace/lib/package.conf.d \
92 inplace/lib/package.conf.d/*.conf \
93 */package.conf.inplace \
95 */*/*/package-data.mk \
96 */*/*/*/package-data.mk \
97 compiler/stage?/build/Config.hs && \
100 ${WRKDIR}/stamp-bootstrap-ghc: ${WRKDIR}/stamp-rewrite-hc-paths
101 ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
102 ${PHASE_MSG} "Creating bootstrapping files for ${PKGNAME}" && \
103 ${BUILD_MAKE_CMD} bootstrapping-files && \
104 ${PHASE_MSG} "Building bootstrapping compiler for ${PKGNAME}" && \
105 ${BUILD_MAKE_CMD} all_ghc_stage2 && \
106 ${PHASE_MSG} "Building bootstrapping toolkit for ${PKGNAME}" && \
107 ${BUILD_MAKE_CMD} inplace/bin/ghc-pkg && \
108 ${BUILD_MAKE_CMD} inplace/lib/unlit && \
109 inplace/bin/ghc-pkg recache && \
110 ${CP} -f inplace/bin/ghc-stage2 ${BUILDLINK_DIR}/bin/ghc && \
111 ${CP} -f inplace/bin/ghc-pkg ${BUILDLINK_DIR}/bin/ghc-pkg && \