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