Skip to content

Commit a3b67a4

Browse files
committed
add detection for the musl search path file
Maybe this should be parsed, it may add search paths which are not relevant. Possibly the detected library paths could be used to build this file manually near the end of the build process Signed-off-by: Zen <[email protected]>
1 parent 5c8e49b commit a3b67a4

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/ugrd/base/core.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__author__ = "desultory"
2-
__version__ = "4.4.1"
2+
__version__ = "4.5.0"
33

4-
from os import environ, makedev, mknod
4+
from os import environ, makedev, mknod, uname
55
from pathlib import Path
66
from shutil import rmtree, which
77
from stat import S_IFCHR
@@ -24,6 +24,7 @@ def _has_zstd() -> bool:
2424

2525
class DecompressorError(Exception):
2626
"""Custom exception for decompressor errors."""
27+
2728
pass
2829

2930

@@ -333,6 +334,17 @@ def autodetect_libgcc(self) -> None:
333334
self["library_paths"] = str(source_path.parent)
334335

335336

337+
def autodetect_musl(self) -> None:
338+
"""Looks for /etc/ld-musl-<arch>.path
339+
If it exists, adds it to the dependencies list.
340+
"""
341+
arch = uname().machine
342+
musl_path = Path(f"/etc/ld-musl-{arch}.path")
343+
if musl_path.exists():
344+
self.logger.info("Detected musl searcg path: %s" % c_(musl_path, "cyan"))
345+
self["dependencies"] = musl_path
346+
347+
336348
def _process_out_file(self, out_file: str) -> None:
337349
"""Processes the out_file.
338350

src/ugrd/base/core.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ timeout = 15
3333
]
3434

3535
[imports.build_enum]
36-
"ugrd.base.core" = [ "get_tmpdir", "autodetect_libgcc", "get_shell" ]
36+
"ugrd.base.core" = [ "get_tmpdir", "autodetect_libgcc", "autodetect_musl", "get_shell" ]
3737

3838
[imports.build_pre]
3939
"ugrd.base.core" = [ "clean_build_dir" ]

0 commit comments

Comments
 (0)