Skip to content

Commit

Permalink
OpenBSD only - statically link OpenSSL (borgbackup#6474)
Browse files Browse the repository at this point in the history
Avoid conflicting with shared libcrypto from the base OS pulled in via
dependencies.
  • Loading branch information
bket committed Sep 10, 2022
1 parent b6469bb commit 730fca5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,23 @@ def lib_ext_kwargs(pc, prefix_env_var, lib_name, lib_pkg_name, pc_version, lib_s
f"or ensure {lib_pkg_name}.pc is in PKG_CONFIG_PATH."
)

crypto_ldflags = []
crypto_extra_objects = []
if is_win32:
crypto_ext_lib = lib_ext_kwargs(pc, "BORG_OPENSSL_PREFIX", "libcrypto", "libcrypto", ">=1.1.1", lib_subdir="")
elif is_openbsd:
# use openssl (not libressl) because we need AES-OCB and CHACHA20-POLY1305 via EVP api
crypto_ext_lib = lib_ext_kwargs(pc, "BORG_OPENSSL_PREFIX", "crypto", "libecrypto11", ">=1.1.1")
crypto_ldflags += ["-Wl,-rpath=/usr/local/lib/eopenssl11"]
# Use openssl (not libressl) because we need AES-OCB via EVP api. Link
# it statically to avoid conflicting with shared libcrypto from the base
# OS pulled in via dependencies.
crypto_ext_lib = {"include_dirs": ["/usr/local/include/eopenssl11"]}
crypto_extra_objects += ["/usr/local/lib/eopenssl11/libcrypto.a"]
else:
crypto_ext_lib = lib_ext_kwargs(pc, "BORG_OPENSSL_PREFIX", "crypto", "libcrypto", ">=1.1.1")

crypto_ext_kwargs = members_appended(
dict(sources=[crypto_ll_source]),
crypto_ext_lib,
dict(extra_compile_args=cflags),
dict(extra_link_args=crypto_ldflags),
dict(extra_objects=crypto_extra_objects),
)

compress_ext_kwargs = members_appended(
Expand Down

0 comments on commit 730fca5

Please sign in to comment.