2019-03-13 23:15:17 +00:00
|
|
|
# Support code for building a C extension with compression code
|
2017-12-04 22:59:35 +00:00
|
|
|
|
|
|
|
import os
|
|
|
|
|
2019-03-13 23:15:17 +00:00
|
|
|
|
2022-02-26 21:18:12 +00:00
|
|
|
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'])
|
2019-03-13 23:15:17 +00:00
|
|
|
|
2022-02-26 21:18:12 +00:00
|
|
|
if pc and pc.installed('libzstd', '>= 1.3.0'):
|
|
|
|
print('Detected and preferring libzstd [via pkg-config]')
|
|
|
|
return pc.parse('libzstd')
|
2019-03-13 23:15:17 +00:00
|
|
|
|
2022-02-26 21:18:12 +00:00
|
|
|
raise Exception('Could not find zstd lib/headers, please set BORG_LIBZSTD_PREFIX')
|
2017-12-05 03:16:25 +00:00
|
|
|
|
2019-03-12 02:44:43 +00:00
|
|
|
|
2022-02-26 21:18:12 +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'])
|
2017-12-04 22:59:35 +00:00
|
|
|
|
2022-02-26 21:18:12 +00:00
|
|
|
if pc and pc.installed('liblz4', '>= 1.7.0'):
|
|
|
|
print('Detected and preferring liblz4 [via pkg-config]')
|
|
|
|
return pc.parse('liblz4')
|
2017-12-04 22:59:35 +00:00
|
|
|
|
2022-02-26 21:18:12 +00:00
|
|
|
raise Exception('Could not find lz4 lib/headers, please set BORG_LIBLZ4_PREFIX')
|