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]*
34 .elif ${MACHINE_ARCH} == "x86_64" && ${OPSYS} == "Linux"
35 BOOTSTRAP_BUILD_MK = ${PKGDIR}/files/bootstrap-linux.mk
36 BOOTSTRAP_CAPI_C = ${PKGDIR}/files/capi-wrappers-linux-x86_64.c
37 BOOTSTRAP_TARBALL = ${DISTNAME}-boot-x86_64-unknown-linux-gnu.tar.bz2
38 PLATFORM = x86_64-unknown-linux
41 PKG_FAIL_REASON+= "internal error: unsupported platform"
44 BOOTSTRAP_MAIN_C= ${PKGDIR}/files/bootstrap-main.c
46 pre-configure: ${WRKDIR}/stamp-bootstrap-ghc
48 ${WRKDIR}/stamp-autoreconf:
49 ${RUN} cd ${WRKSRC} && \
50 ${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" && \
54 ${WRKDIR}/stamp-prepare-bootstrap: ${WRKDIR}/stamp-autoreconf
55 ${RUN} cd ${WRKDIR} && \
56 ${PHASE_MSG} "Preparing bootstrapping compiler for ${PKGNAME}" && \
57 ${RM} -rf bootstrap && \
58 ${MKDIR} bootstrap && \
59 ${GTAR} -cf - ${DISTNAME} | ${GTAR} -C bootstrap -xf - && \
60 ${CP} ${BOOTSTRAP_MAIN_C} bootstrap/${DISTNAME}/rts/bootstrap-main.c && \
61 ${CP} ${BOOTSTRAP_CAPI_C} bootstrap/${DISTNAME}/rts/capi-wrappers.c && \
64 ${WRKDIR}/stamp-configure-hc-boot: ${WRKDIR}/stamp-prepare-bootstrap
65 ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
66 ${PHASE_MSG} "Configuring bootstrapping compiler for ${PKGNAME}" && \
67 ${SETENV} ${CONFIGURE_ENV} ./configure --enable-hc-boot --with-ghc="" ${CONFIGURE_ARGS} && \
70 ${WRKDIR}/stamp-extract-hc: ${WRKDIR}/stamp-configure-hc-boot
71 ${RUN} cd ${WRKDIR}/bootstrap && \
72 ${PHASE_MSG} "Extracting bootstrap HC archive for ${PKGNAME}" && \
73 if ${TEST} "`${DATE} '+%Y%m%d%H%M'`" -le 200001010000; then \
74 ${FAIL_MSG} "Adjust your system clock: `${DATE}`"; \
76 ${FIND} ${DISTNAME} -type d -o -type f | ${XARGS} ${TOUCH} -t 200001010000 && \
77 ${GTAR} -jxf ${DISTDIR}/${BOOTSTRAP_TARBALL} && \
78 (cd ${DISTNAME} && ${SH} mkfiles) && \
81 ${WRKDIR}/stamp-rewrite-hc-paths: ${WRKDIR}/stamp-extract-hc
82 ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
83 ${PHASE_MSG} "Rewriting source paths in bootstrapping compiler for ${PKGNAME}" && \
84 ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" ${BOOTSTRAP_BUILD_MK} > mk/build.mk && \
85 for c in libraries/*/configure; do \
86 (cd `${DIRNAME} $$c` && ${SETENV} ${CONFIGURE_ENV} ${SH} configure ${CONFIGURE_ARGS}); \
88 for i in inplace/lib/package.conf.d/*.conf \
89 */package.conf.inplace \
91 */*/*/package-data.mk \
92 */*/*/*/package-data.mk; do \
93 ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" \
94 -e "s#\\[\\[GHC_SOURCE_PATH\\]\\]#`${PWD_CMD}`#g" $$i > $$i.tmp; \
95 ${MV} -f $$i.tmp $$i; \
97 ${TOUCH} -r inplace/lib/package.conf.d \
98 inplace/lib/package.conf.d/*.conf \
99 */package.conf.inplace \
100 */*/package-data.mk \
101 */*/*/package-data.mk \
102 */*/*/*/package-data.mk \
103 compiler/stage?/build/Config.hs && \
106 ${WRKDIR}/stamp-bootstrap-ghc: ${WRKDIR}/stamp-rewrite-hc-paths
107 ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
108 ${PHASE_MSG} "Creating bootstrapping files for ${PKGNAME}" && \
109 ${BUILD_MAKE_CMD} bootstrapping-files && \
110 ${PHASE_MSG} "Building bootstrapping compiler for ${PKGNAME}" && \
111 ${BUILD_MAKE_CMD} all_ghc_stage2 && \
112 ${PHASE_MSG} "Building bootstrapping toolkit for ${PKGNAME}" && \
113 ${BUILD_MAKE_CMD} inplace/bin/ghc-pkg && \
114 ${BUILD_MAKE_CMD} inplace/lib/unlit && \
115 inplace/bin/ghc-pkg recache && \
116 ${CP} -f inplace/bin/ghc-stage2 ${BUILDLINK_DIR}/bin/ghc && \
117 ${CP} -f inplace/bin/ghc-pkg ${BUILDLINK_DIR}/bin/ghc-pkg && \