Skip to content

Commit 2f6ce6e

Browse files
committed
checksums: refresh vendored blake3
Verbatim drop of the c/ sources upstream 1.8.5 Move vendored-related building into a separate SConscript, that now picks blake3 sources explicitly by arch.
1 parent 3f3ebee commit 2f6ce6e

22 files changed

Lines changed: 3513 additions & 549 deletions

lib/SConscript

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -85,35 +85,12 @@ sh_formatter = env.Command(
8585
'formats/sh.c', ['formats/sh.c.in', 'formats/sh.sh'], build_sh_formatter
8686
)
8787

88-
blake3 = Glob('checksums/blake3/*.[cS]')
89-
if not env['HAVE_AVX2']:
90-
print('Not compiling blake3 avx2 options')
91-
blake3 = [f for f in blake3 if 'avx2' not in f.path]
92-
env.Append(CCFLAGS=['-DBLAKE3_NO_AVX2'])
93-
94-
if not env['HAVE_AVX512F'] or not env['HAVE_AVX512VL']:
95-
print('Not compiling blake3 avx512 options')
96-
blake3 = [f for f in blake3 if 'avx512' not in f.path]
97-
env.Append(CCFLAGS=['-DBLAKE3_NO_AVX512'])
98-
99-
if not env['HAVE_SSE4_1']:
100-
print('Not compiling blake3 sse41 options')
101-
blake3 = [f for f in blake3 if 'sse41' not in f.path]
102-
env.Append(CCFLAGS=['-DBLAKE3_NO_SSE41'])
103-
104-
if not env['HAVE_SSE2']:
105-
print('Not compiling blake3 sse2 options')
106-
blake3 = [f for f in blake3 if 'sse2' not in f.path]
107-
env.Append(CCFLAGS=['-DBLAKE3_NO_SSE2'])
88+
checksums = SConscript('checksums/SConscript', exports='env')
10889

10990
library = env.Library(
11091
'../rmlint',
111-
Glob('*.c') +
112-
Glob('checksums/*.c') +
113-
Glob('checksums/xxhash/*.c') +
114-
Glob('checksums/blake2/*.c') +
115-
blake3 +
116-
Glob('checksums/sha3/*.c') +
92+
Glob('*.c') +
93+
checksums +
11794
Glob('formats/*.c') +
11895
Glob('fts/*.c')
11996
)

