Patch /usr/bin/file to file when on nixos (#30718)
These changes make many packages build on nixos where nearly nothing comes from /bin or /usr/bin (the only things in "system locations" are /bin/sh and /usr/bin/env, all the rest is found through PATH). Many configuration scripts hardcode /usr/bin/file instead of using the one from PATH. This patches them to use file from PATH.
This commit is contained in:
parent
9df2c7190f
commit
f237e669f2
@ -238,6 +238,15 @@ def runs_ok(script_abs_path):
|
||||
fs.copy(substitutes[name], abs_path)
|
||||
os.chmod(abs_path, mode)
|
||||
|
||||
@run_before("configure")
|
||||
def _patch_usr_bin_file(self):
|
||||
"""On NixOS file is not available in /usr/bin/file. Patch configure
|
||||
scripts to use file from path."""
|
||||
|
||||
if self.spec.os.startswith("nixos"):
|
||||
for configure_file in fs.find(".", files=["configure"], recursive=True):
|
||||
fs.filter_file("/usr/bin/file", "file", configure_file, string=True)
|
||||
|
||||
@run_before("configure")
|
||||
def _set_autotools_environment_variables(self):
|
||||
"""Many autotools builds use a version of mknod.m4 that fails when
|
||||
|
Loading…
Reference in New Issue
Block a user