Thu May 5 08:19:00 2022 UTC ()
ghc*: Use OPSYS_VERSION to numerically compare NetBSD versions


(nia)
diff -r1.51 -r1.52 pkgsrc/lang/ghc7/Makefile
diff -r1.15 -r1.16 pkgsrc/lang/ghc80/Makefile
diff -r1.10 -r1.11 pkgsrc/lang/ghc810/Makefile
diff -r1.17 -r1.18 pkgsrc/lang/ghc84/Makefile
diff -r1.23 -r1.24 pkgsrc/lang/ghc88/Makefile
diff -r1.19 -r1.20 pkgsrc/lang/ghc90/Makefile
diff -r1.6 -r1.7 pkgsrc/lang/ghc92/Makefile

cvs diff -r1.51 -r1.52 pkgsrc/lang/ghc7/Makefile (switch to unified diff)

--- pkgsrc/lang/ghc7/Makefile 2021/12/08 16:02:15 1.51
+++ pkgsrc/lang/ghc7/Makefile 2022/05/05 08:18:59 1.52
@@ -1,194 +1,194 @@ @@ -1,194 +1,194 @@
1# $NetBSD: Makefile,v 1.51 2021/12/08 16:02:15 adam Exp $ 1# $NetBSD: Makefile,v 1.52 2022/05/05 08:18:59 nia Exp $
2# ----------------------------------------------------------------------------- 2# -----------------------------------------------------------------------------
3# Package metadata 3# Package metadata
4# 4#
5DISTNAME= ghc-7.10.3-src 5DISTNAME= ghc-7.10.3-src
6PKGREVISION= 7 6PKGREVISION= 7
7PKGNAME= ${DISTNAME:S/-src$//} 7PKGNAME= ${DISTNAME:S/-src$//}
8CATEGORIES= lang 8CATEGORIES= lang
9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/ 9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
10EXTRACT_SUFX= .tar.xz 10EXTRACT_SUFX= .tar.xz
11 11
12MAINTAINER= pho@cielonegro.org 12MAINTAINER= pho@cielonegro.org
13HOMEPAGE= https://www.haskell.org/ghc/ 13HOMEPAGE= https://www.haskell.org/ghc/
14COMMENT= Compiler for the functional language Haskell - 7.10 Release Series 14COMMENT= Compiler for the functional language Haskell - 7.10 Release Series
15LICENSE= modified-bsd 15LICENSE= modified-bsd
16 16
17MKPIE_SUPPORTED= no 17MKPIE_SUPPORTED= no
18 18
19# GHC requires GHC to build itself. Formerly we could work around this 19# GHC requires GHC to build itself. Formerly we could work around this
20# bootstrapping problem by creating a special archive containing C 20# bootstrapping problem by creating a special archive containing C
21# sources compiled from Haskell sources, but that's no longer 21# sources compiled from Haskell sources, but that's no longer
22# possible. So we have to prepare stripped-down binaries sufficient to 22# possible. So we have to prepare stripped-down binaries sufficient to
23# bootstrap compilers for each platforms. If you want to build them 23# bootstrap compilers for each platforms. If you want to build them
24# yourself, follow instructions in BOOTSTRAP.txt and ./bootstrap.mk 24# yourself, follow instructions in BOOTSTRAP.txt and ./bootstrap.mk
25BROKEN_EXCEPT_ON_PLATFORM+= \ 25BROKEN_EXCEPT_ON_PLATFORM+= \
26 Darwin-*-powerpc \ 26 Darwin-*-powerpc \
27 FreeBSD-*-i386 \ 27 FreeBSD-*-i386 \
28 NetBSD-*-x86_64 \ 28 NetBSD-*-x86_64 \
29 SunOS-*-i386 \ 29 SunOS-*-i386 \
30 SunOS-*-x86_64 30 SunOS-*-x86_64
31 31
32 32
33# ----------------------------------------------------------------------------- 33# -----------------------------------------------------------------------------
34# Distfiles 34# Distfiles
35# 35#
36DISTFILES= ${DEFAULT_DISTFILES} 36DISTFILES= ${DEFAULT_DISTFILES}
37WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} 37WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
38 38
39# We don't want to extract all of the DISTFILEs. 39# We don't want to extract all of the DISTFILEs.
40EXTRACT_ONLY= ${DEFAULT_DISTFILES} 40EXTRACT_ONLY= ${DEFAULT_DISTFILES}
41 41
42 42
43# ----------------------------------------------------------------------------- 43# -----------------------------------------------------------------------------
44# Tools 44# Tools
45# 45#
46# The runtime dependency on perl is due to the evil splitter 46# The runtime dependency on perl is due to the evil splitter
47# (lib/${PKGNAME_NOREV}/ghc-split). 47# (lib/${PKGNAME_NOREV}/ghc-split).
48USE_TOOLS+= autoconf gmake gzip perl:run 48USE_TOOLS+= autoconf gmake gzip perl:run
49GNU_CONFIGURE= yes 49GNU_CONFIGURE= yes
50USE_GNU_CONFIGURE_HOST= no 50USE_GNU_CONFIGURE_HOST= no
51USE_LIBTOOL= yes 51USE_LIBTOOL= yes
52 52
53CONFIGURE_ARGS.common= \ 53CONFIGURE_ARGS.common= \
54 --with-gcc=${CC:Q} \ 54 --with-gcc=${CC:Q} \
55 --with-ld=${LD:Q} \ 55 --with-ld=${LD:Q} \
56 --with-curses-includes=${BUILDLINK_PREFIX.curses:Q}/${BUILDLINK_INCDIRS.curses:Q} \ 56 --with-curses-includes=${BUILDLINK_PREFIX.curses:Q}/${BUILDLINK_INCDIRS.curses:Q} \
57 --with-curses-libraries=${BUILDLINK_PREFIX.curses:Q}/${BUILDLINK_LIBDIRS.curses:Q} \ 57 --with-curses-libraries=${BUILDLINK_PREFIX.curses:Q}/${BUILDLINK_LIBDIRS.curses:Q} \
58 --with-gmp-includes=${BUILDLINK_PREFIX.gmp:Q}/${BUILDLINK_INCDIRS.gmp:Q} \ 58 --with-gmp-includes=${BUILDLINK_PREFIX.gmp:Q}/${BUILDLINK_INCDIRS.gmp:Q} \
59 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp:Q}/${BUILDLINK_LIBDIRS.gmp:Q} \ 59 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp:Q}/${BUILDLINK_LIBDIRS.gmp:Q} \
60 --with-iconv-includes=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_INCDIRS.iconv:Q} \ 60 --with-iconv-includes=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_INCDIRS.iconv:Q} \
61 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_LIBDIRS.iconv:Q} \ 61 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_LIBDIRS.iconv:Q} \
62 --with-system-libffi \ 62 --with-system-libffi \
63 --with-ffi-includes=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_INCDIRS.libffi:Q} \ 63 --with-ffi-includes=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_INCDIRS.libffi:Q} \
64 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_LIBDIRS.libffi:Q} 64 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_LIBDIRS.libffi:Q}
65 65
66CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common} 66CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
67 67
68CONFIGURE_ENV+= \ 68CONFIGURE_ENV+= \
69 ac_cv_path_fp_prog_ar=${AR:Q} \ 69 ac_cv_path_fp_prog_ar=${AR:Q} \
70 ac_cv_path_READELF=readelf \ 70 ac_cv_path_READELF=readelf \
71 PerlCmd=${PERL5:Q} 71 PerlCmd=${PERL5:Q}
72 72
73# LDFLAGS is currently not honored by "./configure". Since LDFLAGS 73# LDFLAGS is currently not honored by "./configure". Since LDFLAGS
74# contains rpath flags it's very important to force GHC to honor 74# contains rpath flags it's very important to force GHC to honor
75# it. Otherwise neither GHC itself nor executables it produces will 75# it. Otherwise neither GHC itself nor executables it produces will
76# have any rpaths so users will have to put "${PREFIX}/lib" into their 76# have any rpaths so users will have to put "${PREFIX}/lib" into their
77# "/etc/ld-elf.so.conf". See 77# "/etc/ld-elf.so.conf". See
78# http://hackage.haskell.org/trac/ghc/ticket/2933 78# http://hackage.haskell.org/trac/ghc/ticket/2933
79.for stage in 0 1 2 79.for stage in 0 1 2
80CONFIGURE_ENV+= \ 80CONFIGURE_ENV+= \
81 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:Q} 81 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:Q}
82# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for 82# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for
83# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS} 83# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS}
84# does more harm than good because our ${LDFLAGS} contains -Wl,* 84# does more harm than good because our ${LDFLAGS} contains -Wl,*
85# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them 85# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them
86# but those flags will also be baked into the compiler (see 86# but those flags will also be baked into the compiler (see
87# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside 87# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside
88# the buildlink. 88# the buildlink.
89.endfor 89.endfor
90 90
91# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT 91# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT
92# because it needs to generate various kinds of code at run time. The 92# because it needs to generate various kinds of code at run time. The
93# RTS linker, whose job is to load *static* objects at run time, 93# RTS linker, whose job is to load *static* objects at run time,
94# doesn't play nice with ASLR either. This means most executables 94# doesn't play nice with ASLR either. This means most executables
95# produced by GHC need them to be disabled. Perhaps we should patch 95# produced by GHC need them to be disabled. Perhaps we should patch
96# rts/sm/Storage.c so that it uses ffi_closure_alloc(3) on every 96# rts/sm/Storage.c so that it uses ffi_closure_alloc(3) on every
97# platform, not just Linux, and also drop support for static library 97# platform, not just Linux, and also drop support for static library
98# loading and switch to dynamic libraries entirely. 98# loading and switch to dynamic libraries entirely.
99.for f in ghc ghc-pkg haddock hpc hsc2hs runghc 99.for f in ghc ghc-pkg haddock hpc hsc2hs runghc
100NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 100NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
101NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 101NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
102.endfor 102.endfor
103 103
104 104
105# ----------------------------------------------------------------------------- 105# -----------------------------------------------------------------------------
106# Build hooks 106# Build hooks
107# 107#
108 108
109# We patch configure.ac in some directories. 109# We patch configure.ac in some directories.
110post-patch: 110post-patch:
111 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" 111 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
112 ${RUN} cd ${WRKSRC:Q}/libraries/base && autoconf 112 ${RUN} cd ${WRKSRC:Q}/libraries/base && autoconf
113 ${RUN} cd ${WRKSRC:Q}/libraries/integer-gmp && autoconf 113 ${RUN} cd ${WRKSRC:Q}/libraries/integer-gmp && autoconf
114 114
115# Define the target "pre-configure" and non-standard "bootstrap". 115# Define the target "pre-configure" and non-standard "bootstrap".
116.include "../../lang/ghc7/bootstrap.mk" 116.include "../../lang/ghc7/bootstrap.mk"
117 117
118# Our pre-configure phase installs a bindist of bootstrapping compiler 118# Our pre-configure phase installs a bindist of bootstrapping compiler
119# directly into TOOLS_DIR so that ./configure can find it. 119# directly into TOOLS_DIR so that ./configure can find it.
120 120
121# Here we generate mk/build.mk dynamically. 121# Here we generate mk/build.mk dynamically.
122post-configure: 122post-configure:
123 ${RUN} ${RM} -f ${WRKSRC:Q}/mk/build.mk 123 ${RUN} ${RM} -f ${WRKSRC:Q}/mk/build.mk
124 124
125# If there is HsColour in the PATH, GHC's build system tries to use it 125# If there is HsColour in the PATH, GHC's build system tries to use it
126# without even checking if it really works. That's not what we 126# without even checking if it really works. That's not what we
127# appreciate. 127# appreciate.
128 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC:Q}/mk/build.mk 128 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC:Q}/mk/build.mk
129 129
130# Don't even think of PDF. 130# Don't even think of PDF.
131 ${RUN} ${ECHO} "BUILD_DOCBOOK_PS = NO" >> ${WRKSRC:Q}/mk/build.mk 131 ${RUN} ${ECHO} "BUILD_DOCBOOK_PS = NO" >> ${WRKSRC:Q}/mk/build.mk
132 ${RUN} ${ECHO} "BUILD_DOCBOOK_PDF = NO" >> ${WRKSRC:Q}/mk/build.mk 132 ${RUN} ${ECHO} "BUILD_DOCBOOK_PDF = NO" >> ${WRKSRC:Q}/mk/build.mk
133 133
134 134
135# ----------------------------------------------------------------------------- 135# -----------------------------------------------------------------------------
136# Installation/removal hooks 136# Installation/removal hooks
137# 137#
138 138
139# Substitutions for INSTALL and DEINSTALL that handles package.cache. 139# Substitutions for INSTALL and DEINSTALL that handles package.cache.
140FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV} 140FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV}
141 141
142# We don't want package.cache to be in the PLIST. 142# We don't want package.cache to be in the PLIST.
143post-install: 143post-install:
144 ${RM} -f ${DESTDIR:Q}${PREFIX:Q}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache 144 ${RM} -f ${DESTDIR:Q}${PREFIX:Q}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache
145 145
146 146
147# ----------------------------------------------------------------------------- 147# -----------------------------------------------------------------------------
148# PLIST 148# PLIST
149# 149#
150# We can't use static PLIST because the package installs files with a 150# We can't use static PLIST because the package installs files with a
151# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm 151# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm
152# [2019-12-27; pho]. 152# [2019-12-27; pho].
153GENERATE_PLIST+= \ 153GENERATE_PLIST+= \
154 cd ${DESTDIR:Q}${PREFIX:Q} && \ 154 cd ${DESTDIR:Q}${PREFIX:Q} && \
155 ${FIND} * \( -type f -o -type l \) | ${SORT}; 155 ${FIND} * \( -type f -o -type l \) | ${SORT};
156 156
157 157
158# ----------------------------------------------------------------------------- 158# -----------------------------------------------------------------------------
159# Sanity checks 159# Sanity checks
160# 160#
161 161
162# There is an unused script which don't pass the portability test. 162# There is an unused script which don't pass the portability test.
163CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw 163CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
164 164
165# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable 165# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
166CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.* 166CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
167 167
168# ld: fatal: relocation error ... relocation requires reference symbol 168# ld: fatal: relocation error ... relocation requires reference symbol
169STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a 169STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a
170 170
171 171
172# ----------------------------------------------------------------------------- 172# -----------------------------------------------------------------------------
173# Dependencies 173# Dependencies
174# 174#
175BUILD_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt 175BUILD_DEPENDS+= libxslt-[0-9]*:../../textproc/libxslt
176BUILD_DEPENDS+= docbook-xsl-[0-9]*:../../textproc/docbook-xsl 176BUILD_DEPENDS+= docbook-xsl-[0-9]*:../../textproc/docbook-xsl
177 177
178# NetBSD 9.x have libcurses with a newer major version than the 178# NetBSD 9.x have libcurses with a newer major version than the
179# bootstrap kit is linked against. For now, work around this with 179# bootstrap kit is linked against. For now, work around this with
180# compat80. 180# compat80.
181.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*) 181.if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} >= 090000
182BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80 182BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
183# In a sandboxed build environment, we have to reach over to the 183# In a sandboxed build environment, we have to reach over to the
184# installed libraries themselves, since the symlinks compat80 adds 184# installed libraries themselves, since the symlinks compat80 adds
185# to the /usr tree can't be applied. 185# to the /usr tree can't be applied.
186ALL_ENV+= LD_LIBRARY_PATH=${PREFIX:Q}/emul/netbsd/usr/lib 186ALL_ENV+= LD_LIBRARY_PATH=${PREFIX:Q}/emul/netbsd/usr/lib
187.endif 187.endif
188 188
189.include "../../converters/libiconv/buildlink3.mk" 189.include "../../converters/libiconv/buildlink3.mk"
190.include "../../devel/libffi/buildlink3.mk" 190.include "../../devel/libffi/buildlink3.mk"
191.include "../../devel/gmp/buildlink3.mk" 191.include "../../devel/gmp/buildlink3.mk"
192.include "../../mk/curses.buildlink3.mk" 192.include "../../mk/curses.buildlink3.mk"
193.include "../../mk/pthread.buildlink3.mk" 193.include "../../mk/pthread.buildlink3.mk"
194.include "../../mk/bsd.pkg.mk" 194.include "../../mk/bsd.pkg.mk"

