Skip to content

Commit

Permalink
Attempt to output a file rather than directory for make build
Browse files Browse the repository at this point in the history
  • Loading branch information
jsharpe committed Mar 9, 2021
1 parent daa047f commit c519ff0
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions for_workspace/make_build.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,24 @@ def _make_tool(ctx):

cc_toolchain = find_cpp_toolchain(ctx)

# we need this fictive file in the root to get the path of the root in the script
empty = fictive_file_in_genroot(ctx.actions, ctx.label.name)

make = ctx.actions.declare_directory("make")
make = ctx.actions.declare_file("bin/make")
script = [
"##script_prelude##",
"export EXT_BUILD_ROOT=##pwd##",
"export INSTALLDIR=$$EXT_BUILD_ROOT$$/" + empty.file.dirname + "/" + ctx.attr.name,
"export BUILD_TMPDIR=$$INSTALLDIR$$.build_tmpdir",
"export BUILD_TMPDIR={}.build_tmpdir".format(make.root.path),
"##mkdirs## $$BUILD_TMPDIR$$",
"##copy_dir_contents_to_dir## ./{} $BUILD_TMPDIR".format(root),
"cd $$BUILD_TMPDIR$$",
"./configure --disable-dependency-tracking --prefix=$$EXT_BUILD_ROOT$$/{}".format(make.path),
"./configure --disable-dependency-tracking --prefix=$$BUILD_TMPDIR$$/install",
"./build.sh",
"touch aclocal.m4 configure Makefile.am Makefile.in po/*.in doc/*.in doc/*.am doc/make.info doc/make.info* doc/make.1",
"./make install",
empty.script,
"cp -L ./make {}".format(make.path),
]
script_text = convert_shell_script(ctx, script)

ctx.actions.run_shell(
mnemonic = "BootstrapMake",
inputs = ctx.attr.make_srcs.files,
outputs = [make, empty.file],
outputs = [make],
tools = cc_toolchain.all_files,
use_default_shell_env = True,
command = script_text,
Expand Down

0 comments on commit c519ff0

Please sign in to comment.