bazel-contrib / bazel-contrib/rules_foreign_cc
make install fails when --prefix needs to be an absolute path
- Dominant language
- Starlark
- Stars
- 737
- Forks
- 270
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to build nginx from sources. With nginx, it is fairly standard to set `--prefix` to an absolute path. For example, the default value is `/usr/local/nginx`.
http://nginx.org/en/docs/configure.html
If I try to use `install_prefix` to do this, rules_foreign_cc still appends `$$BUILD_TMPDIR$$` to my install_prefix. This will make nginx think its config and such are in /some/long/bazel/tmpdir/usr/local/nginx.
It seems that the correct tool to use in this case is DESTDIR. I want to be able to set --prefix like any other arg I pass to configure, then use DESTDIR to install it in the tmp dir.
Here is a patch that seems to accomplish what I want:
https://gist.github.com/aptenodytes-forsteri/99f84a715b481db59442cde579c432b1
Here is an example of building nginx from sources:
```
filegroup(
name = "srcs",
srcs = glob(["**/*"]),
)
configure_make(
name = "nginx_all",
args = ["--debug"],
configure_in_place = True,
configure_options = [
# Note that it is standard to have absolute paths here, so --prefix doesn't work.
"--sbin-path=/usr/sbin/nginx",
"--modules-path=/usr/lib/nginx/modules",
"--conf-path=/etc/nginx/nginx.conf",
"--pid-path=/var/run/nginx/nginx.pid",
"--lock-path=/var/run/nginx/nginx.lock",
# Redacted - some other flags to include nginx modules
],
lib_source = ":srcs",
# This matches the --sbin-path flag above
out_bin_dir = "usr/sbin",
out_binaries = ["nginx"],
# This is the part I added in my patch.
override_install_prefix = "/usr/share/nginx"
)
```
cc: @alexeagle
Contributor guide
Assessment
This issue has not been assessed yet.