Skip to content

Commit e1c75e8

Browse files
Merge pull request #7875 from steelman/acl_pc
linux: use pkgconfig to find libacl
2 parents 9108039 + c68a158 commit e1c75e8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

docs/usage/general/environment.rst.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ Directories and files:
194194
Building:
195195
BORG_OPENSSL_PREFIX
196196
Adds given OpenSSL header file directory to the default locations (setup.py).
197+
BORG_LIBACL_PREFIX
198+
Adds given prefix directory to the default locations. If an 'include/acl/libacl.h' is found
199+
Borg will be linked against the system libacl instead of a bundled implementation. (setup.py)
197200
BORG_LIBLZ4_PREFIX
198201
Adds given prefix directory to the default locations. If a 'include/lz4.h' is found Borg
199202
will be linked against the system liblz4 instead of a bundled implementation. (setup.py)

setup.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,17 @@ def lib_ext_kwargs(pc, prefix_env_var, lib_name, lib_pkg_name, pc_version, lib_s
186186
dict(extra_compile_args=cflags),
187187
)
188188

189+
if sys.platform == "linux":
190+
linux_ext_kwargs = members_appended(
191+
dict(sources=[platform_linux_source]),
192+
lib_ext_kwargs(pc, "BORG_LIBACL_PREFIX", "acl", "libacl", ">=2.3.1"),
193+
dict(extra_compile_args=cflags),
194+
)
195+
else:
196+
linux_ext_kwargs = members_appended(
197+
dict(sources=[platform_linux_source], libraries=["acl"], extra_compile_args=cflags),
198+
)
199+
189200
# note: _chunker.c and _hashindex.c are relatively complex/large pieces of handwritten C code,
190201
# thus we undef NDEBUG for them, so the compiled code will contain and execute assert().
191202
ext_modules += [
@@ -198,7 +209,8 @@ def lib_ext_kwargs(pc, prefix_env_var, lib_name, lib_pkg_name, pc_version, lib_s
198209
]
199210

200211
posix_ext = Extension("borg.platform.posix", [platform_posix_source], extra_compile_args=cflags)
201-
linux_ext = Extension("borg.platform.linux", [platform_linux_source], libraries=["acl"], extra_compile_args=cflags)
212+
linux_ext = Extension("borg.platform.linux", **linux_ext_kwargs)
213+
202214
syncfilerange_ext = Extension(
203215
"borg.platform.syncfilerange", [platform_syncfilerange_source], extra_compile_args=cflags
204216
)

0 commit comments

Comments
 (0)