Skip to content

Commit 145b7c5

Browse files
committed
wrapper.in: Allow runtime ghc-pkgs to be a superset 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 145b7c5

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Diff for: GNUmakefile

+1
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"

Diff for: bindist/wrapper.in

+6-2
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

Diff for: haskell-language-server.cabal

+1
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)