]> gitweb @ CieloNegro.org - pkgsrc-ghc.git/blob - Makefile
Tidy-up bootstrapping rules.
[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
26
27 # -----------------------------------------------------------------------------
28 # Distfiles
29 #
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
35
36 .for i in ${DISTFILES:M*-boot-*}
37 SITES.${i}=     http://static.cielonegro.org/archive/
38 .endfor
39
40 # We don't want to extract all of the DISTFILEs.
41 EXTRACT_ONLY=   ${DISTNAME}-src.tar.bz2
42
43
44 # -----------------------------------------------------------------------------
45 # Tools
46 #
47 USE_TOOLS+=                     autoconf gmake perl:run
48 GNU_CONFIGURE=                  yes
49 USE_GNU_CONFIGURE_HOST= no
50
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
53 # better than this?
54 .include "../../mk/compiler.mk"
55 .if empty(CCPATH)
56 CCPATH= /usr/bin/gcc
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..."
60 .endif
61
62 CONFIGURE_ARGS+= \
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
68
69 CONFIGURE_ENV+= \
70         PerlCmd=${PERL5:Q}
71
72
73 # -----------------------------------------------------------------------------
74 # Build hooks
75 #
76
77 # We patch configure.ac in some directories.
78 post-patch:
79         @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
80         ${RUN} cd ${WRKSRC:Q}/libraries/integer-gmp && autoconf
81
82
83 # Define the target "pre-configure" and non-standard "bootstrap".
84 .include "../../wip/ghc/bootstrap.mk"
85
86
87 # Our pre-configure phase installs a bindist of bootstrapping compiler
88 # directly into TOOLS_DIR so that ./configure can find it.
89 do-configure:
90         ${RUN} cd ${WRKSRC:Q} && \
91                 ${SETENV} ${CONFIGURE_ENV} ${SH} ./configure ${CONFIGURE_ARGS}
92
93 # Here we generate mk/build.mk dynamically.
94         ${RUN} ${RM} -f ${WRKSRC:Q}/mk/build.mk
95
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
102
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
112
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
115 # appreciate.
116         ${RUN} ${ECHO} "HSCOLOUR_SRCS     = NO" >> ${WRKSRC:Q}/mk/build.mk
117
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
121
122
123 # -----------------------------------------------------------------------------
124 # Installation/removal hooks
125 #
126
127 # Substitutions for INSTALL and DEINSTALL that handles package.cache.
128 FILES_SUBST+=   DISTNAME=${DISTNAME}
129
130 # We don't want package.cache to be in the PLIST.
131 post-install:
132         ${RM} -f ${DESTDIR:Q}${PREFIX:Q}/lib/${DISTNAME}/package.conf.d/package.cache
133
134
135 # -----------------------------------------------------------------------------
136 # PLIST
137 #
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
141 #
142
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"
146 .if empty(DESTDIR)
147 PKG_FAIL_REASON+="This package can not be built without using DESTDIR.\
148 You need to set USE_DESTDIR to \"yes\"."
149 .else
150 GENERATE_PLIST+= \
151         cd ${DESTDIR:Q}${PREFIX:Q} && \
152                 ${FIND} * \( -type f -or -type l \) | ${SORT} -d;
153 .endif
154
155
156 # -----------------------------------------------------------------------------
157 # Sanity checks
158 #
159
160 # There is an unused script which don't pass the portability test.
161 CHECK_PORTABILITY_SKIP+=        distrib/prep-bin-dist-mingw
162
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
167
168
169 # -----------------------------------------------------------------------------
170 # Dependencies
171 #
172
173 # I guess pdcurses works well but not tested.
174 USE_NCURSES=    yes
175
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"