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