Sat May 1 02:57:31 2021 UTC ()
Backport the $ORIGIN removal patch from ghc88


(pho)
diff -r1.12 -r1.13 pkgsrc/lang/ghc84/Makefile
diff -r1.7 -r1.8 pkgsrc/lang/ghc84/distinfo
diff -r0 -r1.1 pkgsrc/lang/ghc84/patches/patch-ghc.mk
diff -r0 -r1.1 pkgsrc/lang/ghc84/patches/patch-rts_ghc.mk
diff -r0 -r1.1 pkgsrc/lang/ghc84/patches/patch-rules_build-package-way.mk
diff -r1.1 -r1.2 pkgsrc/lang/ghc84/patches/patch-rules_distdir-way-opts.mk

cvs diff -r1.12 -r1.13 pkgsrc/lang/ghc84/Makefile (expand / switch to unified diff)

--- pkgsrc/lang/ghc84/Makefile 2021/04/27 13:55:25 1.12
+++ pkgsrc/lang/ghc84/Makefile 2021/05/01 02:57:31 1.13
@@ -1,45 +1,45 @@ @@ -1,45 +1,45 @@
1# $NetBSD: Makefile,v 1.12 2021/04/27 13:55:25 pho Exp $ 1# $NetBSD: Makefile,v 1.13 2021/05/01 02:57:31 pho 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= 3 7PKGREVISION= 4
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
17UNLIMIT_RESOURCES= datasize virtualsize 17UNLIMIT_RESOURCES= datasize virtualsize
18 18
19# TODO: We should be using the alternatives framework. 19# TODO: We should be using the alternatives framework.
20CONFLICTS+= ghc-[0-9]* 20CONFLICTS+= ghc-[0-9]*
21 21
22# GHC requires GHC to build itself. We have to prepare stripped-down 22# GHC requires GHC to build itself. We have to prepare stripped-down
23# binaries sufficient to bootstrap compilers for each platforms. If 23# binaries sufficient to bootstrap compilers for each platforms. If
24# you want to build them yourself, follow instructions in 24# you want to build them yourself, follow instructions in
25# BOOTSTRAP.txt and ./bootstrap.mk 25# BOOTSTRAP.txt and ./bootstrap.mk
26#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet 26#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet
27BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64 27BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-x86_64
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
31#BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-i386 # Not available yet 31#BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-i386 # Not available yet
32BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64 # Not available yet 32BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64
33 33
34 34
35# ----------------------------------------------------------------------------- 35# -----------------------------------------------------------------------------
36# Distfiles 36# Distfiles
37# 37#
38DISTFILES= ${DEFAULT_DISTFILES} 38DISTFILES= ${DEFAULT_DISTFILES}
39WRKSRC= ${WRKDIR}/${PKGNAME_NOREV} 39WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
40 40
41# We don't want to extract all of the DISTFILEs. 41# We don't want to extract all of the DISTFILEs.
42EXTRACT_ONLY= ${DEFAULT_DISTFILES} 42EXTRACT_ONLY= ${DEFAULT_DISTFILES}
43 43
44 44
45# ----------------------------------------------------------------------------- 45# -----------------------------------------------------------------------------
@@ -168,62 +168,46 @@ post-install: @@ -168,62 +168,46 @@ post-install:
168# [2019-12-27; pho]. 168# [2019-12-27; pho].
169GENERATE_PLIST+= \ 169GENERATE_PLIST+= \
170 cd ${DESTDIR}${PREFIX} && \ 170 cd ${DESTDIR}${PREFIX} && \
171 ${FIND} * \( -type f -o -type l \) | ${SORT}; 171 ${FIND} * \( -type f -o -type l \) | ${SORT};
172 172
173 173
174# ----------------------------------------------------------------------------- 174# -----------------------------------------------------------------------------
175# Sanity checks 175# Sanity checks
176# 176#
177 177
178# There is an unused script which don't pass the portability test. 178# There is an unused script which don't pass the portability test.
179CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw 179CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
180 180
181# Dynamically linked Haskell executables and libraries have rpaths to 
182# dependent Haskell libraries, but the problem is that they are 
183# specified with $ORIGIN, which isn't currently supported by 
184# ../../mk/check/check-shlibs-elf.awk nor 
185# mk/pkgformat/pkg/metadata.mk. 
186# 
187# This means we need to disable the entire CHECK_SHLIBS machinery 
188# because otherwise the resulting binary package would contain 
189# REQUIRES lines with $ORIGIN wrongly expanded by ldd(1). 
190# 
191# Note that arguments like "-Wl,-rpath,$ORIGIN/.." are usually dropped 
192# by the "cleanup" phase of wrappers. This is not the case in GHC 
193# because GHC uses @file syntax while linking objects, and our 
194# wrappers does nothing about it. 
195CHECK_SHLIBS_SUPPORTED= no 
196 
197# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable 181# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
198CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.* 182CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
199 183
200# ld: fatal: relocation error ... relocation requires reference symbol 184# ld: fatal: relocation error ... relocation requires reference symbol
201STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a 185STRIP_FILES_SKIP+= lib/${PKGNAME_NOREV}/libHSrts.a
202 186
203 187
204# ----------------------------------------------------------------------------- 188# -----------------------------------------------------------------------------
205# Dependencies 189# Dependencies
206# 190#
207.if ${BUILD_SPHINX_HTML} != "no" 191.if ${BUILD_SPHINX_HTML} != "no"
208BUILDLINK_DEPMETHOD.python:= build 192BUILDLINK_DEPMETHOD.python:= build
209.include "../../lang/python/pyversion.mk" 193.include "../../lang/python/pyversion.mk"
210BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx 194BUILD_DEPENDS+= ${PYPKGPREFIX}-sphinx-[0-9]*:../../textproc/py-sphinx
211.endif 195.endif
212 196
213# NetBSD 9.x have libcurses with a newer major version than the 197# NetBSD 9.x have libcurses with a newer major version than the
214# bootstrap kit is linked against. For now, work around this with 198# bootstrap kit is linked against. For now, work around this with
215# compat80. 199# compat80.
216.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*) 200.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*)
217BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80 201BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
218# In a sandboxed build environment, we have to reach over to the 202# In a sandboxed build environment, we have to reach over to the
219# installed libraries themselves, since the symlinks compat80 adds 203# installed libraries themselves, since the symlinks compat80 adds
220# to the /usr tree can't be applied. 204# to the /usr tree can't be applied.
221ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib:${FILESDIR} 205ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib
222.endif 206.endif
223 207
224.include "../../converters/libiconv/buildlink3.mk" 208.include "../../converters/libiconv/buildlink3.mk"
225.include "../../devel/libffi/buildlink3.mk" 209.include "../../devel/libffi/buildlink3.mk"
226.include "../../devel/gmp/buildlink3.mk" 210.include "../../devel/gmp/buildlink3.mk"
227.include "../../mk/curses.buildlink3.mk" 211.include "../../mk/curses.buildlink3.mk"
228.include "../../mk/pthread.buildlink3.mk" 212.include "../../mk/pthread.buildlink3.mk"
229.include "../../mk/bsd.pkg.mk" 213.include "../../mk/bsd.pkg.mk"

