pkgsrc-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7f801148bce0
branches:  trunk
changeset: 451757:7f801148bce0
user:      pho <pho%pkgsrc.org@localhost>
date:      Sat May 01 01:24:50 2021 +0000

description:
Backport the $ORIGIN removal patch from ghc88

diffstat:

 lang/ghc80/Makefile                                 |  34 ++++-------------
 lang/ghc80/distinfo                                 |   7 ++-
 lang/ghc80/patches/patch-ghc.mk                     |  28 +++++++++++++++
 lang/ghc80/patches/patch-rts_ghc.mk                 |  14 +++++++
 lang/ghc80/patches/patch-rules_build-package-way.mk |  14 +++++++
 lang/ghc80/patches/patch-rules_distdir-way-opts.mk  |  38 +++++++++++++-------
 6 files changed, 94 insertions(+), 41 deletions(-)

diffs (212 lines):

diff -r db25d8b63b7d -r 7f801148bce0 lang/ghc80/Makefile
--- a/lang/ghc80/Makefile       Sat May 01 00:01:29 2021 +0000
+++ b/lang/ghc80/Makefile       Sat May 01 01:24:50 2021 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.10 2021/04/27 13:55:25 pho Exp $
+# $NetBSD: Makefile,v 1.11 2021/05/01 01:24:50 pho Exp $
 # -----------------------------------------------------------------------------
 # Package metadata
 #
 DISTNAME=      ghc-8.0.2-src
 PKGNAME=       ${DISTNAME:S/-src$//}
-PKGREVISION=   3
+PKGREVISION=   4
 CATEGORIES=    lang
 MASTER_SITES=  https://downloads.haskell.org/~ghc/${PKGVERSION_NOREV}/
 EXTRACT_SUFX=  .tar.xz
@@ -25,11 +25,11 @@
 # possible. So we have to prepare stripped-down binaries sufficient to
 # bootstrap compilers for each platforms. If you want to build them
 # yourself, follow instructions in BOOTSTRAP.txt and ./bootstrap.mk
-#BROKEN_EXCEPT_ON_PLATFORM+= Darwin-*-powerpc # Not available yet
-BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-i386
-BROKEN_EXCEPT_ON_PLATFORM+= FreeBSD-*-x86_64
-BROKEN_EXCEPT_ON_PLATFORM+= NetBSD-*-x86_64
-BROKEN_EXCEPT_ON_PLATFORM+= SunOS-*-x86_64
+#BROKEN_EXCEPT_ON_PLATFORM+=   Darwin-*-powerpc # Not available yet
+BROKEN_EXCEPT_ON_PLATFORM+=    FreeBSD-*-i386
+BROKEN_EXCEPT_ON_PLATFORM+=    FreeBSD-*-x86_64
+BROKEN_EXCEPT_ON_PLATFORM+=    NetBSD-*-x86_64
+BROKEN_EXCEPT_ON_PLATFORM+=    SunOS-*-x86_64
 
 
 # -----------------------------------------------------------------------------
@@ -64,7 +64,7 @@
        --with-ffi-includes=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_INCDIRS.libffi:Q} \
        --with-ffi-libraries=${BUILDLINK_PREFIX.libffi:Q}/${BUILDLINK_LIBDIRS.libffi:Q}
 
-CONFIGURE_ARGS+= ${CONFIGURE_ARGS.common}
+CONFIGURE_ARGS+=       ${CONFIGURE_ARGS.common}
 
 CONFIGURE_ENV+= \
        ac_cv_path_fp_prog_ar=${AR:Q} \
@@ -162,22 +162,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}.*
 
@@ -200,7 +184,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 db25d8b63b7d -r 7f801148bce0 lang/ghc80/distinfo
--- a/lang/ghc80/distinfo       Sat May 01 00:01:29 2021 +0000
+++ b/lang/ghc80/distinfo       Sat May 01 01:24:50 2021 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.5 2021/02/17 08:44:33 wiz Exp $
+$NetBSD: distinfo,v 1.6 2021/05/01 01:24:50 pho Exp $
 
 SHA1 (ghc-7.10.3-boot-x86_64-unknown-solaris2.tar.xz) = 8ad1116768112bd6f2cf9a9ad2ed6b5052bedd4b
 RMD160 (ghc-7.10.3-boot-x86_64-unknown-solaris2.tar.xz) = c9ef4fa2f83b77b964a08b3f3b6d9916a490506f
