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