cvs diff -r1.15 -r1.16 pkgsrc/lang/ghc80/Makefile (switch to unified diff)

--- pkgsrc/lang/ghc80/Makefile 2021/12/08 16:02:15 1.15
+++ pkgsrc/lang/ghc80/Makefile 2022/05/05 08:18:59 1.16
@@ -1,194 +1,194 @@ @@ -1,194 +1,194 @@
1# $NetBSD: Makefile,v 1.15 2021/12/08 16:02:15 adam Exp $ 1# $NetBSD: Makefile,v 1.16 2022/05/05 08:18:59 nia Exp $
2# ----------------------------------------------------------------------------- 2# -----------------------------------------------------------------------------
3# Package metadata 3# Package metadata
4# 4#
5DISTNAME= ghc-8.0.2-src 5DISTNAME= ghc-8.0.2-src
6PKGNAME= ${DISTNAME:S/-src$//} 6PKGNAME= ${DISTNAME:S/-src$//}
7PKGREVISION= 6 7PKGREVISION= 6
8CATEGORIES= lang 8CATEGORIES= lang
9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/ 9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
10EXTRACT_SUFX= .tar.xz 10EXTRACT_SUFX= .tar.xz
11 11
12MAINTAINER= pho@cielonegro.org 12MAINTAINER= pho@cielonegro.org
13HOMEPAGE= https://www.haskell.org/ghc/ 13HOMEPAGE= https://www.haskell.org/ghc/
14COMMENT= Compiler for the functional language Haskell - 8.0 Release Series 14COMMENT= Compiler for the functional language Haskell - 8.0 Release Series
15LICENSE= modified-bsd 15LICENSE= modified-bsd
16 16
17MKPIE_SUPPORTED= no 17MKPIE_SUPPORTED= no
18 18
19UNLIMIT_RESOURCES= datasize virtualsize 19UNLIMIT_RESOURCES= datasize virtualsize
20 20
21# GHC requires GHC to build itself. Formerly we could work around this 21# GHC requires GHC to build itself. Formerly we could work around this
22# bootstrapping problem by creating a special archive containing C 22# bootstrapping problem by creating a special archive containing C
23# sources compiled from Haskell sources, but that's no longer 23# sources compiled from Haskell sources, but that's no longer
24# possible. So we have to prepare stripped-down binaries sufficient to 24# possible. So we have to prepare stripped-down binaries sufficient to
25# bootstrap compilers for each platforms. If you want to build them 25# bootstrap compilers for each platforms. If you want to build them
26# yourself, follow instructions in BOOTSTRAP.txt and ./bootstrap.mk 26# yourself, follow instructions in BOOTSTRAP.txt and ./bootstrap.mk
27#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet 27#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet
28BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386 28BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386
29BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64 29BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64
30BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64 30BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64
31BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64 31BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64
32 32
33 33
34# ----------------------------------------------------------------------------- 34# -----------------------------------------------------------------------------
35# Distfiles 35# Distfiles
36# 36#
37DISTFILES= ${DEFAULT_DISTFILES} 37DISTFILES= ${DEFAULT_DISTFILES}
38WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} 38WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
39 39
40# We don't want to extract all of the DISTFILEs. 40# We don't want to extract all of the DISTFILEs.
41EXTRACT_ONLY= ${DEFAULT_DISTFILES} 41EXTRACT_ONLY= ${DEFAULT_DISTFILES}
42 42
43 43
44# ----------------------------------------------------------------------------- 44# -----------------------------------------------------------------------------
45# Tools 45# Tools
46# 46#
47# The runtime dependency on perl is due to the evil splitter 47# The runtime dependency on perl is due to the evil splitter
48# (lib/${PKGNAME_NOREV}/ghc-split). 48# (lib/${PKGNAME_NOREV}/ghc-split).
49USE_TOOLS+= autoconf gmake gzip perl:run 49USE_TOOLS+= autoconf gmake gzip perl:run
50GNU_CONFIGURE= yes 50GNU_CONFIGURE= yes
51USE_GNU_CONFIGURE_HOST= no 51USE_GNU_CONFIGURE_HOST= no
52USE_LIBTOOL= yes 52USE_LIBTOOL= yes
53 53
54CONFIGURE_ARGS.common= \ 54CONFIGURE_ARGS.common= \
55 --with-gcc=${CC:Q} \ 55 --with-gcc=${CC:Q} \
56 --with-ld=${LD:Q} \ 56 --with-ld=${LD:Q} \
57 --with-curses-libraries=${BUILDLINK_PREFIX.curses:Q}/${BUILDLINK_LIBDIRS.curses:Q} \ 57 --with-curses-libraries=${BUILDLINK_PREFIX.curses:Q}/${BUILDLINK_LIBDIRS.curses:Q} \
58 --with-gmp-includes=${BUILDLINK_PREFIX.gmp:Q}/${BUILDLINK_INCDIRS.gmp:Q} \ 58 --with-gmp-includes=${BUILDLINK_PREFIX.gmp:Q}/${BUILDLINK_INCDIRS.gmp:Q} \
59 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp:Q}/${BUILDLINK_LIBDIRS.gmp:Q} \ 59 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp:Q}/${BUILDLINK_LIBDIRS.gmp:Q} \
60 --with-iconv-includes=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_INCDIRS.iconv:Q} \ 60 --with-iconv-includes=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_INCDIRS.iconv:Q} \
61 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_LIBDIRS.iconv:Q} \ 61 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv:Q}/${BUILDLINK_LIBDIRS.iconv:Q} \
62 --with-system-libffi \ 62 --with-system-libffi \
63 --with-ffi-includes=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_INCDIRS.libffi:Q} \ 63 --with-ffi-includes=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_INCDIRS.libffi:Q} \
64 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_LIBDIRS.libffi:Q} 64 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_LIBDIRS.libffi:Q}
65 65
66CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common} 66CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
67 67
68CONFIGURE_ENV+= \ 68CONFIGURE_ENV+= \
69 ac_cv_path_fp_prog_ar=${AR:Q} \ 69 ac_cv_path_fp_prog_ar=${AR:Q} \
70 PerlCmd=${PERL5:Q} 70 PerlCmd=${PERL5:Q}
71 71
72# LDFLAGS is currently not honored by "./configure". Since LDFLAGS 72# LDFLAGS is currently not honored by "./configure". Since LDFLAGS
73# contains rpath flags it's very important to force GHC to honor 73# contains rpath flags it's very important to force GHC to honor
74# it. Otherwise neither GHC itself nor executables it produces will 74# it. Otherwise neither GHC itself nor executables it produces will
75# have any rpaths so users will have to put "${PREFIX}/lib" into their 75# have any rpaths so users will have to put "${PREFIX}/lib" into their
76# "/etc/ld-elf.so.conf". See 76# "/etc/ld-elf.so.conf". See
77# http://hackage.haskell.org/trac/ghc/ticket/2933 77# http://hackage.haskell.org/trac/ghc/ticket/2933
78.for stage in 0 1 2 78.for stage in 0 1 2
79CONFIGURE_ENV+= \ 79CONFIGURE_ENV+= \
80 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:Q} 80 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:Q}
81# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for 81# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for
82# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS} 82# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS}
83# does more harm than good because our ${LDFLAGS} contains -Wl,* 83# does more harm than good because our ${LDFLAGS} contains -Wl,*
84# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them 84# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them
85# but those flags will also be baked into the compiler (see 85# but those flags will also be baked into the compiler (see
86# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside 86# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside
87# the buildlink. 87# the buildlink.
88.endfor 88.endfor
89 89
90# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT 90# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT
91# because it needs to generate various kinds of code at run time. The 91# because it needs to generate various kinds of code at run time. The
92# RTS linker, whose job is to load *static* objects at run time, 92# RTS linker, whose job is to load *static* objects at run time,
93# doesn't play nice with ASLR either. This means most executables 93# doesn't play nice with ASLR either. This means most executables
94# produced by GHC need them to be disabled. Perhaps we should patch 94# produced by GHC need them to be disabled. Perhaps we should patch
95# rts/sm/Storage.c so that it uses ffi_closure_alloc(3) on every 95# rts/sm/Storage.c so that it uses ffi_closure_alloc(3) on every
96# platform, not just Linux, and also drop support for static library 96# platform, not just Linux, and also drop support for static library
97# loading and switch to dynamic libraries entirely. 97# loading and switch to dynamic libraries entirely.
98.for f in ghc ghc-iserv ghc-iserv-dyn ghc-iserv-prof ghc-pkg haddock hpc hsc2hs runghc 98.for f in ghc ghc-iserv ghc-iserv-dyn ghc-iserv-prof ghc-pkg haddock hpc hsc2hs runghc
99NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 99NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
100NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 100NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
101.endfor 101.endfor
102 102
103 103
104# ----------------------------------------------------------------------------- 104# -----------------------------------------------------------------------------
105# Build hooks 105# Build hooks
106# 106#
107 107
108# We patch configure.ac in some directories. 108# We patch configure.ac in some directories.
109post-patch: 109post-patch:
110 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" 110 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
111 ${RUN} cd ${WRKSRC:Q} && autoconf 111 ${RUN} cd ${WRKSRC:Q} && autoconf
112 ${RUN} cd ${WRKSRC:Q}/libraries/base && autoconf 112 ${RUN} cd ${WRKSRC:Q}/libraries/base && autoconf
113 ${RUN} cd ${WRKSRC:Q}/libraries/integer-gmp && autoconf 113 ${RUN} cd ${WRKSRC:Q}/libraries/integer-gmp && autoconf
114 114
115# Define the target "pre-configure" and non-standard "bootstrap". 115# Define the target "pre-configure" and non-standard "bootstrap".
116.include "../../lang/ghc80/bootstrap.mk" 116.include "../../lang/ghc80/bootstrap.mk"
117 117
118# Our pre-configure phase installs a bindist of bootstrapping compiler 118# Our pre-configure phase installs a bindist of bootstrapping compiler
119# directly into TOOLS_DIR so that ./configure can find it. 119# directly into TOOLS_DIR so that ./configure can find it.
120 120
121# Here we generate mk/build.mk dynamically. 121# Here we generate mk/build.mk dynamically.
122post-configure: 122post-configure:
123 ${RUN} ${RM} -f ${WRKSRC:Q}/mk/build.mk 123 ${RUN} ${RM} -f ${WRKSRC:Q}/mk/build.mk
124 124
125# If there is HsColour in the PATH, GHC's build system tries to use it 125# If there is HsColour in the PATH, GHC's build system tries to use it
126# without even checking if it really works. That's not what we 126# without even checking if it really works. That's not what we
127# appreciate. 127# appreciate.
128 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC:Q}/mk/build.mk 128 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC:Q}/mk/build.mk
129 129
130# Don't even think of PDF. 130# Don't even think of PDF.
131 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC:Q}/mk/build.mk 131 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC:Q}/mk/build.mk
132 132
133 133
134# ----------------------------------------------------------------------------- 134# -----------------------------------------------------------------------------
135# Installation/removal hooks 135# Installation/removal hooks
136# 136#
137 137
138# Substitutions for INSTALL and DEINSTALL that handles package.cache. 138# Substitutions for INSTALL and DEINSTALL that handles package.cache.
139FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV} 139FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV}
140 140
141# We don't want package.cache to be in the PLIST. 141# We don't want package.cache to be in the PLIST.
142post-install: 142post-install:
143 ${RM} -f ${DESTDIR:Q}${PREFIX:Q}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache 143 ${RM} -f ${DESTDIR:Q}${PREFIX:Q}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache
144 144
145 145
146# ----------------------------------------------------------------------------- 146# -----------------------------------------------------------------------------
147# PLIST 147# PLIST
148# 148#
149# We can't use static PLIST because the package installs files with a 149# We can't use static PLIST because the package installs files with a
150# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm 150# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm
151# [2019-12-27; pho]. 151# [2019-12-27; pho].
152GENERATE_PLIST+= \ 152GENERATE_PLIST+= \
153 cd ${DESTDIR:Q}${PREFIX:Q} && \ 153 cd ${DESTDIR:Q}${PREFIX:Q} && \
154 ${FIND} * \( -type f -o -type l \) | ${SORT}; 154 ${FIND} * \( -type f -o -type l \) | ${SORT};
155 155
156 156
157# ----------------------------------------------------------------------------- 157# -----------------------------------------------------------------------------
158# Sanity checks 158# Sanity checks
159# 159#
160 160
161# There is an unused script which don't pass the portability test. 161# There is an unused script which don't pass the portability test.
162CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw 162CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
163 163
164# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable 164# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
165CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.* 165CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
166 166
167# ld: fatal: relocation error ... relocation requires reference symbol 167# ld: fatal: relocation error ... relocation requires reference symbol
168STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a 168STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a
169 169
170 170
171# ----------------------------------------------------------------------------- 171# -----------------------------------------------------------------------------
172# Dependencies 172# Dependencies
173# 173#
174BUILDLINK_DEPMETHOD.python:= build 174BUILDLINK_DEPMETHOD.python:= build
175.include "../../lang/python/pyversion.mk" 175.include "../../lang/python/pyversion.mk"
176BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx 176BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
177 177
178# NetBSD 9.x have libcurses with a newer major version than the 178# NetBSD 9.x have libcurses with a newer major version than the
179# bootstrap kit is linked against. For now, work around this with 179# bootstrap kit is linked against. For now, work around this with
180# compat80. 180# compat80.
181.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*) 181.if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} >= 090000
182BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80 182BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
183# In a sandboxed build environment, we have to reach over to the 183# In a sandboxed build environment, we have to reach over to the
184# installed libraries themselves, since the symlinks compat80 adds 184# installed libraries themselves, since the symlinks compat80 adds
185# to the /usr tree can't be applied. 185# to the /usr tree can't be applied.
186ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib 186ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib
187.endif 187.endif
188 188
189.include "../../converters/libiconv/buildlink3.mk" 189.include "../../converters/libiconv/buildlink3.mk"
190.include "../../devel/libffi/buildlink3.mk" 190.include "../../devel/libffi/buildlink3.mk"
191.include "../../devel/gmp/buildlink3.mk" 191.include "../../devel/gmp/buildlink3.mk"
192.include "../../mk/curses.buildlink3.mk" 192.include "../../mk/curses.buildlink3.mk"
193.include "../../mk/pthread.buildlink3.mk" 193.include "../../mk/pthread.buildlink3.mk"
194.include "../../mk/bsd.pkg.mk" 194.include "../../mk/bsd.pkg.mk"

