Skip to content

Commit

Permalink
Merge pull request #7875 from steelman/acl_pc
Browse files Browse the repository at this point in the history
linux: use pkgconfig to find libacl
  • Loading branch information
ThomasWaldmann committed Oct 24, 2023
2 parents 9108039 + c68a158 commit e1c75e8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/usage/general/environment.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ Directories and files:
Building:
BORG_OPENSSL_PREFIX
Adds given OpenSSL header file directory to the default locations (setup.py).
BORG_LIBACL_PREFIX
Adds given prefix directory to the default locations. If an 'include/acl/libacl.h' is found
Borg will be linked against the system libacl instead of a bundled implementation. (setup.py)
BORG_LIBLZ4_PREFIX
Adds given prefix directory to the default locations. If a 'include/lz4.h' is found Borg
will be linked against the system liblz4 instead of a bundled implementation. (setup.py)
Expand Down
14 changes: 13 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@ def lib_ext_kwargs(pc, prefix_env_var, lib_name, lib_pkg_name, pc_version, lib_s
dict(extra_compile_args=cflags),
)

if sys.platform == "linux":
linux_ext_kwargs = members_appended(
dict(sources=[platform_linux_source]),
lib_ext_kwargs(pc, "BORG_LIBACL_PREFIX", "acl", "libacl", ">=2.3.1"),
dict(extra_compile_args=cflags),
)
else:
linux_ext_kwargs = members_appended(
dict(sources=[platform_linux_source], libraries=["acl"], extra_compile_args=cflags),
)

# note: _chunker.c and _hashindex.c are relatively complex/large pieces of handwritten C code,
# thus we undef NDEBUG for them, so the compiled code will contain and execute assert().
ext_modules += [
Expand All @@ -198,7 +209,8 @@ def lib_ext_kwargs(pc, prefix_env_var, lib_name, lib_pkg_name, pc_version, lib_s
]

posix_ext = Extension("borg.platform.posix", [platform_posix_source], extra_compile_args=cflags)
linux_ext = Extension("borg.platform.linux", [platform_linux_source], libraries=["acl"], extra_compile_args=cflags)
linux_ext = Extension("borg.platform.linux", **linux_ext_kwargs)

syncfilerange_ext = Extension(
"borg.platform.syncfilerange", [platform_syncfilerange_source], extra_compile_args=cflags
)
Expand Down

0 comments on commit e1c75e8

Please sign in to comment.