]> gitweb @ CieloNegro.org - pkgsrc-ghc.git/blob - Makefile
GHC 7.0.3 for i386-unknown-freebsd
[pkgsrc-ghc.git] / Makefile
1 # $NetBSD: Makefile,v 1.42 2008/07/07 14:58:00 kristerw Exp $
2
3 DISTNAME=               ghc-${VERSION}
4 VERSION=                7.0.3
5 CATEGORIES=             lang
6 MASTER_SITES=   http://www.haskell.org/ghc/dist/${VERSION}/
7 MAINTAINER=             kristerw@NetBSD.org
8 HOMEPAGE=               http://www.haskell.org/ghc/
9 COMMENT=                Compiler for the functional language Haskell
10 LICENSE=                modified-bsd
11
12 DISTFILES=              ${DISTNAME}-src.tar.bz2
13 DISTFILES+=             ${DISTNAME}-boot-i386-unknown-freebsd.tar.bz2
14 #DISTFILES+=            ${DISTNAME}-boot-i386-unknown-netbsd.tar.bz2
15 DISTFILES+=             ${DISTNAME}-boot-powerpc-apple-darwin.tar.bz2
16
17
18 #SITES.${DISTNAME}-boot-i386-unknown-netbsd.tar.bz2     = http://static.cielonegro.org/archive/
19 SITES.${DISTNAME}-boot-i386-unknown-freebsd.tar.bz2     = http://static.cielonegro.org/archive/
20 SITES.${DISTNAME}-boot-powerpc-apple-darwin.tar.bz2     = http://static.cielonegro.org/archive/
21
22 PKG_DESTDIR_SUPPORT=    user-destdir
23
24 .include "../../mk/bsd.prefs.mk"
25
26 # Unregisterised HC packages are architecture dependent. We have to
27 # create more HC packages to support more architectures. Note that
28 # these packages are built with integer-simple, not integer-gmp, to
29 # reduce some complexity by not depending on the GMP. The resulting
30 # registerised GHC uses integer-gmp so this won't be a problem.
31 #
32 # If you want to build HC packages yourself, follow instructions in
33 # the ./TODO file.
34 #ONLY_FOR_PLATFORM= NetBSD-*-i386 FreeBSD-*-i386 Darwin-*-powerpc
35 ONLY_FOR_PLATFORM= FreeBSD-*-i386 Darwin-*-powerpc
36
37 # We must provide the real pass to gcc to the ./configure script,
38 # because GHC has a runtime dependency on it. Aren't there any ways
39 # better than this?
40 .include "../../mk/compiler.mk"
41 .if empty(CCPATH)
42 WARNINGS+= "This package depends on pkgsrc's undocumented variable\
43 CCPATH but it disappeared somehow."
44 WARNINGS+= "Using hard-coded /usr/bin/gcc as the C compiler..."
45 CONFIGURE_ARGS+= --with-gcc=/usr/bin/gcc
46 .else
47 CONFIGURE_ARGS+= --with-gcc=${CCPATH}
48 .endif
49
50 USE_TOOLS+=     gmake bsdtar perl:run
51 CONFIGURE_ENV+=         PerlCmd=${PERL5:Q}
52
53 # We don't want to extract all of the DISTFILEs.
54 EXTRACT_ONLY=   ${DISTNAME}-src.tar.bz2
55
56 CONFIGURE_ARGS += \
57         --build=${PLATFORM} \
58         --host=${PLATFORM} \
59         --target=${PLATFORM} \
60         --prefix=${PREFIX} \
61         --mandir=${PREFIX}/${PKGMANDIR} \
62         --with-gmp-includes=${PREFIX}/include \
63         --with-gmp-libraries=${PREFIX}/lib \
64         --with-iconv-includes=${PREFIX}/include \
65         --with-iconv-libraries=${PREFIX}/lib
66
67 # Build an unregisterised bootstrap compiler and install it directly
68 # into the .buildlink directory. But we can't use "make install"
69 # because we don't build it in a standard way (./configure && make).
70 #
71 # To install it, we just copy ghc and ghc-pkg from
72 # "work/bootstrap/ghc-${VERSION}/inplace/bin" to
73 # "${BUILDLINK_DIR}/bin". Note that in-place ghc isn't usable before
74 # running "ghc-pkg recache".
75
76 .if ${MACHINE_ARCH} == "i386" && ${OPSYS} == "NetBSD"
77 BOOTSTRAP_BUILD_MK = ${PKGDIR}/files/bootstrap-bsd.mk
78 PLATFORM           = i386-unknown-netbsd
79
80 .elif ${MACHINE_ARCH} == "i386" && ${OPSYS} == "FreeBSD"
81 BOOTSTRAP_BUILD_MK = ${PKGDIR}/files/bootstrap-bsd.mk
82 PLATFORM           = i386-unknown-freebsd
83
84 .elif ${MACHINE_ARCH} == "powerpc" && ${OPSYS} == "Darwin"
85 BOOTSTRAP_BUILD_MK = ${PKGDIR}/files/bootstrap.mk
86 PLATFORM           = powerpc-apple-darwin
87 # Existence of libelf makes LeadingUnderscore being "NO", which is
88 # incorrect for this platform. See ghc-6.12.1/aclocal.m4
89 # (FP_LEADING_UNDERSCORE)
90 CONFLICTS=      libelf-[0-9]*
91
92 .else
93 PKG_FAIL_REASON+=       "internal error: unsupported platform"
94 .endif
95
96 BOOTSTRAP_TARBALL = ${DISTNAME}-boot-${PLATFORM}.tar.bz2
97
98 pre-configure: ${WRKDIR}/stamp-bootstrap-ghc
99
100 ${WRKDIR}/stamp-prepare-bootstrap:
101         ${RUN} cd ${WRKDIR} && \
102                 ${ECHO} "====> Preparing bootstrap compiler" && \
103                 ${RM} -rf bootstrap && \
104                 ${MKDIR} -p bootstrap && \
105                 ${CP} -r ${DISTNAME} bootstrap && \
106                 cd bootstrap/${DISTNAME} && \
107                 ${MKDIR} -p utils/ghc-pwd/dist-boot && \
108                 ${LN} -sf ${PWD_CMD} utils/ghc-pwd/dist-boot/ghc-pwd && \
109                 ${TOUCH} $@
110
111 ${WRKDIR}/stamp-configure-hc-boot: ${WRKDIR}/stamp-prepare-bootstrap
112         ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
113                 ${ECHO} "====> Configuring for bootstrap compiler" && \
114                 ${SETENV} ${CONFIGURE_ENV} ./configure --enable-hc-boot --with-ghc="" ${CONFIGURE_ARGS} && \
115                 ${TOUCH} $@
116
117 ${WRKDIR}/stamp-extract-hc: ${WRKDIR}/stamp-configure-hc-boot
118         ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
119                 ${ECHO} "====> Extracting bootstrap HC archive" && \
120                 (cd .. && bsdtar jxfm ${DISTDIR}/${BOOTSTRAP_TARBALL}) && \
121                 ${SH} mkfiles && \
122                 ${TOUCH} $@
123
124 ${WRKDIR}/stamp-rewrite-hc-paths: ${WRKDIR}/stamp-extract-hc
125         ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
126                 ${ECHO} "====> Rewriting GHC source paths" && \
127                 ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" ${BOOTSTRAP_BUILD_MK} > mk/build.mk && \
128                 for c in libraries/*/configure; do \
129                         (cd `${DIRNAME} $$c` && ${SETENV} ${CONFIGURE_ENV} ${SH} configure ${CONFIGURE_ARGS}); \
130                 done && \
131                 for i in inplace/lib/package.conf.d/*.conf */*/package-data.mk */*/*/package-data.mk; do \
132                         ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" \
133                                    -e "s#\\[\\[GHC_SOURCE_PATH\\]\\]#`${PWD_CMD}`#g" $$i > $$i.tmp; \
134                         ${MV} -f $$i.tmp $$i; \
135                 done && \
136                 ${TOUCH} -r inplace/lib/package.conf.d */*/package-data.mk */*/*/package-data.mk && \
137                 ${TOUCH} $@
138
139 ${WRKDIR}/stamp-bootstrap-ghc: ${WRKDIR}/stamp-rewrite-hc-paths
140         ${RUN} cd ${WRKDIR}/bootstrap/${DISTNAME} && \
141                 ${ECHO} "====> Building bootstrap compiler" && \
142                 ${GMAKE} bootstrapping-files && \
143                 ${GMAKE} all_ghc_stage2 && \
144                 ${GMAKE} inplace/bin/ghc-pkg && \
145                 ${GMAKE} inplace/lib/unlit && \
146                 inplace/bin/ghc-pkg recache && \
147                 ${CP} -f inplace/bin/ghc-stage2 ${BUILDLINK_DIR}/bin/ghc && \
148                 ${CP} -f inplace/bin/ghc-pkg ${BUILDLINK_DIR}/bin/ghc-pkg && \
149                 ${TOUCH} $@
150
151 do-configure:
152 # Seemingly by mistake, ghc-7.0.3 has a prebuilt
153 # utils/ghc-pwd/dist-boot/ghc-pwd for amd64 GNU/Linux.
154         ${RUN} cd ${WRKSRC} && \
155                 rm -rf utils/ghc-pwd/dist-boot
156         ${RUN} cd ${WRKSRC} && \
157                 ${SETENV} ${CONFIGURE_ENV} ./configure ${CONFIGURE_ARGS}
158 # We need to tell the libraries/terminfo/configure that our ncurses is
159 # in a non-standard path. Without that, the resulting GHC tries to
160 # link programs by executing ld(1) without passing it -L${PREFIX}/lib.
161         ${RUN} ${ECHO} "libraries/terminfo_CONFIGURE_OPTS += \
162                 --configure-option=--with-curses-includes=${PREFIX}/include \
163                 --configure-option=--with-curses-libraries=${PREFIX}/lib" >> ${WRKSRC}/mk/build.mk
164 # The ghc compiler does normally split the generated asm files into small
165 # parts before sending them to gcc, to enable the linker to eliminate
166 # unused parts.  This does however not play nice with the pkgsrc
167 # framework, and the result is that the build takes more than 5 times
168 # as long than when the files are not split.  See
169 #    http://mail-index.netbsd.org/tech-pkg/2006/07/30/0005.html
170 # for a description of the problem.
171 # Disable file splitting until pkgsrc gets improved.
172         ${RUN} ${ECHO} "SplitObjs = NO" >> ${WRKSRC}/mk/build.mk
173 # If we don't explicitly disable HsColour, PLIST gets changed
174 # depending on whether we have installed it or not.
175         ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk
176 # To avoid powerpc crash...
177 # See http://hackage.haskell.org/trac/ghc/ticket/4034
178 #.if ${MACHINE_ARCH} == "powerpc" && ${OPSYS} == "Darwin"
179 #       ${RUN} ${ECHO} "GhcRtsHcOpts = -optc-O0 -optc-g" >> ${WRKSRC}/mk/build.mk
180 #       ${RUN} ${ECHO} "GhcRtsCcOpts = -O0 -g" >> ${WRKSRC}/mk/build.mk
181 #.endif
182
183 # Substitutions for INSTALL and DEINSTALL.
184 FILES_SUBST+=   DISTNAME=${DISTNAME}
185
186 # Some unused scripts don't pass the portability test.
187 CHECK_PORTABILITY_SKIP+=        distrib/prep-bin-dist-mingw
188
189 # GHC currently *requires* ${PREFIX}/lib to be in
190 # "/etc/ld-elf.so.conf". See
191 # http://hackage.haskell.org/trac/ghc/ticket/2933
192 CHECK_SHLIBS_SUPPORTED=         no
193
194 # I guess pdcurses works well but not tested.
195 USE_NCURSES=    yes
196 .include "../../devel/ncurses/buildlink3.mk"
197
198 BUILD_DEPENDS+= docbook-xsl-[0-9]*:../../textproc/docbook-xsl
199 BUILDLINK_DEPMETHOD.libxslt = build
200 .include "../../converters/libiconv/buildlink3.mk"
201 .include "../../devel/gmp/buildlink3.mk"
202 .include "../../textproc/libxslt/buildlink3.mk"
203 .include "../../mk/pthread.buildlink3.mk"
204 .include "../../mk/bsd.pkg.mk"