cvs diff -r1.10 -r1.11 pkgsrc/lang/ghc810/Makefile (switch to unified diff)

--- pkgsrc/lang/ghc810/Makefile 2022/02/14 12:12:07 1.10
+++ pkgsrc/lang/ghc810/Makefile 2022/05/05 08:18:59 1.11
@@ -1,236 +1,236 @@ @@ -1,236 +1,236 @@
1# $NetBSD: Makefile,v 1.10 2022/02/14 12:12:07 pho Exp $ 1# $NetBSD: Makefile,v 1.11 2022/05/05 08:18:59 nia Exp $
2# ----------------------------------------------------------------------------- 2# -----------------------------------------------------------------------------
3# Package metadata 3# Package metadata
4# 4#
5DISTNAME= ghc-8.10.4-src 5DISTNAME= ghc-8.10.4-src
6PKGREVISION= 4 6PKGREVISION= 4
7PKGNAME= ${DISTNAME:S/-src$//} 7PKGNAME= ${DISTNAME:S/-src$//}
8CATEGORIES= lang 8CATEGORIES= lang
9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/ 9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
10EXTRACT_SUFX= .tar.xz 10EXTRACT_SUFX= .tar.xz
11 11
12MAINTAINER= pkgsrc-users@NetBSD.org 12MAINTAINER= pkgsrc-users@NetBSD.org
13HOMEPAGE= https://www.haskell.org/ghc/ 13HOMEPAGE= https://www.haskell.org/ghc/
14COMMENT= Compiler for the functional language Haskell - 8.10 Release Series 14COMMENT= Compiler for the functional language Haskell - 8.10 Release Series
15LICENSE= modified-bsd 15LICENSE= modified-bsd
16 16
17MKPIE_SUPPORTED= no 17MKPIE_SUPPORTED= no
18 18
19UNLIMIT_RESOURCES= datasize virtualsize 19UNLIMIT_RESOURCES= datasize virtualsize
20 20
21# GHC requires GHC to build itself. We have to prepare stripped-down 21# GHC requires GHC to build itself. We have to prepare stripped-down
22# binaries sufficient to bootstrap compilers for each platforms. If 22# binaries sufficient to bootstrap compilers for each platforms. If
23# you want to build them yourself, follow instructions in 23# you want to build them yourself, follow instructions in
24# BOOTSTRAP.txt and ./bootstrap.mk 24# BOOTSTRAP.txt and ./bootstrap.mk
25#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet 25#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet
26BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64 26BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64
27BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386 27BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386
28BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64 28BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64
29BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64 29BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64
30BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64 30BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64
31 31
32 32
33# ----------------------------------------------------------------------------- 33# -----------------------------------------------------------------------------
34# Distfiles 34# Distfiles
35# 35#
36DISTFILES= ${DEFAULT_DISTFILES} 36DISTFILES= ${DEFAULT_DISTFILES}
37WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} 37WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
38 38
39# We don't want to extract all of the DISTFILEs. 39# We don't want to extract all of the DISTFILEs.
40EXTRACT_ONLY= ${DEFAULT_DISTFILES} 40EXTRACT_ONLY= ${DEFAULT_DISTFILES}
41 41
42 42
43# ----------------------------------------------------------------------------- 43# -----------------------------------------------------------------------------
44# Tools 44# Tools
45# 45#
46# The runtime dependency on perl is due to the evil splitter 46# The runtime dependency on perl is due to the evil splitter
47# (lib/${PKGNAME_NOREV}/ghc-split). 47# (lib/${PKGNAME_NOREV}/ghc-split).
48USE_TOOLS+= autoconf gmake perl:run 48USE_TOOLS+= autoconf gmake perl:run
49GNU_CONFIGURE= yes 49GNU_CONFIGURE= yes
50USE_GNU_CONFIGURE_HOST= no 50USE_GNU_CONFIGURE_HOST= no
51USE_LIBTOOL= yes 51USE_LIBTOOL= yes
52 52
53# TODO: Disable the splitter entirely so that we can drop the runtime 53# TODO: Disable the splitter entirely so that we can drop the runtime
54# dependency on perl. The purpose of the splitter is to perform a dead 54# dependency on perl. The purpose of the splitter is to perform a dead
55# code elimination by breaking .o files into many pieces. This only 55# code elimination by breaking .o files into many pieces. This only
56# makes sense when linking executables statically, which is rarely 56# makes sense when linking executables statically, which is rarely
57# done these days. 57# done these days.
58 58
59 59
60# ----------------------------------------------------------------------------- 60# -----------------------------------------------------------------------------
61# Configuration 61# Configuration
62# 62#
63CONFIGURE_ARGS.common= \ 63CONFIGURE_ARGS.common= \
64 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \ 64 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \
65 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \ 65 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \
66 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \ 66 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \
67 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \ 67 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \
68 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \ 68 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \
69 --with-system-libffi \ 69 --with-system-libffi \
70 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \ 70 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \
71 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q} 71 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q}
72 72
73CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common} 73CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
74 74
75# We must pass non-wrapper tools to ./configure because they will be 75# We must pass non-wrapper tools to ./configure because they will be
76# embedded in the compiler (actually ${WRKSRC}/settings). 76# embedded in the compiler (actually ${WRKSRC}/settings).
77CONFIGURE_ENV+= \ 77CONFIGURE_ENV+= \
78 ac_cv_prog_fp_prog_ar=${AR:Q} \ 78 ac_cv_prog_fp_prog_ar=${AR:Q} \
79 ac_cv_prog_LIBTOOL=libtool \ 79 ac_cv_prog_LIBTOOL=libtool \
80 PerlCmd=${PERL5:Q} \ 80 PerlCmd=${PERL5:Q} \
81 CC=${CC:Q} \ 81 CC=${CC:Q} \
82 LD=${LD:Q} 82 LD=${LD:Q}
83 83
84# LDFLAGS is currently not honored by "./configure". Since LDFLAGS 84# LDFLAGS is currently not honored by "./configure". Since LDFLAGS
85# contains rpath flags it's very important to force GHC to honor 85# contains rpath flags it's very important to force GHC to honor
86# it. Otherwise neither GHC itself nor executables it produces will 86# it. Otherwise neither GHC itself nor executables it produces will
87# have any rpaths so users will have to put "${PREFIX}/lib" into their 87# have any rpaths so users will have to put "${PREFIX}/lib" into their
88# "/etc/ld-elf.so.conf". See 88# "/etc/ld-elf.so.conf". See
89# http://hackage.haskell.org/trac/ghc/ticket/2933 89# http://hackage.haskell.org/trac/ghc/ticket/2933
90.for stage in 0 1 2 90.for stage in 0 1 2
91CONFIGURE_ENV+= \ 91CONFIGURE_ENV+= \
92 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q} 92 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q}
93# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for 93# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for
94# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS} 94# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS}
95# does more harm than good because our ${LDFLAGS} contains -Wl,* 95# does more harm than good because our ${LDFLAGS} contains -Wl,*
96# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them 96# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them
97# but those flags will also be baked into the compiler (see 97# but those flags will also be baked into the compiler (see
98# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside 98# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside
99# the buildlink. 99# the buildlink.
100.endfor 100.endfor
101 101
102 102
103# ----------------------------------------------------------------------------- 103# -----------------------------------------------------------------------------
104# Security 104# Security
105# 105#
106# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT 106# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT
107# because it needs to generate various kinds of code at run time. The 107# because it needs to generate various kinds of code at run time. The
108# RTS linker, whose job is to load *static* objects at run time, 108# RTS linker, whose job is to load *static* objects at run time,
109# doesn't play nice with ASLR either because it relies on 109# doesn't play nice with ASLR either because it relies on
110# mmap(MAP_FIXED). This means most executables produced by GHC need 110# mmap(MAP_FIXED). This means most executables produced by GHC need
111# them to be disabled. Perhaps we should patch rts/sm/Storage.c so 111# them to be disabled. Perhaps we should patch rts/sm/Storage.c so
112# that it uses ffi_closure_alloc(3) on every platform, not just Linux, 112# that it uses ffi_closure_alloc(3) on every platform, not just Linux,
113# and also drop support for static library loading and switch to 113# and also drop support for static library loading and switch to
114# dynamic libraries entirely. (Partially done: 114# dynamic libraries entirely. (Partially done:
115# https://gitlab.haskell.org/ghc/ghc/merge_requests/2498) 115# https://gitlab.haskell.org/ghc/ghc/merge_requests/2498)
116.for f in ghc ghc-iserv ghc-iserv-dyn ghc-iserv-prof ghc-pkg haddock hpc hsc2hs runghc 116.for f in ghc ghc-iserv ghc-iserv-dyn ghc-iserv-prof ghc-pkg haddock hpc hsc2hs runghc
117NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 117NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
118NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 118NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
119.endfor 119.endfor
120# Additional note: Now that DYNAMIC_GHC_PROGRAMS is enabled by 120# Additional note: Now that DYNAMIC_GHC_PROGRAMS is enabled by
121# default, we no longer need to disable PaX ASLR because the RTS 121# default, we no longer need to disable PaX ASLR because the RTS
122# linker is not used... except for ghc-iserv. The program is launched 122# linker is not used... except for ghc-iserv. The program is launched
123# when ghci is started with -fexternal-interpreter without 123# when ghci is started with -fexternal-interpreter without
124# -dynamic. Its purpose is to run non-PIC code from a dynamically 124# -dynamic. Its purpose is to run non-PIC code from a dynamically
125# linked ghci, and therefore still uses RTS linker. Also note that RTS 125# linked ghci, and therefore still uses RTS linker. Also note that RTS
126# linker requires PaX mprotect to be disabled too. This means that 126# linker requires PaX mprotect to be disabled too. This means that
127# once the merge request mentioned above is merged to the upstream, we 127# once the merge request mentioned above is merged to the upstream, we
128# can at least enable PaX mprotect and PaX ASLR for all the 128# can at least enable PaX mprotect and PaX ASLR for all the
129# executables except ghc-iserv and ghc-iserv-prof. 129# executables except ghc-iserv and ghc-iserv-prof.
130 130
131 131
132# ----------------------------------------------------------------------------- 132# -----------------------------------------------------------------------------
133# Build hooks 133# Build hooks
134# 134#
135 135
136# We patch configure.ac in some directories. 136# We patch configure.ac in some directories.
137post-patch: 137post-patch:
138 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" 138 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
139 ${RUN} cd ${WRKSRC} && autoconf 139 ${RUN} cd ${WRKSRC} && autoconf
140 140
141# Define the target "pre-configure" and non-standard "bootstrap". 141# Define the target "pre-configure" and non-standard "bootstrap".
142.include "../../lang/ghc810/bootstrap.mk" 142.include "../../lang/ghc810/bootstrap.mk"
143 143
144# Our pre-configure phase installs a bindist of bootstrapping compiler 144# Our pre-configure phase installs a bindist of bootstrapping compiler
145# directly into TOOLS_DIR so that ./configure can find it. 145# directly into TOOLS_DIR so that ./configure can find it.
146 146
147# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too 147# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too
148# loose, and building docs/users_guide rarely succeeds. We don't know 148# loose, and building docs/users_guide rarely succeeds. We don't know
149# which version is actually required for it. 149# which version is actually required for it.
150.include "../../mk/bsd.prefs.mk" 150.include "../../mk/bsd.prefs.mk"
151BUILD_SPHINX_HTML?= no 151BUILD_SPHINX_HTML?= no
152 152
153# Here we generate mk/build.mk dynamically. 153# Here we generate mk/build.mk dynamically.
154post-configure: 154post-configure:
155 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk 155 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk
156 156
157# If there is HsColour in the PATH, GHC's build system tries to use it 157# If there is HsColour in the PATH, GHC's build system tries to use it
158# without even checking if it really works. That's not what we 158# without even checking if it really works. That's not what we
159# appreciate. 159# appreciate.
160 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk 160 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk
161 161
162.if ${BUILD_SPHINX_HTML} == "no" 162.if ${BUILD_SPHINX_HTML} == "no"
163 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk 163 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk
164.endif 164.endif
165 165
166# Don't even think of PDF. 166# Don't even think of PDF.
167 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk 167 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk
168 168
169# https://gitlab.haskell.org/ghc/ghc/issues/13542 169# https://gitlab.haskell.org/ghc/ghc/issues/13542
170.if ${OPSYS} == "SunOS" 170.if ${OPSYS} == "SunOS"
171 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk 171 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk
172.endif 172.endif
173 173
174# ----------------------------------------------------------------------------- 174# -----------------------------------------------------------------------------
175# Installation/removal hooks 175# Installation/removal hooks
176# 176#
177 177
178# Substitutions for INSTALL and DEINSTALL that handles package.cache. 178# Substitutions for INSTALL and DEINSTALL that handles package.cache.
179FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV} 179FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV}
180 180
181# We don't want package.cache to be in the PLIST. 181# We don't want package.cache to be in the PLIST.
182post-install: 182post-install:
183 ${RM} -f ${DESTDIR}${PREFIX}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache 183 ${RM} -f ${DESTDIR}${PREFIX}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache
184 184
185 185
186# ----------------------------------------------------------------------------- 186# -----------------------------------------------------------------------------
187# PLIST 187# PLIST
188# 188#
189# We can't use static PLIST because the package installs files with a 189# We can't use static PLIST because the package installs files with a
190# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm 190# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm
191# [2019-12-27; pho]. 191# [2019-12-27; pho].
192GENERATE_PLIST+= \ 192GENERATE_PLIST+= \
193 cd ${DESTDIR}${PREFIX} && \ 193 cd ${DESTDIR}${PREFIX} && \
194 ${FIND} * \( -type f -o -type l \) | ${SORT}; 194 ${FIND} * \( -type f -o -type l \) | ${SORT};
195 195
196 196
197# ----------------------------------------------------------------------------- 197# -----------------------------------------------------------------------------
198# Sanity checks 198# Sanity checks
199# 199#
200 200
201# There is an unused script which don't pass the portability test. 201# There is an unused script which don't pass the portability test.
202CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw 202CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
203 203
204# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable 204# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
205CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.* 205CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
206 206
207# ld: fatal: relocation error ... relocation requires reference symbol 207# ld: fatal: relocation error ... relocation requires reference symbol
208STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a 208STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a
209 209
210 210
211# ----------------------------------------------------------------------------- 211# -----------------------------------------------------------------------------
212# Dependencies 212# Dependencies
213# 213#
214.if ${BUILD_SPHINX_HTML} != "no" 214.if ${BUILD_SPHINX_HTML} != "no"
215BUILDLINK_DEPMETHOD.python:= build 215BUILDLINK_DEPMETHOD.python:= build
216.include "../../lang/python/pyversion.mk" 216.include "../../lang/python/pyversion.mk"
217BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx 217BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
218.endif 218.endif
219 219
220# NetBSD 9.x have libcurses with a newer major version than the 220# NetBSD 9.x have libcurses with a newer major version than the
221# bootstrap kit is linked against. For now, work around this with 221# bootstrap kit is linked against. For now, work around this with
222# compat80. 222# compat80.
223.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*) 223.if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} >= 090000
224BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80 224BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
225# In a sandboxed build environment, we have to reach over to the 225# In a sandboxed build environment, we have to reach over to the
226# installed libraries themselves, since the symlinks compat80 adds 226# installed libraries themselves, since the symlinks compat80 adds
227# to the /usr tree can't be applied. 227# to the /usr tree can't be applied.
228ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib 228ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib
229.endif 229.endif
230 230
231.include "../../converters/libiconv/buildlink3.mk" 231.include "../../converters/libiconv/buildlink3.mk"
232.include "../../devel/libffi/buildlink3.mk" 232.include "../../devel/libffi/buildlink3.mk"
233.include "../../devel/gmp/buildlink3.mk" 233.include "../../devel/gmp/buildlink3.mk"
234.include "../../mk/curses.buildlink3.mk" 234.include "../../mk/curses.buildlink3.mk"
235.include "../../mk/pthread.buildlink3.mk" 235.include "../../mk/pthread.buildlink3.mk"
236.include "../../mk/bsd.pkg.mk" 236.include "../../mk/bsd.pkg.mk"

