]> gitweb @ CieloNegro.org - pkgsrc-ghc.git/blob - Makefile
It finally passes developer's tests on 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=                6.12.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                                 ${DISTNAME}-boot-i386-unknown-freebsd.tar.bz2
14
15 SITES.${DISTNAME}-src.tar.bz2                                           = http://www.haskell.org/ghc/dist/${VERSION}/
16 SITES.${DISTNAME}-boot-i386-unknown-freebsd.tar.bz2     = http://static.cielonegro.org/archive/
17
18 PKG_DESTDIR_SUPPORT=    user-destdir
19
20 .include "../../mk/bsd.prefs.mk"
21
22 # Unregisterised HC packages are architecture dependent. We have to
23 # create more HC packages to support more architectures.
24 #ONLY_FOR_PLATFORM= *-*-i386 *-*-powerpc
25 ONLY_FOR_PLATFORM= *-*-i386
26
27 USE_TOOLS+=     gmake bsdtar perl:run
28 CONFIGURE_ENV+=         PerlCmd=${PERL5:Q}
29
30 # We don't want to extract all of the DISTFILEs.
31 EXTRACT_ONLY=   ${DISTNAME}-src.tar.bz2
32
33 CONFIGURE_ARGS += \
34         --prefix=${PREFIX} \
35         --mandir=${PREFIX}/${PKGMANDIR} \
36         --with-gmp-includes=${PREFIX}/include \
37         --with-gmp-libraries=${PREFIX}/lib \
38         --with-iconv-includes=${PREFIX}/include \
39         --with-iconv-libraries=${PREFIX}/lib
40
41 # Build an unregisterised bootstrap compiler and install it directly
42 # into the .buildlink directory. But we can't use "make install"
43 # because we don't build it in a standard way (./configure && make).
44 #
45 # To install it, we just copy ghc and ghc-pkg from
46 # "work/bootstrap/ghc-${VERSION}/inplace/bin" to
47 # "${BUILDLINK_DIR}/bin". Note that in-place ghc isn't usable before
48 # running "ghc-pkg recache".
49
50 .if ${MACHINE_ARCH} == "i386"
51 BOOTSTRAP_TARBALL = ${DISTNAME}-boot-i386-unknown-freebsd.tar.bz2
52 #.elif ${MACHINE_ARCH} == "powerpc"
53 #BOOTSTRAP_TARBALL = ${DISTNAME}-boot-powerpc-apple-darwin.tar.bz2
54 .endif
55
56 .if ${OPSYS} == "NetBSD" || ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD"
57 BUILD_MK = ${PKGDIR}/files/bsd-build.mk
58 .else
59 BUILD_MK = ${PKGDIR}/files/fallback-build.mk
60 .endif
61
62 pre-configure:
63         ${RUN} cd ${WRKDIR} && \
64                 ${ECHO} "====> Preparing bootstrap compiler" && \
65                 ${MKDIR} bootstrap && \
66                 ${CP} -r ${DISTNAME} bootstrap && \
67                 cd bootstrap/${DISTNAME} && \
68                 ${LN} -sf ${PWD_CMD} utils/ghc-pwd/ghc-pwd && \
69                 ${ECHO} "====> Configuring for bootstrap compiler" && \
70                 ${ENV} ${CONFIGURE_ENV} ./configure --enable-hc-boot ${CONFIGURE_ARGS} && \
71                 ${ECHO} "====> Extracting bootstrap HC archive" && \
72                 (cd .. && bsdtar jxfm ${DISTDIR}/${BOOTSTRAP_TARBALL}) && \
73                 ${SH} mkfiles && \
74                 ${ECHO} "====> Building bootstrap compiler" && \
75                 ${SED} -e "s#\\[\\[PREFIX\\]\\]#${PREFIX}#g" ${BUILD_MK} > mk/build.mk && \
76                 for c in libraries/*/configure; do \
77                         (cd `${DIRNAME} $$c` && ${ENV} ${CONFIGURE_ENV} ${SH} configure ${CONFIGURE_ARGS}); \
78                 done && \
79                 ${SED} -i -e "s#\\[\\[GHC_SOURCE_PATH\\]\\]#`${PWD_CMD}`#g" \
80                         inplace/lib/package.conf.d/*.conf */*/package-data.mk */*/*/package-data.mk && \
81                 ${TOUCH} -r inplace/lib/package.conf.d */*/package-data.mk */*/*/package-data.mk && \
82                 ${GMAKE} bootstrapping-files && \
83                 ${GMAKE} all_ghc_stage2 && \
84                 ${GMAKE} inplace/bin/ghc-pkg && \
85                 ${GMAKE} inplace/lib/unlit && \
86                 inplace/bin/ghc-pkg recache && \
87                 ${CP} inplace/bin/ghc-stage2 ${BUILDLINK_DIR}/bin/ghc && \
88                 ${CP} inplace/bin/ghc-pkg ${BUILDLINK_DIR}/bin/ghc-pkg
89
90 # We need to tell the libraries/integer-gmp/configure that libgmp is
91 # in a non-standard path. Without that, the resulting GHC tries to
92 # link programs by executing ld(1) without passing it -L${PREFIX}/lib.
93 do-configure:
94         ${RUN} cd ${WRKSRC} && \
95                 ${ENV} ${CONFIGURE_ENV} ./configure ${CONFIGURE_ARGS}
96         ${RUN} ${ECHO} "libraries/integer-gmp_CONFIGURE_OPTS += \
97                 --configure-option=--with-gmp-includes=${PREFIX}/include \
98                 --configure-option=--with-gmp-libraries=${PREFIX}/lib" > ${WRKSRC}/mk/build.mk
99
100 # The ghc compiler does normally split the generated C files into small
101 # parts before sending them to gcc, to enable the linker to eliminate
102 # unused parts.  This does however not play nice with the pkgsrc
103 # framework, and the result is that the build takes more than 5 times
104 # as long than when the files are not split.  See
105 #    http://mail-index.netbsd.org/tech-pkg/2006/07/30/0005.html
106 # for a description of the problem.
107 # Disable file splitting until pkgsrc gets improved.
108 pre-build:
109         ${RUN} ${ECHO} "SplitObjs = NO" >> ${WRKSRC}/mk/build.mk
110
111 # Some unused scripts don't pass the portability test.
112 CHECK_PORTABILITY_SKIP+=        distrib/prep-bin-dist-mingw
113
114 # GHC currently *requires* ${PREFIX}/lib to be in
115 # "/etc/ld-elf.so.conf". See
116 # http://hackage.haskell.org/trac/ghc/ticket/2933
117 CHECK_SHLIBS_SUPPORTED=         no
118
119 BUILDLINK_DEPMETHOD.libxslt = build
120 .include "../../converters/libiconv/buildlink3.mk"
121 .include "../../devel/gmp/buildlink3.mk"
122 .include "../../textproc/libxslt/buildlink3.mk"
123 .include "../../mk/termcap.buildlink3.mk"
124 .include "../../mk/pthread.buildlink3.mk"
125 .include "../../mk/bsd.pkg.mk"