cvs diff -r1.7 -r1.8 pkgsrc/lang/ghc84/distinfo (expand / switch to unified diff)

--- pkgsrc/lang/ghc84/distinfo 2021/02/17 07:02:30 1.7
+++ pkgsrc/lang/ghc84/distinfo 2021/05/01 02:57:31 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: distinfo,v 1.7 2021/02/17 07:02:30 wiz Exp $ 1$NetBSD: distinfo,v 1.8 2021/05/01 02:57:31 pho Exp $
2 2
3SHA1 (ghc-8.0.2-boot-x86_64-unknown-solaris2.tar.xz) = 517ea9435af0c8b4f32899ae3bd26ff8da34f180 3SHA1 (ghc-8.0.2-boot-x86_64-unknown-solaris2.tar.xz) = 517ea9435af0c8b4f32899ae3bd26ff8da34f180
4RMD160 (ghc-8.0.2-boot-x86_64-unknown-solaris2.tar.xz) = c88b0958085ce9a6e1b175280d536986e4c712b1 4RMD160 (ghc-8.0.2-boot-x86_64-unknown-solaris2.tar.xz) = c88b0958085ce9a6e1b175280d536986e4c712b1
5SHA512 (ghc-8.0.2-boot-x86_64-unknown-solaris2.tar.xz) = 9a58d74a4e4256caf4b2ecd09f6f96156e5d4d242ed83d906d114a0cb1fc86277384dfb966dd3a7fdbbf9a18d0abca05e4633637f1ba1afbdc30623793aa8b22 5SHA512 (ghc-8.0.2-boot-x86_64-unknown-solaris2.tar.xz) = 9a58d74a4e4256caf4b2ecd09f6f96156e5d4d242ed83d906d114a0cb1fc86277384dfb966dd3a7fdbbf9a18d0abca05e4633637f1ba1afbdc30623793aa8b22
6Size (ghc-8.0.2-boot-x86_64-unknown-solaris2.tar.xz) = 71752772 bytes 6Size (ghc-8.0.2-boot-x86_64-unknown-solaris2.tar.xz) = 71752772 bytes
7SHA1 (ghc-8.4.4-boot-i386-unknown-freebsd.tar.xz) = 04981802730423aa12999e59679be198d540222a 7SHA1 (ghc-8.4.4-boot-i386-unknown-freebsd.tar.xz) = 04981802730423aa12999e59679be198d540222a
8RMD160 (ghc-8.4.4-boot-i386-unknown-freebsd.tar.xz) = f617e67f2c2f07c7211cb391a4bc2e7b304045e2 8RMD160 (ghc-8.4.4-boot-i386-unknown-freebsd.tar.xz) = f617e67f2c2f07c7211cb391a4bc2e7b304045e2
9SHA512 (ghc-8.4.4-boot-i386-unknown-freebsd.tar.xz) = 0819d9d9cd73688c143812c703e8394c9010e9e81c03a69c81f6bcc784f262ec04bffb9d8f2d030209f2f1a05ccddfb46c36fe789936e2b850920bf08052448f 9SHA512 (ghc-8.4.4-boot-i386-unknown-freebsd.tar.xz) = 0819d9d9cd73688c143812c703e8394c9010e9e81c03a69c81f6bcc784f262ec04bffb9d8f2d030209f2f1a05ccddfb46c36fe789936e2b850920bf08052448f
10Size (ghc-8.4.4-boot-i386-unknown-freebsd.tar.xz) = 52125656 bytes 10Size (ghc-8.4.4-boot-i386-unknown-freebsd.tar.xz) = 52125656 bytes
11SHA1 (ghc-8.4.4-boot-x86_64-apple-darwin.tar.xz) = 688f5729992bd2476699d9067d97e79b06bdec60 11SHA1 (ghc-8.4.4-boot-x86_64-apple-darwin.tar.xz) = 688f5729992bd2476699d9067d97e79b06bdec60
12RMD160 (ghc-8.4.4-boot-x86_64-apple-darwin.tar.xz) = 4e9c52c8ef07343cc24528e3f8431754237d0be3 12RMD160 (ghc-8.4.4-boot-x86_64-apple-darwin.tar.xz) = 4e9c52c8ef07343cc24528e3f8431754237d0be3
13SHA512 (ghc-8.4.4-boot-x86_64-apple-darwin.tar.xz) = abc92ca6822ba7fe2d09bc381a833c0cbd5f436b517fba003736195cec45f8ce2e33623a587ad35f5702baac791594d62fc829e2ea4dfceae2455875661b3ba6 13SHA512 (ghc-8.4.4-boot-x86_64-apple-darwin.tar.xz) = abc92ca6822ba7fe2d09bc381a833c0cbd5f436b517fba003736195cec45f8ce2e33623a587ad35f5702baac791594d62fc829e2ea4dfceae2455875661b3ba6
14Size (ghc-8.4.4-boot-x86_64-apple-darwin.tar.xz) = 51700444 bytes 14Size (ghc-8.4.4-boot-x86_64-apple-darwin.tar.xz) = 51700444 bytes
@@ -20,24 +20,27 @@ SHA1 (ghc-8.4.4-boot-x86_64-unknown-netb @@ -20,24 +20,27 @@ SHA1 (ghc-8.4.4-boot-x86_64-unknown-netb
20RMD160 (ghc-8.4.4-boot-x86_64-unknown-netbsd.tar.xz) = dd50835c50cd2102c1af4d2ed8f1148c8ac4d4d9 20RMD160 (ghc-8.4.4-boot-x86_64-unknown-netbsd.tar.xz) = dd50835c50cd2102c1af4d2ed8f1148c8ac4d4d9
21SHA512 (ghc-8.4.4-boot-x86_64-unknown-netbsd.tar.xz) = 0cc836390985c56d79a5c08dd2117c53fc9802b969db408dab14cfd441d95b2b5c18fed5d0b6da8a8555501e668ba471d0b878ea11a0021fba76265ed4ef8f76 21SHA512 (ghc-8.4.4-boot-x86_64-unknown-netbsd.tar.xz) = 0cc836390985c56d79a5c08dd2117c53fc9802b969db408dab14cfd441d95b2b5c18fed5d0b6da8a8555501e668ba471d0b878ea11a0021fba76265ed4ef8f76
22Size (ghc-8.4.4-boot-x86_64-unknown-netbsd.tar.xz) = 53040892 bytes 22Size (ghc-8.4.4-boot-x86_64-unknown-netbsd.tar.xz) = 53040892 bytes
23SHA1 (ghc-8.4.4-src.tar.xz) = bf8f807348c8a64469e42ecf9c4b71108f185c2c 23SHA1 (ghc-8.4.4-src.tar.xz) = bf8f807348c8a64469e42ecf9c4b71108f185c2c
24RMD160 (ghc-8.4.4-src.tar.xz) = d2be33c4b38ee0660fe081e625ad5242c819392c 24RMD160 (ghc-8.4.4-src.tar.xz) = d2be33c4b38ee0660fe081e625ad5242c819392c
25SHA512 (ghc-8.4.4-src.tar.xz) = 685e102eee8cf8b6a377afd7871998c8c368a5da288469367e3fb804aa6109e6f59be5945b8cd3d1e36c851190ea9a7f74c576528589589313d237b721d86da5 25SHA512 (ghc-8.4.4-src.tar.xz) = 685e102eee8cf8b6a377afd7871998c8c368a5da288469367e3fb804aa6109e6f59be5945b8cd3d1e36c851190ea9a7f74c576528589589313d237b721d86da5
26Size (ghc-8.4.4-src.tar.xz) = 11319500 bytes 26Size (ghc-8.4.4-src.tar.xz) = 11319500 bytes
27SHA1 (netbsd-9.0-amd64-libterminfo.tar.gz) = db6b385b8676efc135c08b06e3dd6fd11b926999 27SHA1 (netbsd-9.0-amd64-libterminfo.tar.gz) = db6b385b8676efc135c08b06e3dd6fd11b926999
28RMD160 (netbsd-9.0-amd64-libterminfo.tar.gz) = 5a246633c90ee85f71efcc02d8280bd0c50ab5a7 28RMD160 (netbsd-9.0-amd64-libterminfo.tar.gz) = 5a246633c90ee85f71efcc02d8280bd0c50ab5a7
29SHA512 (netbsd-9.0-amd64-libterminfo.tar.gz) = 79288d44b84df8848afc2cdfee628cc4fd1ec0334159403ef8ba994d617bc56a7114af3031198afb5f3b8f45c0463a848099431e32bc6725042908576b6f95b8 29SHA512 (netbsd-9.0-amd64-libterminfo.tar.gz) = 79288d44b84df8848afc2cdfee628cc4fd1ec0334159403ef8ba994d617bc56a7114af3031198afb5f3b8f45c0463a848099431e32bc6725042908576b6f95b8
30Size (netbsd-9.0-amd64-libterminfo.tar.gz) = 27744 bytes 30Size (netbsd-9.0-amd64-libterminfo.tar.gz) = 27744 bytes
31SHA1 (patch-aclocal.m4) = cb444acc956f46657070f9f6dc343008b35594bd 31SHA1 (patch-aclocal.m4) = cb444acc956f46657070f9f6dc343008b35594bd
32SHA1 (patch-configure.ac) = dae98e76c51fdc2f70a77adf7d206c3d79c6bca6 32SHA1 (patch-configure.ac) = dae98e76c51fdc2f70a77adf7d206c3d79c6bca6
 33SHA1 (patch-ghc.mk) = fdcbc5b0c48b616eb96868e49681536d773eaddd
33SHA1 (patch-libraries_base_GHC_Event_KQueue.hsc) = 8ee5da667a241a05fde3c580d3dc9bdc05aa5f00 34SHA1 (patch-libraries_base_GHC_Event_KQueue.hsc) = 8ee5da667a241a05fde3c580d3dc9bdc05aa5f00
34SHA1 (patch-libraries_base_System_CPUTime_Posix_Times.hsc) = 2bfb779d534d12073287274ce5e90b99e457a860 35SHA1 (patch-libraries_base_System_CPUTime_Posix_Times.hsc) = 2bfb779d534d12073287274ce5e90b99e457a860
35SHA1 (patch-libraries_base_System_Environment.hs) = 7d79a91f295915b4408d5f41d5405739d7189215 36SHA1 (patch-libraries_base_System_Environment.hs) = 7d79a91f295915b4408d5f41d5405739d7189215
36SHA1 (patch-libraries_time_lib_Data_Time_Clock_Internal_CTimespec.hsc) = 588270767f8a9cbde0648fc99807891fef65d721 37SHA1 (patch-libraries_time_lib_Data_Time_Clock_Internal_CTimespec.hsc) = 588270767f8a9cbde0648fc99807891fef65d721
37SHA1 (patch-libraries_time_lib_Data_Time_Clock_Internal_CTimeval.hs) = b2811ec4a845e6b2b44414e940b6108178b597c5 38SHA1 (patch-libraries_time_lib_Data_Time_Clock_Internal_CTimeval.hs) = b2811ec4a845e6b2b44414e940b6108178b597c5
38SHA1 (patch-libraries_unix_System_Posix_Env.hsc) = e94936c139ca15d45cac4a7feb74a601567913ab 39SHA1 (patch-libraries_unix_System_Posix_Env.hsc) = e94936c139ca15d45cac4a7feb74a601567913ab
39SHA1 (patch-libraries_unix_System_Posix_Env_ByteString.hsc) = 3f675fc5d6bf5cc59a2d5ccffeb9ccd51521645a 40SHA1 (patch-libraries_unix_System_Posix_Env_ByteString.hsc) = 3f675fc5d6bf5cc59a2d5ccffeb9ccd51521645a
40SHA1 (patch-libraries_unix_System_Posix_Files_Common.hsc) = 6efef280832d376915a8987e4e8aac283408f607 41SHA1 (patch-libraries_unix_System_Posix_Files_Common.hsc) = 6efef280832d376915a8987e4e8aac283408f607
41SHA1 (patch-libraries_unix_System_Posix_Signals.hsc) = 49215dce493a6bbc440f91a3959e592f86fc779b 42SHA1 (patch-libraries_unix_System_Posix_Signals.hsc) = 49215dce493a6bbc440f91a3959e592f86fc779b
42SHA1 (patch-libraries_unix_include_execvpe.h) = 67dd9720a71a6a55bbe2b50e61621ca60187ef00 43SHA1 (patch-libraries_unix_include_execvpe.h) = 67dd9720a71a6a55bbe2b50e61621ca60187ef00
43SHA1 (patch-rules_distdir-way-opts.mk) = 7fc9e3111377680f698ec8877b91e98f7cdcdbb9 44SHA1 (patch-rts_ghc.mk) = 6e3daf71fb7e656131aa2aeeb0346c651520216a
 45SHA1 (patch-rules_build-package-way.mk) = ec73df0bbc85e962f76a9068683879a1a1ba1815
 46SHA1 (patch-rules_distdir-way-opts.mk) = a058c6428faf02ef94aab3336d2d2874f2726f4e

File Added: pkgsrc/lang/ghc84/patches/patch-ghc.mk
$NetBSD: patch-ghc.mk,v 1.1 2021/05/01 02:57:31 pho Exp $

Use the wrapper scripts for ghc as we can't use the ones from the DESTDIR
as the libraries are not in the right place yet.

--- ghc.mk.orig	2021-01-25 16:30:28.000000000 +0000
+++ ghc.mk
@@ -938,7 +938,7 @@ endif
 
 INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d
 
-ifeq "$(BINDIST) $(CrossCompiling)" "NO YES"
+ifeq "$(BINDIST)" "NO"
 # when installing ghc-stage2 we can't run target's
 # 'ghc-pkg' and 'ghc-stage2' but those are needed for registration.
 INSTALLED_GHC_REAL=$(TOP)/inplace/bin/ghc-stage1

File Added: pkgsrc/lang/ghc84/patches/patch-rts_ghc.mk
$NetBSD: patch-rts_ghc.mk,v 1.1 2021/05/01 02:57:31 pho Exp $

This is for Darwin. See the patch to rules/distdir-way-opts.mk.

--- rts/ghc.mk.orig	2021-04-29 03:14:20.000000000 +0000
+++ rts/ghc.mk
@@ -251,6 +251,7 @@ endif
 $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/dist/libs.depend $$(rts_dist_FFI_SO)
 	"$$(RM)" $$(RM_OPTS) $$@
 	"$$(rts_dist_HC)" -this-unit-id rts -shared -dynamic -dynload deploy \
+	  -dylib-install-name $$(ghclibdir)/rts/$$(rts_$1_LIB_FILE) \
 	  -no-auto-link-packages $$(LIBFFI_LIBS) `cat rts/dist/libs.depend` $$(rts_$1_OBJS) \
           $$(rts_dist_$1_GHC_LD_OPTS) \
 	  $$(rts_$1_DTRACE_OBJS) -o $$@

File Added: pkgsrc/lang/ghc84/patches/patch-rules_build-package-way.mk
$NetBSD: patch-rules_build-package-way.mk,v 1.1 2021/05/01 02:57:31 pho Exp $

This is for Darwin. See the patch to rules/distdir-way-opts.mk.

--- rules/build-package-way.mk.orig	2021-04-28 17:51:42.000000000 +0000
+++ rules/build-package-way.mk
@@ -64,6 +64,7 @@ else # ifneq "$$(TargetOS_CPP)" "mingw32
 $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS)
 	$$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) $$($1_$2_$3_GHC_LD_OPTS) $$($1_$2_$3_ALL_OBJS) \
          -shared -dynamic -dynload deploy \