cvs diff -r1.17 -r1.18 pkgsrc/lang/ghc84/Makefile (switch to unified diff)

--- pkgsrc/lang/ghc84/Makefile 2021/12/08 16:02:15 1.17
+++ pkgsrc/lang/ghc84/Makefile 2022/05/05 08:18:59 1.18
@@ -1,212 +1,212 @@ @@ -1,212 +1,212 @@
1# $NetBSD: Makefile,v 1.17 2021/12/08 16:02:15 adam Exp $ 1# $NetBSD: Makefile,v 1.18 2022/05/05 08:18:59 nia Exp $
2# ----------------------------------------------------------------------------- 2# -----------------------------------------------------------------------------
3# Package metadata 3# Package metadata
4# 4#
5DISTNAME= ghc-8.4.4-src 5DISTNAME= ghc-8.4.4-src
6PKGNAME= ${DISTNAME:S/-src$//} 6PKGNAME= ${DISTNAME:S/-src$//}
7PKGREVISION= 6 7PKGREVISION= 6
8CATEGORIES= lang 8CATEGORIES= lang
9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/ 9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
10EXTRACT_SUFX= .tar.xz 10EXTRACT_SUFX= .tar.xz
11 11
12MAINTAINER= pho@cielonegro.org 12MAINTAINER= pho@cielonegro.org
13HOMEPAGE= https://www.haskell.org/ghc/ 13HOMEPAGE= https://www.haskell.org/ghc/
14COMMENT= Compiler for the functional language Haskell - 8.4 Release Series 14COMMENT= Compiler for the functional language Haskell - 8.4 Release Series
15LICENSE= modified-bsd 15LICENSE= modified-bsd
16 16
17MKPIE_SUPPORTED= no 17MKPIE_SUPPORTED= no
18 18
19UNLIMIT_RESOURCES= datasize virtualsize 19UNLIMIT_RESOURCES= datasize virtualsize
20 20
21# GHC requires GHC to build itself. We have to prepare stripped-down 21# GHC requires GHC to build itself. We have to prepare stripped-down
22# binaries sufficient to bootstrap compilers for each platforms. If 22# binaries sufficient to bootstrap compilers for each platforms. If
23# you want to build them yourself, follow instructions in 23# you want to build them yourself, follow instructions in
24# BOOTSTRAP.txt and ./bootstrap.mk 24# BOOTSTRAP.txt and ./bootstrap.mk
25#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet 25#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet
26BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64 26BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64
27BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386 27BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386
28BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64 28BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64
29BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64 29BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64
30#BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-i386 # Not available yet 30#BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-i386 # Not available yet
31BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64 31BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64
32 32
33 33
34# ----------------------------------------------------------------------------- 34# -----------------------------------------------------------------------------
35# Distfiles 35# Distfiles
36# 36#
37DISTFILES= ${DEFAULT_DISTFILES} 37DISTFILES= ${DEFAULT_DISTFILES}
38WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} 38WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
39 39
40# We don't want to extract all of the DISTFILEs. 40# We don't want to extract all of the DISTFILEs.
41EXTRACT_ONLY= ${DEFAULT_DISTFILES} 41EXTRACT_ONLY= ${DEFAULT_DISTFILES}
42 42
43 43
44# ----------------------------------------------------------------------------- 44# -----------------------------------------------------------------------------
45# Tools 45# Tools
46# 46#
47# The runtime dependency on perl is due to the evil splitter 47# The runtime dependency on perl is due to the evil splitter
48# (lib/${PKGNAME_NOREV}/ghc-split). 48# (lib/${PKGNAME_NOREV}/ghc-split).
49USE_TOOLS+= autoconf gmake perl:run 49USE_TOOLS+= autoconf gmake perl:run
50GNU_CONFIGURE= yes 50GNU_CONFIGURE= yes
51USE_GNU_CONFIGURE_HOST= no 51USE_GNU_CONFIGURE_HOST= no
52USE_LIBTOOL= yes 52USE_LIBTOOL= yes
53 53
54CONFIGURE_ARGS.common= \ 54CONFIGURE_ARGS.common= \
55 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \ 55 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \
56 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \ 56 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \
57 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \ 57 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \
58 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \ 58 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \
59 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \ 59 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \
60 --with-system-libffi \ 60 --with-system-libffi \
61 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \ 61 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \
62 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q} 62 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q}
63 63
64CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common} 64CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
65 65
66# We must pass non-wrapper tools to ./configure because they will be 66# We must pass non-wrapper tools to ./configure because they will be
67# embedded in the compiler (actually ${WRKSRC}/settings). 67# embedded in the compiler (actually ${WRKSRC}/settings).
68CONFIGURE_ENV+= \ 68CONFIGURE_ENV+= \
69 ac_cv_prog_fp_prog_ar=${AR:Q} \ 69 ac_cv_prog_fp_prog_ar=${AR:Q} \
70 ac_cv_prog_LIBTOOL=libtool \ 70 ac_cv_prog_LIBTOOL=libtool \
71 PerlCmd=${PERL5:Q} \ 71 PerlCmd=${PERL5:Q} \
72 CC=${CC:Q} \ 72 CC=${CC:Q} \
73 LD=${LD:Q} 73 LD=${LD:Q}
74 74
75# LDFLAGS is currently not honored by "./configure". Since LDFLAGS 75# LDFLAGS is currently not honored by "./configure". Since LDFLAGS
76# contains rpath flags it's very important to force GHC to honor 76# contains rpath flags it's very important to force GHC to honor
77# it. Otherwise neither GHC itself nor executables it produces will 77# it. Otherwise neither GHC itself nor executables it produces will
78# have any rpaths so users will have to put "${PREFIX}/lib" into their 78# have any rpaths so users will have to put "${PREFIX}/lib" into their
79# "/etc/ld-elf.so.conf". See 79# "/etc/ld-elf.so.conf". See
80# http://hackage.haskell.org/trac/ghc/ticket/2933 80# http://hackage.haskell.org/trac/ghc/ticket/2933
81.for stage in 0 1 2 81.for stage in 0 1 2
82CONFIGURE_ENV+= \ 82CONFIGURE_ENV+= \
83 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q} 83 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q}
84# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for 84# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for
85# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS} 85# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS}
86# does more harm than good because our ${LDFLAGS} contains -Wl,* 86# does more harm than good because our ${LDFLAGS} contains -Wl,*
87# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them 87# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them
88# but those flags will also be baked into the compiler (see 88# but those flags will also be baked into the compiler (see
89# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside 89# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside
90# the buildlink. 90# the buildlink.
91.endfor 91.endfor
92 92
93# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT 93# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT
94# because it needs to generate various kinds of code at run time. The 94# because it needs to generate various kinds of code at run time. The
95# RTS linker, whose job is to load *static* objects at run time, 95# RTS linker, whose job is to load *static* objects at run time,
96# doesn't play nice with ASLR either. This means most executables 96# doesn't play nice with ASLR either. This means most executables
97# produced by GHC need them to be disabled. Perhaps we should patch 97# produced by GHC need them to be disabled. Perhaps we should patch
98# rts/sm/Storage.c so that it uses ffi_closure_alloc(3) on every 98# rts/sm/Storage.c so that it uses ffi_closure_alloc(3) on every
99# platform, not just Linux, and also drop support for static library 99# platform, not just Linux, and also drop support for static library
100# loading and switch to dynamic libraries entirely. 100# loading and switch to dynamic libraries entirely.
101.for f in ghc ghc-iserv ghc-iserv-dyn ghc-iserv-prof ghc-pkg haddock hpc hsc2hs runghc 101.for f in ghc ghc-iserv ghc-iserv-dyn ghc-iserv-prof ghc-pkg haddock hpc hsc2hs runghc
102NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 102NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
103NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 103NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
104.endfor 104.endfor
105 105
106 106
107# ----------------------------------------------------------------------------- 107# -----------------------------------------------------------------------------
108# Build hooks 108# Build hooks
109# 109#
110 110
111# We patch configure.ac in some directories. 111# We patch configure.ac in some directories.
112post-patch: 112post-patch:
113 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" 113 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
114 ${RUN} cd ${WRKSRC} && autoconf 114 ${RUN} cd ${WRKSRC} && autoconf
115 115
116# Define the target "pre-configure" and non-standard "bootstrap". 116# Define the target "pre-configure" and non-standard "bootstrap".
117.include "../../lang/ghc84/bootstrap.mk" 117.include "../../lang/ghc84/bootstrap.mk"
118 118
119# Our pre-configure phase installs a bindist of bootstrapping compiler 119# Our pre-configure phase installs a bindist of bootstrapping compiler
120# directly into TOOLS_DIR so that ./configure can find it. 120# directly into TOOLS_DIR so that ./configure can find it.
121 121
122# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too 122# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too
123# loose, and building docs/users_guide rarely succeeds. We don't know 123# loose, and building docs/users_guide rarely succeeds. We don't know
124# which version is actually required for it. 124# which version is actually required for it.
125.include "../../mk/bsd.prefs.mk" 125.include "../../mk/bsd.prefs.mk"
126BUILD_SPHINX_HTML?= no 126BUILD_SPHINX_HTML?= no
127 127
128# Here we generate mk/build.mk dynamically. 128# Here we generate mk/build.mk dynamically.
129post-configure: 129post-configure:
130 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk 130 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk
131 131
132# If there is HsColour in the PATH, GHC's build system tries to use it 132# If there is HsColour in the PATH, GHC's build system tries to use it
133# without even checking if it really works. That's not what we 133# without even checking if it really works. That's not what we
134# appreciate. 134# appreciate.
135 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk 135 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk
136 136
137.if ${BUILD_SPHINX_HTML} == "no" 137.if ${BUILD_SPHINX_HTML} == "no"
138 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk 138 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk
139.endif 139.endif
140 140
141# Don't even think of PDF. 141# Don't even think of PDF.
142 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk 142 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk
143 143
144# https://gitlab.haskell.org/ghc/ghc/issues/13542 144# https://gitlab.haskell.org/ghc/ghc/issues/13542
145.if ${OPSYS} == "SunOS" 145.if ${OPSYS} == "SunOS"
146 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk 146 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk
147.endif 147.endif
148 148
149 149
150# ----------------------------------------------------------------------------- 150# -----------------------------------------------------------------------------
151# Installation/removal hooks 151# Installation/removal hooks
152# 152#
153 153
154# Substitutions for INSTALL and DEINSTALL that handles package.cache. 154# Substitutions for INSTALL and DEINSTALL that handles package.cache.
155FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV} 155FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV}
156 156
157# We don't want package.cache to be in the PLIST. 157# We don't want package.cache to be in the PLIST.
158post-install: 158post-install:
159 ${RM} -f ${DESTDIR}${PREFIX}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache 159 ${RM} -f ${DESTDIR}${PREFIX}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache
160 160
161 161
162# ----------------------------------------------------------------------------- 162# -----------------------------------------------------------------------------
163# PLIST 163# PLIST
164# 164#
165# We can't use static PLIST because the package installs files with a 165# We can't use static PLIST because the package installs files with a
166# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm 166# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm
167# [2019-12-27; pho]. 167# [2019-12-27; pho].
168GENERATE_PLIST+= \ 168GENERATE_PLIST+= \
169 cd ${DESTDIR}${PREFIX} && \ 169 cd ${DESTDIR}${PREFIX} && \
170 ${FIND} * \( -type f -o -type l \) | ${SORT}; 170 ${FIND} * \( -type f -o -type l \) | ${SORT};
171 171
172 172
173# ----------------------------------------------------------------------------- 173# -----------------------------------------------------------------------------
174# Sanity checks 174# Sanity checks
175# 175#
176 176
177# There is an unused script which don't pass the portability test. 177# There is an unused script which don't pass the portability test.
178CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw 178CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
179 179
180# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable 180# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
181CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.* 181CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
182 182
183# ld: fatal: relocation error ... relocation requires reference symbol 183# ld: fatal: relocation error ... relocation requires reference symbol
184STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a 184STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a
185 185
186 186
187# ----------------------------------------------------------------------------- 187# -----------------------------------------------------------------------------
188# Dependencies 188# Dependencies
189# 189#
190.if ${BUILD_SPHINX_HTML} != "no" 190.if ${BUILD_SPHINX_HTML} != "no"
191BUILDLINK_DEPMETHOD.python:= build 191BUILDLINK_DEPMETHOD.python:= build
192.include "../../lang/python/pyversion.mk" 192.include "../../lang/python/pyversion.mk"
193BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx 193BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
194.endif 194.endif
195 195
196# NetBSD 9.x have libcurses with a newer major version than the 196# NetBSD 9.x have libcurses with a newer major version than the
197# bootstrap kit is linked against. For now, work around this with 197# bootstrap kit is linked against. For now, work around this with
198# compat80. 198# compat80.
199.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*) 199.if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} >= 090000
200BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80 200BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
201# In a sandboxed build environment, we have to reach over to the 201# In a sandboxed build environment, we have to reach over to the
202# installed libraries themselves, since the symlinks compat80 adds 202# installed libraries themselves, since the symlinks compat80 adds
203# to the /usr tree can't be applied. 203# to the /usr tree can't be applied.
204ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib 204ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib
205.endif 205.endif
206 206
207.include "../../converters/libiconv/buildlink3.mk" 207.include "../../converters/libiconv/buildlink3.mk"
208.include "../../devel/libffi/buildlink3.mk" 208.include "../../devel/libffi/buildlink3.mk"
209.include "../../devel/gmp/buildlink3.mk" 209.include "../../devel/gmp/buildlink3.mk"
210.include "../../mk/curses.buildlink3.mk" 210.include "../../mk/curses.buildlink3.mk"
211.include "../../mk/pthread.buildlink3.mk" 211.include "../../mk/pthread.buildlink3.mk"
212.include "../../mk/bsd.pkg.mk" 212.include "../../mk/bsd.pkg.mk"

