-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install GHC bindist in relocatable mode on Unix #853
Conversation
On some platforms autotools will instead default to EPREFIX/lib64. To minimize differences in installed GHC bindists, we pin EPREFIX/lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 LGTM
haskell/ghc_bindist.bzl
Outdated
_execute_fail_loudly(ctx, ["make", "install"]) | ||
ctx.file("patch_bins", executable=True, content="""#!/usr/bin/env bash | ||
set -x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tracing stuff should probably go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed. Sorry, overlooked that.
haskell/ghc_bindist.bzl
Outdated
@@ -212,8 +212,20 @@ def _ghc_bindist_impl(ctx): | |||
|
|||
# On Windows the bindist already contains the built executables | |||
if os != "windows": | |||
_execute_fail_loudly(ctx, ["./configure", "--prefix", bindist_dir.realpath]) | |||
_execute_fail_loudly(ctx, ["sed", "-i", "s/RelocatableBuild = NO/RelocatableBuild = YES/", "mk/config.mk.in"]) | |||
_execute_fail_loudly(ctx, ["./configure", "--prefix", bindist_dir.realpath, "--libdir", "${exec_prefix}/lib"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does ${exec_prefix}
come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${exec_prefix}
is defined within mk/install.mk
. However, it turns out that ${exec_prefix}/lib
is the default for RelocatableBuild = YES
. So the --libdir
flag is redundant. I've removed it.
- Configure Unix bindist to be relocatable. - Patch bin wrapper scripts to not hard-code the execroot. This makes their cache key independent of platform details, like the path to the user's home directory.
`readlink -f` does not work on MacOS. Replace it by a cross platform version.
`${exec_prefix}/lib` is the default in case of `RelocatableBuild = YES`.
On Unix the GHC bindist requires to execute
./configure && make && make install
. In its default configuration, it hard-codes the absolute path to the bindist installation dir into various places in the final bindist. This affects the hashes and thereby cache keys, as the absolute install path will likely differ on different machines. This patch builds the bindist in relocatable mode on Unix and patches the generated wrapper scripts to no longer hard-code the absolute installation path.--libdir
toEPREFIX/lib
. On some platforms autotools defaults toEPREFIX/lib64
, instead.