mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-23 00:07:38 +00:00
Allow extra compiler flags for every extension build
This is mainly intended for explicit warnings but it can be used for other flags as well.
This commit is contained in:
parent
9a8fb9c902
commit
820de65562
1 changed files with 19 additions and 9 deletions
28
setup.py
28
setup.py
|
@ -78,6 +78,13 @@
|
||||||
'nofuse': [],
|
'nofuse': [],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Extra cflags for all extensions, usually just warnings we want to explicitly enable
|
||||||
|
cflags = [
|
||||||
|
'-Wall',
|
||||||
|
'-Wextra',
|
||||||
|
'-Wpointer-arith',
|
||||||
|
]
|
||||||
|
|
||||||
compress_source = 'src/borg/compress.pyx'
|
compress_source = 'src/borg/compress.pyx'
|
||||||
crypto_ll_source = 'src/borg/crypto/low_level.pyx'
|
crypto_ll_source = 'src/borg/crypto/low_level.pyx'
|
||||||
crypto_helpers = 'src/borg/crypto/_crypto_helpers.c'
|
crypto_helpers = 'src/borg/crypto/_crypto_helpers.c'
|
||||||
|
@ -174,34 +181,37 @@ def members_appended(*ds):
|
||||||
crypto_ext_kwargs = members_appended(
|
crypto_ext_kwargs = members_appended(
|
||||||
dict(sources=[crypto_ll_source, crypto_helpers]),
|
dict(sources=[crypto_ll_source, crypto_helpers]),
|
||||||
setup_crypto.crypto_ext_kwargs(pc, system_prefix_openssl),
|
setup_crypto.crypto_ext_kwargs(pc, system_prefix_openssl),
|
||||||
|
dict(extra_compile_args=cflags),
|
||||||
)
|
)
|
||||||
|
|
||||||
compress_ext_kwargs = members_appended(
|
compress_ext_kwargs = members_appended(
|
||||||
dict(sources=[compress_source]),
|
dict(sources=[compress_source]),
|
||||||
setup_compress.lz4_ext_kwargs(pc, system_prefix_liblz4),
|
setup_compress.lz4_ext_kwargs(pc, system_prefix_liblz4),
|
||||||
setup_compress.zstd_ext_kwargs(pc, system_prefix_libzstd),
|
setup_compress.zstd_ext_kwargs(pc, system_prefix_libzstd),
|
||||||
|
dict(extra_compile_args=cflags),
|
||||||
)
|
)
|
||||||
|
|
||||||
checksums_ext_kwargs = members_appended(
|
checksums_ext_kwargs = members_appended(
|
||||||
dict(sources=[checksums_source]),
|
dict(sources=[checksums_source]),
|
||||||
setup_checksums.xxhash_ext_kwargs(pc, system_prefix_libxxhash),
|
setup_checksums.xxhash_ext_kwargs(pc, system_prefix_libxxhash),
|
||||||
|
dict(extra_compile_args=cflags),
|
||||||
)
|
)
|
||||||
|
|
||||||
ext_modules += [
|
ext_modules += [
|
||||||
Extension('borg.crypto.low_level', **crypto_ext_kwargs),
|
Extension('borg.crypto.low_level', **crypto_ext_kwargs),
|
||||||
Extension('borg.compress', **compress_ext_kwargs),
|
Extension('borg.compress', **compress_ext_kwargs),
|
||||||
Extension('borg.hashindex', [hashindex_source]),
|
Extension('borg.hashindex', [hashindex_source], extra_compile_args=cflags),
|
||||||
Extension('borg.item', [item_source]),
|
Extension('borg.item', [item_source], extra_compile_args=cflags),
|
||||||
Extension('borg.chunker', [chunker_source]),
|
Extension('borg.chunker', [chunker_source], extra_compile_args=cflags),
|
||||||
Extension('borg.algorithms.checksums', **checksums_ext_kwargs),
|
Extension('borg.algorithms.checksums', **checksums_ext_kwargs),
|
||||||
]
|
]
|
||||||
|
|
||||||
posix_ext = Extension('borg.platform.posix', [platform_posix_source])
|
posix_ext = Extension('borg.platform.posix', [platform_posix_source], extra_compile_args=cflags)
|
||||||
linux_ext = Extension('borg.platform.linux', [platform_linux_source], libraries=['acl'])
|
linux_ext = Extension('borg.platform.linux', [platform_linux_source], libraries=['acl'], extra_compile_args=cflags)
|
||||||
syncfilerange_ext = Extension('borg.platform.syncfilerange', [platform_syncfilerange_source])
|
syncfilerange_ext = Extension('borg.platform.syncfilerange', [platform_syncfilerange_source], extra_compile_args=cflags)
|
||||||
freebsd_ext = Extension('borg.platform.freebsd', [platform_freebsd_source])
|
freebsd_ext = Extension('borg.platform.freebsd', [platform_freebsd_source], extra_compile_args=cflags)
|
||||||
darwin_ext = Extension('borg.platform.darwin', [platform_darwin_source])
|
darwin_ext = Extension('borg.platform.darwin', [platform_darwin_source], extra_compile_args=cflags)
|
||||||
windows_ext = Extension('borg.platform.windows', [platform_windows_source])
|
windows_ext = Extension('borg.platform.windows', [platform_windows_source], extra_compile_args=cflags)
|
||||||
|
|
||||||
if not is_win32:
|
if not is_win32:
|
||||||
ext_modules.append(posix_ext)
|
ext_modules.append(posix_ext)
|
||||||
|
|
Loading…
Reference in a new issue