cvs diff -r1.23 -r1.24 pkgsrc/lang/ghc88/Makefile (switch to unified diff)

--- pkgsrc/lang/ghc88/Makefile 2021/12/08 16:02:15 1.23
+++ pkgsrc/lang/ghc88/Makefile 2022/05/05 08:18:59 1.24
@@ -1,238 +1,238 @@ @@ -1,238 +1,238 @@
1# $NetBSD: Makefile,v 1.23 2021/12/08 16:02:15 adam Exp $ 1# $NetBSD: Makefile,v 1.24 2022/05/05 08:18:59 nia Exp $
2# ----------------------------------------------------------------------------- 2# -----------------------------------------------------------------------------
3# Package metadata 3# Package metadata
4# 4#
5DISTNAME= ghc-8.8.4-src 5DISTNAME= ghc-8.8.4-src
6PKGNAME= ${DISTNAME:S/-src$//} 6PKGNAME= ${DISTNAME:S/-src$//}
7PKGREVISION= 6 7PKGREVISION= 6
8CATEGORIES= lang 8CATEGORIES= lang
9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/ 9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
10EXTRACT_SUFX= .tar.xz 10EXTRACT_SUFX= .tar.xz
11 11
12MAINTAINER= pho@cielonegro.org 12MAINTAINER= pho@cielonegro.org
13HOMEPAGE= https://www.haskell.org/ghc/ 13HOMEPAGE= https://www.haskell.org/ghc/
14COMMENT= Compiler for the functional language Haskell - 8.8 Release Series 14COMMENT= Compiler for the functional language Haskell - 8.8 Release Series
15LICENSE= modified-bsd 15LICENSE= modified-bsd
16 16
17MKPIE_SUPPORTED= no 17MKPIE_SUPPORTED= no
18 18
19UNLIMIT_RESOURCES= datasize virtualsize 19UNLIMIT_RESOURCES= datasize virtualsize
20 20
21# GHC requires GHC to build itself. We have to prepare stripped-down 21# GHC requires GHC to build itself. We have to prepare stripped-down
22# binaries sufficient to bootstrap compilers for each platforms. If 22# binaries sufficient to bootstrap compilers for each platforms. If
23# you want to build them yourself, follow instructions in 23# you want to build them yourself, follow instructions in
24# BOOTSTRAP.txt and ./bootstrap.mk 24# BOOTSTRAP.txt and ./bootstrap.mk
25#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet 25#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet
26BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64 26BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64
27BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386 27BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386
28BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64 28BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64
29BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64 29BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64
30BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64 30BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64
31 31
32 32
33# ----------------------------------------------------------------------------- 33# -----------------------------------------------------------------------------
34# Distfiles 34# Distfiles
35# 35#
36DISTFILES= ${DEFAULT_DISTFILES} 36DISTFILES= ${DEFAULT_DISTFILES}
37WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} 37WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
38 38
39# We don't want to extract all of the DISTFILEs. 39# We don't want to extract all of the DISTFILEs.
40EXTRACT_ONLY= ${DEFAULT_DISTFILES} 40EXTRACT_ONLY= ${DEFAULT_DISTFILES}
41 41
42 42
43# ----------------------------------------------------------------------------- 43# -----------------------------------------------------------------------------
44# Tools 44# Tools
45# 45#
46# The runtime dependency on perl is due to the evil splitter 46# The runtime dependency on perl is due to the evil splitter
47# (lib/${PKGNAME_NOREV}/ghc-split). 47# (lib/${PKGNAME_NOREV}/ghc-split).
48USE_TOOLS+= autoconf gmake perl:run 48USE_TOOLS+= autoconf gmake perl:run
49GNU_CONFIGURE= yes 49GNU_CONFIGURE= yes
50USE_GNU_CONFIGURE_HOST= no 50USE_GNU_CONFIGURE_HOST= no
51USE_LIBTOOL= yes 51USE_LIBTOOL= yes
52 52
53# TODO: Disable the splitter entirely so that we can drop the runtime 53# TODO: Disable the splitter entirely so that we can drop the runtime
54# dependency on perl. The purpose of the splitter is to perform a dead 54# dependency on perl. The purpose of the splitter is to perform a dead
55# code elimination by breaking .o files into many pieces. This only 55# code elimination by breaking .o files into many pieces. This only
56# makes sense when linking executables statically, which is rarely 56# makes sense when linking executables statically, which is rarely
57# done these days. 57# done these days.
58 58
59 59
60# ----------------------------------------------------------------------------- 60# -----------------------------------------------------------------------------
61# Configuration 61# Configuration
62# 62#
63CONFIGURE_ARGS.common= \ 63CONFIGURE_ARGS.common= \
64 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \ 64 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \
65 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \ 65 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \
66 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \ 66 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \
67 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \ 67 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \
68 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \ 68 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \
69 --with-system-libffi \ 69 --with-system-libffi \
70 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \ 70 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \
71 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q} 71 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q}
72 72
73CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common} 73CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
74 74
75# We must pass non-wrapper tools to ./configure because they will be 75# We must pass non-wrapper tools to ./configure because they will be
76# embedded in the compiler (actually ${WRKSRC}/settings). 76# embedded in the compiler (actually ${WRKSRC}/settings).
77CONFIGURE_ENV+= \ 77CONFIGURE_ENV+= \
78 ac_cv_prog_fp_prog_ar=${AR:Q} \ 78 ac_cv_prog_fp_prog_ar=${AR:Q} \
79 ac_cv_prog_LIBTOOL=libtool \ 79 ac_cv_prog_LIBTOOL=libtool \
80 PerlCmd=${PERL5:Q} \ 80 PerlCmd=${PERL5:Q} \
81 CC=${CC:Q} \ 81 CC=${CC:Q} \
82 LD=${LD:Q} 82 LD=${LD:Q}
83 83
84# LDFLAGS is currently not honored by "./configure". Since LDFLAGS 84# LDFLAGS is currently not honored by "./configure". Since LDFLAGS
85# contains rpath flags it's very important to force GHC to honor 85# contains rpath flags it's very important to force GHC to honor
86# it. Otherwise neither GHC itself nor executables it produces will 86# it. Otherwise neither GHC itself nor executables it produces will
87# have any rpaths so users will have to put "${PREFIX}/lib" into their 87# have any rpaths so users will have to put "${PREFIX}/lib" into their
88# "/etc/ld-elf.so.conf". See 88# "/etc/ld-elf.so.conf". See
89# http://hackage.haskell.org/trac/ghc/ticket/2933 89# http://hackage.haskell.org/trac/ghc/ticket/2933
90.for stage in 0 1 2 90.for stage in 0 1 2
91CONFIGURE_ENV+= \ 91CONFIGURE_ENV+= \
92 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q} 92 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q}
93# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for 93# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for
94# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS} 94# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS}
95# does more harm than good because our ${LDFLAGS} contains -Wl,* 95# does more harm than good because our ${LDFLAGS} contains -Wl,*
96# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them 96# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them
97# but those flags will also be baked into the compiler (see 97# but those flags will also be baked into the compiler (see
98# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside 98# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside
99# the buildlink. 99# the buildlink.
100.endfor 100.endfor
101 101
102 102
103# ----------------------------------------------------------------------------- 103# -----------------------------------------------------------------------------
104# Security 104# Security
105# 105#
106# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT 106# The runtime system of GHC (rts) tends to conflict with PaX MPROTECT
107# because it needs to generate various kinds of code at run time. The 107# because it needs to generate various kinds of code at run time. The
108# RTS linker, whose job is to load *static* objects at run time, 108# RTS linker, whose job is to load *static* objects at run time,
109# doesn't play nice with ASLR either because it relies on 109# doesn't play nice with ASLR either because it relies on
110# mmap(MAP_FIXED). This means most executables produced by GHC need 110# mmap(MAP_FIXED). This means most executables produced by GHC need
111# them to be disabled. Perhaps we should patch rts/sm/Storage.c so 111# them to be disabled. Perhaps we should patch rts/sm/Storage.c so
112# that it uses ffi_closure_alloc(3) on every platform, not just Linux, 112# that it uses ffi_closure_alloc(3) on every platform, not just Linux,
113# and also drop support for static library loading and switch to 113# and also drop support for static library loading and switch to
114# dynamic libraries entirely. (Partially done: 114# dynamic libraries entirely. (Partially done:
115# https://gitlab.haskell.org/ghc/ghc/merge_requests/2498) 115# https://gitlab.haskell.org/ghc/ghc/merge_requests/2498)
116.for f in ghc ghc-iserv ghc-iserv-dyn ghc-iserv-prof ghc-pkg haddock hpc hsc2hs runghc 116.for f in ghc ghc-iserv ghc-iserv-dyn ghc-iserv-prof ghc-pkg haddock hpc hsc2hs runghc
117NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 117NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
118NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 118NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
119.endfor 119.endfor
120# Additional note: Now that DYNAMIC_GHC_PROGRAMS is enabled by 120# Additional note: Now that DYNAMIC_GHC_PROGRAMS is enabled by
121# default, we no longer need to disable PaX ASLR because the RTS 121# default, we no longer need to disable PaX ASLR because the RTS
122# linker is not used... except for ghc-iserv. The program is launched 122# linker is not used... except for ghc-iserv. The program is launched
123# when ghci is started with -fexternal-interpreter without 123# when ghci is started with -fexternal-interpreter without
124# -dynamic. Its purpose is to run non-PIC code from a dynamically 124# -dynamic. Its purpose is to run non-PIC code from a dynamically
125# linked ghci, and therefore still uses RTS linker. Also note that RTS 125# linked ghci, and therefore still uses RTS linker. Also note that RTS
126# linker requires PaX mprotect to be disabled too. This means that 126# linker requires PaX mprotect to be disabled too. This means that
127# once the merge request mentioned above is merged to the upstream, we 127# once the merge request mentioned above is merged to the upstream, we
128# can at least enable PaX mprotect and PaX ASLR for all the 128# can at least enable PaX mprotect and PaX ASLR for all the
129# executables except ghc-iserv and ghc-iserv-prof. 129# executables except ghc-iserv and ghc-iserv-prof.
130 130
131 131
132# ----------------------------------------------------------------------------- 132# -----------------------------------------------------------------------------
133# Build hooks 133# Build hooks
134# 134#
135 135
136# We patch configure.ac in some directories. 136# We patch configure.ac in some directories.
137post-patch: 137post-patch:
138 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" 138 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
139 ${RUN} cd ${WRKSRC} && autoconf 139 ${RUN} cd ${WRKSRC} && autoconf
140 140
141# Define the target "pre-configure" and non-standard "bootstrap". 141# Define the target "pre-configure" and non-standard "bootstrap".
142.include "../../lang/ghc88/bootstrap.mk" 142.include "../../lang/ghc88/bootstrap.mk"
143 143
144# Our pre-configure phase installs a bindist of bootstrapping compiler 144# Our pre-configure phase installs a bindist of bootstrapping compiler
145# directly into TOOLS_DIR so that ./configure can find it. 145# directly into TOOLS_DIR so that ./configure can find it.
146 146
147# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too 147# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too
148# loose, and building docs/users_guide rarely succeeds. We don't know 148# loose, and building docs/users_guide rarely succeeds. We don't know
149# which version is actually required for it. 149# which version is actually required for it.
150.include "../../mk/bsd.prefs.mk" 150.include "../../mk/bsd.prefs.mk"
151BUILD_SPHINX_HTML?= no 151BUILD_SPHINX_HTML?= no
152 152
153# Here we generate mk/build.mk dynamically. 153# Here we generate mk/build.mk dynamically.
154post-configure: 154post-configure:
155 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk 155 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk
156 156
157# If there is HsColour in the PATH, GHC's build system tries to use it 157# If there is HsColour in the PATH, GHC's build system tries to use it
158# without even checking if it really works. That's not what we 158# without even checking if it really works. That's not what we
159# appreciate. 159# appreciate.
160 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk 160 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk
161 161
162.if ${BUILD_SPHINX_HTML} == "no" 162.if ${BUILD_SPHINX_HTML} == "no"
163 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk 163 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk
164.endif 164.endif
165 165
166# Don't even think of PDF. 166# Don't even think of PDF.
167 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk 167 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk
168 168
169# https://gitlab.haskell.org/ghc/ghc/issues/13542 169# https://gitlab.haskell.org/ghc/ghc/issues/13542
170.if ${OPSYS} == "SunOS" 170.if ${OPSYS} == "SunOS"
171 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk 171 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk
172.endif 172.endif
173 173
174# ----------------------------------------------------------------------------- 174# -----------------------------------------------------------------------------
175# Installation/removal hooks 175# Installation/removal hooks
176# 176#
177 177
178# Substitutions for INSTALL and DEINSTALL that handles package.cache. 178# Substitutions for INSTALL and DEINSTALL that handles package.cache.
179FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV} 179FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV}
180 180
181# We don't want package.cache to be in the PLIST. 181# We don't want package.cache to be in the PLIST.
182post-install: 182post-install:
183 ${RM} -f ${DESTDIR}${PREFIX}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache 183 ${RM} -f ${DESTDIR}${PREFIX}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache
184 184
185 185
186# ----------------------------------------------------------------------------- 186# -----------------------------------------------------------------------------
187# PLIST 187# PLIST
188# 188#
189# We can't use static PLIST because the package installs files with a 189# We can't use static PLIST because the package installs files with a
190# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm 190# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm
191# [2019-12-27; pho]. 191# [2019-12-27; pho].
192GENERATE_PLIST+= \ 192GENERATE_PLIST+= \
193 cd ${DESTDIR}${PREFIX} && \ 193 cd ${DESTDIR}${PREFIX} && \
194 ${FIND} * \( -type f -o -type l \) | ${SORT}; 194 ${FIND} * \( -type f -o -type l \) | ${SORT};
195 195
196 196
197# ----------------------------------------------------------------------------- 197# -----------------------------------------------------------------------------
198# Sanity checks 198# Sanity checks
199# 199#
200 200
201# There is an unused script which don't pass the portability test. 201# There is an unused script which don't pass the portability test.
202CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw 202CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
203 203
204# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable 204# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
205CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.* 205CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
206 206
207# ld: fatal: relocation error ... relocation requires reference symbol 207# ld: fatal: relocation error ... relocation requires reference symbol
208STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a 208STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a
209 209
210 210
211# ----------------------------------------------------------------------------- 211# -----------------------------------------------------------------------------
212# Dependencies 212# Dependencies
213# 213#
214.if ${BUILD_SPHINX_HTML} != "no" 214.if ${BUILD_SPHINX_HTML} != "no"
215BUILDLINK_DEPMETHOD.python:= build 215BUILDLINK_DEPMETHOD.python:= build
216.include "../../lang/python/pyversion.mk" 216.include "../../lang/python/pyversion.mk"
217BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx 217BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
218.endif 218.endif
219 219
220# NetBSD 9.x have libcurses with a newer major version than the 220# NetBSD 9.x have libcurses with a newer major version than the
221# bootstrap kit is linked against. For now, work around this with 221# bootstrap kit is linked against. For now, work around this with
222# compat80. 222# compat80.
223.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*) 223.if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} >= 090000
224BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80 224BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
225# In a sandboxed build environment, we have to reach over to the 225# In a sandboxed build environment, we have to reach over to the
226# installed libraries themselves, since the symlinks compat80 adds 226# installed libraries themselves, since the symlinks compat80 adds
227# to the /usr tree can't be applied. 227# to the /usr tree can't be applied.
228ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib 228ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib
229# XXX: ${WRKDIR}/lib is a temporary workaround for compat80 not having 229# XXX: ${WRKDIR}/lib is a temporary workaround for compat80 not having
230# libterminfo.so.1. See ./bootstrap.mk 230# libterminfo.so.1. See ./bootstrap.mk
231.endif 231.endif
232 232
233.include "../../converters/libiconv/buildlink3.mk" 233.include "../../converters/libiconv/buildlink3.mk"
234.include "../../devel/libffi/buildlink3.mk" 234.include "../../devel/libffi/buildlink3.mk"
235.include "../../devel/gmp/buildlink3.mk" 235.include "../../devel/gmp/buildlink3.mk"
236.include "../../mk/curses.buildlink3.mk" 236.include "../../mk/curses.buildlink3.mk"
237.include "../../mk/pthread.buildlink3.mk" 237.include "../../mk/pthread.buildlink3.mk"
238.include "../../mk/bsd.pkg.mk" 238.include "../../mk/bsd.pkg.mk"