+	 -dylib-install-name $$(ghclibdir)/$$($1_$2_COMPONENT_ID)/$$($1_$2_$3_LIB_FILE) \
 	 $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) $$(addprefix -L,$$($1_$2_EXTRA_LIBDIRS)) \
          -no-auto-link-packages \
          -o $$@

cvs diff -r1.1 -r1.2 pkgsrc/lang/ghc84/patches/patch-rules_distdir-way-opts.mk (expand / switch to unified diff)

--- pkgsrc/lang/ghc84/patches/patch-rules_distdir-way-opts.mk 2020/02/17 17:24:06 1.1
+++ pkgsrc/lang/ghc84/patches/patch-rules_distdir-way-opts.mk 2021/05/01 02:57:31 1.2
@@ -1,17 +1,27 @@ @@ -1,17 +1,27 @@
1$NetBSD: patch-rules_distdir-way-opts.mk,v 1.1 2020/02/17 17:24:06 jperkin Exp $ 1$NetBSD: patch-rules_distdir-way-opts.mk,v 1.2 2021/05/01 02:57:31 pho Exp $
2 2
3https://gitlab.haskell.org/ghc/ghc/issues/17385 3Use correct RPATHs. On ELF we replace "$ORIGIN/../{PACKAGE_ID}" with
 4the final installation path.
