]> gitweb @ CieloNegro.org - pkgsrc-ghc.git/blob - Makefile
9a01243b49811ca0d47a06e29d500105ea0cdf0d
[pkgsrc-ghc.git] / Makefile
1 # $NetBSD: Makefile,v 1.42 2008/07/07 14:58:00 kristerw Exp $
2 # -----------------------------------------------------------------------------
3 # Package metadata
4 #
5 DISTNAME=       ghc-${VERSION}
6 VERSION=        7.6.2
7 CATEGORIES=     lang
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
12 LICENSE=        modified-bsd
13
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.
20 ONLY_FOR_PLATFORM= \
21         Darwin-*-powerpc \
22         FreeBSD-*-i386 \
23         Linux-*-x86_64 \
24         NetBSD-*-i386 \
25         NetBSD-*-x86_64
26
27
28 # -----------------------------------------------------------------------------
29 # Distfiles
30 #
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.tar.xz
36 DISTFILES+=     ${DISTNAME}-boot-x86_64-unknown-netbsd.tar.xz
37
38 .for i in ${DISTFILES:M*-boot-*}
39 SITES.${i}=     http://static.cielonegro.org/archive/
40 .endfor
41
42 # We don't want to extract all of the DISTFILEs.
43 EXTRACT_ONLY=   ${DISTNAME}-src.tar.bz2
44
45
46 # -----------------------------------------------------------------------------
47 # Tools
48 #
49 USE_TOOLS+=                     autoconf gmake perl:run
50 GNU_CONFIGURE=                  yes
51 USE_GNU_CONFIGURE_HOST= no
52
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
55 # better than this?
56 .include "../../mk/compiler.mk"
57 .if empty(CCPATH)
58 CCPATH= /usr/bin/gcc
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..."
62 .endif
63
64 CONFIGURE_ARGS+= \
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
70
71 CONFIGURE_ENV+= \
72         PerlCmd=${PERL5:Q}
73
74
75 # -----------------------------------------------------------------------------
76 # Build hooks
77 #
78
79 # We patch configure.ac in some directories.
80 post-patch:
81         @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
82         ${RUN} cd ${WRKSRC:Q}/libraries/integer-gmp && autoconf
83
84
85 # Define the target "pre-configure" and non-standard "bootstrap".
86 .include "../../wip/ghc/bootstrap.mk"
87
88
89 # Our pre-configure phase installs a bindist of bootstrapping compiler
90 # directly into TOOLS_DIR so that ./configure can find it.
91 do-configure:
92         ${RUN} cd ${WRKSRC:Q} && \
93                 ${SETENV} ${CONFIGURE_ENV} ${SH} ./configure ${CONFIGURE_ARGS}
94
95 # Here we generate mk/build.mk dynamically.
96         ${RUN} ${RM} -f ${WRKSRC:Q}/mk/build.mk
97
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
104
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
114
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
117 # appreciate.
118         ${RUN} ${ECHO} "HSCOLOUR_SRCS     = NO" >> ${WRKSRC:Q}/mk/build.mk
119
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
123
124
125 # -----------------------------------------------------------------------------
126 # Installation/removal hooks
127 #
128
129 # Substitutions for INSTALL and DEINSTALL that handles package.cache.
130 FILES_SUBST+=   DISTNAME=${DISTNAME}
131
132 # We don't want package.cache to be in the PLIST.
133 post-install:
134         ${RM} -f ${DESTDIR:Q}${PREFIX:Q}/lib/${DISTNAME}/package.conf.d/package.cache
135
136
137 # -----------------------------------------------------------------------------
138 # PLIST
139 #
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
143 #
144
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"
148 .if empty(DESTDIR)
149 PKG_FAIL_REASON+="This package can not be built without using DESTDIR.\
150 You need to set USE_DESTDIR to \"yes\"."
151 .else
152 GENERATE_PLIST+= \
153         cd ${DESTDIR:Q}${PREFIX:Q} && \
154                 ${FIND} * \( -type f -or -type l \) | ${SORT} -d;
155 .endif
156
157
158 # -----------------------------------------------------------------------------
159 # Sanity checks
160 #
161
162 # There is an unused script which don't pass the portability test.
163 CHECK_PORTABILITY_SKIP+=        distrib/prep-bin-dist-mingw
164
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
169
170
171 # -----------------------------------------------------------------------------
172 # Dependencies
173 #
174
175 # I guess pdcurses works well but not tested.
176 USE_NCURSES=    yes
177
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"