pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk



Module Name:    pkgsrc
Committed By:   pho
Date:           Wed Feb 23 16:03:00 UTC 2022

Modified Files:
        pkgsrc/mk: haskell.mk

Log Message:
mk/haskell.mk: Add a package-settable variable HASKELL_ENABLE_DYNAMIC_EXECUTABLE

Prior to this change, packages that install both libraries and executables
were both linked dynamically when HASKELL_ENABLE_SHARED_LIBRARY is set to
yes. This turned out to be problematic when the executables end up
depending on hundreds of shared objects (which occurs rather frequently for
tools written in Haskell): the dynamic linker spends several seconds upon
loading the executables to resolve all the symbols.

Now we can selectively opt out from dynamic linkage by setting
HASKELL_ENABLE_DYNAMIC_EXECUTABLE to no. This should be done carefully,
because linking executables with static Haskell libraries means that those
executables will also use static RTS. This causes problems if they use GHC
API to interpret Haskell code at run time: static RTS would violate PaX
MPROTECT and suffer from ASLR while loading static objects.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 pkgsrc/mk/haskell.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/haskell.mk
diff -u pkgsrc/mk/haskell.mk:1.41 pkgsrc/mk/haskell.mk:1.42
--- pkgsrc/mk/haskell.mk:1.41   Sat Feb 12 08:38:15 2022
+++ pkgsrc/mk/haskell.mk        Wed Feb 23 16:03:00 2022
@@ -1,4 +1,4 @@
-# $NetBSD: haskell.mk,v 1.41 2022/02/12 08:38:15 pho Exp $
+# $NetBSD: haskell.mk,v 1.42 2022/02/23 16:03:00 pho Exp $
 #
 # This Makefile fragment handles Haskell Cabal packages. Package
 # configuration, building, installation, registration and unregistration
@@ -19,6 +19,13 @@
 #      Possible values: 0 1 2
 #       Default value: 2
 #
+# HASKELL_ENABLE_DYNAMIC_EXECUTABLE
+#      Whether executables in the package should be linked dynamically or
+#      not.
+#
+#      Possible values: yes, no
+#      Default value: inherits ${HASKELL_ENABLE_SHARED_LIBRARY}
+#
 # User-settable variables:
 #
 # HASKELL_ENABLE_SHARED_LIBRARY
@@ -62,6 +69,7 @@ _SYS_VARS.haskell= \
        HOMEPAGE UNLIMIT_RESOURCES PREFIX
 _DEF_VARS.haskell= \
        BUILDLINK_PASSTHRU_DIRS \
+       HASKELL_ENABLE_DYNAMIC_EXECUTABLE \
        HASKELL_OPTIMIZATION_LEVEL \
        HASKELL_PKG_NAME \
        USE_LANGUAGES \
@@ -110,6 +118,7 @@ TOOLS_FAIL+=        pkg-config
 UNLIMIT_RESOURCES+=    datasize virtualsize
 
 HASKELL_OPTIMIZATION_LEVEL?=           2
+HASKELL_ENABLE_DYNAMIC_EXECUTABLE?=    ${HASKELL_ENABLE_SHARED_LIBRARY}
 HASKELL_ENABLE_SHARED_LIBRARY?=                yes
 HASKELL_ENABLE_LIBRARY_PROFILING?=     yes
 HASKELL_ENABLE_HADDOCK_DOCUMENTATION?= yes
@@ -150,10 +159,16 @@ PKGSRC_OVERRIDE_MKPIE=    yes
 CONFIGURE_ARGS+=       --ghc-option=-fPIC --ghc-option=-pie
 .endif
 
+.if ${HASKELL_ENABLE_DYNAMIC_EXECUTABLE} == "yes"
+CONFIGURE_ARGS+=       --enable-executable-dynamic
+.else
+CONFIGURE_ARGS+=       --disable-executable-dynamic
+.endif
+
 .if ${HASKELL_ENABLE_SHARED_LIBRARY} == "yes"
-CONFIGURE_ARGS+=       --enable-shared --enable-executable-dynamic
+CONFIGURE_ARGS+=       --enable-shared
 .else
-CONFIGURE_ARGS+=       --disable-shared --disable-executable-dynamic
+CONFIGURE_ARGS+=       --disable-shared
 .endif
 
 .if ${HASKELL_ENABLE_LIBRARY_PROFILING} == "yes"



Home | Main Index | Thread Index | Old Index