Skip to content

Commit f6dc206

Browse files
wrapper.in: Require runtime ghc-pkgs to be an abi compatible superset of bootpkgs (#3214)
This still makes sure that ghc has been compiled with the same core libraries as hls while it allows runtime environments where other packages have been added to the ghc-pkg database. This commit also adds that file to the sdist, so that distro packagers can use it. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 468db6f commit f6dc206

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

GNUmakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ bindist-ghc:
106106
$(SED) \
107107
-e "s/@@EXE_NAME@@/haskell-language-server-$(GHC_VERSION)/" \
108108
-e "s/@@GHC_VERSION@@/$(GHC_VERSION)/" \
109+
-e "s/@@BOOT_PKGS@@/$(shell ghc-pkg-$(GHC_VERSION) --global list --simple-output)/" \
109110
-e "s/@@ABI_HASHES@@/$(shell for dep in `ghc-pkg-$(GHC_VERSION) --global list --simple-output` ; do printf "%s:" "$$dep" && ghc-pkg-$(GHC_VERSION) field $$dep abi --simple-output ; done | tr '\n' ' ' | xargs)/" \
110111
bindist/wrapper.in > "$(BINDIST_OUT_DIR)/haskell-language-server-$(GHC_VERSION).in"
111112
$(CHMOD_X) "$(BINDIST_OUT_DIR)/haskell-language-server-$(GHC_VERSION).in"

bindist/wrapper.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
exedir="@@EXE_DIR@@"
44
executablename="@@EXE_NAME@@"
55
GHC_VERSION="@@GHC_VERSION@@"
6+
7+
# This space separated list contains the names and versions of the boot libraries used to compile hls.
8+
BOOT_PKGS="@@BOOT_PKGS@@"
9+
# This space separated list contains the ABI hashes of the pkgs in BOOT_PKGS at compiletime.
610
ABI_HASHES="@@ABI_HASHES@@"
711

812
debug_msg() {
@@ -62,7 +66,7 @@ check_ghc() {
6266

6367
# check version
6468
if [ "${check_ghc_ver}" = "${GHC_VERSION}" ] ; then
65-
# check ABI
69+
# check for all packages listed in BOOT_PKGS that they are present with the same ABI hash as at hls-compiletime to prevent linking issues.
6670
if "${GHC_PKG}" --version >/dev/null ; then
6771
:
6872
elif "${GHC_PKG}-${GHC_VERSION}" --version >/dev/null ; then
@@ -73,7 +77,7 @@ check_ghc() {
7377
return 1
7478
fi
7579
PKGCONF="${check_ghc_libdir}/package.conf.d"
76-
MY_ABI_HASHES="$(for dep in $("${GHC_PKG}" --global --global-package-db "$PKGCONF" list --simple-output) ; do printf "%s:" "${dep}" && "${GHC_PKG}" --global --global-package-db "$PKGCONF" field "${dep}" abi --simple-output ; done | tr '\n' ' ' | xargs)"
80+
MY_ABI_HASHES="$(for dep in ${BOOT_PKGS} ; do printf "%s:" "${dep}" && "${GHC_PKG}" --global --global-package-db "$PKGCONF" field "${dep}" abi --simple-output ; done | tr '\n' ' ' | xargs)"
7781
if [ "${ABI_HASHES}" != "${MY_ABI_HASHES}" ] ; then
7882
err_abi "${MY_ABI_HASHES}"
7983
return 3

haskell-language-server.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ extra-source-files:
2222
test/testdata/**/*.cabal
2323
test/testdata/**/*.yaml
2424
test/testdata/**/*.hs
25+
bindist/wrapper.in
2526

2627
flag pedantic
2728
description: Enable -Werror

0 commit comments

Comments
 (0)