Skip to content

Commit

Permalink
Use cc_wrapper in Cabal rules
Browse files Browse the repository at this point in the history
  • Loading branch information
aherrmann committed Oct 10, 2019
1 parent a511324 commit 5096ca2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions haskell/cabal.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def _prepare_cabal_inputs(hs, cc, unix, dep_info, cc_info, component, package_id
"%{ghc_pkg}": hs.tools.ghc_pkg.path,
"%{runghc}": hs.tools.runghc.path,
"%{ar}": cc.tools.ar,
"%{cc}": cc.tools.cc,
"%{strip}": cc.tools.strip,
# XXX Workaround
# https://github.com/bazelbuild/bazel/issues/5980.
Expand Down
11 changes: 11 additions & 0 deletions haskell/private/cabal_wrapper.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ done
shift 1

ar=$(realpath %{ar})
cc=$(realpath %{cc})
strip=$(realpath %{strip})
distdir=$(mktemp -d)
libdir="$pkgroot/${name}_iface"
Expand All @@ -99,6 +100,15 @@ trap cleanup EXIT

%{ghc_pkg} recache --package-db=$package_database

WITH_GCC=
if [[ %{is_windows} != True ]]; then
# Use the cc-wrapper for Cabal builds.
# Note, we cannot currently use it on Windows because the solution to the
# following issue is not released, yet.
# https://github.com/bazelbuild/bazel/issues/9390
WITH_GCC="--with-gcc=$cc"
fi

ENABLE_RELOCATABLE=
if [[ %{is_windows} != True ]]; then
ENABLE_RELOCATABLE=--enable-relocatable
Expand All @@ -119,6 +129,7 @@ $execroot/%{runghc} $setup configure \
--with-compiler=$execroot/%{ghc} \
--with-hc-pkg=$execroot/%{ghc_pkg} \
--with-ar=$ar \
$WITH_GCC \
--with-strip=$strip \
--enable-deterministic \
$ENABLE_RELOCATABLE \
Expand Down

0 comments on commit 5096ca2

Please sign in to comment.