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.
28 # -----------------------------------------------------------------------------
31 DISTFILES= ${DISTNAME}-src.tar.bz2
32 #DISTFILES+= ${DISTNAME}-boot-i386-unknown-freebsd8.0.tar.bz2
33 #DISTFILES+= ${DISTNAME}-boot-i386-unknown-netbsdelf6.99.1.tar.bz2
34 DISTFILES+= ${DISTNAME}-boot-powerpc-apple-darwin.tar.xz
35 #DISTFILES+= ${DISTNAME}-boot-x86_64-unknown-linux-gnu.tar.bz2
36 DISTFILES+= ${DISTNAME}-boot-x86_64-unknown-netbsd.tar.xz
38 .for i in ${DISTFILES:M*-boot-*}
39 SITES.${i}= http://static.cielonegro.org/archive/
42 # We don't want to extract all of the DISTFILEs.
43 EXTRACT_ONLY= ${DISTNAME}-src.tar.bz2
46 # -----------------------------------------------------------------------------
49 USE_TOOLS+= autoconf gmake perl:run
51 USE_GNU_CONFIGURE_HOST= no
53 # We must provide the real path to gcc to the ./configure script,
54 # because GHC has a runtime dependency on it. Aren't there any ways
56 .include "../../mk/compiler.mk"
59 WARNINGS+="This package depends on pkgsrc's undocumented variable\
60 CCPATH but it disappeared somehow."
61 WARNINGS+="Using hard-coded ${CCPATH:Q} as the C compiler..."
65 --with-gcc=${CCPATH:Q} \
66 --with-gmp-includes=${PREFIX:Q}/include \
67 --with-gmp-libraries=${PREFIX:Q}/lib \
68 --with-iconv-includes=${PREFIX:Q}/include \
69 --with-iconv-libraries=${PREFIX:Q}/lib
75 # -----------------------------------------------------------------------------
79 # We patch configure.ac in some directories.
81 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
82 ${RUN} cd ${WRKSRC:Q}/libraries/integer-gmp && autoconf
85 # Define the target "pre-configure" and non-standard "bootstrap".
86 .include "../../wip/ghc/bootstrap.mk"
89 # Our pre-configure phase installs a bindist of bootstrapping compiler
90 # directly into TOOLS_DIR so that ./configure can find it.
92 ${RUN} cd ${WRKSRC:Q} && \
93 ${SETENV} ${CONFIGURE_ENV} ${SH} ./configure ${CONFIGURE_ARGS}
95 # Here we generate mk/build.mk dynamically.
96 ${RUN} ${RM} -f ${WRKSRC:Q}/mk/build.mk
98 # We need to tell the libraries/terminfo/configure that our ncurses is
99 # in a non-standard path. Without that, the resulting GHC tries to
100 # link programs by executing ld(1) without passing it -L${PREFIX:Q}/lib.
101 ${RUN} ${ECHO} "libraries/terminfo_CONFIGURE_OPTS += \
102 --configure-option=--with-curses-includes=${PREFIX:Q}/include \
103 --configure-option=--with-curses-libraries=${PREFIX:Q}/lib" >> ${WRKSRC:Q}/mk/build.mk
105 # The ghc compiler does normally split the generated asm files into small
106 # parts before sending them to gcc, to enable the linker to eliminate
107 # unused parts. This does however not play nice with the pkgsrc
108 # framework, and the result is that the build takes more than 5 times
109 # as long than when the files are not split. See
110 # http://mail-index.netbsd.org/tech-pkg/2006/07/30/0005.html
111 # for a description of the problem.
112 # Disable file splitting until pkgsrc gets improved.
113 ${RUN} ${ECHO} "SplitObjs = NO" >> ${WRKSRC:Q}/mk/build.mk
115 # If there is HsColour is in the PATH, GHC's build system tries to use
116 # it without even checking if it really works. That's not what we
118 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC:Q}/mk/build.mk
120 # Don't even think of PDF.
121 ${RUN} ${ECHO} "BUILD_DOCBOOK_PS = NO" >> ${WRKSRC:Q}/mk/build.mk
122 ${RUN} ${ECHO} "BUILD_DOCBOOK_PDF = NO" >> ${WRKSRC:Q}/mk/build.mk
125 # -----------------------------------------------------------------------------
126 # Installation/removal hooks
129 # Substitutions for INSTALL and DEINSTALL that handles package.cache.
130 FILES_SUBST+= DISTNAME=${DISTNAME}
132 # We don't want package.cache to be in the PLIST.
134 ${RM} -f ${DESTDIR:Q}${PREFIX:Q}/lib/${DISTNAME}/package.conf.d/package.cache
137 # -----------------------------------------------------------------------------
140 # We can't use static PLIST because the package installs some files
141 # whose names are randomly generated, namely
142 # lib/${PKGNAME}/package.conf.d/*.conf
145 # If we were lucky we could just use "PLIST_TYPE = dynamic", but the
146 # feature has seemingly bitrotted.
147 .include "../../mk/bsd.prefs.mk"
149 PKG_FAIL_REASON+="This package can not be built without using DESTDIR.\
150 You need to set USE_DESTDIR to \"yes\"."
153 cd ${DESTDIR:Q}${PREFIX:Q} && \
154 ${FIND} * \( -type f -or -type l \) | ${SORT} -d;
158 # -----------------------------------------------------------------------------
162 # There is an unused script which don't pass the portability test.
163 CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
165 # GHC currently *requires* ${PREFIX}/lib to be in
166 # "/etc/ld-elf.so.conf". See
167 # http://hackage.haskell.org/trac/ghc/ticket/2933
168 CHECK_SHLIBS_SUPPORTED= no
171 # -----------------------------------------------------------------------------
175 # I guess pdcurses works well but not tested.
178 BUILDLINK_DEPMETHOD.docbook-xsl= build
179 BUILDLINK_DEPMETHOD.libxslt= build
180 BUILDLINK_DEPMETHOD.xz= build
181 .include "../../archivers/xz/buildlink3.mk"
182 .include "../../converters/libiconv/buildlink3.mk"
183 .include "../../devel/gmp/buildlink3.mk"
184 .include "../../devel/ncurses/buildlink3.mk"
185 .include "../../textproc/libxslt/buildlink3.mk"
186 .include "../../textproc/docbook-xsl/buildlink3.mk"
187 .include "../../mk/pthread.buildlink3.mk"
188 .include "../../mk/bsd.pkg.mk"