瀏覽代碼

Merge pull request #5937 from ThomasWaldmann/fix-xxh-build-1.1

fix xxh64 related build
TW 3 年之前
父節點
當前提交
70ba2513f0
共有 3 個文件被更改,包括 699 次插入249 次删除
  1. 7 4
      setup.py
  2. 5 3
      setup_xxhash.py
  3. 687 242
      src/borg/algorithms/xxh64/xxhash.h

+ 7 - 4
setup.py

@@ -222,8 +222,10 @@ libxxhash_prefix = setup_xxhash.xxhash_system_prefix(possible_libxxhash_prefixes
 if prefer_system_libxxhash and libxxhash_prefix:
     print('Detected and preferring libxxhash over bundled XXHASH')
     define_macros.append(('BORG_USE_LIBXXHASH', 'YES'))
+    define_macros.append(('XXH_PRIVATE_API', 'YES'))  # do not use this for bundled zstd or xxh64, breaks the build
     libxxhash_system = True
 else:
+    define_macros.append(('XXH_VECTOR', '0'))  # avoid compile issues with CPU specific stuff
     libxxhash_system = False
 
 
@@ -811,10 +813,11 @@ if not on_rtd:
     crypto_ext_kwargs = setup_b2.b2_ext_kwargs(bundled_path='src/borg/algorithms/blake2',
                                                system_prefix=libb2_prefix, system=libb2_system,
                                                **crypto_ext_kwargs)
-
-    crypto_ext_kwargs = setup_xxhash.xxhash_ext_kwargs(bundled_path='src/borg/algorithms/xxh64',
+    checksums_ext_kwargs = dict(sources=[checksums_source], include_dirs=include_dirs, library_dirs=library_dirs,
+                                define_macros=define_macros)
+    checksums_ext_kwargs = setup_xxhash.xxhash_ext_kwargs(bundled_path='src/borg/algorithms/xxh64',
                                                system_prefix=libxxhash_prefix, system=libxxhash_system,
-                                               **crypto_ext_kwargs)
+                                               **checksums_ext_kwargs)
 
     msgpack_macros = []  # setup.py of msgpack 0.5.6 defines __LITTLE_ENDIAN__ / __BIG_ENDIAN__ - which
                          # leads to troubles when trying cross-platform builds, see borg issue #6105.
@@ -844,7 +847,7 @@ if not on_rtd:
         Extension('borg.hashindex', [hashindex_source]),
         Extension('borg.item', [item_source]),
         Extension('borg.chunker', [chunker_source]),
-        Extension('borg.algorithms.checksums', [checksums_source]),
+        Extension('borg.algorithms.checksums', **checksums_ext_kwargs),
     ]
     if not sys.platform.startswith(('win32', )):
         ext_modules.append(Extension('borg.platform.posix', [platform_posix_source]))

+ 5 - 3
setup_xxhash.py

@@ -13,11 +13,11 @@ import os
 # xxhash files, structure as seen in XXHASH (reference implementation) project repository:
 
 xxhash_sources = [
-    'xxhash.c',
+#    'xxhash.c',  # do not compile xxhash.c (it is included by xxhash-libselect.h)
 ]
 
 xxhash_includes = [
-    '.',
+    '',
 ]
 
 
@@ -67,7 +67,9 @@ def xxhash_ext_kwargs(bundled_path, system_prefix=None, system=False, **kwargs):
     if not use_system:
         extra_compile_args += []  # not used yet
 
+    define_macros = kwargs.get('define_macros', [])
+
     ret = dict(**kwargs)
-    ret.update(dict(sources=sources, extra_compile_args=extra_compile_args,
+    ret.update(dict(sources=sources, extra_compile_args=extra_compile_args, define_macros=define_macros,
                     include_dirs=include_dirs, library_dirs=library_dirs, libraries=libraries))
     return ret

File diff suppressed because it is too large
+ 687 - 242
src/borg/algorithms/xxh64/xxhash.h


Some files were not shown because too many files changed in this diff