cvs diff -r1.19 -r1.20 pkgsrc/lang/ghc90/Makefile (switch to unified diff)

--- pkgsrc/lang/ghc90/Makefile 2022/02/24 09:18:09 1.19
+++ pkgsrc/lang/ghc90/Makefile 2022/05/05 08:18:59 1.20
@@ -1,259 +1,259 @@ @@ -1,259 +1,259 @@
1# $NetBSD: Makefile,v 1.19 2022/02/24 09:18:09 pho Exp $ 1# $NetBSD: Makefile,v 1.20 2022/05/05 08:18:59 nia Exp $
2# ----------------------------------------------------------------------------- 2# -----------------------------------------------------------------------------
3# Package metadata 3# Package metadata
4# 4#
5DISTNAME= ghc-9.0.2-src 5DISTNAME= ghc-9.0.2-src
6PKGREVISION= 1 6PKGREVISION= 1
7PKGNAME= ${DISTNAME:S/-src$//} 7PKGNAME= ${DISTNAME:S/-src$//}
8CATEGORIES= lang 8CATEGORIES= lang
9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/ 9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
10EXTRACT_SUFX= .tar.xz 10EXTRACT_SUFX= .tar.xz
11 11
12MAINTAINER= pkgsrc-users@NetBSD.org 12MAINTAINER= pkgsrc-users@NetBSD.org
13HOMEPAGE= https://www.haskell.org/ghc/ 13HOMEPAGE= https://www.haskell.org/ghc/
14COMMENT= Compiler for the functional language Haskell - 9.0 Release Series 14COMMENT= Compiler for the functional language Haskell - 9.0 Release Series
15LICENSE= modified-bsd 15LICENSE= modified-bsd
16 16
17UNLIMIT_RESOURCES= datasize virtualsize 17UNLIMIT_RESOURCES= datasize virtualsize
18 18
19# GHC requires GHC to build itself. We have to prepare stripped-down 19# GHC requires GHC to build itself. We have to prepare stripped-down
20# binaries sufficient to bootstrap compilers for each platform. If 20# binaries sufficient to bootstrap compilers for each platform. If
21# you want to build them yourself, follow instructions in 21# you want to build them yourself, follow instructions in
22# BOOTSTRAP.txt and ./bootstrap.mk 22# BOOTSTRAP.txt and ./bootstrap.mk
23BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64 23BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64
24BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386 24BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386
25BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64 25BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64
26BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-aarch64 26BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-aarch64
27BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64 27BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64
28BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64 28BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64
29 29
30# We are going to do a PIE build on our responsibility. Do not put -pie in 30# We are going to do a PIE build on our responsibility. Do not put -pie in
31# wrappers, as that would prevent us from building stage-1 compiler. 31# wrappers, as that would prevent us from building stage-1 compiler.
32PKGSRC_OVERRIDE_MKPIE= yes 32PKGSRC_OVERRIDE_MKPIE= yes
33 33
34.include "options.mk" 34.include "options.mk"
35 35
36 36
37# ----------------------------------------------------------------------------- 37# -----------------------------------------------------------------------------
38# Distfiles 38# Distfiles
39# 39#
40DISTFILES= ${DEFAULT_DISTFILES} 40DISTFILES= ${DEFAULT_DISTFILES}
41WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} 41WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
42 42
43# We don't want to extract all of the DISTFILEs. 43# We don't want to extract all of the DISTFILEs.
44EXTRACT_ONLY= ${DEFAULT_DISTFILES} 44EXTRACT_ONLY= ${DEFAULT_DISTFILES}
45 45
46 46
47# ----------------------------------------------------------------------------- 47# -----------------------------------------------------------------------------
48# Tools 48# Tools
49# 49#
50USE_TOOLS+= autoconf gmake 50USE_TOOLS+= autoconf gmake
51GNU_CONFIGURE= yes 51GNU_CONFIGURE= yes
52USE_GNU_CONFIGURE_HOST= no 52USE_GNU_CONFIGURE_HOST= no
53USE_LIBTOOL= yes 53USE_LIBTOOL= yes
54 54
55 55
56# ----------------------------------------------------------------------------- 56# -----------------------------------------------------------------------------
57# Configuration 57# Configuration
58# 58#
59CONFIGURE_ARGS.common+= \ 59CONFIGURE_ARGS.common+= \
60 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \ 60 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \
61 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \ 61 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \
62 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \ 62 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \
63 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \ 63 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \
64 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \ 64 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \
65 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \ 65 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \
66 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q} 66 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q}
67 67
68.include "../../mk/bsd.prefs.mk" 68.include "../../mk/bsd.prefs.mk"
69.if ${OPSYS} == "NetBSD" 69.if ${OPSYS} == "NetBSD"
70# The GHC rts, by default, creates executable objects on the heap by first 70# The GHC rts, by default, creates executable objects on the heap by first
71# mmap(2)'ing an anonymous memory with PROT_READ|PROT_WRITE and then calling 71# mmap(2)'ing an anonymous memory with PROT_READ|PROT_WRITE and then calling
72# mprotect(2) with PROT_READ|PROT_EXEC after filling its content. However, 72# mprotect(2) with PROT_READ|PROT_EXEC after filling its content. However,
73# NetBSD PaX mprotect doesn't allow this practice. That is, turning pages that 73# NetBSD PaX mprotect doesn't allow this practice. That is, turning pages that
74# have been initially mapped as non-executable into something executable is a 74# have been initially mapped as non-executable into something executable is a
75# no-no. We must therefore take a different path although it might be a bit slower. 75# no-no. We must therefore take a different path although it might be a bit slower.
76CONFIGURE_ARGS.common+= --enable-libffi-adjustors 76CONFIGURE_ARGS.common+= --enable-libffi-adjustors
77# See rts/adjustor/NativeAmd64.c and rts/adjustor/LibffiAdjustor.c 77# See rts/adjustor/NativeAmd64.c and rts/adjustor/LibffiAdjustor.c
78.endif 78.endif
79 79
80# We must pass non-wrapper tools to ./configure because they will be 80# We must pass non-wrapper tools to ./configure because they will be
81# embedded in the compiler (actually ${WRKSRC}/settings). 81# embedded in the compiler (actually ${WRKSRC}/settings).
82CONFIGURE_ENV+= ac_cv_prog_fp_prog_ar=${AR:Q} 82CONFIGURE_ENV+= ac_cv_prog_fp_prog_ar=${AR:Q}
83CONFIGURE_ENV+= ac_cv_prog_LIBTOOL=libtool 83CONFIGURE_ENV+= ac_cv_prog_LIBTOOL=libtool
84CONFIGURE_ARGS.common+= LD=${LD:Q} 84CONFIGURE_ARGS.common+= LD=${LD:Q}
85 85
86CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common} 86CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
87CONFIGURE_ARGS+= --with-system-libffi 87CONFIGURE_ARGS+= --with-system-libffi
88 88
89# CFLAGS and LDFLAGS are currently not honored by "./configure". Since 89# CFLAGS and LDFLAGS are currently not honored by "./configure". Since
90# LDFLAGS contains rpath flags it's very important to force GHC to honor 90# LDFLAGS contains rpath flags it's very important to force GHC to honor
91# it. Otherwise neither GHC itself nor executables it produces will have 91# it. Otherwise neither GHC itself nor executables it produces will have
92# any rpaths so users will have to put "${PREFIX}/lib" into their 92# any rpaths so users will have to put "${PREFIX}/lib" into their
93# "/etc/ld-elf.so.conf". See 93# "/etc/ld-elf.so.conf". See
94# http://hackage.haskell.org/trac/ghc/ticket/2933 94# http://hackage.haskell.org/trac/ghc/ticket/2933
95.for stage in 0 1 2 95.for stage in 0 1 2
96CONFIGURE_ENV+= CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q} 96CONFIGURE_ENV+= CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q}
97# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for 97# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for
98# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS} 98# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS}
99# does more harm than good because our ${LDFLAGS} contains -Wl,* 99# does more harm than good because our ${LDFLAGS} contains -Wl,*
100# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them 100# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them
101# but those flags will also be baked into the compiler (see 101# but those flags will also be baked into the compiler (see
102# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside 102# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside
103# the buildlink. 103# the buildlink.
104.endfor 104.endfor
105 105
106# The use of internal variable ${_PKGSRC_MKPIE} in mk/bsd.prefs.mk is not 106# The use of internal variable ${_PKGSRC_MKPIE} in mk/bsd.prefs.mk is not
107# very satisfying, but the current infrastructure does not export a public 107# very satisfying, but the current infrastructure does not export a public
108# variable indicating whether a PIE build is requested or not. Note that we 108# variable indicating whether a PIE build is requested or not. Note that we
109# can't build stage-1 compiler as PIE, because our bootkit libraries aren't 109# can't build stage-1 compiler as PIE, because our bootkit libraries aren't
110# necessarily built as PIC. 110# necessarily built as PIC.
111.for stage in 0 1 2 111.for stage in 0 1 2
112. if ${stage} == 0 112. if ${stage} == 0
113CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q} 113CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q}
114. else 114. else
115. if ${_PKGSRC_MKPIE} == "yes" 115. if ${_PKGSRC_MKPIE} == "yes"
116CONFIGURE_ENV+= CONF_HC_OPTS_STAGE${stage}=-fPIC\ -pie 116CONFIGURE_ENV+= CONF_HC_OPTS_STAGE${stage}=-fPIC\ -pie
117CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q}\ -fPIC 117CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q}\ -fPIC
118. else 118. else
119CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q} 119CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q}
120. endif 120. endif
121. endif 121. endif
122.endfor 122.endfor
123 123
124 124
125# ----------------------------------------------------------------------------- 125# -----------------------------------------------------------------------------
126# Security 126# Security
127# 127#
128# The runtime system of GHC (rts) has a functionality called "RTS linker" 128# The runtime system of GHC (rts) has a functionality called "RTS linker"
129# whose job is to load and execute *static* objects (.a and .o files) at 129# whose job is to load and execute *static* objects (.a and .o files) at
130# run time. It cannot survive PaX MPROTECT because preloadObjectFile() in 130# run time. It cannot survive PaX MPROTECT because preloadObjectFile() in
131# rts/linker.c tries to mmap pages with w+x. It doesn't play nice with ASLR 131# rts/linker.c tries to mmap pages with w+x. It doesn't play nice with ASLR
132# either because mmapForLinker() in rts/linker.c wants to always mmap pages 132# either because mmapForLinker() in rts/linker.c wants to always mmap pages
133# in the lower 32-bit area on 64-bit platforms. 133# in the lower 32-bit area on 64-bit platforms.
134# 134#
135# Luckily for us, the RTS linker is only used when the GHC executable (or 135# Luckily for us, the RTS linker is only used when the GHC executable (or
136# any user programs which uses GHC API as an interpreter, not a compiler) 136# any user programs which uses GHC API as an interpreter, not a compiler)
137# is statically linked, which is no longer the case except for ghc-iserv 137# is statically linked, which is no longer the case except for ghc-iserv
138# and ghc-iesrv-prof. They are launched when ghci is started with 138# and ghc-iesrv-prof. They are launched when ghci is started with
139# -fexternal-interpreter without -dynamic, and their purpose is to run 139# -fexternal-interpreter without -dynamic, and their purpose is to run
140# non-PIC code from a dynamically linked ghci using the evil RTS linker. 140# non-PIC code from a dynamically linked ghci using the evil RTS linker.
141.for f in ghc-iserv ghc-iserv-prof 141.for f in ghc-iserv ghc-iserv-prof
142NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 142NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
143NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 143NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
144.endfor 144.endfor
145 145
146 146
147# ----------------------------------------------------------------------------- 147# -----------------------------------------------------------------------------
148# Build hooks 148# Build hooks
149# 149#
150 150
151# We patch configure.ac in some directories. 151# We patch configure.ac in some directories.
152post-patch: 152post-patch:
153 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" 153 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
154 ${RUN} cd ${WRKSRC} && autoconf 154 ${RUN} cd ${WRKSRC} && autoconf
155 155
156# Define the target "pre-configure" and non-standard "bootstrap". 156# Define the target "pre-configure" and non-standard "bootstrap".
157.include "../../lang/ghc90/bootstrap.mk" 157.include "../../lang/ghc90/bootstrap.mk"
158 158
159# Our pre-configure phase installs a bindist of bootstrapping compiler 159# Our pre-configure phase installs a bindist of bootstrapping compiler
160# directly into TOOLS_DIR so that ./configure can find it. 160# directly into TOOLS_DIR so that ./configure can find it.
161 161
162# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too 162# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too
163# loose, and building docs/users_guide rarely succeeds. We don't know 163# loose, and building docs/users_guide rarely succeeds. We don't know
164# which version is actually required for it. 164# which version is actually required for it.
165BUILD_SPHINX_HTML?= no 165BUILD_SPHINX_HTML?= no
166 166
167# Here we generate mk/build.mk dynamically. 167# Here we generate mk/build.mk dynamically.
168post-configure: 168post-configure:
169 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk 169 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk
170 170
171# If there is HsColour in the PATH, GHC's build system tries to use it 171# If there is HsColour in the PATH, GHC's build system tries to use it
172# without even checking if it really works. That's not what we 172# without even checking if it really works. That's not what we
173# appreciate. 173# appreciate.
174 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk 174 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk
175 175
176.if ${BUILD_SPHINX_HTML} == "no" 176.if ${BUILD_SPHINX_HTML} == "no"
177 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk 177 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk
178.endif 178.endif
179 179
180# Don't even think of PDF. 180# Don't even think of PDF.
181 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk 181 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk
182 182
183# SplitSections is only enabled by default on platforms with GNU ld. On SunOS, 183# SplitSections is only enabled by default on platforms with GNU ld. On SunOS,
184# whose ld is not the GNU one, it can however be used as well. 184# whose ld is not the GNU one, it can however be used as well.
185.if ${OPSYS} == "SunOS" 185.if ${OPSYS} == "SunOS"
186 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk 186 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk
187.endif 187.endif
188 188
189 189
190# ----------------------------------------------------------------------------- 190# -----------------------------------------------------------------------------
191# Installation/removal hooks 191# Installation/removal hooks
192# 192#
193 193
194# Substitutions for INSTALL and DEINSTALL that handles package.cache. 194# Substitutions for INSTALL and DEINSTALL that handles package.cache.
195FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV} 195FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV}
196 196
197# We don't want package.cache to be in the PLIST. 197# We don't want package.cache to be in the PLIST.
198post-install: 198post-install:
199 ${RM} -f ${DESTDIR}${PREFIX}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache 199 ${RM} -f ${DESTDIR}${PREFIX}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache
200 200
201 201
202# ----------------------------------------------------------------------------- 202# -----------------------------------------------------------------------------
203# PLIST 203# PLIST
204# 204#
205# We can't use static PLIST because the package installs files with a 205# We can't use static PLIST because the package installs files with a
206# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm 206# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm
207# [2019-12-27; pho]. 207# [2019-12-27; pho].
208GENERATE_PLIST+= \ 208GENERATE_PLIST+= \
209 cd ${DESTDIR}${PREFIX} && \ 209 cd ${DESTDIR}${PREFIX} && \
210 ${FIND} * \( -type f -o -type l \) | ${SORT}; 210 ${FIND} * \( -type f -o -type l \) | ${SORT};
211 211
212 212
213# ----------------------------------------------------------------------------- 213# -----------------------------------------------------------------------------
214# Sanity checks 214# Sanity checks
215# 215#
216 216
217# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable 217# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
218# XXX: On which platform? Is it still an issue? 218# XXX: On which platform? Is it still an issue?
219CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.* 219CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
220 220
221# ld: fatal: relocation error ... relocation requires reference symbol 221# ld: fatal: relocation error ... relocation requires reference symbol
222# XXX: On which platform? Is it still an issue? 222# XXX: On which platform? Is it still an issue?
223STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a 223STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a
224 224
225 225
226# ----------------------------------------------------------------------------- 226# -----------------------------------------------------------------------------
227# Dependencies 227# Dependencies
228# 228#
229.if ${BUILD_SPHINX_HTML} != "no" 229.if ${BUILD_SPHINX_HTML} != "no"
230BUILDLINK_DEPMETHOD.python:= build 230BUILDLINK_DEPMETHOD.python:= build
231.include "../../lang/python/pyversion.mk" 231.include "../../lang/python/pyversion.mk"
232BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx 232BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
233.endif 233.endif
234 234
235# NetBSD 9.x have libcurses with a newer major version than the 235# NetBSD 9.x have libcurses with a newer major version than the
236# bootstrap kit is linked against. For now, work around this with 236# bootstrap kit is linked against. For now, work around this with
237# compat80. 237# compat80.
238.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) && empty(OS_VERSION:M[0-8].*) 238.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) && ${OPSYS_VERSION} >= 090000
239BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80 239BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
240# In a sandboxed build environment, we have to reach over to the 240# In a sandboxed build environment, we have to reach over to the
241# installed libraries themselves, since the symlinks compat80 adds 241# installed libraries themselves, since the symlinks compat80 adds
242# to the /usr tree can't be applied. 242# to the /usr tree can't be applied.
243ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib 243ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib
244# XXX: ${WRKDIR}/lib is a temporary workaround for compat80 not having 244# XXX: ${WRKDIR}/lib is a temporary workaround for compat80 not having
245# libterminfo.so.1. See ./bootstrap.mk 245# libterminfo.so.1. See ./bootstrap.mk
246.endif 246.endif
247 247
248# On Solaris-based platforms our bootkit tends to depend on 248# On Solaris-based platforms our bootkit tends to depend on
249# pkgsrc-installed shlibs. 249# pkgsrc-installed shlibs.
250.if ${OPSYS} == "SunOS" 250.if ${OPSYS} == "SunOS"
251ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/lib 251ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/lib
252.endif 252.endif
253 253
254.include "../../converters/libiconv/buildlink3.mk" 254.include "../../converters/libiconv/buildlink3.mk"
255.include "../../devel/libffi/buildlink3.mk" 255.include "../../devel/libffi/buildlink3.mk"
256.include "../../devel/gmp/buildlink3.mk" 256.include "../../devel/gmp/buildlink3.mk"
257.include "../../mk/curses.buildlink3.mk" 257.include "../../mk/curses.buildlink3.mk"
258.include "../../mk/pthread.buildlink3.mk" 258.include "../../mk/pthread.buildlink3.mk"
259.include "../../mk/bsd.pkg.mk" 259.include "../../mk/bsd.pkg.mk"

