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