Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nmattia committed Jan 13, 2025
1 parent c68c2eb commit cda9c41
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions bazel/rules_haskell.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,55 @@ index df851329..980b3e16 100644
)
if exec_result.return_code != 0:
arguments = [_as_string(x) for x in arguments]
diff --git a/haskell/ghc_bindist.bzl b/haskell/ghc_bindist.bzl
index 51b740db..dd562291 100644
--- a/haskell/ghc_bindist.bzl
+++ b/haskell/ghc_bindist.bzl
@@ -161,6 +161,8 @@ def _ghc_bindist_impl(ctx):

is_hadrian_dist = ctx.path(unpack_dir).get_child("config.mk.in").exists

+ print("is_hadrian_dist", is_hadrian_dist)
+
# On Windows the bindist already contains the built executables
if os != "windows":
# IMPORTANT: all these scripts have to be compatible with BSD
@@ -177,6 +179,7 @@ include Makefile""")
execute_or_fail_loudly(ctx, ["sed", "-e", "s/RelocatableBuild = NO/RelocatableBuild = YES/", "-i.bak", "mk/config.mk.in"], working_directory = unpack_dir)
execute_or_fail_loudly(ctx, ["rm", "-f", "mk/config.mk.in.bak"], working_directory = unpack_dir)

+ print("config prefix", bindist_dir.realpath)
execute_or_fail_loudly(ctx, ["./configure", "--prefix", bindist_dir.realpath], working_directory = unpack_dir)

make_loc = ctx.which("make")
@@ -189,6 +192,7 @@ include Makefile""")
ctx.file("{}/mk/relpath.sh".format(unpack_dir), ctx.read(ctx.path(ctx.attr._relpath_script)), executable = False, legacy_utf8 = False)
execute_or_fail_loudly(ctx, ["chmod", "+x", "mk/relpath.sh"], working_directory = unpack_dir)

+ print("make args", make_args)
execute_or_fail_loudly(
ctx,
["make", "install"] + make_args,
@@ -203,8 +207,7 @@ include Makefile""")
working_directory = unpack_dir,
)

- if not is_hadrian_dist:
- ctx.file(paths.join(unpack_dir, "patch_bins"), executable = True, content = r"""#!/usr/bin/env bash
+ ctx.file(paths.join(unpack_dir, "patch_bins"), executable = True, content = r"""#!/usr/bin/env bash
find bin -type f -print0 | xargs -0 \
grep --files-with-matches --null {bindist_dir} | xargs -0 -n1 \
sed -i.bak \
@@ -215,9 +218,9 @@ find bin -type f -print0 | xargs -0 \
grep --files-with-matches --null {bindist_dir} | xargs -0 -n1 \
rm -f
""".format(
- bindist_dir = bindist_dir.realpath,
- ))
- execute_or_fail_loudly(ctx, [paths.join(".", unpack_dir, "patch_bins")])
+ bindist_dir = bindist_dir.realpath,
+ ))
+ execute_or_fail_loudly(ctx, [paths.join(".", unpack_dir, "patch_bins")])

# As the patches may touch the package DB we regenerate the cache.
if len(ctx.attr.patches) > 0:

0 comments on commit cda9c41

Please sign in to comment.