lib/checksums/SConscript

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Import('env')
2+
3+
import platform
4+
5+
6+
blake3 = Glob('blake3/*.[cS]')
7+
blake3_machine = platform.machine().lower()
8+
9+
# Windows-only blake3 assembly files are vendored, ignore them for now.
10+
blake3 = [f for f in blake3 if '_windows_' not in f.path]
11+
12+
if blake3_machine in ('x86_64', 'amd64'):
13+
# remove C intrinsics when we should use the assembly version
14+
blake3_intrinsics = (
15+
'blake3_sse2.c', 'blake3_sse41.c', 'blake3_avx2.c', 'blake3_avx512.c'
16+
)
17+
blake3 = [f for f in blake3 if f.name not in blake3_intrinsics]
18+
else:
19+
# the assembly is x86-64-only
20+
blake3 = [f for f in blake3 if not f.path.endswith('.S')]
21+
22+
if blake3_machine != 'aarch64':
23+
blake3 = [f for f in blake3 if 'neon' not in f.path]
24+
25+
if not env['HAVE_AVX2']:
26+
print('Not compiling blake3 avx2 options')
27+
blake3 = [f for f in blake3 if 'avx2' not in f.path]
28+
env.Append(CCFLAGS=['-DBLAKE3_NO_AVX2'])
29+
30+
if not env['HAVE_AVX512F'] or not env['HAVE_AVX512VL']:
31+
print('Not compiling blake3 avx512 options')
32+
blake3 = [f for f in blake3 if 'avx512' not in f.path]
33+
env.Append(CCFLAGS=['-DBLAKE3_NO_AVX512'])
34+
35+
if not env['HAVE_SSE4_1']:
36+
print('Not compiling blake3 sse41 options')
37+
blake3 = [f for f in blake3 if 'sse41' not in f.path]
38+
env.Append(CCFLAGS=['-DBLAKE3_NO_SSE41'])
39+
40+
if not env['HAVE_SSE2']:
41+
print('Not compiling blake3 sse2 options')
42+
blake3 = [f for f in blake3 if 'sse2' not in f.path]
43+
env.Append(CCFLAGS=['-DBLAKE3_NO_SSE2'])
44+
45+
sources = (
46+
Glob('*.c') +
47+
Glob('xxhash/*.c') +
48+
Glob('blake2/*.c') +
49+
blake3 +
50+
Glob('sha3/*.c')
51+
)
52+
53+
Return('sources')
Lines changed: 0 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,3 @@
1-
This work is released into the public domain with CC0 1.0. Alternatively, it is
2-
licensed under the Apache License 2.0.
3-
4-
-------------------------------------------------------------------------------
5-
6-
Creative Commons Legal Code
7-
8-
CC0 1.0 Universal
9-
10-
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
11-
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
12-
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
13-
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
14-
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
15-
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
16-
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
17-
HEREUNDER.
18-
19-
Statement of Purpose
20-
21-
The laws of most jurisdictions throughout the world automatically confer
22-
exclusive Copyright and Related Rights (defined below) upon the creator
23-
and subsequent owner(s) (each and all, an "owner") of an original work of
24-
authorship and/or a database (each, a "Work").
25-
26-
Certain owners wish to permanently relinquish those rights to a Work for
27-
the purpose of contributing to a commons of creative, cultural and
28-
scientific works ("Commons") that the public can reliably and without fear
29-
of later claims of infringement build upon, modify, incorporate in other
30-
works, reuse and redistribute as freely as possible in any form whatsoever
31-
and for any purposes, including without limitation commercial purposes.
32-
These owners may contribute to the Commons to promote the ideal of a free
33-
culture and the further production of creative, cultural and scientific
34-
works, or to gain reputation or greater distribution for their Work in
35-
part through the use and efforts of others.
36-
37-
For these and/or other purposes and motivations, and without any
38-
expectation of additional consideration or compensation, the person
39-
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
40-
is an owner of Copyright and Related Rights in the Work, voluntarily
41-
elects to apply CC0 to the Work and publicly distribute the Work under its
42-
terms, with knowledge of his or her Copyright and Related Rights in the
43-
Work and the meaning and intended legal effect of CC0 on those rights.
44-
45-
1. Copyright and Related Rights. A Work made available under CC0 may be
46-
protected by copyright and related or neighboring rights ("Copyright and
47-
Related Rights"). Copyright and Related Rights include, but are not
48-
limited to, the following:
49-
50-
i. the right to reproduce, adapt, distribute, perform, display,
51-
communicate, and translate a Work;
52-
ii. moral rights retained by the original author(s) and/or performer(s);
53-
iii. publicity and privacy rights pertaining to a person's image or
54-
likeness depicted in a Work;
55-
iv. rights protecting against unfair competition in regards to a Work,
56-
subject to the limitations in paragraph 4(a), below;
57-
v. rights protecting the extraction, dissemination, use and reuse of data
58-
in a Work;
59-
vi. database rights (such as those arising under Directive 96/9/EC of the
60-
European Parliament and of the Council of 11 March 1996 on the legal
61-
protection of databases, and under any national implementation
62-
thereof, including any amended or successor version of such
63-
directive); and
64-
vii. other similar, equivalent or corresponding rights throughout the
65-
world based on applicable law or treaty, and any national
66-
implementations thereof.
67-
68-
2. Waiver. To the greatest extent permitted by, but not in contravention
69-
of, applicable law, Affirmer hereby overtly, fully, permanently,
70-
irrevocably and unconditionally waives, abandons, and surrenders all of
71-
Affirmer's Copyright and Related Rights and associated claims and causes
72-
of action, whether now known or unknown (including existing as well as
73-
future claims and causes of action), in the Work (i) in all territories
74-
worldwide, (ii) for the maximum duration provided by applicable law or
75-
treaty (including future time extensions), (iii) in any current or future
76-
medium and for any number of copies, and (iv) for any purpose whatsoever,
77-
including without limitation commercial, advertising or promotional
78-
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
79-
member of the public at large and to the detriment of Affirmer's heirs and
80-
successors, fully intending that such Waiver shall not be subject to
81-
revocation, rescission, cancellation, termination, or any other legal or
82-
equitable action to disrupt the quiet enjoyment of the Work by the public
83-
as contemplated by Affirmer's express Statement of Purpose.
84-
85-
3. Public License Fallback. Should any part of the Waiver for any reason
86-
be judged legally invalid or ineffective under applicable law, then the
87-
Waiver shall be preserved to the maximum extent permitted taking into
88-
account Affirmer's express Statement of Purpose. In addition, to the
89-
extent the Waiver is so judged Affirmer hereby grants to each affected
90-
person a royalty-free, non transferable, non sublicensable, non exclusive,
91-
irrevocable and unconditional license to exercise Affirmer's Copyright and
92-
Related Rights in the Work (i) in all territories worldwide, (ii) for the
93-
maximum duration provided by applicable law or treaty (including future
94-
time extensions), (iii) in any current or future medium and for any number
95-
of copies, and (iv) for any purpose whatsoever, including without
96-
limitation commercial, advertising or promotional purposes (the
97-
"License"). The License shall be deemed effective as of the date CC0 was
98-
applied by Affirmer to the Work. Should any part of the License for any
99-
reason be judged legally invalid or ineffective under applicable law, such
100-
partial invalidity or ineffectiveness shall not invalidate the remainder
101-
of the License, and in such case Affirmer hereby affirms that he or she
102-
will not (i) exercise any of his or her remaining Copyright and Related
103-
Rights in the Work or (ii) assert any associated claims and causes of
104-
action with respect to the Work, in either case contrary to Affirmer's
105-
express Statement of Purpose.
106-
107-
4. Limitations and Disclaimers.
108-
109-
a. No trademark or patent rights held by Affirmer are waived, abandoned,
110-
surrendered, licensed or otherwise affected by this document.
111-
b. Affirmer offers the Work as-is and makes no representations or
112-
warranties of any kind concerning the Work, express, implied,
113-
statutory or otherwise, including without limitation warranties of
114-
title, merchantability, fitness for a particular purpose, non
115-
infringement, or the absence of latent or other defects, accuracy, or
116-
the present or absence of errors, whether or not discoverable, all to
117-
the greatest extent permissible under applicable law.
118-
c. Affirmer disclaims responsibility for clearing rights of other persons
119-
that may apply to the Work or any use thereof, including without
120-
limitation any person's Copyright and Related Rights in the Work.
121-
Further, Affirmer disclaims responsibility for obtaining any necessary
122-
consents, permissions or other rights required for any use of the
123-
Work.
124-
d. Affirmer understands and acknowledges that Creative Commons is not a
125-
party to this document and has no duty or obligation with respect to
126-
this CC0 or use of the Work.
127-
128-
-------------------------------------------------------------------------------
1291

1302
Apache License
1313
Version 2.0, January 2004

0 commit comments

Comments
 (0)