Skip to content

Commit cf6a324

Browse files
committed
borg2 - Support other OpenSSL versions on OpenBSD
`setup.py` hardcoded crypto library paths for OpenBSD, causing build issue when OpenBSD drops specific OpenSSL version. Solution is to make paths configurable. Addresses borgbackup#8553.
1 parent d1b2884 commit cf6a324

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

Vagrantfile

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def packages_openbsd
8484
pkg_add openssl%3.0
8585
pkg_add py3-pip
8686
pkg_add py3-virtualenv
87+
echo 'export BORG_OPENSSL_NAME=eopenssl30' >> ~vagrant/.bash_profile
8788
EOF
8889
end
8990

docs/man/borg.1

+3
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,9 @@ operations), see \fI\%tempfile\fP for details.
662662
.B Building:
663663
.INDENT 7.0
664664
.TP
665+
.B BORG_OPENSSL_NAME
666+
Defines the subdirectory name for OpenSSL (setup.py).
667+
.TP
665668
.B BORG_OPENSSL_PREFIX
666669
Adds given OpenSSL header file directory to the default locations (setup.py).
667670
.TP

docs/usage/general/environment.rst.inc

+2
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ Directories and files:
198198
operations), see tempfile_ for details.
199199

200200
Building:
201+
BORG_OPENSSL_NAME
202+
Defines the subdirectory name for OpenSSL (setup.py).
201203
BORG_OPENSSL_PREFIX
202204
Adds given OpenSSL header file directory to the default locations (setup.py).
203205
BORG_LIBACL_PREFIX

setup.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,23 @@ def lib_ext_kwargs(pc, prefix_env_var, lib_name, lib_pkg_name, pc_version, lib_s
132132
f"or ensure {lib_pkg_name}.pc is in PKG_CONFIG_PATH."
133133
)
134134

135-
crypto_extra_objects = []
136135
if is_win32:
137136
crypto_ext_lib = lib_ext_kwargs(pc, "BORG_OPENSSL_PREFIX", "libcrypto", "libcrypto", ">=1.1.1", lib_subdir="")
138137
elif is_openbsd:
139138
# Use openssl (not libressl) because we need AES-OCB via EVP api. Link
140139
# it statically to avoid conflicting with shared libcrypto from the base
141140
# OS pulled in via dependencies.
142-
crypto_ext_lib = {"include_dirs": ["/usr/local/include/eopenssl30"]}
143-
crypto_extra_objects += ["/usr/local/lib/eopenssl30/libcrypto.a"]
141+
openssl_prefix = os.environ.get("BORG_OPENSSL_PREFIX", "/usr/local")
142+
openssl_name = os.environ.get("BORG_OPENSSL_NAME", "eopenssl33")
143+
crypto_ext_lib = dict(
144+
include_dirs=[os.path.join(openssl_prefix, "include", openssl_name)],
145+
extra_objects=[os.path.join(openssl_prefix, "lib", openssl_name, "libcrypto.a")],
146+
)
144147
else:
145148
crypto_ext_lib = lib_ext_kwargs(pc, "BORG_OPENSSL_PREFIX", "crypto", "libcrypto", ">=1.1.1")
146149

147150
crypto_ext_kwargs = members_appended(
148-
dict(sources=[crypto_ll_source]),
149-
crypto_ext_lib,
150-
dict(extra_compile_args=cflags),
151-
dict(extra_objects=crypto_extra_objects),
151+
dict(sources=[crypto_ll_source]), crypto_ext_lib, dict(extra_compile_args=cflags)
152152
)
153153

154154
compress_ext_kwargs = members_appended(

0 commit comments

Comments
 (0)