@@ -26,6 +26,7 @@
 Size (netbsd-9.0-amd64-libterminfo.tar.gz) = 27744 bytes
 SHA1 (patch-compiler_main_DynFlags.hs) = c9671ca255b06dfbb732f3c56e3cbe9bfed1c075
 SHA1 (patch-configure.ac) = 2323f76a41f1dd65054f4d408629d7b1840b89a4
+SHA1 (patch-ghc.mk) = 92e009d9527b0cd477e6388554329ebec57caff3
 SHA1 (patch-iserv_ghc.mk) = 6d1d79100b4a7b5d8b0c6f25318eaa8b4e20e43d
 SHA1 (patch-libraries_base_GHC_Event_KQueue.hsc) = 8ee5da667a241a05fde3c580d3dc9bdc05aa5f00
 SHA1 (patch-libraries_base_System_Environment.hs) = ec3dfd916593f600a397e5b594672e6d3564f042
@@ -37,4 +38,6 @@
 SHA1 (patch-libraries_unix_System_Posix_Signals.hsc) = 49215dce493a6bbc440f91a3959e592f86fc779b
 SHA1 (patch-libraries_unix_include_execvpe.h) = 67dd9720a71a6a55bbe2b50e61621ca60187ef00
 SHA1 (patch-rts_PosixSource.h) = 604608791f33245d9305dcbd6d9d5979fe162f21
-SHA1 (patch-rules_distdir-way-opts.mk) = 58d9d209762b27da60da98eb942b284b70c88fc5
+SHA1 (patch-rts_ghc.mk) = 6e3daf71fb7e656131aa2aeeb0346c651520216a
+SHA1 (patch-rules_build-package-way.mk) = ec73df0bbc85e962f76a9068683879a1a1ba1815
+SHA1 (patch-rules_distdir-way-opts.mk) = a058c6428faf02ef94aab3336d2d2874f2726f4e
diff -r db25d8b63b7d -r 7f801148bce0 lang/ghc80/patches/patch-ghc.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/ghc80/patches/patch-ghc.mk   Sat May 01 01:24:50 2021 +0000
@@ -0,0 +1,28 @@
+$NetBSD: patch-ghc.mk,v 1.1 2021/05/01 01:24:50 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        2017-01-03 15:59:18.000000000 +0000
++++ ghc.mk
+@@ -960,6 +960,12 @@ endif
+ 
+ INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d
+ 
++ifneq "$(BINDIST)" "YES"
++# 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
++INSTALLED_GHC_PKG_REAL=$(TOP)/utils/ghc-pkg/dist/build/tmp/ghc-pkg
++else
+ # Install packages in the right order, so that ghc-pkg doesn't complain.
+ # Also, install ghc-pkg first.
+ ifeq "$(Windows_Host)" "NO"
+@@ -969,6 +975,7 @@ else
+ INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
+ INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
+ endif
++endif
+ 
+ # Set the INSTALL_DISTDIR_p for each package; compiler is special
+ $(foreach p,$(filter-out compiler,$(INSTALL_PACKAGES)),\
diff -r db25d8b63b7d -r 7f801148bce0 lang/ghc80/patches/patch-rts_ghc.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/ghc80/patches/patch-rts_ghc.mk       Sat May 01 01:24:50 2021 +0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-rts_ghc.mk,v 1.1 2021/05/01 01:24:50 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 db25d8b63b7d -r 7f801148bce0 lang/ghc80/patches/patch-rules_build-package-way.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/ghc80/patches/patch-rules_build-package-way.mk       Sat May 01 01:24:50 2021 +0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-rules_build-package-way.mk,v 1.1 2021/05/01 01:24:50 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 db25d8b63b7d -r 7f801148bce0 lang/ghc80/patches/patch-rules_distdir-way-opts.mk
--- a/lang/ghc80/patches/patch-rules_distdir-way-opts.mk        Sat May 01 00:01:29 2021 +0000
+++ b/lang/ghc80/patches/patch-rules_distdir-way-opts.mk        Sat May 01 01:24:50 2021 +0000
@@ -1,17 +1,27 @@
-$NetBSD: patch-rules_distdir-way-opts.mk,v 1.1 2020/02/17 17:22:43 jperkin Exp $
+$NetBSD: patch-rules_distdir-way-opts.mk,v 1.2 2021/05/01 01:24:50 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-01-04 04:04:11.000000000 +0000
+--- rules/distdir-way-opts.mk.orig     2020-07-08 16:43:04.000000000 +0000
 +++ rules/distdir-way-opts.mk
-@@ -196,8 +196,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