4 5
5--- rules/distdir-way-opts.mk.orig 2017-11-28 16:39:14.000000000 +0000 6On Darwin library paths work differently. If an executable (or a
 7library) A depends on a library B, the installation path of B is first
 8embedded in B, and then the path propagates to A at the time when A is
 9linked. So we remove -rpath to libraries here, and do the other half
 10in rules/build-package-way.mk and rts/ghc.mk.
 11
 12--- rules/distdir-way-opts.mk.orig 2020-07-08 16:43:04.000000000 +0000
6+++ rules/distdir-way-opts.mk 13+++ rules/distdir-way-opts.mk
7@@ -187,8 +187,8 @@ $1_$2_$3_ALL_LD_OPTS = \ 14@@ -209,11 +209,10 @@ ifneq "$4" "0"
8 $$($1_$2_$3_LD_OPTS) \ 15 ifeq "$$(TargetElf)" "YES"
9 $$($1_$2_EXTRA_LD_OPTS) \ 16 $1_$2_$3_GHC_LD_OPTS += \
10 $$(EXTRA_LD_OPTS) \ 17 -fno-use-rpaths \
11- $$(foreach o,$$(EXTRA_LD_LINKER_OPTS),-optl-Wl$$(comma)$$o) \ 18- $$(foreach d,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'$$$$ORIGIN/../$$d') -optl-Wl,-zorigin
12- $$(foreach o,$$(CONF_LD_LINKER_OPTS_STAGE$4),-optl-Wl$$(comma)$$o) 19+ $$(foreach d,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)$$(ghclibdir)/$$d)
13+ $$(foreach o,$$(EXTRA_LD_LINKER_OPTS),-Wl$$(comma)$$o) \ 20 else ifeq "$$(TargetOS_CPP)" "darwin"
14+ $$(foreach o,$$(CONF_LD_LINKER_OPTS_STAGE$4),-Wl$$(comma)$$o) 21 $1_$2_$3_GHC_LD_OPTS += \
15  22- -fno-use-rpaths \
16 # Options for passing to GHC when we use it for linking 23- $$(foreach d,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'@loader_path/../$$d')
17 $1_$2_$3_GHC_LD_OPTS = \ 24+ -fno-use-rpaths
 25 endif
 26 endif
 27 endif