1 # $NetBSD: Makefile,v 1.42 2008/07/07 14:58:00 kristerw Exp $
2 # -----------------------------------------------------------------------------
5 DISTNAME= ghc-${VERSION}
8 MASTER_SITES= http://www.haskell.org/ghc/dist/${VERSION}/
9 MAINTAINER= pho@cielonero.org
10 HOMEPAGE= http://www.haskell.org/ghc/
11 COMMENT= Compiler for the functional language Haskell
14 # GHC requires GHC to build itself. Formerly we could work around this
15 # bootstrapping problem by creating a special archive containing C
16 # sources compiled from Haskell sources, but that's no longer
17 # possible. So we have to prepare stripped-down binaries sufficient to
18 # bootstrap compilers for each platforms. If you want to build them
19 # yourself, follow an instruction in the ./TODO file.
27 # -----------------------------------------------------------------------------
30 DISTFILES= ${DISTNAME}-src.tar.bz2
31 #DISTFILES+= ${DISTNAME}-boot-i386-unknown-freebsd8.0.tar.bz2
32 #DISTFILES+= ${DISTNAME}-boot-i386-unknown-netbsdelf6.99.1.tar.bz2
33 DISTFILES+= ${DISTNAME}-boot-powerpc-apple-darwin.tar.xz
34 #DISTFILES+= ${DISTNAME}-boot-x86_64-unknown-linux-gnu.tar.bz2
36 .for i in ${DISTFILES:M*-boot-*}
37 SITES.${i}= http://static.cielonegro.org/archive/
40 # We don't want to extract all of the DISTFILEs.
41 EXTRACT_ONLY= ${DISTNAME}-src.tar.bz2
44 # -----------------------------------------------------------------------------
47 USE_TOOLS+= autoconf gmake perl:run
49 USE_GNU_CONFIGURE_HOST= no
51 # We must provide the real path to gcc to the ./configure script,
52 # because GHC has a runtime dependency on it. Aren't there any ways
54 .include "../../mk/compiler.mk"
57 WARNINGS+="This package depends on pkgsrc's undocumented variable\
58 CCPATH but it disappeared somehow."
59 WARNINGS+="Using hard-coded ${CCPATH:Q} as the C compiler..."
63 --with-gcc=${CCPATH:Q} \
64 --with-gmp-includes=${PREFIX:Q}/include \
65 --with-gmp-libraries=${PREFIX:Q}/lib \
66 --with-iconv-includes=${PREFIX:Q}/include \
67 --with-iconv-libraries=${PREFIX:Q}/lib
73 # -----------------------------------------------------------------------------
77 # We patch configure.ac in some directories.
79 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
80 ${RUN} cd ${WRKSRC:Q}/libraries/integer-gmp && autoconf
83 # Define the target "pre-configure" and non-standard "bootstrap".
84 .include "../../wip/ghc/bootstrap.mk"
87 # Our pre-configure phase installs a bindist of bootstrapping compiler
88 # directly into TOOLS_DIR so that ./configure can find it.
90 ${RUN} cd ${WRKSRC:Q} && \
91 ${SETENV} ${CONFIGURE_ENV} ${SH} ./configure ${CONFIGURE_ARGS}
93 # Here we generate mk/build.mk dynamically.
94 ${RUN} ${RM} -f ${WRKSRC:Q}/mk/build.mk
96 # We need to tell the libraries/terminfo/configure that our ncurses is
97 # in a non-standard path. Without that, the resulting GHC tries to
98 # link programs by executing ld(1) without passing it -L${PREFIX:Q}/lib.
99 ${RUN} ${ECHO} "libraries/terminfo_CONFIGURE_OPTS += \
100 --configure-option=--with-curses-includes=${PREFIX:Q}/include \
101 --configure-option=--with-curses-libraries=${PREFIX:Q}/lib" >> ${WRKSRC:Q}/mk/build.mk
103 # The ghc compiler does normally split the generated asm files into small
104 # parts before sending them to gcc, to enable the linker to eliminate
105 # unused parts. This does however not play nice with the pkgsrc
106 # framework, and the result is that the build takes more than 5 times
107 # as long than when the files are not split. See
108 # http://mail-index.netbsd.org/tech-pkg/2006/07/30/0005.html
109 # for a description of the problem.
110 # Disable file splitting until pkgsrc gets improved.
111 ${RUN} ${ECHO} "SplitObjs = NO" >> ${WRKSRC:Q}/mk/build.mk
113 # If there is HsColour is in the PATH, GHC's build system tries to use
114 # it without even checking if it really works. That's not what we
116 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC:Q}/mk/build.mk
118 # Don't even think of PDF.
119 ${RUN} ${ECHO} "BUILD_DOCBOOK_PS = NO" >> ${WRKSRC:Q}/mk/build.mk
120 ${RUN} ${ECHO} "BUILD_DOCBOOK_PDF = NO" >> ${WRKSRC:Q}/mk/build.mk
123 # -----------------------------------------------------------------------------
124 # Installation/removal hooks
127 # Substitutions for INSTALL and DEINSTALL that handles package.cache.
128 FILES_SUBST+= DISTNAME=${DISTNAME}
130 # We don't want package.cache to be in the PLIST.
132 ${RM} -f ${DESTDIR:Q}${PREFIX:Q}/lib/${DISTNAME}/package.conf.d/package.cache
135 # -----------------------------------------------------------------------------
138 # We can't use static PLIST because the package installs some files
139 # whose names are randomly generated, namely
140 # lib/${PKGNAME}/package.conf.d/*.conf
143 # If we were lucky we could just use "PLIST_TYPE = dynamic", but the
144 # feature has seemingly bitrotted.
145 .include "../../mk/bsd.prefs.mk"
147 PKG_FAIL_REASON+="This package can not be built without using DESTDIR.\
148 You need to set USE_DESTDIR to \"yes\"."
151 cd ${DESTDIR:Q}${PREFIX:Q} && \
152 ${FIND} * \( -type f -or -type l \) | ${SORT} -d;
156 # -----------------------------------------------------------------------------
160 # There is an unused script which don't pass the portability test.
161 CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
163 # GHC currently *requires* ${PREFIX}/lib to be in
164 # "/etc/ld-elf.so.conf". See
165 # http://hackage.haskell.org/trac/ghc/ticket/2933
166 CHECK_SHLIBS_SUPPORTED= no
169 # -----------------------------------------------------------------------------
173 # I guess pdcurses works well but not tested.
176 BUILDLINK_DEPMETHOD.docbook-xsl= build
177 BUILDLINK_DEPMETHOD.libxslt= build
178 BUILDLINK_DEPMETHOD.xz= build
179 .include "../../archivers/xz/buildlink3.mk"
180 .include "../../converters/libiconv/buildlink3.mk"
181 .include "../../devel/gmp/buildlink3.mk"
182 .include "../../devel/ncurses/buildlink3.mk"
183 .include "../../textproc/libxslt/buildlink3.mk"
184 .include "../../textproc/docbook-xsl/buildlink3.mk"
185 .include "../../mk/pthread.buildlink3.mk"
186 .include "../../mk/bsd.pkg.mk"