1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 01:37:20 +00:00
borg/setup_compress.py

32 lines
1.2 KiB
Python
Raw Normal View History

# Support code for building a C extension with compression code
import os
def zstd_ext_kwargs(pc, system_prefix):
if system_prefix:
print('Detected and preferring libzstd [via BORG_LIBZSTD_PREFIX]')
return dict(include_dirs=[os.path.join(system_prefix, 'include')],
library_dirs=[os.path.join(system_prefix, 'lib')],
libraries=['zstd'])
if pc and pc.installed('libzstd', '>= 1.3.0'):
print('Detected and preferring libzstd [via pkg-config]')
return pc.parse('libzstd')
raise Exception('Could not find zstd lib/headers, please set BORG_LIBZSTD_PREFIX')
2019-03-12 02:44:43 +00:00
def lz4_ext_kwargs(pc, system_prefix):
if system_prefix:
print('Detected and preferring liblz4 [via BORG_LIBLZ4_PREFIX]')
return dict(include_dirs=[os.path.join(system_prefix, 'include')],
library_dirs=[os.path.join(system_prefix, 'lib')],
libraries=['lz4'])
if pc and pc.installed('liblz4', '>= 1.7.0'):
print('Detected and preferring liblz4 [via pkg-config]')
return pc.parse('liblz4')
raise Exception('Could not find lz4 lib/headers, please set BORG_LIBLZ4_PREFIX')