Diff:
diff --git a/lang/ghc88/Makefile b/lang/ghc88/Makefile
index 318fb2649a2..133d0cb95d8 100644
--- a/lang/ghc88/Makefile
+++ b/lang/ghc88/Makefile
@@ -202,20 +202,6 @@ GENERATE_PLIST+= \
# There is an unused script which don't pass the portability test.
CHECK_PORTABILITY_SKIP+= distrib/prep-bin-dist-mingw
-# Dynamically linked Haskell executables and libraries have rpaths to
-# dependent Haskell libraries, but the problem is that they are
-# specified with $ORIGIN, which isn't currently supported by
-# ../../mk/check/check-shlibs-elf.awk.
-#
-# Note that arguments like "-Wl,-rpath,$ORIGIN/.." are usually dropped
-# by the "cleanup" phase of wrappers. This is not the case in GHC
-# because GHC uses @file syntax while linking objects, and our
-# wrappers does nothing about it.
-CHECK_SHLIBS_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
-.for f in ghc ghc-iserv-dyn ghc-pkg haddock hpc hsc2hs runghc
-CHECK_SHLIBS_SKIP+= lib/${PKGNAME_NOREV}/bin/${f}
-.endfor
-
# ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
CTF_FILES_SKIP+= */libHS*-ghc${PKGVERSION_NOREV}.*
@@ -240,7 +226,7 @@ BUILD_DEPENDS+= compat80-[0-9]*:../../emulators/compat80
# In a sandboxed build environment, we have to reach over to the
# installed libraries themselves, since the symlinks compat80 adds
# to the /usr tree can't be applied.
-ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib:${WRKDIR}/lib:${FILESDIR}
+ALL_ENV+= LD_LIBRARY_PATH=${PREFIX}/emul/netbsd/usr/lib
.endif
.include "../../converters/libiconv/buildlink3.mk"
diff --git a/lang/ghc88/distinfo b/lang/ghc88/distinfo
index 1556b88d7b1..06d1982331f 100644
--- a/lang/ghc88/distinfo
+++ b/lang/ghc88/distinfo
@@ -31,6 +31,7 @@ Size (netbsd-9.0-amd64-libterminfo.tar.gz) = 27744 bytes
SHA1 (patch-aclocal.m4) = 16ac8899a7d87cf93a6139edba9e5222eb4c5c66
SHA1 (patch-compiler_main_DynFlags.hs) = 07bb2a5afdd087f4d2da5c035feecc13273aec70
SHA1 (patch-configure.ac) = 6e5cec26e440ccd71343a1981b415459813f88be
+SHA1 (patch-ghc.mk) = 9bfa82ee29c2786e7bae800279823bee72e4fab1
SHA1 (patch-ghc_ghc.mk) = 9c639cc95cb79e4ffbd9b5fce311edba54939b5e
SHA1 (patch-libraries_Cabal_Cabal_Distribution_Simple_GHC.hs) = a4c82b1282c0580a7945be8c3b9d38bc760db99f
SHA1 (patch-libraries_base_GHC_Event_KQueue.hsc) = 8ee5da667a241a05fde3c580d3dc9bdc05aa5f00
@@ -45,3 +46,4 @@ SHA1 (patch-libraries_unix_System_Posix_Files_Common.hsc) = 6efef280832d376915a8
SHA1 (patch-libraries_unix_System_Posix_Signals.hsc) = 49215dce493a6bbc440f91a3959e592f86fc779b
SHA1 (patch-libraries_unix_include_execvpe.h) = 67dd9720a71a6a55bbe2b50e61621ca60187ef00
SHA1 (patch-rts_StgCRun.c) = 121c7bd714725d5b14a3cbb03d81b1c769848824
+SHA1 (patch-rules_distdir-way-opts.mk) = 1430f03c2dfc3462a68002c76bfefcf38622429b
diff --git a/lang/ghc88/patches/patch-ghc.mk b/lang/ghc88/patches/patch-ghc.mk
new file mode 100644
index 00000000000..8972fb41042
--- /dev/null
+++ b/lang/ghc88/patches/patch-ghc.mk
@@ -0,0 +1,16 @@
+$NetBSD$
+
+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 2020-07-08 16:43:03.000000000 +0000
++++ ghc.mk
+@@ -959,7 +959,7 @@ endif
+
+ INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d
+
+-ifeq "$(BINDIST) $(CrossCompiling)" "NO YES"
++ifeq "UseWrappers" "UseWrappers"
+ # 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
diff --git a/lang/ghc88/patches/patch-rules_distdir-way-opts.mk b/lang/ghc88/patches/patch-rules_distdir-way-opts.mk
new file mode 100644
index 00000000000..c18cd8cbdd7
--- /dev/null
+++ b/lang/ghc88/patches/patch-rules_distdir-way-opts.mk
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Use correct RPATHs.
+
+--- rules/distdir-way-opts.mk.orig 2020-07-08 16:43:04.000000000 +0000
++++ rules/distdir-way-opts.mk
+@@ -209,7 +209,7 @@ ifneq "$4" "0"
+ ifeq "$$(TargetElf)" "YES"
+ $1_$2_$3_GHC_LD_OPTS += \
+ -fno-use-rpaths \
+- $$(foreach d,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'$$$$ORIGIN/../$$d') -optl-Wl,-zorigin
++ $$(foreach d,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)$$(ghclibdir)/$$d)
+ else ifeq "$$(TargetOS_CPP)" "darwin"
+ $1_$2_$3_GHC_LD_OPTS += \
+ -fno-use-rpaths \
Tests are correct:
$ bmake _check-shlibs
=> Checking for missing run-time search paths in ghc-8.8.4nb1
Correct REQUIRES
and PROVIDES
:
$ pkg_info -Q REQUIRES ghc
/usr/lib/libc.so.12
/usr/lib/libcurses.so.9
/usr/lib/libgcc_s.so.1
/usr/lib/libm.so.0
/usr/lib/libpthread.so.1
/usr/lib/librt.so.1
/usr/lib/libterminfo.so.2
/usr/lib/libutil.so.7
/usr/pkg/lib/libffi.so.7
/usr/pkg/lib/libgmp.so.10
$ pkg_info -Q PROVIDES ghc
/usr/pkg/lib/ghc-8.8.4/Cabal-3.0.1.0/libHSCabal-3.0.1.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/array-0.5.4.0/libHSarray-0.5.4.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/base-4.13.0.0/libHSbase-4.13.0.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/binary-0.8.7.0/libHSbinary-0.8.7.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/bytestring-0.10.10.1/libHSbytestring-0.10.10.1-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/containers-0.6.2.1/libHScontainers-0.6.2.1-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/deepseq-1.4.4.0/libHSdeepseq-1.4.4.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/directory-1.3.6.0/libHSdirectory-1.3.6.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/filepath-1.4.2.1/libHSfilepath-1.4.2.1-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/ghc-8.8.4/libHSghc-8.8.4-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/ghc-boot-8.8.4/libHSghc-boot-8.8.4-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/ghc-boot-th-8.8.4/libHSghc-boot-th-8.8.4-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/ghc-compact-0.1.0.0/libHSghc-compact-0.1.0.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/ghc-heap-8.8.4/libHSghc-heap-8.8.4-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/ghc-prim-0.5.3/libHSghc-prim-0.5.3-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/ghci-8.8.4/libHSghci-8.8.4-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/haskeline-0.7.5.0/libHShaskeline-0.7.5.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/hpc-0.6.0.3/libHShpc-0.6.0.3-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/integer-gmp-1.0.2.0/libHSinteger-gmp-1.0.2.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/libiserv-8.8.4/libHSlibiserv-8.8.4-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/mtl-2.2.2/libHSmtl-2.2.2-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/parsec-3.1.14.0/libHSparsec-3.1.14.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/pretty-1.1.3.6/libHSpretty-1.1.3.6-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/process-1.6.9.0/libHSprocess-1.6.9.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/rts/libHSrts-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/rts/libHSrts_debug-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/rts/libHSrts_l-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/rts/libHSrts_thr-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/rts/libHSrts_thr_debug-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/rts/libHSrts_thr_l-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/stm-2.5.0.0/libHSstm-2.5.0.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/template-haskell-2.15.0.0/libHStemplate-haskell-2.15.0.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/terminfo-0.4.1.4/libHSterminfo-0.4.1.4-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/text-1.2.4.0/libHStext-1.2.4.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/time-1.9.3/libHStime-1.9.3-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/transformers-0.5.6.2/libHStransformers-0.5.6.2-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/unix-2.7.2.2/libHSunix-2.7.2.2-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/xhtml-3000.2.2.1/libHSxhtml-3000.2.2.1-ghc8.8.4.so
RPATHs are correct:
$ ldd /usr/pkg/lib/ghc-8.8.4/bin/ghc-pkg
/usr/pkg/lib/ghc-8.8.4/bin/ghc-pkg:
-lm.0 => /usr/lib/libm.so.0
-lc.12 => /usr/lib/libc.so.12
-lHSterminfo-0.4.1.4-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/terminfo-0.4.1.4/libHSterminfo-0.4.1.4-ghc8.8.4.so
-lcurses.9 => /usr/lib/libcurses.so.9
-lterminfo.2 => /usr/lib/libterminfo.so.2
-lHSbase-4.13.0.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/base-4.13.0.0/libHSbase-4.13.0.0-ghc8.8.4.so
-lHSinteger-gmp-1.0.2.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/integer-gmp-1.0.2.0/libHSinteger-gmp-1.0.2.0-ghc8.8.4.so
-lgmp.10 => /usr/pkg/lib/libgmp.so.10
-lHSghc-prim-0.5.3-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/ghc-prim-0.5.3/libHSghc-prim-0.5.3-ghc8.8.4.so
-lpthread.1 => /usr/lib/libpthread.so.1
-lHSghc-boot-8.8.4-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/ghc-boot-8.8.4/libHSghc-boot-8.8.4-ghc8.8.4.so
-lHSghc-boot-th-8.8.4-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/ghc-boot-th-8.8.4/libHSghc-boot-th-8.8.4-ghc8.8.4.so
-lHSdirectory-1.3.6.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/directory-1.3.6.0/libHSdirectory-1.3.6.0-ghc8.8.4.so
-lHSunix-2.7.2.2-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/unix-2.7.2.2/libHSunix-2.7.2.2-ghc8.8.4.so
-lrt.1 => /usr/lib/librt.so.1
-lutil.7 => /usr/lib/libutil.so.7
-lHStime-1.9.3-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/time-1.9.3/libHStime-1.9.3-ghc8.8.4.so
-lHSdeepseq-1.4.4.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/deepseq-1.4.4.0/libHSdeepseq-1.4.4.0-ghc8.8.4.so
-lHSarray-0.5.4.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/array-0.5.4.0/libHSarray-0.5.4.0-ghc8.8.4.so
-lHSbytestring-0.10.10.1-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/bytestring-0.10.10.1/libHSbytestring-0.10.10.1-ghc8.8.4.so
-lHSfilepath-1.4.2.1-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/filepath-1.4.2.1/libHSfilepath-1.4.2.1-ghc8.8.4.so
-lHSbinary-0.8.7.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/binary-0.8.7.0/libHSbinary-0.8.7.0-ghc8.8.4.so
-lHScontainers-0.6.2.1-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/containers-0.6.2.1/libHScontainers-0.6.2.1-ghc8.8.4.so
-lHSCabal-3.0.1.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/Cabal-3.0.1.0/libHSCabal-3.0.1.0-ghc8.8.4.so
-lHSprocess-1.6.9.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/process-1.6.9.0/libHSprocess-1.6.9.0-ghc8.8.4.so
-lHSparsec-3.1.14.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/parsec-3.1.14.0/libHSparsec-3.1.14.0-ghc8.8.4.so
-lHStext-1.2.4.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/text-1.2.4.0/libHStext-1.2.4.0-ghc8.8.4.so
-lHStemplate-haskell-2.15.0.0-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/template-haskell-2.15.0.0/libHStemplate-haskell-2.15.0.0-ghc8.8.4.so
-lHSpretty-1.1.3.6-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/pretty-1.1.3.6/libHSpretty-1.1.3.6-ghc8.8.4.so
-lHSmtl-2.2.2-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/mtl-2.2.2/libHSmtl-2.2.2-ghc8.8.4.so
-lHStransformers-0.5.6.2-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/transformers-0.5.6.2/libHStransformers-0.5.6.2-ghc8.8.4.so
-lHSrts-ghc8.8.4 => /usr/pkg/lib/ghc-8.8.4/rts/libHSrts-ghc8.8.4.so
-lffi.7 => /usr/pkg/lib/libffi.so.7
-lgcc_s.1 => /usr/lib/libgcc_s.so.1
No $ORIGIN:
$ readelf -Wd /usr/pkg/lib/ghc-8.8.4/bin/ghc-pkg | grep RPATH
0x000000000000000f (RPATH) Library rpath: [/usr/lib:/usr/pkg/lib:/usr/pkg/lib/ghc-8.8.4/terminfo-0.4.1.4:/usr/pkg/lib/ghc-8.8.4/ghc-boot-8.8.4:/usr/pkg/lib/ghc-8.8.4/Cabal-3.0.1.0:/usr/pkg/lib/ghc-8.8.4/process-1.6.9.0:/usr/pkg/lib/ghc-8.8.4/parsec-3.1.14.0:/usr/pkg/lib/ghc-8.8.4/text-1.2.4.0:/usr/pkg/lib/ghc-8.8.4/template-haskell-2.15.0.0:/usr/pkg/lib/ghc-8.8.4/pretty-1.1.3.6:/usr/pkg/lib/ghc-8.8.4/ghc-boot-th-8.8.4:/usr/pkg/lib/ghc-8.8.4/mtl-2.2.2:/usr/pkg/lib/ghc-8.8.4/transformers-0.5.6.2:/usr/pkg/lib/ghc-8.8.4/directory-1.3.6.0:/usr/pkg/lib/ghc-8.8.4/unix-2.7.2.2:/usr/pkg/lib/ghc-8.8.4/time-1.9.3:/usr/pkg/lib/ghc-8.8.4/filepath-1.4.2.1:/usr/pkg/lib/ghc-8.8.4/binary-0.8.7.0:/usr/pkg/lib/ghc-8.8.4/containers-0.6.2.1:/usr/pkg/lib/ghc-8.8.4/bytestring-0.10.10.1:/usr/pkg/lib/ghc-8.8.4/deepseq-1.4.4.0:/usr/pkg/lib/ghc-8.8.4/array-0.5.4.0:/usr/pkg/lib/ghc-8.8.4/base-4.13.0.0:/usr/pkg/lib/ghc-8.8.4/integer-gmp-1.0.2.0:/usr/pkg/lib/ghc-8.8.4/ghc-prim-0.5.3:/usr/pkg/lib/ghc-8.8.4/rts]
Building a package works:
$ cd devel/hs-primitive
$ bmake install
[...]
=> Checking for missing run-time search paths in hs-primitive-0.7.1.0
[...]
=> Creating binary package /home/pbulk/build/devel/hs-primitive/work/.packages/hs-primitive-0.7.1.0.tgz
and has the correct PROVIDES
/ REQUIRES
$ pkg_info -Q REQUIRES hs-primitive
/usr/lib/libc.so.12
/usr/lib/libm.so.0
/usr/lib/libpthread.so.1
/usr/pkg/lib/ghc-8.8.4/array-0.5.4.0/libHSarray-0.5.4.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/base-4.13.0.0/libHSbase-4.13.0.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/deepseq-1.4.4.0/libHSdeepseq-1.4.4.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/ghc-prim-0.5.3/libHSghc-prim-0.5.3-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/integer-gmp-1.0.2.0/libHSinteger-gmp-1.0.2.0-ghc8.8.4.so
/usr/pkg/lib/ghc-8.8.4/transformers-0.5.6.2/libHStransformers-0.5.6.2-ghc8.8.4.so
/usr/pkg/lib/libgmp.so.10
$ pkg_info -Q PROVIDES hs-primitive
/usr/pkg/lib/x86_64-netbsd-ghc-8.8.4/libHSprimitive-0.7.1.0-HzkHTAQqRdSC3uXdUuRRnX-ghc8.8.4.so