Mon Feb 14 12:12:07 2022 UTC ()
Mark the package as not supporting MKPIE

Not sure if it really doesn't support PIE, but it's an obsolete compiler
anyway.


(pho)
diff -r1.9 -r1.10 pkgsrc/lang/ghc810/Makefile

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

--- pkgsrc/lang/ghc810/Makefile 2021/12/08 16:02:15 1.9
+++ pkgsrc/lang/ghc810/Makefile 2022/02/14 12:12:07 1.10
@@ -1,234 +1,236 @@ @@ -1,234 +1,236 @@
1# $NetBSD: Makefile,v 1.9 2021/12/08 16:02:15 adam Exp $ 1# $NetBSD: Makefile,v 1.10 2022/02/14 12:12:07 pho 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
 18
17UNLIMIT_RESOURCES= datasize virtualsize 19UNLIMIT_RESOURCES= datasize virtualsize
18 20
19# 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
20# binaries sufficient to bootstrap compilers for each platforms. If 22# binaries sufficient to bootstrap compilers for each platforms. If
21# you want to build them yourself, follow instructions in 23# you want to build them yourself, follow instructions in
22# BOOTSTRAP.txt and ./bootstrap.mk 24# BOOTSTRAP.txt and ./bootstrap.mk
23#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet 25#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet
24BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64 26BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64
25BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386 27BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386
26BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64 28BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64
27BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64 29BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64
28BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64 30BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64
29 31
30 32
31# ----------------------------------------------------------------------------- 33# -----------------------------------------------------------------------------
32# Distfiles 34# Distfiles
33# 35#
34DISTFILES= ${DEFAULT_DISTFILES} 36DISTFILES= ${DEFAULT_DISTFILES}
35WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} 37WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
36 38
37# We don't want to extract all of the DISTFILEs. 39# We don't want to extract all of the DISTFILEs.
38EXTRACT_ONLY= ${DEFAULT_DISTFILES} 40EXTRACT_ONLY= ${DEFAULT_DISTFILES}
39 41
40 42
41# ----------------------------------------------------------------------------- 43# -----------------------------------------------------------------------------
42# Tools 44# Tools
43# 45#
44# The runtime dependency on perl is due to the evil splitter 46# The runtime dependency on perl is due to the evil splitter
45# (lib/${PKGNAME_NOREV}/ghc-split). 47# (lib/${PKGNAME_NOREV}/ghc-split).
46USE_TOOLS+= autoconf gmake perl:run 48USE_TOOLS+= autoconf gmake perl:run
47GNU_CONFIGURE= yes 49GNU_CONFIGURE= yes
48USE_GNU_CONFIGURE_HOST= no 50USE_GNU_CONFIGURE_HOST= no
49USE_LIBTOOL= yes 51USE_LIBTOOL= yes
50 52
51# 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
52# 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
53# code elimination by breaking .o files into many pieces. This only 55# code elimination by breaking .o files into many pieces. This only
54# makes sense when linking executables statically, which is rarely 56# makes sense when linking executables statically, which is rarely
55# done these days. 57# done these days.
56 58
57 59
58# ----------------------------------------------------------------------------- 60# -----------------------------------------------------------------------------
59# Configuration 61# Configuration
60# 62#
61CONFIGURE_ARGS.common= \ 63CONFIGURE_ARGS.common= \
62 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \ 64 --with-curses-libraries=${BUILDLINK_PREFIX.curses}/${BUILDLINK_LIBDIRS.curses:Q} \
63 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \ 65 --with-gmp-includes=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_INCDIRS.gmp:Q} \
64 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \ 66 --with-gmp-libraries=${BUILDLINK_PREFIX.gmp}/${BUILDLINK_LIBDIRS.gmp:Q} \
65 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \ 67 --with-iconv-includes=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_INCDIRS.iconv:Q} \
66 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \ 68 --with-iconv-libraries=${BUILDLINK_PREFIX.iconv}/${BUILDLINK_LIBDIRS.iconv:Q} \
67 --with-system-libffi \ 69 --with-system-libffi \
68 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \ 70 --with-ffi-includes=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_INCDIRS.libffi:Q} \
69 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q} 71 --with-ffi-libraries=${BUILDLINK_PREFIX.libffi}/${BUILDLINK_LIBDIRS.libffi:Q}
70 72
71CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common} 73CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
72 74
73# 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
74# embedded in the compiler (actually ${WRKSRC}/settings). 76# embedded in the compiler (actually ${WRKSRC}/settings).
75CONFIGURE_ENV+= \ 77CONFIGURE_ENV+= \
76 ac_cv_prog_fp_prog_ar=${AR:Q} \ 78 ac_cv_prog_fp_prog_ar=${AR:Q} \
77 ac_cv_prog_LIBTOOL=libtool \ 79 ac_cv_prog_LIBTOOL=libtool \
78 PerlCmd=${PERL5:Q} \ 80 PerlCmd=${PERL5:Q} \
79 CC=${CC:Q} \ 81 CC=${CC:Q} \
80 LD=${LD:Q} 82 LD=${LD:Q}
81 83
82# LDFLAGS is currently not honored by "./configure". Since LDFLAGS 84# LDFLAGS is currently not honored by "./configure". Since LDFLAGS
83# 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
84# it. Otherwise neither GHC itself nor executables it produces will 86# it. Otherwise neither GHC itself nor executables it produces will
85# 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
86# "/etc/ld-elf.so.conf". See 88# "/etc/ld-elf.so.conf". See
87# http://hackage.haskell.org/trac/ghc/ticket/2933 89# http://hackage.haskell.org/trac/ghc/ticket/2933
88.for stage in 0 1 2 90.for stage in 0 1 2
89CONFIGURE_ENV+= \ 91CONFIGURE_ENV+= \
90 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q} 92 CONF_GCC_LINKER_OPTS_STAGE${stage}=${LDFLAGS:M*:Q}
91# 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
92# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS} 94# creating static GHCi libraries (HS*.o). Setting them to ${LDFLAGS}
93# does more harm than good because our ${LDFLAGS} contains -Wl,* 95# does more harm than good because our ${LDFLAGS} contains -Wl,*
94# 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
95# but those flags will also be baked into the compiler (see 97# but those flags will also be baked into the compiler (see
96# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside 98# ${WRKSRC}/compiler/ghc.mk) so they cause problems when used outside
97# the buildlink. 99# the buildlink.
98.endfor 100.endfor
99 101
100 102
101# ----------------------------------------------------------------------------- 103# -----------------------------------------------------------------------------
102# Security 104# Security
103# 105#
104# 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
105# 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
106# 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,
107# doesn't play nice with ASLR either because it relies on 109# doesn't play nice with ASLR either because it relies on
108# mmap(MAP_FIXED). This means most executables produced by GHC need 110# mmap(MAP_FIXED). This means most executables produced by GHC need
109# 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
110# 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,
111# and also drop support for static library loading and switch to 113# and also drop support for static library loading and switch to
112# dynamic libraries entirely. (Partially done: 114# dynamic libraries entirely. (Partially done:
113# https://gitlab.haskell.org/ghc/ghc/merge_requests/2498) 115# https://gitlab.haskell.org/ghc/ghc/merge_requests/2498)
114.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
115NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 117NOT_PAX_MPROTECT_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
116NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f} 118NOT_PAX_ASLR_SAFE+= lib/${PKGNAME_NOREV}/bin/${f}
117.endfor 119.endfor
118# Additional note: Now that DYNAMIC_GHC_PROGRAMS is enabled by 120# Additional note: Now that DYNAMIC_GHC_PROGRAMS is enabled by
119# 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
120# 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
121# when ghci is started with -fexternal-interpreter without 123# when ghci is started with -fexternal-interpreter without
122# -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
123# 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
124# linker requires PaX mprotect to be disabled too. This means that 126# linker requires PaX mprotect to be disabled too. This means that
125# 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
126# 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
127# executables except ghc-iserv and ghc-iserv-prof. 129# executables except ghc-iserv and ghc-iserv-prof.
128 130
129 131
130# ----------------------------------------------------------------------------- 132# -----------------------------------------------------------------------------
131# Build hooks 133# Build hooks
132# 134#
133 135
134# We patch configure.ac in some directories. 136# We patch configure.ac in some directories.
135post-patch: 137post-patch:
136 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}" 138 @${PHASE_MSG} "Regenerating configuration scripts for ${PKGNAME}"
137 ${RUN} cd ${WRKSRC} && autoconf 139 ${RUN} cd ${WRKSRC} && autoconf
138 140
139# Define the target "pre-configure" and non-standard "bootstrap". 141# Define the target "pre-configure" and non-standard "bootstrap".
140.include "../../lang/ghc810/bootstrap.mk" 142.include "../../lang/ghc810/bootstrap.mk"
141 143
142# Our pre-configure phase installs a bindist of bootstrapping compiler 144# Our pre-configure phase installs a bindist of bootstrapping compiler
143# directly into TOOLS_DIR so that ./configure can find it. 145# directly into TOOLS_DIR so that ./configure can find it.
144 146
145# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too 147# The version restriction on Sphinx in ${WRKSRC}/configure.ac is too
146# 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
147# which version is actually required for it. 149# which version is actually required for it.
148.include "../../mk/bsd.prefs.mk" 150.include "../../mk/bsd.prefs.mk"
149BUILD_SPHINX_HTML?= no 151BUILD_SPHINX_HTML?= no
150 152
151# Here we generate mk/build.mk dynamically. 153# Here we generate mk/build.mk dynamically.
152post-configure: 154post-configure:
153 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk 155 ${RUN} ${RM} -f ${WRKSRC}/mk/build.mk
154 156
155# 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
156# 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
157# appreciate. 159# appreciate.
158 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk 160 ${RUN} ${ECHO} "HSCOLOUR_SRCS = NO" >> ${WRKSRC}/mk/build.mk
159 161
160.if ${BUILD_SPHINX_HTML} == "no" 162.if ${BUILD_SPHINX_HTML} == "no"
161 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk 163 ${RUN} ${ECHO} "BUILD_SPHINX_HTML = NO" >> ${WRKSRC}/mk/build.mk
162.endif 164.endif
163 165
164# Don't even think of PDF. 166# Don't even think of PDF.
165 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk 167 ${RUN} ${ECHO} "BUILD_SPHINX_PDF = NO" >> ${WRKSRC}/mk/build.mk
166 168
167# https://gitlab.haskell.org/ghc/ghc/issues/13542 169# https://gitlab.haskell.org/ghc/ghc/issues/13542
168.if ${OPSYS} == "SunOS" 170.if ${OPSYS} == "SunOS"
169 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk 171 ${RUN} ${ECHO} "SplitSections = YES" >> ${WRKSRC}/mk/build.mk
170.endif 172.endif
171 173
172# ----------------------------------------------------------------------------- 174# -----------------------------------------------------------------------------
173# Installation/removal hooks 175# Installation/removal hooks
174# 176#
175 177
176# Substitutions for INSTALL and DEINSTALL that handles package.cache. 178# Substitutions for INSTALL and DEINSTALL that handles package.cache.
177FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV} 179FILES_SUBST+= GHC_VERSION=${PKGVERSION_NOREV}
178 180
179# We don't want package.cache to be in the PLIST. 181# We don't want package.cache to be in the PLIST.
180post-install: 182post-install:
181 ${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
182 184
183 185
184# ----------------------------------------------------------------------------- 186# -----------------------------------------------------------------------------
185# PLIST 187# PLIST
186# 188#
187# 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
188# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm 190# hashed name. And "PLIST_TYPE = dynamic" appears to be broken atm
189# [2019-12-27; pho]. 191# [2019-12-27; pho].
190GENERATE_PLIST+= \ 192GENERATE_PLIST+= \
191 cd ${DESTDIR}${PREFIX} && \ 193 cd ${DESTDIR}${PREFIX} && \
192 ${FIND} * \( -type f -o -type l \) | ${SORT}; 194 ${FIND} * \( -type f -o -type l \) | ${SORT};
193 195
194 196
195# ----------------------------------------------------------------------------- 197# -----------------------------------------------------------------------------
196# Sanity checks 198# Sanity checks
197# 199#
198 200
199# 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.
200CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw 202CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
201 203
202# 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
203CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.* 205CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
204 206
205# ld: fatal: relocation error ... relocation requires reference symbol 207# ld: fatal: relocation error ... relocation requires reference symbol
206STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a 208STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a
207 209
208 210
209# ----------------------------------------------------------------------------- 211# -----------------------------------------------------------------------------
210# Dependencies 212# Dependencies
211# 213#
212.if ${BUILD_SPHINX_HTML} != "no" 214.if ${BUILD_SPHINX_HTML} != "no"
213BUILDLINK_DEPMETHOD.python:= build 215BUILDLINK_DEPMETHOD.python:= build
214.include "../../lang/python/pyversion.mk" 216.include "../../lang/python/pyversion.mk"
215BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx 217BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
216.endif 218.endif
217 219
218# 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
219# bootstrap kit is linked against. For now, work around this with 221# bootstrap kit is linked against. For now, work around this with
220# compat80. 222# compat80.
221.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*) 223.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*)
222BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80 224BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
223# 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
224# installed libraries themselves, since the symlinks compat80 adds 226# installed libraries themselves, since the symlinks compat80 adds
225# to the /usr tree can't be applied. 227# to the /usr tree can't be applied.
226ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib 228ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib
227.endif 229.endif
228 230
229.include "../../converters/libiconv/buildlink3.mk" 231.include "../../converters/libiconv/buildlink3.mk"
230.include "../../devel/libffi/buildlink3.mk" 232.include "../../devel/libffi/buildlink3.mk"
231.include "../../devel/gmp/buildlink3.mk" 233.include "../../devel/gmp/buildlink3.mk"
232.include "../../mk/curses.buildlink3.mk" 234.include "../../mk/curses.buildlink3.mk"
233.include "../../mk/pthread.buildlink3.mk" 235.include "../../mk/pthread.buildlink3.mk"
234.include "../../mk/bsd.pkg.mk" 236.include "../../mk/bsd.pkg.mk"