Skip to content

Commit 80c77d5

Browse files
committed
wrapper.in: Allow runtime ghc-pkgs to be a subset of compile-time ghc-pkgs
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.
1 parent b289e48 commit 80c77d5

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-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: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
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 libraries present at compiletime of hls in the ghc-pkg database.
8+
# The assumption is that these are the boot packages hls has been compiled with.
9+
BOOT_PKGS="@@BOOT_PKGS@@"
10+
# This space separated list contains the ABI hashes of the pkgs in BOOT_PKGS at compiletime.
611
ABI_HASHES="@@ABI_HASHES@@"
712

813
debug_msg() {
@@ -62,7 +67,7 @@ check_ghc() {
6267

6368
# check version
6469
if [ "${check_ghc_ver}" = "${GHC_VERSION}" ] ; then
65-
# check ABI
70+
# 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.
6671
if "${GHC_PKG}" --version >/dev/null ; then
6772
:
6873
elif "${GHC_PKG}-${GHC_VERSION}" --version >/dev/null ; then
@@ -73,7 +78,7 @@ check_ghc() {
7378
return 1
7479
fi
7580
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)"
81+
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)"
7782
if [ "${ABI_HASHES}" != "${MY_ABI_HASHES}" ] ; then
7883
err_abi "${MY_ABI_HASHES}"
7984
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)