cvs diff -r1.6 -r1.7 pkgsrc/lang/ghc92/Makefile (switch to unified diff)

--- pkgsrc/lang/ghc92/Makefile 2022/02/24 09:17:59 1.6
+++ pkgsrc/lang/ghc92/Makefile 2022/05/05 08:18:59 1.7
@@ -1,260 +1,260 @@ @@ -1,260 +1,260 @@
1# $NetBSD: Makefile,v 1.6 2022/02/24 09:17:59 pho Exp $ 1# $NetBSD: Makefile,v 1.7 2022/05/05 08:18:59 nia Exp $
2# ----------------------------------------------------------------------------- 2# -----------------------------------------------------------------------------
3# Package metadata 3# Package metadata
4# 4#
5DISTNAME= ghc-9.2.1-src 5DISTNAME= ghc-9.2.1-src
6PKGNAME= ${DISTNAME:S/-src$//} 6PKGNAME= ${DISTNAME:S/-src$//}
7PKGREVISION= 2 7PKGREVISION= 2
8CATEGORIES= lang 8CATEGORIES= lang
9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/ 9MASTER_SITES= https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
10EXTRACT_SUFX= .tar.xz 10EXTRACT_SUFX= .tar.xz
11 11
12MAINTAINER= pkgsrc-users@NetBSD.org 12MAINTAINER= pkgsrc-users@NetBSD.org
13HOMEPAGE= https://www.haskell.org/ghc/ 13HOMEPAGE= https://www.haskell.org/ghc/
14COMMENT= Compiler for the functional language Haskell - 9.2 Release Series 14COMMENT= Compiler for the functional language Haskell - 9.2 Release Series
15LICENSE= modified-bsd 15LICENSE= modified-bsd
16 16
17UNLIMIT_RESOURCES= datasize virtualsize 17UNLIMIT_RESOURCES= datasize virtualsize
18 18
19# GHC requires GHC to build itself. We have to prepare stripped-down 19# GHC requires GHC to build itself. We have to prepare stripped-down
20# binaries sufficient to bootstrap compilers for each platform. If 20# binaries sufficient to bootstrap compilers for each platform. If
21# you want to build them yourself, follow instructions in 21# you want to build them yourself, follow instructions in
22# BOOTSTRAP.txt and ./bootstrap.mk 22# BOOTSTRAP.txt and ./bootstrap.mk
23BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64 23BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64
24BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386 24BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386
25BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64 25BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64
26BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-aarch64 26BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-aarch64
27BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64 27BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64
28BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64 28BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64
29 29
30# We are going to do a PIE build on our responsibility. Do not put -pie in 30# We are going to do a PIE build on our responsibility. Do not put -pie in
31# wrappers, as that would prevent us from building stage-1 compiler. 31# wrappers, as that would prevent us from building stage-1 compiler.
32PKGSRC_OVERRIDE_MKPIE= yes 32PKGSRC_OVERRIDE_MKPIE= yes
33 33
34.include "options.mk" 34.include "options.mk"
35 35
36 36
37# ----------------------------------------------------------------------------- 37# -----------------------------------------------------------------------------
38# Distfiles 38# Distfiles
39# 39#
40DISTFILES= ${DEFAULT_DISTFILES} 40DISTFILES= ${DEFAULT_DISTFILES}
41WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} 41WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
42 42
43# We don't want to extract all of the DISTFILEs. 43# We don't want to extract all of the DISTFILEs.
44EXTRACT_ONLY= ${DEFAULT_DISTFILES} 44EXTRACT_ONLY= ${DEFAULT_DISTFILES}
45 45
46 46
47# ----------------------------------------------------------------------------- 47# -----------------------------------------------------------------------------
48# Tools 48# Tools
49# 49#
50USE_TOOLS+= autoconf gmake 50USE_TOOLS+= autoconf gmake
51GNU_CONFIGURE= yes 51GNU_CONFIGURE= yes
52USE_GNU_CONFIGURE_HOST= no 52USE_GNU_CONFIGURE_HOST= no
53USE_LIBTOOL= yes 53USE_LIBTOOL= yes
54 54
55 55
56# ----------------------------------------------------------------------------- 56# -----------------------------------------------------------------------------
57# Configuration 57# Configuration
58# 58#
59CONFIGURE_ARGS.common+= \ 59CONFIGURE_ARGS.common+= \
60 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \ 60 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \
61 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \ 61 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \
62 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \ 62 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \
63 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \ 63 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \
64 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \ 64 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \
65 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \ 65 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \
66 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q} 66 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q}
67 67
68.include "../../mk/bsd.prefs.mk" 68.include "../../mk/bsd.prefs.mk"
69 69
70# We must pass non-wrapper tools to ./configure because they will be 70# We must pass non-wrapper tools to ./configure because they will be
71# embedded in the compiler (actually ${WRKSRC}/settings). 71# embedded in the compiler (actually ${WRKSRC}/settings).
72CONFIGURE_ENV+= ac_cv_prog_fp_prog_ar=${AR:Q} 72CONFIGURE_ENV+= ac_cv_prog_fp_prog_ar=${AR:Q}
73CONFIGURE_ENV+= ac_cv_prog_LIBTOOL=libtool 73CONFIGURE_ENV+= ac_cv_prog_LIBTOOL=libtool
74CONFIGURE_ARGS.common+= LD=${LD:Q} 74CONFIGURE_ARGS.common+= LD=${LD:Q}
75 75
76CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common} 76CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
77CONFIGURE_ARGS+= --with-system-libffi 77CONFIGURE_ARGS+= --with-system-libffi
78 78
79# CFLAGS and LDFLAGS are currently not honored by "./configure". Since 79# CFLAGS and LDFLAGS are currently not honored by "./configure". Since
80# LDFLAGS contains rpath flags it's very important to force GHC to honor 80# LDFLAGS contains rpath flags it's very important to force GHC to honor
81# it. Otherwise neither GHC itself nor executables it produces will have 81# it. Otherwise neither GHC itself nor executables it produces will have
82# any rpaths so users will have to put "${PREFIX}/lib" into their 82# any rpaths so users will have to put "${PREFIX}/lib" into their
83# "/etc/ld-elf.so.conf". See 83# "/etc/ld-elf.so.conf". See
84# http://hackage.haskell.org/trac/ghc/ticket/2933 84# http://hackage.haskell.org/trac/ghc/ticket/2933
85.for stage in 0 1 2 85.for stage in 0 1 2
86CONFIGURE_ENV+= CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q} 86CONFIGURE_ENV+= CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q}
87# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for 87# Note that CONF_LD_LINKER_OPTS_STAGE{0,1,2} are only used for
88# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS} 88# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS}
89# does more harm than good because our ${LDFLAGS} contains -Wl,* 89# does more harm than good because our ${LDFLAGS} contains -Wl,*
90# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them 90# flags. It's true that ../../mk/wrapper/cmd-sink-ld transforms them
91# but those flags will also be baked into the compiler (see 91# but those flags will also be baked into the compiler (see
92# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside 92# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside
93# the buildlink. 93# the buildlink.
94.endfor 94.endfor
95 95
96# The use of internal variable ${_PKGSRC_MKPIE} in mk/bsd.prefs.mk is not 96# The use of internal variable ${_PKGSRC_MKPIE} in mk/bsd.prefs.mk is not
97# very satisfying, but the current infrastructure does not export a public 97# very satisfying, but the current infrastructure does not export a public
98# variable indicating whether a PIE build is requested or not. Note that we 98# variable indicating whether a PIE build is requested or not. Note that we
99# can't build stage-1 compiler as PIE, because our bootkit libraries aren't 99# can't build stage-1 compiler as PIE, because our bootkit libraries aren't
100# necessarily built as PIC. 100# necessarily built as PIC.
101.for stage in 0 1 2 101.for stage in 0 1 2
102. if ${stage} == 0 102. if ${stage} == 0
103CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q} 103CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q}
104. else 104. else
105. if ${_PKGSRC_MKPIE} == "yes" 105. if ${_PKGSRC_MKPIE} == "yes"
106CONFIGURE_ENV+= CONF_HC_OPTS_STAGE${stage}=-fPIC\ -pie 106CONFIGURE_ENV+= CONF_HC_OPTS_STAGE${stage}=-fPIC\ -pie
107CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q}\ -fPIC 107CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q}\ -fPIC
108. else 108. else
109CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q} 109CONFIGURE_ENV+= CONF_CC_OPTS_STAGE${stage}=${CFLAGS:M*:Q}
110. endif 110. endif
111. endif 111. endif
112.endfor 112.endfor
113 113
114# MacOS X 10.7 is the oldest OS X version supporting __thread. Although 114# MacOS X 10.7 is the oldest OS X version supporting __thread. Although
115# ${WRKSRC}/configure has a check for it, the actual build will fail 115# ${WRKSRC}/configure has a check for it, the actual build will fail
116# without this env. 116# without this env.
117.if ${OPSYS} == "Darwin" 117.if ${OPSYS} == "Darwin"
118ALL_ENV+= MACOSX_DEPLOYMENT_TARGET="10.7" 118ALL_ENV+= MACOSX_DEPLOYMENT_TARGET="10.7"
119.endif 119.endif
120 120
121 121
122# ----------------------------------------------------------------------------- 122# -----------------------------------------------------------------------------
123# Security 123# Security
124# 124#
125# The runtime system of GHC (rts) has a mechanism called "RTS linker" whose 125# The runtime system of GHC (rts) has a mechanism called "RTS linker" whose
126# job is to load and execute *static* objects (.a and .o files) at run 126# job is to load and execute *static* objects (.a and .o files) at run
127# time. It cannot survive PaX MPROTECT because preloadObjectFile() in 127# time. It cannot survive PaX MPROTECT because preloadObjectFile() in
128# rts/linker.c tries to mmap pages with w+x. It doesn't play nice with ASLR 128# rts/linker.c tries to mmap pages with w+x. It doesn't play nice with ASLR
129# either because mmapForLinker() in rts/linker.c wants to always mmap pages 129# either because mmapForLinker() in rts/linker.c wants to always mmap pages
130# in the lower 32-bit area on 64-bit platforms. 130# in the lower 32-bit area on 64-bit platforms.
131# 131#
132# Luckily for us, the RTS linker is only used when the GHC executable (or 132# Luckily for us, the RTS linker is only used when the GHC executable (or
133# any user programs which uses GHC API as an interpreter, not a compiler) 133# any user programs which uses GHC API as an interpreter, not a compiler)
134# is statically linked, which is no longer the case except for ghc-iserv 134# is statically linked, which is no longer the case except for ghc-iserv
135# and ghc-iesrv-prof. They are launched when ghci is started with 135# and ghc-iesrv-prof. They are launched when ghci is started with
136# -fexternal-interpreter without -dynamic, and their purpose is to run 136# -fexternal-interpreter without -dynamic, and their purpose is to run
137# non-PIC code from within a dynamically linked ghci using the evil RTS 137# non-PIC code from within a dynamically linked ghci using the evil RTS
138# linker. 138# linker.
139.for f in ghc-iserv ghc-iserv-prof 139.for f in ghc-iserv ghc-iserv-prof
140NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 140NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
141NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 141NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
142.endfor 142.endfor
143 143
144 144
145# ----------------------------------------------------------------------------- 145# -----------------------------------------------------------------------------
146# Build hooks 146# Build hooks
147# 147#
148 148
149# We patch configure.ac in some directories. 149# We patch configure.ac in some directories.
150post-patch: 150post-patch:
151 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" 151 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
152 ${RUN} cd ${WRKSRC} && autoconf 152 ${RUN} cd ${WRKSRC} && autoconf
153 153
154# Define the target "pre-configure" and non-standard "bootstrap". 154# Define the target "pre-configure" and non-standard "bootstrap".
155.include "bootstrap.mk" 155.include "bootstrap.mk"
156 156
157# Our pre-configure phase installs a bindist of bootstrapping compiler 157# Our pre-configure phase installs a bindist of bootstrapping compiler
158# directly into TOOLS_DIR so that ./configure can find it. 158# directly into TOOLS_DIR so that ./configure can find it.
159 159
160# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too 160# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too
161# loose, and building docs/users_guide rarely succeeds. We don't know 161# loose, and building docs/users_guide rarely succeeds. We don't know
162# which version is actually required for it. 162# which version is actually required for it.
163BUILD_SPHINX_HTML?= no 163BUILD_SPHINX_HTML?= no
164 164
165# Here we generate mk/build.mk dynamically. 165# Here we generate mk/build.mk dynamically.
166post-configure: 166post-configure:
167 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk 167 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk
168 168
169# If there is HsColour in the PATH, GHC's build system tries to use it 169# If there is HsColour in the PATH, GHC's build system tries to use it
170# without even checking if it really works. That's not what we 170# without even checking if it really works. That's not what we
171# appreciate. 171# appreciate.
172 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk 172 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk
173 173
174.if ${BUILD_SPHINX_HTML} == "no" 174.if ${BUILD_SPHINX_HTML} == "no"
175 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk 175 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk
176.endif 176.endif
177 177
178# Don't even think of PDF. 178# Don't even think of PDF.
179 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk 179 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk
180 180
181# SplitSections is only enabled by default on platforms with GNU ld. On SunOS, 181# SplitSections is only enabled by default on platforms with GNU ld. On SunOS,
182# whose ld is not the GNU one, it can however be used as well. 182# whose ld is not the GNU one, it can however be used as well.
183.if ${OPSYS} == "SunOS" 183.if ${OPSYS} == "SunOS"
184 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk 184 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk
185.endif 185.endif
186 186
187 187
188# ----------------------------------------------------------------------------- 188# -----------------------------------------------------------------------------
189# Installation/removal hooks 189# Installation/removal hooks
190# 190#
191 191
192# Substitutions for INSTALL and DEINSTALL that handles package.cache. 192# Substitutions for INSTALL and DEINSTALL that handles package.cache.
193FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV} 193FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV}
194 194
195INSTALLATION_DIRS+= share/bash-completion/completions 195INSTALLATION_DIRS+= share/bash-completion/completions
196post-install: 196post-install:
197 ${INSTALL_DATA} ${WRKSRC}/utils/completion/ghc.bash \ 197 ${INSTALL_DATA} ${WRKSRC}/utils/completion/ghc.bash \
198 ${DESTDIR}${PREFIX}/share/bash-completion/completions/ghc 198 ${DESTDIR}${PREFIX}/share/bash-completion/completions/ghc
199# We don't want package.cache to be in the PLIST. 199# We don't want package.cache to be in the PLIST.
200 ${RM} -f ${DESTDIR}${PREFIX}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache 200 ${RM} -f ${DESTDIR}${PREFIX}/lib/${PKGNAME_NOREV}/package.conf.d/package.cache
201 201
202 202
203# ----------------------------------------------------------------------------- 203# -----------------------------------------------------------------------------
204# PLIST 204# PLIST
205# 205#
206# We can't use static PLIST because the package installs files with a 206# We can't use static PLIST because the package installs files with a
207# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm 207# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm
208# [2019-12-27; pho]. 208# [2019-12-27; pho].
209GENERATE_PLIST+= \ 209GENERATE_PLIST+= \
210 cd ${DESTDIR}${PREFIX} && \ 210 cd ${DESTDIR}${PREFIX} && \
211 ${FIND} * \( -type f -o -type l \) | ${SORT}; 211 ${FIND} * \( -type f -o -type l \) | ${SORT};
212 212
213 213
214# ----------------------------------------------------------------------------- 214# -----------------------------------------------------------------------------
215# Sanity checks 215# Sanity checks
216# 216#
217 217
218# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable 218# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
219# XXX: On which platform? Is it still an issue? 219# XXX: On which platform? Is it still an issue?
220CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.* 220CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
221 221
222# ld: fatal: relocation error ... relocation requires reference symbol 222# ld: fatal: relocation error ... relocation requires reference symbol
223# XXX: On which platform? Is it still an issue? 223# XXX: On which platform? Is it still an issue?
224STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a 224STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a
225 225
226 226
227# ----------------------------------------------------------------------------- 227# -----------------------------------------------------------------------------
228# Dependencies 228# Dependencies
229# 229#
230.if ${BUILD_SPHINX_HTML} != "no" 230.if ${BUILD_SPHINX_HTML} != "no"
231BUILDLINK_DEPMETHOD.python:= build 231BUILDLINK_DEPMETHOD.python:= build
232.include "../../lang/python/pyversion.mk" 232.include "../../lang/python/pyversion.mk"
233BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx 233BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
234.endif 234.endif
235 235
236# NetBSD 9.x have libcurses with a newer major version than the 236# NetBSD 9.x have libcurses with a newer major version than the
237# bootstrap kit is linked against. For now, work around this with 237# bootstrap kit is linked against. For now, work around this with
238# compat80. 238# compat80.
239.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) && empty(OS_VERSION:M[0-8].*) 239.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) && ${OPSYS_VERSION} >= 090000
240BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80 240BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
241# In a sandboxed build environment, we have to reach over to the 241# In a sandboxed build environment, we have to reach over to the
242# installed libraries themselves, since the symlinks compat80 adds 242# installed libraries themselves, since the symlinks compat80 adds
243# to the /usr tree can't be applied. 243# to the /usr tree can't be applied.
244ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib 244ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib
245# XXX: ${WRKDIR}/lib is a temporary workaround for compat80 not having 245# XXX: ${WRKDIR}/lib is a temporary workaround for compat80 not having
246# libterminfo.so.1. See ./bootstrap.mk 246# libterminfo.so.1. See ./bootstrap.mk
247.endif 247.endif
248 248
249# On Solaris-based platforms our bootkit tends to depend on 249# On Solaris-based platforms our bootkit tends to depend on
250# pkgsrc-installed shlibs. 250# pkgsrc-installed shlibs.
251.if ${OPSYS} == "SunOS" 251.if ${OPSYS} == "SunOS"
252ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/lib 252ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/lib
253.endif 253.endif
254 254
255.include "../../converters/libiconv/buildlink3.mk" 255.include "../../converters/libiconv/buildlink3.mk"
256.include "../../devel/libffi/buildlink3.mk" 256.include "../../devel/libffi/buildlink3.mk"
257.include "../../devel/gmp/buildlink3.mk" 257.include "../../devel/gmp/buildlink3.mk"
258.include "../../mk/curses.buildlink3.mk" 258.include "../../mk/curses.buildlink3.mk"
259.include "../../mk/pthread.buildlink3.mk" 259.include "../../mk/pthread.buildlink3.mk"
260.include "../../mk/bsd.pkg.mk" 260.include "../../mk/bsd.pkg.mk"