pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/ghc84 Backport the $ORIGIN removal patch from ghc88



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0152a775b2f6
branches:  trunk
changeset: 451758:0152a775b2f6
user:      pho <pho%pkgsrc.org@localhost>
date:      Sat May 01 02:57:31 2021 +0000

description:
Backport the $ORIGIN removal patch from ghc88

diffstat:

 lang/ghc84/Makefile                                 |  24 ++-----------
 lang/ghc84/distinfo                                 |   7 ++-
 lang/ghc84/patches/patch-ghc.mk                     |  16 ++++++++
 lang/ghc84/patches/patch-rts_ghc.mk                 |  14 +++++++
 lang/ghc84/patches/patch-rules_build-package-way.mk |  14 +++++++
 lang/ghc84/patches/patch-rules_distdir-way-opts.mk  |  38 +++++++++++++-------
 6 files changed, 77 insertions(+), 36 deletions(-)

diffs (183 lines):

diff -r 7f801148bce0 -r 0152a775b2f6 lang/ghc84/Makefile
--- a/lang/ghc84/Makefile       Sat May 01 01:24:50 2021 +0000
+++ b/lang/ghc84/Makefile       Sat May 01 02:57:31 2021 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.12 2021/04/27 13:55:25 pho Exp $
+# $NetBSD: Makefile,v 1.13 2021/05/01 02:57:31 pho Exp $
 # -----------------------------------------------------------------------------
 # Package metadata
 #
 DISTNAME=      ghc-8.4.4-src
 PKGNAME=       ${DISTNAME:S/-src$//}
-PKGREVISION=   3
+PKGREVISION=   4
 CATEGORIES=    lang
 MASTER_SITES=  https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
 EXTRACT_SUFX=  .tar.xz
@@ -29,7 +29,7 @@
 BROKEN_EXCEPT_ON_PLATFORM+=    FreeBSD-*-x86_64
 BROKEN_EXCEPT_ON_PLATFORM+=    NetBSD-*-x86_64
 #BROKEN_EXCEPT_ON_PLATFORM+=   SunOS-*-i386     # Not available yet
-BROKEN_EXCEPT_ON_PLATFORM+=    SunOS-*-x86_64   # Not available yet
+BROKEN_EXCEPT_ON_PLATFORM+=    SunOS-*-x86_64
 
 
 # -----------------------------------------------------------------------------
@@ -178,22 +178,6 @@
 # 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 nor
-# mk/pkgformat/pkg/metadata.mk.
-#
-# This means we need to disable the entire CHECK_SHLIBS machinery
-# because otherwise the resulting binary package would contain
-# REQUIRES lines with $ORIGIN wrongly expanded by ldd(1).
-#
-# 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_SUPPORTED=        no
-
 # ghc57207_0.s: failed to add inputs for merge: Resource temporarily unavailable
 CTF_FILES_SKIP+=               */libHS*-ghc${PKGVERSION_NOREV}.*
 
@@ -218,7 +202,7 @@
 # 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:${WRKDIR}/lib
 .endif
 
 .include "../../converters/libiconv/buildlink3.mk"
diff -r 7f801148bce0 -r 0152a775b2f6 lang/ghc84/distinfo
--- a/lang/ghc84/distinfo       Sat May 01 01:24:50 2021 +0000
+++ b/lang/ghc84/distinfo       Sat May 01 02:57:31 2021 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.7 2021/02/17 07:02:30 wiz Exp $
+$NetBSD: distinfo,v 1.8 2021/05/01 02:57:31 pho Exp $
 
 SHA1 (ghc-8.0.2-boot-x86_64-unknown-solaris2.tar.xz) = 517ea9435af0c8b4f32899ae3bd26ff8da34f180
 RMD160 (ghc-8.0.2-boot-x86_64-unknown-solaris2.tar.xz) = c88b0958085ce9a6e1b175280d536986e4c712b1
@@ -30,6 +30,7 @@
 Size (netbsd-9.0-amd64-libterminfo.tar.gz) = 27744 bytes
 SHA1 (patch-aclocal.m4) = cb444acc956f46657070f9f6dc343008b35594bd
 SHA1 (patch-configure.ac) = dae98e76c51fdc2f70a77adf7d206c3d79c6bca6
+SHA1 (patch-ghc.mk) = fdcbc5b0c48b616eb96868e49681536d773eaddd
 SHA1 (patch-libraries_base_GHC_Event_KQueue.hsc) = 8ee5da667a241a05fde3c580d3dc9bdc05aa5f00
 SHA1 (patch-libraries_base_System_CPUTime_Posix_Times.hsc) = 2bfb779d534d12073287274ce5e90b99e457a860
 SHA1 (patch-libraries_base_System_Environment.hs) = 7d79a91f295915b4408d5f41d5405739d7189215
@@ -40,4 +41,6 @@
 SHA1 (patch-libraries_unix_System_Posix_Files_Common.hsc) = 6efef280832d376915a8987e4e8aac283408f607
 SHA1 (patch-libraries_unix_System_Posix_Signals.hsc) = 49215dce493a6bbc440f91a3959e592f86fc779b
 SHA1 (patch-libraries_unix_include_execvpe.h) = 67dd9720a71a6a55bbe2b50e61621ca60187ef00
-SHA1 (patch-rules_distdir-way-opts.mk) = 7fc9e3111377680f698ec8877b91e98f7cdcdbb9
+SHA1 (patch-rts_ghc.mk) = 6e3daf71fb7e656131aa2aeeb0346c651520216a
+SHA1 (patch-rules_build-package-way.mk) = ec73df0bbc85e962f76a9068683879a1a1ba1815
+SHA1 (patch-rules_distdir-way-opts.mk) = a058c6428faf02ef94aab3336d2d2874f2726f4e
diff -r 7f801148bce0 -r 0152a775b2f6 lang/ghc84/patches/patch-ghc.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/ghc84/patches/patch-ghc.mk   Sat May 01 02:57:31 2021 +0000
@@ -0,0 +1,16 @@
+$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
diff -r 7f801148bce0 -r 0152a775b2f6 lang/ghc84/patches/patch-rts_ghc.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/ghc84/patches/patch-rts_ghc.mk       Sat May 01 02:57:31 2021 +0000
@@ -0,0 +1,14 @@
+$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 $$@
diff -r 7f801148bce0 -r 0152a775b2f6 lang/ghc84/patches/patch-rules_build-package-way.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/ghc84/patches/patch-rules_build-package-way.mk       Sat May 01 02:57:31 2021 +0000
@@ -0,0 +1,14 @@
+$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 $$@
diff -r 7f801148bce0 -r 0152a775b2f6 lang/ghc84/patches/patch-rules_distdir-way-opts.mk
--- a/lang/ghc84/patches/patch-rules_distdir-way-opts.mk        Sat May 01 01:24:50 2021 +0000
+++ b/lang/ghc84/patches/patch-rules_distdir-way-opts.mk        Sat May 01 02:57:31 2021 +0000
@@ -1,17 +1,27 @@
-$NetBSD: patch-rules_distdir-way-opts.mk,v 1.1 2020/02/17 17:24:06 jperkin Exp $
+$NetBSD: patch-rules_distdir-way-opts.mk,v 1.2 2021/05/01 02:57:31 pho Exp $
+
+Use correct RPATHs. On ELF we replace "$ORIGIN/../{PACKAGE_ID}" with
+the final installation path.
 
-https://gitlab.haskell.org/ghc/ghc/issues/17385
+On Darwin library paths work differently. If an executable (or a
+library) A depends on a library B, the installation path of B is first
+embedded in B, and then the path propagates to A at the time when A is
+linked. So we remove -rpath to libraries here, and do the other half
+in rules/build-package-way.mk and rts/ghc.mk.
 
---- rules/distdir-way-opts.mk.orig     2017-11-28 16:39:14.000000000 +0000
+--- rules/distdir-way-opts.mk.orig     2020-07-08 16:43:04.000000000 +0000
 +++ rules/distdir-way-opts.mk
-@@ -187,8 +187,8 @@ $1_$2_$3_ALL_LD_OPTS = \
-  $$($1_$2_$3_LD_OPTS) \
-  $$($1_$2_EXTRA_LD_OPTS) \
-  $$(EXTRA_LD_OPTS) \
-- $$(foreach o,$$(EXTRA_LD_LINKER_OPTS),-optl-Wl$$(comma)$$o) \
-- $$(foreach o,$$(CONF_LD_LINKER_OPTS_STAGE$4),-optl-Wl$$(comma)$$o)
-+ $$(foreach o,$$(EXTRA_LD_LINKER_OPTS),-Wl$$(comma)$$o) \
-+ $$(foreach o,$$(CONF_LD_LINKER_OPTS_STAGE$4),-Wl$$(comma)$$o)
- 
- # Options for passing to GHC when we use it for linking
- $1_$2_$3_GHC_LD_OPTS = \
+@@ -209,11 +209,10 @@ 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 \
+-    $$(foreach d,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'@loader_path/../$$d')
++    -fno-use-rpaths
+ endif
+ endif
+ endif



Home | Main Index | Thread Index | Old Index