|
@@ -24,7 +24,7 @@ on_rtd = os.environ.get('READTHEDOCS')
|
|
|
|
|
|
# msgpack pure python data corruption was fixed in 0.4.6.
|
|
# msgpack pure python data corruption was fixed in 0.4.6.
|
|
# Also, we might use some rather recent API features.
|
|
# Also, we might use some rather recent API features.
|
|
-install_requires = ['msgpack-python>=0.4.6', 'zstandard', ]
|
|
|
|
|
|
+install_requires = ['msgpack-python>=0.4.6', ]
|
|
|
|
|
|
# note for package maintainers: if you package borgbackup for distribution,
|
|
# note for package maintainers: if you package borgbackup for distribution,
|
|
# please add llfuse as a *requirement* on all platforms that have a working
|
|
# please add llfuse as a *requirement* on all platforms that have a working
|
|
@@ -155,10 +155,20 @@ def detect_libb2(prefixes):
|
|
return prefix
|
|
return prefix
|
|
|
|
|
|
|
|
|
|
|
|
+def detect_libzstd(prefixes):
|
|
|
|
+ for prefix in prefixes:
|
|
|
|
+ filename = os.path.join(prefix, 'include', 'zstd.h')
|
|
|
|
+ if os.path.exists(filename):
|
|
|
|
+ with open(filename, 'r') as fd:
|
|
|
|
+ if 'ZSTD_getFrameContentSize' in fd.read():
|
|
|
|
+ return prefix
|
|
|
|
+
|
|
|
|
+
|
|
include_dirs = []
|
|
include_dirs = []
|
|
library_dirs = []
|
|
library_dirs = []
|
|
define_macros = []
|
|
define_macros = []
|
|
crypto_libraries = ['crypto']
|
|
crypto_libraries = ['crypto']
|
|
|
|
+compression_libraries = ['lz4']
|
|
|
|
|
|
possible_openssl_prefixes = ['/usr', '/usr/local', '/usr/local/opt/openssl', '/usr/local/ssl', '/usr/local/openssl',
|
|
possible_openssl_prefixes = ['/usr', '/usr/local', '/usr/local/opt/openssl', '/usr/local/ssl', '/usr/local/openssl',
|
|
'/usr/local/borg', '/opt/local', '/opt/pkg', ]
|
|
'/usr/local/borg', '/opt/local', '/opt/pkg', ]
|
|
@@ -194,6 +204,18 @@ if libb2_prefix:
|
|
crypto_libraries.append('b2')
|
|
crypto_libraries.append('b2')
|
|
define_macros.append(('BORG_USE_LIBB2', 'YES'))
|
|
define_macros.append(('BORG_USE_LIBB2', 'YES'))
|
|
|
|
|
|
|
|
+possible_libzstd_prefixes = ['/usr', '/usr/local', '/usr/local/opt/libzstd', '/usr/local/libzstd',
|
|
|
|
+ '/usr/local/borg', '/opt/local', '/opt/pkg', ]
|
|
|
|
+if os.environ.get('BORG_LIBZSTD_PREFIX'):
|
|
|
|
+ possible_libzstd_prefixes.insert(0, os.environ.get('BORG_LIBZSTD_PREFIX'))
|
|
|
|
+libzstd_prefix = detect_libzstd(possible_libzstd_prefixes)
|
|
|
|
+if libzstd_prefix:
|
|
|
|
+ print('Detected and preferring libzstd over bundled ZSTD')
|
|
|
|
+ include_dirs.append(os.path.join(libzstd_prefix, 'include'))
|
|
|
|
+ library_dirs.append(os.path.join(libzstd_prefix, 'lib'))
|
|
|
|
+ compression_libraries.append('zstd')
|
|
|
|
+ define_macros.append(('BORG_USE_LIBZSTD', 'YES'))
|
|
|
|
+
|
|
|
|
|
|
with open('README.rst', 'r') as fd:
|
|
with open('README.rst', 'r') as fd:
|
|
long_description = fd.read()
|
|
long_description = fd.read()
|
|
@@ -754,7 +776,7 @@ cmdclass = {
|
|
ext_modules = []
|
|
ext_modules = []
|
|
if not on_rtd:
|
|
if not on_rtd:
|
|
ext_modules += [
|
|
ext_modules += [
|
|
- Extension('borg.compress', [compress_source], libraries=['lz4'], include_dirs=include_dirs, library_dirs=library_dirs, define_macros=define_macros),
|
|
|
|
|
|
+ Extension('borg.compress', [compress_source], libraries=compression_libraries, include_dirs=include_dirs, library_dirs=library_dirs, define_macros=define_macros),
|
|
Extension('borg.crypto.low_level', [crypto_ll_source], libraries=crypto_libraries, include_dirs=include_dirs, library_dirs=library_dirs, define_macros=define_macros),
|
|
Extension('borg.crypto.low_level', [crypto_ll_source], libraries=crypto_libraries, include_dirs=include_dirs, library_dirs=library_dirs, define_macros=define_macros),
|
|
Extension('borg.hashindex', [hashindex_source]),
|
|
Extension('borg.hashindex', [hashindex_source]),
|
|
Extension('borg.item', [item_source]),
|
|
Extension('borg.item', [item_source]),
|