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