Skip to content

The animation engine for agents: blazingly fast math and 3D videos with Manim's Python API, on a Rust GPU core.

Python

Build portable, authenticated native dependencies

Sina Atalay9e027b6772e1
diff --git a/LICENSE-DXC b/LICENSE-DXC
new file mode 100644
index 00000000..e3758f2b
--- /dev/null
+++ b/LICENSE-DXC
@@ -0,0 +1,1606 @@
+The Windows wheels include Microsoft's DirectX Shader Compiler (DXC v1.9.2609),
+loaded from dxcompiler.dll beside the engine. The optional dxil.dll validator is
+not included. The compiler is distributed under the University of Illinois/NCSA
+Open Source License, with the additional notices below.
+
+Compiler source: https://github.com/microsoft/DirectXShaderCompiler/tree/01b62ad47db7dee3dd33f90e7339cf9e860b3f93
+Official distribution: https://github.com/microsoft/DirectXShaderCompiler/releases/tag/v1.9.2609
+SHA-256 of dxc_2026_09_29.zip: ad31b1fc8443175d204f77a611fdb3ef2ec42759bdc2f1167368de24a4a7e7f1
+
+The complete-source archive includes both the unmodified compiler distribution
+and this matching source with its three pinned Git submodules. rust/dxc/README.md
+describes reconstructing and building the compiler offline. rust/dxc stages the
+appropriate compiler for the target;
+the source includes Microsoft's CMake build files and instructions for rebuilding
+it. The following are the source release's complete LICENSE.TXT and
+ThirdPartyNotices.txt, including their descriptions of which components they cover.
+
+==============================================================================
+LLVM Release License
+==============================================================================
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2003-2015 University of Illinois at Urbana-Champaign.
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+
+==============================================================================
+Copyrights and Licenses for Third Party Software Distributed with LLVM:
+==============================================================================
+The LLVM software contains code written by third parties. Such software will
+have its own individual LICENSE.TXT file in the directory in which it appears.
+This file will describe the copyrights, license, and restrictions which apply
+to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source License
+applies to all code in the LLVM Distribution, and nothing in any of the
+other licenses gives permission to use the names of the LLVM Team or the
+University of Illinois to endorse or promote products derived from this
+Software.
+
+------------------
+
+Files: lib/Miniz/* include/miniz/*
+
+Copyright 2013-2014 RAD Game Tools and Valve Software
+Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
+
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+------------------
+
+Files: lib/Miniz/miniz.c
+
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
+
+------------------
+
+Files: lib/Support/* docs/SystemLibrary.rst
+
+Written by Henry Spencer. Not derived from licensed software.
+
+Permission is granted to anyone to use this software for any
+purpose on any computer system, and to redistribute it freely,
+subject to the following restrictions:
+
+1. The author is not responsible for the consequences of use of
+ this software, no matter how awful, even if they arise
+ from defects in it.
+
+2. The origin of this software must not be misrepresented, either
+ by explicit claim or by omission.
+
+3. Altered versions must be plainly marked as such, and must not
+ be misrepresented as being the original software.
+
+------------------
+
+Files: include/llvm/Support/ConvertUTF.h
+
+Copyright 2001-2004 Unicode, Inc.
+
+Disclaimer
+
+This source code is provided as is by Unicode, Inc. No claims are
+made as to fitness for any particular purpose. No warranties of any
+kind are expressed or implied. The recipient agrees to determine
+applicability of information provided. If this file has been
+purchased on magnetic or optical media from Unicode, Inc., the
+sole remedy for any claim will be exchange of defective media
+within 90 days of receipt.
+
+Limitations on Rights to Redistribute This Code
+
+Unicode, Inc. hereby grants the right to freely use the information
+supplied in this file in the creation of products supporting the
+Unicode Standard, and to make copies of this file in any form
+for internal or external distribution as long as this notice
+remains attached.
+
+------------------
+
+Files: include/llvm/Support/MD5.h
+
+This software was written by Alexander Peslyak in 2001. No copyright is
+claimed, and the software is hereby placed in the public domain.
+In case this attempt to disclaim copyright and place the software in the
+public domain is deemed null and void, then the software is
+Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
+general public under the following terms:
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted.
+
+There's ABSOLUTELY NO WARRANTY, express or implied.
+
+------------------
+
+Files: lib/Support/regstrlcpy.c
+
+Copyright (c) 1998 Todd C. Miller <[email protected]>
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+
+
+------------------
+------------------
+
+THE FOLLOWING LICENSES ARE FOR BUILD AND TEST DEPENDENCIES ONLY.
+
+------------------
+------------------
+
+Files: utils/unittest/googletest/*
+
+Copyright 2008, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+------------------
+
+Files: utils/unittest/googlemock/*
+
+Copyright 2008, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+------------------
+
+Files: test/YamlParser/*
+
+Copyright (c) 2006 Kirill Simonov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+------------------
+
+Files: autoconf/config.guess
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+Autoconf Exception
+
+As a special exception, the Free Software Foundation gives unlimited
+permission to copy, distribute and modify the configure scripts that are the
+output of Autoconf. You need not follow the terms of the GNU General Public
+License when using or distributing such scripts, even though portions of the
+text of Autoconf appear in them. The GNU General Public License (GPL) does
+govern all other use of the material that constitutes the Autoconf program.
+
+Certain portions of the Autoconf source text are designed to be copied (in
+certain cases, depending on the input) into the output of Autoconf. We call
+these the "data" portions. The rest of the Autoconf source text consists of
+comments plus executable code that decides which of the data portions to
+output in any given case. We call these comments and executable code the "non-
+data" portions. Autoconf never copies any of the non-data portions into its
+output.
+
+This special exception to the GPL applies to versions of Autoconf released by
+the Free Software Foundation. When you make and distribute a modified version
+of Autoconf, you may extend this special exception to the GPL to apply to your
+modified version as well, *unless* your modified version has the potential to
+copy into its output some of the text that was the non-data portion of the
+version that you started with. (In other words, unless your change moves or
+copies text from the non-data portions to the data portions.) If your
+modification has such potential, you must delete any notice of this special
+exception to the GPL from your modified version.
+
+ END OF TERMS AND CONDITIONS
+
+===============================================================================
+ThirdPartyNotices.txt
+===============================================================================
+Microsoft/DirectXShaderCompiler
+
+THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
+
+Do Not Translate or Localize
+
+This project incorporates components from the projects listed below. The
+original copyright notices and the licenses under which Microsoft received
+such components are set forth below. Microsoft reserves all rights not
+expressly granted herein, whether by implication, estoppel or otherwise.
+
+
+* LLVM
+
+==============================================================================
+LLVM Release License
+==============================================================================
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2003-2015 University of Illinois at Urbana-Champaign.
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+
+==============================================================================
+Copyrights and Licenses for Third Party Software Distributed with LLVM:
+==============================================================================
+The LLVM software contains code written by third parties. Such software will
+have its own individual LICENSE.TXT file in the directory in which it appears.
+This file will describe the copyrights, license, and restrictions which apply
+to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source License
+applies to all code in the LLVM Distribution, and nothing in any of the
+other licenses gives permission to use the names of the LLVM Team or the
+University of Illinois to endorse or promote products derived from this
+Software.
+
+The following pieces of software have additional or alternate copyrights,
+licenses, and/or restrictions:
+
+Program Directory
+------- ---------
+OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
+pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
+md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
+
+
+* tools\clang
+
+==============================================================================
+LLVM Release License
+==============================================================================
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2007-2015 University of Illinois at Urbana-Champaign.
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+
+==============================================================================
+The LLVM software contains code written by third parties. Such software will
+have its own individual LICENSE.TXT file in the directory in which it appears.
+This file will describe the copyrights, license, and restrictions which apply
+to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source License
+applies to all code in the LLVM Distribution, and nothing in any of the
+other licenses gives permission to use the names of the LLVM Team or the
+University of Illinois to endorse or promote products derived from this
+Software.
+
+
+* test\YAMLParser
+
+Copyright (c) 2006 Kirill Simonov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+* include\llvm\Support
+
+LLVM System Interface Library
+-------------------------------------------------------------------------------
+The LLVM System Interface Library is licensed under the Illinois Open Source
+License and has the following additional copyright:
+
+Copyright (C) 2004 eXtensible Systems, Inc.
+
+* OpenBSD regex
+
+$OpenBSD: COPYRIGHT,v 1.3 2003/06/02 20:18:36 millert Exp $
+
+Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
+This software is not subject to any license of the American Telephone
+and Telegraph Company or of the Regents of the University of California.
+
+Permission is granted to anyone to use this software for any purpose on
+any computer system, and to alter it and redistribute it, subject
+to the following restrictions:
+
+1. The author is not responsible for the consequences of use of this
+ software, no matter how awful, even if they arise from flaws in it.
+
+2. The origin of this software must not be misrepresented, either by
+ explicit claim or by omission. Since few users ever read sources,
+ credits must appear in the documentation.
+
+3. Altered versions must be plainly marked as such, and must not be
+ misrepresented as being the original software. Since few users
+ ever read sources, credits must appear in the documentation.
+
+4. This notice may not be removed or altered.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/*-
+ * Copyright (c) 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94
+ */
+
+* lib\Headers Files
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+==============================================================================
+DirectX-Headers (980971e835876dc0cde415e8f9bc646e64667bf7)
+==============================================================================
+Copyright (c) Microsoft Corporation.
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+==============================================================================
+SPIRV-Headers (496543121ce6419f23d6fa5d7194ba66c36212d2)
+==============================================================================
+Files: All files except for those called out below.
+Copyright (c) 2015-2024 The Khronos Group Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and/or associated documentation files (the
+"Materials"), to deal in the Materials without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Materials, and to
+permit persons to whom the Materials are furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Materials.
+
+MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+ https://www.khronos.org/registry/
+
+THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+---
+
+Files: include/spirv/spir-v.xml
+Copyright (c) 2015-2024 The Khronos Group Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and/or associated documentation files (the
+"Materials"), to deal in the Materials without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Materials, and to
+permit persons to whom the Materials are furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Materials.
+
+THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+---
+
+Files: tools/buildHeaders/jsoncpp/*
+The JsonCpp library's source code, including accompanying documentation,
+tests and demonstration applications, are licensed under the following
+conditions...
+
+The author (Baptiste Lepilleur) explicitly disclaims copyright in all
+jurisdictions which recognize such a disclaimer. In such jurisdictions,
+this software is released into the Public Domain.
+
+In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
+2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
+released under the terms of the MIT License (see below).
+
+In jurisdictions which recognize Public Domain property, the user of this
+software may choose to accept it either as 1) Public Domain, 2) under the
+conditions of the MIT License (see below), or 3) under the terms of dual
+Public Domain/MIT License conditions described here, as they choose.
+
+The MIT License is about as close to Public Domain as a license can get, and is
+described in clear, concise terms at:
+
+ http://en.wikipedia.org/wiki/MIT_License
+
+The full text of the MIT License follows:
+
+========================================================================
+Copyright (c) 2007-2010 Baptiste Lepilleur
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use, copy,
+modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+========================================================================
+
+---
+
+Files: **.md, WORKSPACE, .git**
+
+Attribution 4.0 International
+
+=======================================================================
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+ Considerations for licensors: Our public licenses are
+ intended for use by those authorized to give the public
+ permission to use material in ways otherwise restricted by
+ copyright and certain other rights. Our licenses are
+ irrevocable. Licensors should read and understand the terms
+ and conditions of the license they choose before applying it.
+ Licensors should also secure all rights necessary before
+ applying our licenses so that the public can reuse the
+ material as expected. Licensors should clearly mark any
+ material not subject to the license. This includes other CC-
+ licensed material, or material used under an exception or
+ limitation to copyright. More considerations for licensors:
+ wiki.creativecommons.org/Considerations_for_licensors
+
+ Considerations for the public: By using one of our public
+ licenses, a licensor grants the public permission to use the
+ licensed material under specified terms and conditions. If
+ the licensor's permission is not necessary for any reason--for
+ example, because of any applicable exception or limitation to
+ copyright--then that use is not regulated by the license. Our
+ licenses grant only permissions under copyright and certain
+ other rights that a licensor has authority to grant. Use of
+ the licensed material may still be restricted for other
+ reasons, including because others have copyright or other
+ rights in the material. A licensor may make special requests,
+ such as asking that all changes be marked or described.
+ Although not required by our licenses, you are encouraged to
+ respect those requests where reasonable. More considerations
+ for the public:
+ wiki.creativecommons.org/Considerations_for_licensees
+
+=======================================================================
+
+Creative Commons Attribution 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution 4.0 International Public License ("Public License"). To the
+extent this Public License may be interpreted as a contract, You are
+granted the Licensed Rights in consideration of Your acceptance of
+these terms and conditions, and the Licensor grants You such rights in
+consideration of benefits the Licensor receives from making the
+Licensed Material available under these terms and conditions.
+
+
+Section 1 -- Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar
+ Rights that is derived from or based upon the Licensed Material
+ and in which the Licensed Material is translated, altered,
+ arranged, transformed, or otherwise modified in a manner requiring
+ permission under the Copyright and Similar Rights held by the
+ Licensor. For purposes of this Public License, where the Licensed
+ Material is a musical work, performance, or sound recording,
+ Adapted Material is always produced where the Licensed Material is
+ synched in timed relation with a moving image.
+
+ b. Adapter's License means the license You apply to Your Copyright
+ and Similar Rights in Your contributions to Adapted Material in
+ accordance with the terms and conditions of this Public License.
+
+ c. Copyright and Similar Rights means copyright and/or similar rights
+ closely related to copyright including, without limitation,
+ performance, broadcast, sound recording, and Sui Generis Database
+ Rights, without regard to how the rights are labeled or
+ categorized. For purposes of this Public License, the rights
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
+ Rights.
+
+ d. Effective Technological Measures means those measures that, in the
+ absence of proper authority, may not be circumvented under laws
+ fulfilling obligations under Article 11 of the WIPO Copyright
+ Treaty adopted on December 20, 1996, and/or similar international
+ agreements.
+
+ e. Exceptions and Limitations means fair use, fair dealing, and/or
+ any other exception or limitation to Copyright and Similar Rights
+ that applies to Your use of the Licensed Material.
+
+ f. Licensed Material means the artistic or literary work, database,
+ or other material to which the Licensor applied this Public
+ License.
+
+ g. Licensed Rights means the rights granted to You subject to the
+ terms and conditions of this Public License, which are limited to
+ all Copyright and Similar Rights that apply to Your use of the
+ Licensed Material and that the Licensor has authority to license.
+
+ h. Licensor means the individual(s) or entity(ies) granting rights
+ under this Public License.
+
+ i. Share means to provide material to the public by any means or
+ process that requires permission under the Licensed Rights, such
+ as reproduction, public display, public performance, distribution,
+ dissemination, communication, or importation, and to make material
+ available to the public including in ways that members of the
+ public may access the material from a place and at a time
+ individually chosen by them.
+
+ j. Sui Generis Database Rights means rights other than copyright
+ resulting from Directive 96/9/EC of the European Parliament and of
+ the Council of 11 March 1996 on the legal protection of databases,
+ as amended and/or succeeded, as well as other essentially
+ equivalent rights anywhere in the world.
+
+ k. You means the individual or entity exercising the Licensed Rights
+ under this Public License. Your has a corresponding meaning.
+
+
+Section 2 -- Scope.
+
+ a. License grant.
+
+ 1. Subject to the terms and conditions of this Public License,
+ the Licensor hereby grants You a worldwide, royalty-free,
+ non-sublicensable, non-exclusive, irrevocable license to
+ exercise the Licensed Rights in the Licensed Material to:
+
+ a. reproduce and Share the Licensed Material, in whole or
+ in part; and
+
+ b. produce, reproduce, and Share Adapted Material.
+
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
+ Exceptions and Limitations apply to Your use, this Public
+ License does not apply, and You do not need to comply with
+ its terms and conditions.
+
+ 3. Term. The term of this Public License is specified in Section
+ 6(a).
+
+ 4. Media and formats; technical modifications allowed. The
+ Licensor authorizes You to exercise the Licensed Rights in
+ all media and formats whether now known or hereafter created,
+ and to make technical modifications necessary to do so. The
+ Licensor waives and/or agrees not to assert any right or
+ authority to forbid You from making technical modifications
+ necessary to exercise the Licensed Rights, including
+ technical modifications necessary to circumvent Effective
+ Technological Measures. For purposes of this Public License,
+ simply making modifications authorized by this Section 2(a)
+ (4) never produces Adapted Material.
+
+ 5. Downstream recipients.
+
+ a. Offer from the Licensor -- Licensed Material. Every
+ recipient of the Licensed Material automatically
+ receives an offer from the Licensor to exercise the
+ Licensed Rights under the terms and conditions of this
+ Public License.
+
+ b. No downstream restrictions. You may not offer or impose
+ any additional or different terms or conditions on, or
+ apply any Effective Technological Measures to, the
+ Licensed Material if doing so restricts exercise of the
+ Licensed Rights by any recipient of the Licensed
+ Material.
+
+ 6. No endorsement. Nothing in this Public License constitutes or
+ may be construed as permission to assert or imply that You
+ are, or that Your use of the Licensed Material is, connected
+ with, or sponsored, endorsed, or granted official status by,
+ the Licensor or others designated to receive attribution as
+ provided in Section 3(a)(1)(A)(i).
+
+ b. Other rights.
+
+ 1. Moral rights, such as the right of integrity, are not
+ licensed under this Public License, nor are publicity,
+ privacy, and/or other similar personality rights; however, to
+ the extent possible, the Licensor waives and/or agrees not to
+ assert any such rights held by the Licensor to the limited
+ extent necessary to allow You to exercise the Licensed
+ Rights, but not otherwise.
+
+ 2. Patent and trademark rights are not licensed under this
+ Public License.
+
+ 3. To the extent possible, the Licensor waives any right to
+ collect royalties from You for the exercise of the Licensed
+ Rights, whether directly or through a collecting society
+ under any voluntary or waivable statutory or compulsory
+ licensing scheme. In all other cases the Licensor expressly
+ reserves any right to collect such royalties.
+
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+ a. Attribution.
+
+ 1. If You Share the Licensed Material (including in modified
+ form), You must:
+
+ a. retain the following if it is supplied by the Licensor
+ with the Licensed Material:
+
+ i. identification of the creator(s) of the Licensed
+ Material and any others designated to receive
+ attribution, in any reasonable manner requested by
+ the Licensor (including by pseudonym if
+ designated);
+
+ ii. a copyright notice;
+
+ iii. a notice that refers to this Public License;
+
+ iv. a notice that refers to the disclaimer of
+ warranties;
+
+ v. a URI or hyperlink to the Licensed Material to the
+ extent reasonably practicable;
+
+ b. indicate if You modified the Licensed Material and
+ retain an indication of any previous modifications; and
+
+ c. indicate the Licensed Material is licensed under this
+ Public License, and include the text of, or the URI or
+ hyperlink to, this Public License.
+
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
+ reasonable manner based on the medium, means, and context in
+ which You Share the Licensed Material. For example, it may be
+ reasonable to satisfy the conditions by providing a URI or
+ hyperlink to a resource that includes the required
+ information.
+
+ 3. If requested by the Licensor, You must remove any of the
+ information required by Section 3(a)(1)(A) to the extent
+ reasonably practicable.
+
+ 4. If You Share Adapted Material You produce, the Adapter's
+ License You apply must not prevent recipients of the Adapted
+ Material from complying with this Public License.
+
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+ to extract, reuse, reproduce, and Share all or a substantial
+ portion of the contents of the database;
+
+ b. if You include all or a substantial portion of the database
+ contents in a database in which You have Sui Generis Database
+ Rights, then the database in which You have Sui Generis Database
+ Rights (but not its individual contents) is Adapted Material; and
+
+ c. You must comply with the conditions in Section 3(a) if You Share
+ all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+ c. The disclaimer of warranties and limitation of liability provided
+ above shall be interpreted in a manner that, to the extent
+ possible, most closely approximates an absolute disclaimer and
+ waiver of all liability.
+
+
+Section 6 -- Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and
+ Similar Rights licensed here. However, if You fail to comply with
+ this Public License, then Your rights under this Public License
+ terminate automatically.
+
+ b. Where Your right to use the Licensed Material has terminated under
+ Section 6(a), it reinstates:
+
+ 1. automatically as of the date the violation is cured, provided
+ it is cured within 30 days of Your discovery of the
+ violation; or
+
+ 2. upon express reinstatement by the Licensor.
+
+ For the avoidance of doubt, this Section 6(b) does not affect any
+ right the Licensor may have to seek remedies for Your violations
+ of this Public License.
+
+ c. For the avoidance of doubt, the Licensor may also offer the
+ Licensed Material under separate terms or conditions or stop
+ distributing the Licensed Material at any time; however, doing so
+ will not terminate this Public License.
+
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+ License.
+
+
+Section 7 -- Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different
+ terms or conditions communicated by You unless expressly agreed.
+
+ b. Any arrangements, understandings, or agreements regarding the
+ Licensed Material not stated herein are separate from and
+ independent of the terms and conditions of this Public License.
+
+
+Section 8 -- Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and
+ shall not be interpreted to, reduce, limit, restrict, or impose
+ conditions on any use of the Licensed Material that could lawfully
+ be made without permission under this Public License.
+
+ b. To the extent possible, if any provision of this Public License is
+ deemed unenforceable, it shall be automatically reformed to the
+ minimum extent necessary to make it enforceable. If the provision
+ cannot be reformed, it shall be severed from this Public License
+ without affecting the enforceability of the remaining terms and
+ conditions.
+
+ c. No term or condition of this Public License will be waived and no
+ failure to comply consented to unless expressly agreed to by the
+ Licensor.
+
+ d. Nothing in this Public License constitutes or may be interpreted
+ as a limitation upon, or waiver of, any privileges and immunities
+ that apply to the Licensor or You, including from the legal
+ processes of any jurisdiction or authority.
+
+
+=======================================================================
+
+Creative Commons is not a party to its public
+licenses. Notwithstanding, Creative Commons may elect to apply one of
+its public licenses to material it publishes and in those instances
+will be considered the “Licensor.” The text of the Creative Commons
+public licenses is dedicated to the public domain under the CC0 Public
+Domain Dedication. Except for the limited purpose of indicating that
+material is shared under a Creative Commons public license or as
+otherwise permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the
+public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
+
+==============================================================================
+SPIRV-Tools (ef96ed763b43b59b33b31b362f09a02b729fa1c9)
+==============================================================================
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index 30e099e8..21ad9091 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -170,6 +170,17 @@ dependencies = [
"libloading",
]
+[[package]]
+name = "async-trait"
+version = "0.1.92"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.6",
+]
+
[[package]]
name = "atomic-waker"
version = "1.1.2"
@@ -405,6 +416,12 @@ dependencies = [
"wayland-client",
]
+[[package]]
+name = "cast"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
+
[[package]]
name = "cc"
version = "1.5.1"
@@ -879,6 +896,15 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76"
+[[package]]
+name = "dxc"
+version = "0.1.0"
+dependencies = [
+ "fetch",
+ "tempfile",
+ "zip",
+]
+
[[package]]
name = "ecow"
version = "0.2.6"
@@ -991,6 +1017,7 @@ name = "fetch"
version = "0.1.0"
dependencies = [
"sha2",
+ "tempfile",
]
[[package]]
@@ -2039,6 +2066,8 @@ dependencies = [
"bytemuck",
"console_error_panic_hook",
"cpal",
+ "dirs",
+ "dxc",
"ffmpeg",
"js-sys",
"libc",
@@ -2061,9 +2090,11 @@ dependencies = [
"wasm-bindgen",
"wasm-bindgen-cli-support",
"wasm-bindgen-futures",
+ "wasm-bindgen-test",
"web-sys",
"web-time",
"wgpu",
+ "windows-sys 0.61.2",
"winit",
"x264",
"xxhash-rust",
@@ -2094,6 +2125,16 @@ dependencies = [
"autocfg",
]
+[[package]]
+name = "minicov"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4869b6a491569605d66d3952bcdf03df789e5b536e5f0cf7758a7f08a55ae24d"
+dependencies = [
+ "cc",
+ "walkdir",
+]
+
[[package]]
name = "miniz_oxide"
version = "0.8.9"
@@ -2268,6 +2309,15 @@ dependencies = [
"jni-sys 0.3.1",
]
+[[package]]
+name = "nu-ansi-term"
+version = "0.50.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "num-bigint"
version = "0.4.8"
@@ -2687,6 +2737,12 @@ version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+[[package]]
+name = "oorandom"
+version = "11.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
+
[[package]]
name = "option-ext"
version = "0.2.0"
@@ -3924,6 +3980,19 @@ version = "0.13.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
+[[package]]
+name = "tempfile"
+version = "3.27.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
+dependencies = [
+ "fastrand",
+ "getrandom 0.4.3",
+ "once_cell",
+ "rustix 1.1.5",
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "termcolor"
version = "1.4.1"
@@ -4187,6 +4256,12 @@ version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
+[[package]]
+name = "typed-path"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e"
+
[[package]]
name = "typenum"
version = "1.20.1"
@@ -4865,6 +4940,45 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "wasm-bindgen-test"
+version = "0.3.78"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "45863ef0bef521c12124eb39d9a38513c47db75f22e503c06beacd40afeb35db"
+dependencies = [
+ "async-trait",
+ "cast",
+ "js-sys",
+ "libm",
+ "minicov",
+ "nu-ansi-term",
+ "num-traits",
+ "oorandom",
+ "serde",
+ "serde_json",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "wasm-bindgen-test-macro",
+ "wasm-bindgen-test-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-test-macro"
+version = "0.3.78"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c89dcab8b516b6b603baca9d550b7282d68fcc7f367e3956cff7ebf406a3f12"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.6",
+]
+
+[[package]]
+name = "wasm-bindgen-test-shared"
+version = "0.2.128"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f37b4f992cebe528ef34964ae69681ac0fe7080071e7298e46008f9d380302af"
+
[[package]]
name = "wasm-encoder"
version = "0.245.1"
@@ -5743,6 +5857,19 @@ dependencies = [
"syn 3.0.6",
]
+[[package]]
+name = "zip"
+version = "8.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b"
+dependencies = [
+ "crc32fast",
+ "flate2",
+ "indexmap",
+ "memchr",
+ "typed-path",
+]
+
[[package]]
name = "zlib-rs"
version = "0.6.8"
diff --git a/rust/dxc/Cargo.toml b/rust/dxc/Cargo.toml
new file mode 100644
index 00000000..026c5124
--- /dev/null
+++ b/rust/dxc/Cargo.toml
@@ -0,0 +1,14 @@
+[package]
+name = "dxc"
+version = "0.1.0"
+edition = "2024"
+license = "MIT"
+publish = false
+description = "The pinned DirectX shader compiler resource for Windows wheels and source builds."
+
+[dependencies]
+fetch = { path = "../fetch" }
+zip = { version = "8.6", default-features = false, features = ["deflate-flate2-zlib-rs"] }
+
+[dev-dependencies]
+tempfile = "3.27.0"
diff --git a/rust/dxc/README.md b/rust/dxc/README.md
new file mode 100644
index 00000000..b1557a6a
--- /dev/null
+++ b/rust/dxc/README.md
@@ -0,0 +1,35 @@
+# Windows shader compiler
+
+The wheel and editable installation carry the same pinned official `dxcompiler.dll`
+beside the engine. The engine selects it explicitly by absolute path. `dxil.dll` is
+optional with this compiler version and is not distributed. `LICENSE-DXC` carries
+the compiler's complete notices, including its SPIR-V dependencies.
+
+With `MANIMGX_SOURCES` set, this crate collects the original binary release and
+matching compiler source, plus every Git submodule at that revision. Ordinary
+non-Windows builds do not fetch DXC. The source bundle can build manimgx offline
+using the included compiler payload.
+
+To rebuild the compiler itself, unpack these source archives from the complete
+source bundle's `sources/` directory. These commands run in a shell with `tar`:
+
+```sh
+mkdir -p dxc-src
+tar -xf sources/01b62ad47db7dee3dd33f90e7339cf9e860b3f93.tar.gz -C dxc-src --strip-components=1
+mkdir -p dxc-src/external/DirectX-Headers dxc-src/external/SPIRV-Headers dxc-src/external/SPIRV-Tools
+tar -xf sources/980971e835876dc0cde415e8f9bc646e64667bf7.tar.gz -C dxc-src/external/DirectX-Headers --strip-components=1
+tar -xf sources/496543121ce6419f23d6fa5d7194ba66c36212d2.tar.gz -C dxc-src/external/SPIRV-Headers --strip-components=1
+tar -xf sources/ef96ed763b43b59b33b31b362f09a02b729fa1c9.tar.gz -C dxc-src/external/SPIRV-Tools --strip-components=1
+cmake -S dxc-src -B dxc-build -C dxc-src/cmake/caches/PredefinedParams.cmake \
+ -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=OFF -DHLSL_INCLUDE_TESTS=OFF \
+ -DSPIRV_BUILD_TESTS=OFF -DSPIRV_SKIP_TESTS=ON -DSPIRV_BUILD_FUZZER=OFF \
+ -DSPIRV_TOOLS_USE_MIMALLOC=OFF
+cmake --build dxc-build --config Release --target dxcompiler
+```
+
+DXC's `docs/BuildingAndTestingDXC.rst` describes the required C++ compiler, CMake,
+Python, and Windows SDK/WDK. Choose the generator and target architecture for your
+toolchain. Optional upstream test and fuzzing programs are disabled here; their
+separate dependencies are not part of the compiler library. The main source's
+`.gitmodules` has a stale `googletest` declaration, but the pinned Git tree contains
+only the three submodules above, none with nested Git submodules.
diff --git a/rust/dxc/src/lib.rs b/rust/dxc/src/lib.rs
new file mode 100644
index 00000000..5ee43453
--- /dev/null
+++ b/rust/dxc/src/lib.rs
@@ -0,0 +1,75 @@
+//! Windows' shader compiler is part of the engine's distribution, not a capability inferred
+//! from PATH. DXC is Microsoft's maintained compiler; FXC cannot compile our valid WGSL loops.
+//! The official release archive is pinned by bytes, and its corresponding source by its files.
+
+use std::{fs, path::Path};
+
+const BINARY_URL: &str = "https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.9.2609/dxc_2026_09_29.zip";
+const BINARY_HASH: &str = "ad31b1fc8443175d204f77a611fdb3ef2ec42759bdc2f1167368de24a4a7e7f1";
+const SOURCE_URL: &str = "https://github.com/microsoft/DirectXShaderCompiler/archive/01b62ad47db7dee3dd33f90e7339cf9e860b3f93.tar.gz";
+const SOURCE_HASH: &str = "2d6e2bfe4265ba123b4a3d4d0a4c245e32971e66ba06c2d3ccc30337199ef5ff";
+// GitHub's source archive omits these three gitlinks. DXC's SPIR-V backend uses them;
+// collect their exact revisions too, so its compiler can be rebuilt from the source bundle.
+const SUBMODULES: &[(&str, &str)] = &[
+ ("https://github.com/microsoft/DirectX-Headers/archive/980971e835876dc0cde415e8f9bc646e64667bf7.tar.gz", "44fda0c5e670cea86f6b890d7c4252c0c7b0b04cc5c8e292bb39b0d6ea00512d"),
+ ("https://github.com/KhronosGroup/SPIRV-Headers/archive/496543121ce6419f23d6fa5d7194ba66c36212d2.tar.gz", "5db9005d02b280ffb4c4605feb1e4e122dbdfeac673544d1bc26516f1f073c20"),
+ ("https://github.com/KhronosGroup/SPIRV-Tools/archive/ef96ed763b43b59b33b31b362f09a02b729fa1c9.tar.gz", "a2e2378712cd1a21fdbfc24c7fc8533df44b33ca0a051e258e2f3ddf3a7b2ee5"),
+];
+
+/// Stage DXC in the engine's OUT_DIR for maturin. A complete-source build on any platform
+/// collects both the distributable and its matching source; ordinary non-Windows builds do no
+/// DXC work. Only dxcompiler.dll is needed: since DXC 1.8.2502, dxil.dll is optional.
+pub fn prepare() {
+ println!("cargo:rerun-if-env-changed=MANIMGX_SOURCES");
+ let windows = std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows");
+ let collecting = std::env::var_os("MANIMGX_SOURCES").is_some();
+ if !windows && !collecting { return; }
+ let archive = fetch::file(BINARY_URL, BINARY_HASH);
+ if collecting {
+ fetch::tree(SOURCE_URL, SOURCE_HASH);
+ for (url, hash) in SUBMODULES { fetch::tree(url, hash); }
+ }
+ if windows {
+ let out = std::env::var_os("OUT_DIR").expect("a build script's OUT_DIR");
+ let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
+ extract(&archive, Path::new(&out), &arch).unwrap_or_else(|error| panic!("the bundled DXC: {error}"));
+ }
+}
+
+fn extract(archive: &Path, out: &Path, arch: &str) -> Result<(), Box<dyn std::error::Error>> {
+ let folder = match arch {
+ "x86_64" => "x64",
+ "aarch64" => "arm64",
+ _ => return Err(format!("DXC has no bundled compiler for {arch}").into()),
+ };
+ let mut zip = zip::ZipArchive::new(fs::File::open(archive)?)?;
+ let mut dll = zip.by_name(&format!("bin\\{folder}\\dxcompiler.dll"))?;
+ std::io::copy(&mut dll, &mut fs::File::create(out.join("dxcompiler.dll"))?)?;
+ Ok(())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use std::io::Write;
+
+ #[test]
+ fn only_the_target_compiler_is_staged() {
+ let work = tempfile::tempdir().unwrap();
+ let archive = work.path().join("compiler.zip");
+ let mut zip = zip::ZipWriter::new(fs::File::create(&archive).unwrap());
+ for (name, bytes) in [("bin\\x64\\dxcompiler.dll", "x64"), ("bin\\arm64\\dxcompiler.dll", "arm64"), ("bin\\x64\\dxil.dll", "optional validator")] {
+ zip.start_file(name, zip::write::SimpleFileOptions::default()).unwrap();
+ zip.write_all(bytes.as_bytes()).unwrap();
+ }
+ zip.finish().unwrap();
+ for (arch, bytes) in [("x86_64", "x64"), ("aarch64", "arm64")] {
+ let out = work.path().join(arch);
+ fs::create_dir(&out).unwrap();
+ extract(&archive, &out, arch).unwrap();
+ assert_eq!(fs::read_to_string(out.join("dxcompiler.dll")).unwrap(), bytes);
+ assert_eq!(fs::read_dir(out).unwrap().count(), 1);
+ }
+ assert!(extract(&archive, work.path(), "unknown").unwrap_err().to_string().contains("unknown"));
+ }
+}
diff --git a/rust/engine/Cargo.toml b/rust/engine/Cargo.toml
index 6003766d..566a1a17 100644
--- a/rust/engine/Cargo.toml
+++ b/rust/engine/Cargo.toml
@@ -18,9 +18,9 @@ crate-type = ["cdylib"]
[features]
default = ["python", "render", "export", "typeset", "window"]
python = ["dep:pyo3", "dep:ffmpeg", "dep:wasm-bindgen-cli-support", "dep:zstd"]
-render = ["dep:wgpu", "dep:ash", "dep:libc"]
+render = ["dep:wgpu", "dep:ash", "dep:libc", "dep:dxc", "dep:windows-sys"]
export = ["render", "dep:rusty_aac", "dep:x264"]
-typeset = ["dep:typst", "dep:typst-kit", "dep:typst-layout", "dep:ttf-parser", "dep:unicode-segmentation", "dep:mitex", "dep:mitex-spec-gen", "dep:bincode", "dep:memmap2"]
+typeset = ["dep:typst", "dep:typst-kit", "dep:typst-layout", "dep:ttf-parser", "dep:unicode-segmentation", "dep:mitex", "dep:mitex-spec-gen", "dep:bincode", "dep:memmap2", "dep:dirs"]
# the player (src/player.rs): takes played on a clock, with a face and a sound, on any screen
player = ["render", "dep:ruzstd", "dep:serde", "dep:serde_json", "dep:rustybuzz", "dep:ttf-parser", "dep:unicode-bidi", "dep:unicode-segmentation", "dep:web-time"]
window = ["python", "typeset", "player", "dep:winit", "dep:cpal"]
@@ -29,7 +29,7 @@ web = ["player", "dep:wasm-bindgen", "dep:wasm-bindgen-futures", "dep:js-sys", "
[dependencies]
bytemuck = { version = "1.25", features = ["derive", "extern_crate_alloc", "min_const_generics"] }
xxhash-rust = { version = "0.8.19", features = ["xxh3"] } # content keys: what names an upload
-pyo3 = { version = "0.29.2", features = ["abi3-py313", "extension-module"], optional = true }
+pyo3 = { version = "0.29.2", features = ["abi3-py313"], optional = true }
wgpu = { version = "30.0.1", optional = true }
# the typesetter: Typst as a library, its layout read directly (see src/typeset.rs)
typst = { version = "0.15.1", optional = true }
@@ -39,6 +39,7 @@ ttf-parser = { version = "0.25.1", optional = true } # glyph outlines and ligat
unicode-segmentation = { version = "1.12", optional = true } # graphemes: the characters a ligature's colors divide
bincode = { version = "1.3", optional = true } # the system fonts' scan, cached on disk
memmap2 = { version = "0.9", optional = true } # system fonts mapped, not read whole (a CJK font is 60 MB)
+dirs = { version = "6", optional = true } # the current user's cache directory
rusty_aac = { version = "0.5.0", optional = true } # sound out: AAC-LC in pure Rust (src/aac.rs)
# sound in: the common audio files decoded by FFmpeg, built from its source (src/audio.rs)
ffmpeg = { path = "../ffmpeg", optional = true }
@@ -79,11 +80,19 @@ cpal = { version = "0.18.2", optional = true }
ash = { version = "0.38", optional = true }
libc = { version = "0.2", optional = true }
-[dev-dependencies]
+# Find the engine's own module, so DXC is loaded beside it rather than searched for on PATH.
+[target.'cfg(windows)'.dependencies]
+windows-sys = { version = "0.61", features = ["Win32_System_LibraryLoader"], optional = true }
+
+[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
+wasm-bindgen-test = "=0.3.78"
+
+[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
zstd = { version = "0.14", default-features = false }
ruzstd = "0.9"
[build-dependencies]
+dxc = { path = "../dxc", optional = true }
wasm-bindgen-cli-support = { version = "=0.2.128", optional = true }
[lints.clippy]
diff --git a/rust/engine/build.rs b/rust/engine/build.rs
index 1b8ff814..986008d1 100644
--- a/rust/engine/build.rs
+++ b/rust/engine/build.rs
@@ -7,6 +7,8 @@
use std::path::{Path, PathBuf};
fn main() {
+ #[cfg(feature = "render")]
+ dxc::prepare();
println!("cargo::rustc-check-cfg=cfg(web_player)");
#[cfg(feature = "python")]
web_player();
@@ -31,7 +33,7 @@ fn web_player() {
.map_or_else(|| crate_dir.join("../target"), PathBuf::from)
.join("web-player");
let built = std::process::Command::new(std::env::var("CARGO").unwrap())
- .args(["build", "--lib", "--release", "--target", "wasm32-unknown-unknown", "--no-default-features", "--features", "web"])
+ .args(["build", "--locked", "--lib", "--release", "--target", "wasm32-unknown-unknown", "--no-default-features", "--features", "web"])
.arg("--target-dir")
.arg(&target)
.current_dir(&crate_dir)
diff --git a/rust/engine/src/dxc.rs b/rust/engine/src/dxc.rs
new file mode 100644
index 00000000..bad0ad30
--- /dev/null
+++ b/rust/engine/src/dxc.rs
@@ -0,0 +1,36 @@
+//! The DXC staged by the engine's build and included beside the extension by maturin. Its
+//! absolute path makes the compiler independent of the working directory and process PATH.
+
+use std::path::PathBuf;
+
+pub(super) fn compiler() -> Result<wgpu::Dx12Compiler, String> {
+ // Cargo runs its test executable from target's deps directory; maturin instead installs
+ // the extension and its resources together. Both load this build's exact staged compiler.
+ #[cfg(test)]
+ let path = PathBuf::from(env!("OUT_DIR")).join("dxcompiler.dll");
+ #[cfg(not(test))]
+ let path = module_path()?.with_file_name("dxcompiler.dll");
+ if !path.is_file() { return Err(format!("the engine's shader compiler is missing: {}", path.display())); }
+ Ok(wgpu::Dx12Compiler::DynamicDxc { dxc_path: path.to_str().ok_or("the shader compiler's path is not Unicode")?.to_owned() })
+}
+
+#[cfg(not(test))]
+fn module_path() -> Result<PathBuf, String> {
+ use std::ffi::OsString;
+ use std::os::windows::ffi::OsStringExt;
+ use windows_sys::Win32::System::LibraryLoader::{GetModuleFileNameW, GetModuleHandleExW, GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT};
+ unsafe {
+ let mut module = std::ptr::null_mut();
+ let flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT;
+ if GetModuleHandleExW(flags, compiler as *const u16, &mut module) == 0 {
+ return Err(format!("the engine cannot find its own module: {}", std::io::Error::last_os_error()));
+ }
+ // Windows' maximum extended path length, in UTF-16 code units.
+ let mut path = vec![0; 32768];
+ let length = GetModuleFileNameW(module, path.as_mut_ptr(), path.len() as u32) as usize;
+ if length == 0 || length == path.len() {
+ return Err(format!("the engine cannot find its own file: {}", std::io::Error::last_os_error()));
+ }
+ Ok(PathBuf::from(OsString::from_wide(&path[..length])))
+ }
+}
diff --git a/rust/fetch/Cargo.toml b/rust/fetch/Cargo.toml
index 89bb8ed5..15c062ca 100644
--- a/rust/fetch/Cargo.toml
+++ b/rust/fetch/Cargo.toml
@@ -8,3 +8,4 @@ description = "Others' sources for a build script: fetched at build time, named
[dependencies]
sha2 = "0.11.0"
+tempfile = "3.27.0"
diff --git a/rust/fetch/src/bin/fetch-file.rs b/rust/fetch/src/bin/fetch-file.rs
new file mode 100644
index 00000000..90508e8a
--- /dev/null
+++ b/rust/fetch/src/bin/fetch-file.rs
@@ -0,0 +1,11 @@
+//! Use the build scripts' verified source store from release tooling. OUT_DIR holds the
+//! verified file under its hash; MANIMGX_SOURCES retains the original download for reuse.
+
+fn main() {
+ let args: Vec<_> = std::env::args().skip(1).collect();
+ let [url, hash] = args.as_slice() else {
+ eprintln!("usage: fetch-file URL SHA256 (OUT_DIR and optionally MANIMGX_SOURCES in the environment)");
+ std::process::exit(2);
+ };
+ fetch::file(url, hash);
+}
diff --git a/rust/fetch/src/lib.rs b/rust/fetch/src/lib.rs
index 8fc957c9..22a4f3ec 100644
--- a/rust/fetch/src/lib.rs
+++ b/rust/fetch/src/lib.rs
@@ -1,63 +1,126 @@
//! Others' sources for a build script: the engine's crates hold only manimgx's code, and fetch
//! what they build from others (x264, NASM, FFmpeg, libopus, mitex's Typst package) at build time,
-//! each pinned by the hash of its files.
+//! each pinned by the hash of its files. Immutable binary resources are pinned by their bytes.
+use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
use sha2::{Digest, Sha256};
+type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
+
/// The tree of files in the archive at `url` (its one top folder, if it has one), unpacked into
/// the build script's OUT_DIR, in a folder named by `hash`: the SHA-256 of its files, each one's
/// path, length and bytes, by path. It names the files, not the archive, which hosts regenerate:
/// any archive of the same files passes, and a tree once checked is found again by its name.
///
/// The archive is kept in the folder MANIMGX_SOURCES names (an absolute path), if it names one:
-/// read from there, and downloaded there first unless it is there. So a folder that holds the
-/// archives builds offline, and a build into an empty one gathers what it is built from, as a
-/// release does for its complete source. A build script fetches the same archives on every
-/// target (what it compiles of them may differ), so one build gathers what every build reads.
+/// read from there, and published there only after its files pass verification. A folder that
+/// holds the archives builds offline, and a build into an empty one gathers what it is built
+/// from, as a release does for its complete source. A build script fetches the same archives on
+/// every target (what it compiles of them may differ), so one build gathers what every build reads.
pub fn tree(url: &str, hash: &str) -> PathBuf {
+ stored(url, hash, unpack)
+}
+
+/// An immutable file, verified against the SHA-256 of its bytes. Like `tree`, this reads and
+/// collects the original download in MANIMGX_SOURCES, and publishes only verified content.
+pub fn file(url: &str, hash: &str) -> PathBuf {
+ stored(url, hash, verified_file)
+}
+
+type Prepare = fn(&Path, &Path, &str) -> Result<PathBuf>;
+
+fn stored(url: &str, hash: &str, prepare: Prepare) -> PathBuf {
println!("cargo:rerun-if-env-changed=MANIMGX_SOURCES");
let out = PathBuf::from(std::env::var_os("OUT_DIR").expect("a build script's OUT_DIR"));
+ let sources = std::env::var_os("MANIMGX_SOURCES").map(PathBuf::from);
+ acquire(url, hash, &out, sources.as_deref(), prepare).unwrap_or_else(|error| panic!("{url}: {error}"))
+}
+
+fn acquire(url: &str, hash: &str, out: &Path, sources: Option<&Path>, prepare: Prepare) -> Result<PathBuf> {
let tree = out.join(hash);
- if tree.exists() {
- return tree;
+ if tree.exists() && sources.is_none() {
+ return Ok(tree);
+ }
+ fs::create_dir_all(out)?;
+ let work = tempfile::tempdir_in(out)?;
+ let unpacked = work.path().join("files");
+ let cached = sources.map(|folder| folder.join(url.rsplit('/').next().unwrap()));
+ let verified = cached.as_ref().filter(|archive| archive.is_file()).map(|archive| prepare(archive, &unpacked, hash));
+ let root = match verified {
+ Some(Ok(root)) => root,
+ invalid => {
+ if let Some(Err(error)) = invalid {
+ eprintln!("{url}: ignoring invalid cached archive: {error}");
+ }
+ // Each candidate stays private until verified. Staging beside its destination
+ // makes publication atomic even when MANIMGX_SOURCES is on another filesystem.
+ let folder = sources.unwrap_or(out);
+ fs::create_dir_all(folder)?;
+ let download = tempfile::tempdir_in(folder)?;
+ let archive = download.path().join("archive");
+ run(Command::new("curl")
+ .args(["-fsSL", "--retry", "3", "--retry-connrefused", "--connect-timeout", "30", "--max-time", "300", "--retry-max-time", "600", "-o"])
+ .arg(&archive)
+ .arg(url))?;
+ let root = prepare(&archive, &unpacked, hash)?;
+ if let Some(cached) = cached {
+ fs::rename(archive, cached)?;
+ }
+ root
+ }
+ };
+ // Concurrent builders publish the same verified content; only one needs to win.
+ if let Err(error) = fs::rename(root, &tree)
+ && !tree.exists()
+ {
+ return Err(error.into());
}
- let folder = std::env::var_os("MANIMGX_SOURCES").map_or(out.clone(), PathBuf::from);
- let archive = folder.join(url.rsplit('/').next().unwrap());
- if !archive.exists() {
- // under another name until it is whole, so a build sharing the folder never reads half
- let part = archive.with_extension(format!("{}.part", std::process::id()));
- std::fs::create_dir_all(&folder).unwrap();
- run(Command::new("curl").args(["-fsSL", "--retry", "3", "-o"]).arg(&part).arg(url));
- std::fs::rename(&part, &archive).unwrap();
+ Ok(tree)
+}
+
+fn verified_file(archive: &Path, prepared: &Path, hash: &str) -> Result<PathBuf> {
+ let found = Sha256::digest(fs::read(archive)?).iter().map(|byte| format!("{byte:02x}")).collect::<String>();
+ if found != hash {
+ return Err(format!("{}: its bytes hash to {found}, not {hash}", archive.display()).into());
+ }
+ fs::copy(archive, prepared)?;
+ Ok(prepared.to_owned())
+}
+
+fn unpack(archive: &Path, unpacked: &Path, hash: &str) -> Result<PathBuf> {
+ if unpacked.exists() {
+ fs::remove_dir_all(unpacked)?;
}
- let unpacked = out.join(format!("{hash}.unpacked"));
- let _ = std::fs::remove_dir_all(&unpacked);
- std::fs::create_dir_all(&unpacked).unwrap();
+ fs::create_dir(unpacked)?;
// the archive named from its own folder: GNU tar reads `C:` in a path as a remote host
- run(Command::new("tar").current_dir(&folder).arg("-xf").arg(archive.file_name().unwrap()).arg("-C").arg(&unpacked));
- let entries: Vec<_> = std::fs::read_dir(&unpacked).unwrap().map(|entry| entry.unwrap().path()).collect();
+ run(Command::new("tar").current_dir(archive.parent().unwrap()).arg("-xf").arg(archive.file_name().unwrap()).arg("-C").arg(unpacked))?;
+ let entries = fs::read_dir(unpacked)?.map(|entry| entry.map(|entry| entry.path())).collect::<std::io::Result<Vec<_>>>()?;
let root = match &entries[..] {
[folder] if folder.is_dir() => folder.clone(),
- _ => unpacked.clone(),
+ _ => unpacked.to_owned(),
};
- let found = files_hash(&root);
- assert!(found == hash, "{url}: its files hash to {found}, not {hash}");
- std::fs::rename(&root, &tree).unwrap();
- let _ = std::fs::remove_dir_all(&unpacked);
- tree
+ let found = hash_files(&root)?;
+ if found != hash {
+ return Err(format!("{}: its files hash to {found}, not {hash}", archive.display()).into());
+ }
+ Ok(root)
}
/// The SHA-256 of a tree's files: each one's path (`/` between its parts), length and bytes, by
/// path.
pub fn files_hash(root: &Path) -> String {
+ hash_files(root).unwrap_or_else(|error| panic!("{}: {error}", root.display()))
+}
+
+fn hash_files(root: &Path) -> std::io::Result<String> {
let mut files = Vec::new();
let mut folders = vec![PathBuf::new()];
while let Some(folder) = folders.pop() {
- for entry in std::fs::read_dir(root.join(&folder)).unwrap() {
- let path = folder.join(entry.unwrap().file_name());
+ for entry in fs::read_dir(root.join(&folder))? {
+ let path = folder.join(entry?.file_name());
if root.join(&path).is_dir() { folders.push(path) } else { files.push(path) }
}
}
@@ -65,16 +128,19 @@ pub fn files_hash(root: &Path) -> String {
files.sort_by_cached_key(key);
let mut sha = Sha256::new();
for path in &files {
- let bytes = std::fs::read(root.join(path)).unwrap();
+ let bytes = fs::read(root.join(path))?;
sha.update(key(path).as_bytes());
sha.update([0]);
sha.update((bytes.len() as u64).to_le_bytes());
sha.update(&bytes);
}
- sha.finalize().iter().map(|byte| format!("{byte:02x}")).collect()
+ Ok(sha.finalize().iter().map(|byte| format!("{byte:02x}")).collect())
}
-fn run(command: &mut Command) {
- let status = command.status().unwrap_or_else(|e| panic!("{command:?}: {e}"));
- assert!(status.success(), "{command:?} failed");
+fn run(command: &mut Command) -> Result<()> {
+ let output = command.output().map_err(|error| format!("{command:?}: {error}"))?;
+ if !output.status.success() {
+ return Err(format!("{command:?}: {}\n{}", output.status, String::from_utf8_lossy(&output.stderr)).into());
+ }
+ Ok(())
}
diff --git a/rust/fetch/tests/folder.rs b/rust/fetch/tests/folder.rs
index cbb1a9d8..64c2d542 100644
--- a/rust/fetch/tests/folder.rs
+++ b/rust/fetch/tests/folder.rs
@@ -1,39 +1,362 @@
-//! MANIMGX_SOURCES, a folder of archives: a build into an empty one downloads each archive into
-//! it, and a build from a full one reads them there, with nothing to download.
-
-use std::process::Command;
-
-#[test]
-fn an_empty_folder_gathers_the_archives_and_a_full_one_builds_offline() {
- let work = std::env::temp_dir().join(format!("fetch-folder-{}", std::process::id()));
- let _ = std::fs::remove_dir_all(&work);
- // an archive of a small tree, at a file URL
- let served = work.join("served");
- std::fs::create_dir_all(served.join("tree/sub")).unwrap();
- std::fs::write(served.join("tree/a.txt"), "a").unwrap();
- std::fs::write(served.join("tree/sub/b.txt"), "b").unwrap();
- let tar = Command::new("tar").current_dir(&served).args(["-czf", "tree.tar.gz", "tree"]).status().unwrap();
- assert!(tar.success());
- let hash = fetch::files_hash(&served.join("tree"));
- let path = served.join("tree.tar.gz").display().to_string().replace('\\', "/");
- let url = format!("file:///{}", path.trim_start_matches('/'));
- let sources = work.join("sources");
-
- // SAFETY: the only test in its binary, so no other thread reads the environment
- unsafe {
- std::env::set_var("OUT_DIR", work.join("first"));
- std::env::set_var("MANIMGX_SOURCES", &sources);
- }
- let tree = fetch::tree(&url, &hash);
- assert_eq!(std::fs::read_to_string(tree.join("sub/b.txt")).unwrap(), "b");
- let gathered: Vec<_> = std::fs::read_dir(&sources).unwrap().map(|entry| entry.unwrap().file_name()).collect();
- assert_eq!(gathered, ["tree.tar.gz"], "the folder holds the archive, whole, and nothing else");
-
- // the archive no longer at its URL: another build reads it from the folder
- std::fs::remove_file(served.join("tree.tar.gz")).unwrap();
- // SAFETY: as above
- unsafe { std::env::set_var("OUT_DIR", work.join("second")) }
- let tree = fetch::tree(&url, &hash);
- assert_eq!(std::fs::read_to_string(tree.join("a.txt")).unwrap(), "a");
- std::fs::remove_dir_all(&work).unwrap();
+//! The source store's contract, through separate build-script processes: only verified
+//! archives are published, independent builds can share them, and a full store needs no network.
+
+use std::fs;
+use std::io::{Read, Write};
+use std::net::TcpListener;
+use std::path::{Path, PathBuf};
+use std::process::{Command, Output, Stdio};
+
+struct Source {
+ work: tempfile::TempDir,
+ hash: String,
+ url: String,
+}
+
+impl Source {
+ fn new() -> Self {
+ let work = tempfile::tempdir().unwrap();
+ let served = work.path().join("served");
+ fs::create_dir_all(served.join("tree/sub")).unwrap();
+ fs::write(served.join("tree/a.txt"), "a").unwrap();
+ fs::write(served.join("tree/sub/b.txt"), "b").unwrap();
+ let status = Command::new("tar").current_dir(&served).args(["-czf", "tree.tar.gz", "tree"]).status().unwrap();
+ assert!(status.success());
+ let hash = fetch::files_hash(&served.join("tree"));
+ let path = served.join("tree.tar.gz").display().to_string().replace('\\', "/");
+ let url = format!("file:///{}", path.trim_start_matches('/'));
+ Self { work, hash, url }
+ }
+
+ fn path(&self, name: &str) -> PathBuf {
+ self.work.path().join(name)
+ }
+
+ fn build(&self, out: &str) -> Command {
+ let mut command = Command::new(std::env::current_exe().unwrap());
+ command.args(["--exact", "build_script", "--nocapture"]);
+ command.env("FETCH_TEST_URL", &self.url).env("FETCH_TEST_HASH", &self.hash);
+ command.env("OUT_DIR", self.path(out)).env("MANIMGX_SOURCES", self.path("sources"));
+ command.stdout(Stdio::piped()).stderr(Stdio::piped());
+ command
+ }
+
+ fn check(&self, out: &str) {
+ assert_eq!(fetch::files_hash(&self.path(out).join(&self.hash)), self.hash);
+ assert_eq!(entries(&self.path("sources")), ["tree.tar.gz"]);
+ assert_eq!(entries(&self.path(out)), std::slice::from_ref(&self.hash));
+ }
+}
+
+fn entries(path: &Path) -> Vec<String> {
+ let mut names: Vec<_> = fs::read_dir(path).unwrap().map(|entry| entry.unwrap().file_name().into_string().unwrap()).collect();
+ names.sort();
+ names
+}
+
+fn success(output: Output) {
+ assert!(output.status.success(), "{}\n{}", String::from_utf8_lossy(&output.stdout), String::from_utf8_lossy(&output.stderr));
+}
+
+#[test]
+fn build_script() {
+ // Children exercise the public API without mutating the test runner's environment.
+ if let Ok(url) = std::env::var("FETCH_TEST_URL") {
+ let acquire = if std::env::var("FETCH_TEST_KIND").as_deref() == Ok("file") { fetch::file } else { fetch::tree };
+ acquire(&url, &std::env::var("FETCH_TEST_HASH").unwrap());
+ }
+}
+
+#[test]
+fn an_empty_folder_gathers_archives_and_a_full_one_builds_offline() {
+ let source = Source::new();
+ success(source.build("first").output().unwrap());
+ source.check("first");
+ fs::remove_file(source.path("served/tree.tar.gz")).unwrap();
+ success(source.build("second").output().unwrap());
+ source.check("second");
+}
+
+#[test]
+fn release_tooling_collects_and_reuses_the_same_verified_source_store() {
+ use sha2::{Digest, Sha256};
+ let source = Source::new();
+ let bytes = fs::read(source.path("served/tree.tar.gz")).unwrap();
+ let hash = Sha256::digest(&bytes).iter().map(|byte| format!("{byte:02x}")).collect::<String>();
+ for out in ["first", "offline"] {
+ let output = Command::new(env!("CARGO_BIN_EXE_fetch-file"))
+ .args([&source.url, &hash])
+ .env("OUT_DIR", source.path(out))
+ .env("MANIMGX_SOURCES", source.path("sources"))
+ .output().unwrap();
+ success(output);
+ assert_eq!(fs::read(source.path(out).join(&hash)).unwrap(), bytes);
+ assert_eq!(fs::read(source.path("sources/tree.tar.gz")).unwrap(), bytes);
+ if out == "first" { fs::remove_file(source.path("served/tree.tar.gz")).unwrap(); }
+ }
+}
+
+#[test]
+fn no_archive_is_retained_without_a_source_store_and_the_tree_is_reused_offline() {
+ let source = Source::new();
+ success(source.build("first").env_remove("MANIMGX_SOURCES").output().unwrap());
+ assert_eq!(entries(&source.path("first")), std::slice::from_ref(&source.hash));
+ fs::remove_file(source.path("served/tree.tar.gz")).unwrap();
+ success(source.build("first").env_remove("MANIMGX_SOURCES").output().unwrap());
+}
+
+#[test]
+fn a_warm_tree_still_populates_a_new_source_store() {
+ let source = Source::new();
+ success(source.build("first").env_remove("MANIMGX_SOURCES").output().unwrap());
+ success(source.build("first").output().unwrap());
+ source.check("first");
+}
+
+#[test]
+fn invalid_downloads_publish_nothing_and_a_later_attempt_recovers() {
+ let source = Source::new();
+ let archive = source.path("served/tree.tar.gz");
+ let valid = fs::read(&archive).unwrap();
+ for invalid in [b"<html>upstream error</html>".as_slice(), &valid[..valid.len() / 2]] {
+ fs::write(&archive, invalid).unwrap();
+ let output = source.build("first").output().unwrap();
+ assert!(!output.status.success());
+ assert!(String::from_utf8_lossy(&output.stderr).contains("tar"));
+ assert!(entries(&source.path("sources")).is_empty());
+ assert!(entries(&source.path("first")).is_empty());
+ }
+ fs::write(archive, valid).unwrap();
+ success(source.build("first").output().unwrap());
+ source.check("first");
+}
+
+#[test]
+fn a_successful_http_response_must_still_be_a_verified_archive() {
+ let mut source = Source::new();
+ let listener = TcpListener::bind("127.0.0.1:0").unwrap();
+ source.url = format!("http://{}/tree.tar.gz", listener.local_addr().unwrap());
+ let valid = fs::read(source.path("served/tree.tar.gz")).unwrap();
+ let server = std::thread::spawn(move || {
+ for body in [b"<html>upstream challenge</html>".to_vec(), valid] {
+ let (mut stream, _) = listener.accept().unwrap();
+ stream.set_read_timeout(Some(std::time::Duration::from_secs(10))).unwrap();
+ let mut request = Vec::new();
+ while !request.ends_with(b"\r\n\r\n") {
+ let mut byte = [0];
+ stream.read_exact(&mut byte).unwrap();
+ request.push(byte[0]);
+ }
+ write!(stream, "HTTP/1.1 200 OK\r\nContent-Length: {}\r\nConnection: close\r\n\r\n", body.len()).unwrap();
+ stream.write_all(&body).unwrap();
+ }
+ });
+ assert!(!source.build("first").output().unwrap().status.success());
+ assert!(entries(&source.path("sources")).is_empty());
+ success(source.build("first").output().unwrap());
+ source.check("first");
+ server.join().unwrap();
+}
+
+#[test]
+fn a_source_that_temporarily_refuses_connections_recovers() {
+ use std::sync::mpsc;
+ use std::time::Duration;
+
+ let mut source = Source::new();
+ let reserved = TcpListener::bind("127.0.0.1:0").unwrap();
+ let address = reserved.local_addr().unwrap();
+ drop(reserved); // The first requests see a refused connection, not an HTTP error.
+ source.url = format!("http://{address}/tree.tar.gz");
+ let archive = fs::read(source.path("served/tree.tar.gz")).unwrap();
+ let (finished, stopped) = mpsc::channel();
+ let server = std::thread::spawn(move || {
+ if stopped.recv_timeout(Duration::from_secs(2)).is_ok() {
+ return; // A downloader without retries already failed.
+ }
+ let listener = TcpListener::bind(address).unwrap();
+ listener.set_nonblocking(true).unwrap();
+ loop {
+ match listener.accept() {
+ Ok((mut stream, _)) => {
+ // Winsock inherits the listener's mode; request reads are blocking.
+ stream.set_nonblocking(false).unwrap();
+ stream.set_read_timeout(Some(Duration::from_secs(10))).unwrap();
+ let mut request = Vec::new();
+ while !request.ends_with(b"\r\n\r\n") {
+ let mut byte = [0];
+ stream.read_exact(&mut byte).unwrap();
+ request.push(byte[0]);
+ }
+ write!(stream, "HTTP/1.1 200 OK\r\nContent-Length: {}\r\nConnection: close\r\n\r\n", archive.len()).unwrap();
+ stream.write_all(&archive).unwrap();
+ return;
+ }
+ Err(error) if error.kind() == std::io::ErrorKind::WouldBlock => {
+ if stopped.recv_timeout(Duration::from_millis(10)).is_ok() {
+ return;
+ }
+ }
+ Err(error) => panic!("{error}"),
+ }
+ }
+ });
+ let result = source.build("first").output().unwrap();
+ let _ = finished.send(());
+ server.join().unwrap();
+ success(result);
+ source.check("first");
+}
+
+#[test]
+fn the_pin_rejects_valid_archives_with_different_files() {
+ let source = Source::new();
+ let output = source.build("first").env("FETCH_TEST_HASH", "0".repeat(64)).output().unwrap();
+ assert!(!output.status.success());
+ let error = String::from_utf8_lossy(&output.stderr);
+ assert!(error.contains(&source.hash) && error.contains(&"0".repeat(64)), "{error}");
+ assert!(entries(&source.path("sources")).is_empty());
+ assert!(entries(&source.path("first")).is_empty());
+}
+
+#[test]
+fn a_corrupted_archive_is_replaced_only_by_verified_content() {
+ let source = Source::new();
+ success(source.build("first").output().unwrap());
+ let archive = source.path("sources/tree.tar.gz");
+ fs::write(&archive, "broken cache").unwrap();
+ success(source.build("second").output().unwrap());
+ assert_eq!(fs::read(archive).unwrap(), fs::read(source.path("served/tree.tar.gz")).unwrap());
+ source.check("second");
+}
+
+#[test]
+fn cached_files_with_the_wrong_hash_are_refetched() {
+ let source = Source::new();
+ success(source.build("first").output().unwrap());
+ let served = source.path("served");
+ fs::write(served.join("tree/a.txt"), "tampered").unwrap();
+ let status = Command::new("tar").current_dir(&served).args(["-czf", "../sources/tree.tar.gz", "tree"]).status().unwrap();
+ assert!(status.success());
+ success(source.build("second").output().unwrap());
+ source.check("second");
+}
+
+#[test]
+fn failed_recovery_does_not_replace_cached_data_or_publish_a_tree() {
+ let source = Source::new();
+ success(source.build("first").output().unwrap());
+ let archive = source.path("sources/tree.tar.gz");
+ fs::write(&archive, "broken cache").unwrap();
+ fs::remove_file(source.path("served/tree.tar.gz")).unwrap();
+ let output = source.build("second").output().unwrap();
+ assert!(!output.status.success());
+ let error = String::from_utf8_lossy(&output.stderr);
+ assert!(error.contains("invalid cached archive") && error.contains("curl"), "{error}");
+ assert_eq!(fs::read_to_string(archive).unwrap(), "broken cache");
+ assert!(entries(&source.path("second")).is_empty());
+}
+
+#[test]
+fn concurrent_builds_publish_whole_archives_and_trees() {
+ let source = Source::new();
+ // Share both a source store and some output directories, as independent Cargo invocations do.
+ let children: Vec<_> = (0..12).map(|i| source.build(&format!("build-{}", i % 3)).spawn().unwrap()).collect();
+ for child in children {
+ success(child.wait_with_output().unwrap());
+ }
+ for i in 0..3 {
+ source.check(&format!("build-{i}"));
+ }
+ fs::remove_file(source.path("served/tree.tar.gz")).unwrap();
+ success(source.build("offline").output().unwrap());
+ source.check("offline");
+}
+
+#[test]
+fn archives_without_a_top_folder_are_supported() {
+ let source = Source::new();
+ let status = Command::new("tar").current_dir(source.path("served/tree")).args(["-czf", "../tree.tar.gz", "a.txt", "sub"]).status().unwrap();
+ assert!(status.success());
+ success(source.build("first").output().unwrap());
+ source.check("first");
+}
+
+#[test]
+fn output_and_source_paths_may_contain_spaces() {
+ let source = Source::new();
+ let sources = source.path("source archives");
+ success(source.build("build output").env("MANIMGX_SOURCES", &sources).output().unwrap());
+ fs::remove_file(source.path("served/tree.tar.gz")).unwrap();
+ success(source.build("offline output").env("MANIMGX_SOURCES", sources).output().unwrap());
+ assert_eq!(fetch::files_hash(&source.path("offline output").join(&source.hash)), source.hash);
+}
+
+#[cfg(unix)]
+#[test]
+fn an_offline_source_store_can_be_read_only() {
+ use std::os::unix::fs::PermissionsExt;
+ let source = Source::new();
+ success(source.build("first").output().unwrap());
+ fs::remove_file(source.path("served/tree.tar.gz")).unwrap();
+ fs::set_permissions(source.path("sources"), fs::Permissions::from_mode(0o555)).unwrap();
+ let output = source.build("second").output().unwrap();
+ fs::set_permissions(source.path("sources"), fs::Permissions::from_mode(0o755)).unwrap();
+ success(output);
+ source.check("second");
+}
+
+#[test]
+fn an_immutable_file_is_verified_collected_and_reused_offline() {
+ use sha2::{Digest, Sha256};
+ let mut source = Source::new();
+ let bytes = fs::read(source.path("served/tree.tar.gz")).unwrap();
+ source.hash = Sha256::digest(&bytes).iter().map(|byte| format!("{byte:02x}")).collect();
+ success(source.build("first").env("FETCH_TEST_KIND", "file").env_remove("MANIMGX_SOURCES").output().unwrap());
+ success(source.build("first").env("FETCH_TEST_KIND", "file").output().unwrap());
+ fs::remove_file(source.path("served/tree.tar.gz")).unwrap();
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::PermissionsExt;
+ fs::set_permissions(source.path("sources"), fs::Permissions::from_mode(0o555)).unwrap();
+ }
+ let offline = source.build("offline").env("FETCH_TEST_KIND", "file").output().unwrap();
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::PermissionsExt;
+ fs::set_permissions(source.path("sources"), fs::Permissions::from_mode(0o755)).unwrap();
+ }
+ success(offline);
+ assert_eq!(fs::read(source.path("offline").join(&source.hash)).unwrap(), bytes);
+ assert_eq!(entries(&source.path("sources")), ["tree.tar.gz"]);
+}
+
+#[test]
+fn immutable_file_cache_corruption_is_repaired_only_by_verified_bytes() {
+ use sha2::{Digest, Sha256};
+ let mut source = Source::new();
+ let bytes = fs::read(source.path("served/tree.tar.gz")).unwrap();
+ source.hash = Sha256::digest(&bytes).iter().map(|byte| format!("{byte:02x}")).collect();
+ success(source.build("first").env("FETCH_TEST_KIND", "file").output().unwrap());
+ fs::write(source.path("sources/tree.tar.gz"), "corrupt cache").unwrap();
+ fs::write(source.path("served/tree.tar.gz"), "invalid response").unwrap();
+ let output = source.build("second").env("FETCH_TEST_KIND", "file").output().unwrap();
+ assert!(!output.status.success());
+ assert!(String::from_utf8_lossy(&output.stderr).contains("its bytes hash to"));
+ assert_eq!(fs::read_to_string(source.path("sources/tree.tar.gz")).unwrap(), "corrupt cache");
+ assert!(entries(&source.path("second")).is_empty());
+ fs::write(source.path("served/tree.tar.gz"), &bytes).unwrap();
+ success(source.build("second").env("FETCH_TEST_KIND", "file").output().unwrap());
+ assert_eq!(fs::read(source.path("sources/tree.tar.gz")).unwrap(), bytes);
+}
+
+#[test]
+fn concurrent_builds_publish_whole_immutable_files() {
+ use sha2::{Digest, Sha256};
+ let mut source = Source::new();
+ let bytes = fs::read(source.path("served/tree.tar.gz")).unwrap();
+ source.hash = Sha256::digest(&bytes).iter().map(|byte| format!("{byte:02x}")).collect();
+ let children: Vec<_> = (0..12).map(|i| source.build(&format!("build-{}", i % 3)).env("FETCH_TEST_KIND", "file").spawn().unwrap()).collect();
+ for child in children { success(child.wait_with_output().unwrap()); }
+ for i in 0..3 { assert_eq!(fs::read(source.path(&format!("build-{i}")).join(&source.hash)).unwrap(), bytes); }
}
diff --git a/rust/ffmpeg/build.rs b/rust/ffmpeg/build.rs
index 91c897c8..46e7516a 100644
--- a/rust/ffmpeg/build.rs
+++ b/rust/ffmpeg/build.rs
@@ -81,6 +81,7 @@ const C99: &str = "atanf atan2f cbrt cbrtf copysign cosf erf exp2 exp2f expf hyp
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/shim.c");
+ println!("cargo:rerun-if-changed=src/opus/config.h");
let ffmpeg = &fetch::tree("https://ffmpeg.org/releases/ffmpeg-9.0.2.tar.gz", "c92e6bbcf8183b80ab4771d4fc07dee2d97dd2af0a72f8a6bf13c4242c756ff0");
let opus = &fetch::tree(
"https://downloads.xiph.org/releases/opus/opus-1.6.1.tar.gz",
@@ -91,8 +92,7 @@ fn main() {
let msvc = target("ENV") == "msvc";
let mut on: BTreeSet<String> = ON.split_whitespace().map(|name| format!("CONFIG_{}", name.to_uppercase())).collect();
on.extend(C99.split_whitespace().map(|name| format!("HAVE_{}", name.to_uppercase())));
- // read() and close(), for av_file_map, from the header each system has them in
- on.insert(if target("OS") == "windows" { "HAVE_IO_H" } else { "HAVE_UNISTD_H" }.into());
+ on.insert("HAVE_AV_CONFIG_H".into()); // also passed to the compiler, before config.h is read
if target("POINTER_WIDTH") == "64" {
on.insert("HAVE_FAST_64BIT".into());
}
@@ -104,6 +104,13 @@ fn main() {
}
let mut config = String::from("#ifndef FFMPEG_CONFIG_H\n#define FFMPEG_CONFIG_H\n#define FFMPEG_CONFIGURATION \"manimgx\"\n");
config += "#define FFMPEG_LICENSE \"LGPL version 2.1 or later\"\n";
+ // The file-system wrappers use these even without file protocols. Ask the compiler, as
+ // configure does, rather than assuming a target's available C library headers.
+ for header in ["direct.h", "io.h", "unistd.h"] {
+ let name = format!("HAVE_{}", header.replace('.', "_").to_uppercase());
+ config += &format!("#define {name} __has_include(<{header}>)\n");
+ defined.insert(name);
+ }
for name in tested.difference(&defined).chain(&on).collect::<BTreeSet<_>>() {
config += &format!("#define {name} {}\n", on.contains(name) as u8);
}
@@ -138,20 +145,18 @@ fn main() {
let build = || {
let mut build = cc::Build::new();
- build.warnings(false).opt_level(3).std("c17"); // FFmpeg counts on dead code being removed
+ build.extra_warnings(false).opt_level(3).std("c17"); // FFmpeg counts on dead code being removed
if msvc {
build.define("_USE_MATH_DEFINES", None).define("_CRT_SECURE_NO_WARNINGS", None).define("_CRT_NONSTDC_NO_WARNINGS", None);
+ build.flag("/we4013").flag("/we4133"); // undeclared functions and incompatible pointers
} else {
- build.flag("-w").flag("-fno-math-errno").flag("-fno-signed-zeros");
+ build.flag("-Werror=implicit-function-declaration").flag("-Werror=incompatible-pointer-types").flag("-fno-math-errno").flag("-fno-signed-zeros");
}
build
};
// libopus, its float build: the files its lists name
let mut libopus = build();
- libopus.includes(["include", "celt", "silk", "silk/float"].map(|dir| opus.join(dir)));
- for define in ["OPUS_BUILD", "USE_ALLOCA", "HAVE_LRINT", "HAVE_LRINTF", "ENABLE_HARDENING"] {
- libopus.define(define, None);
- }
+ libopus.include("src/opus").define("HAVE_CONFIG_H", None).includes(["include", "celt", "silk", "silk/float"].map(|dir| opus.join(dir)));
for (list, names) in [("celt_sources.mk", "CELT_SOURCES"), ("silk_sources.mk", "SILK_SOURCES SILK_SOURCES_FLOAT"), ("opus_sources.mk", "OPUS_SOURCES OPUS_SOURCES_FLOAT")] {
// but silk/debug.c, empty without SILK_DEBUG (an object with no symbols, which ranlib warns of)
libopus.files(make_list(&opus.join(list), names).iter().filter(|file| *file != "silk/debug.c").map(|file| opus.join(file)));
@@ -161,6 +166,8 @@ fn main() {
let mut libav = build();
libav.include(out).include(ffmpeg).include(ffmpeg.join("compat/stdbit")).include(opus.join("include"));
libav.define("HAVE_AV_CONFIG_H", None).define("_ISOC11_SOURCE", None).define("_FILE_OFFSET_BITS", "64").define("_LARGEFILE_SOURCE", None);
+ // configure exposes POSIX.1-2001 / XSI alongside ISO C, including fdopen in strict C17.
+ libav.define("_POSIX_C_SOURCE", "200112").define("_XOPEN_SOURCE", "600");
if msvc {
libav.include(ffmpeg.join("compat/atomics/win32")); // FFmpeg's <stdatomic.h> for MSVC
}
diff --git a/rust/ffmpeg/src/opus/config.h b/rust/ffmpeg/src/opus/config.h
new file mode 100644
index 00000000..850c29c1
--- /dev/null
+++ b/rust/ffmpeg/src/opus/config.h
@@ -0,0 +1,15 @@
+// Opus's portable float build. C17's compiler feature test chooses the temporary allocation
+// mode, as Opus's configure does: standard variable-length arrays first, alloca otherwise.
+#define OPUS_BUILD
+#define HAVE_LRINT
+#define HAVE_LRINTF
+#define ENABLE_HARDENING
+
+#ifndef __STDC_NO_VLA__
+#define VAR_ARRAYS
+#else
+#define USE_ALLOCA
+#if __has_include(<alloca.h>)
+#define HAVE_ALLOCA_H
+#endif
+#endif
diff --git a/rust/ffmpeg/tests/decode.rs b/rust/ffmpeg/tests/decode.rs
new file mode 100644
index 00000000..d747a735
--- /dev/null
+++ b/rust/ffmpeg/tests/decode.rs
@@ -0,0 +1,34 @@
+//! Execute the linked native decoder, including libopus. An rlib alone can hide unresolved C
+//! symbols until Python imports the engine; these tests require a working executable first.
+
+#[test]
+fn pcm_wave_is_decoded_without_external_libraries() {
+ let mut wav = Vec::from(&b"RIFF\x2c\x00\x00\x00WAVEfmt \x10\x00\x00\x00\x01\x00\x01\x00\x80\xbb\x00\x00\x00\x77\x01\x00\x02\x00\x10\x00data\x08\x00\x00\x00"[..]);
+ for sample in [0_i16, 16384, -16384, 0] {
+ wav.extend(sample.to_le_bytes());
+ }
+ let (samples, rate, channels) = ffmpeg::decode(&wav).unwrap();
+ assert_eq!(rate, 48000);
+ assert_eq!(channels, 1);
+ assert_eq!(samples, [0.0, 0.5, -0.5, 0.0]);
+}
+
+#[test]
+fn opus_silence() {
+ // A 20 ms mono Opus packet (f8 ff fe), in three Ogg pages: OpusHead (no pre-skip),
+ // OpusTags (empty), and the packet (final granule 960). No encoder or external tool needed.
+ let (samples, rate, channels) = ffmpeg::decode(include_bytes!("silence.opus")).unwrap();
+ assert_eq!((samples.len(), rate, channels), (960, 48_000, 1));
+ assert!(
+ samples
+ .iter()
+ .all(|sample| sample.is_finite() && sample.abs() < 1e-6)
+ );
+}
+
+#[test]
+fn rejects_invalid_audio() {
+ for bytes in [b"".as_slice(), b"not an audio file"] {
+ assert!(ffmpeg::decode(bytes).is_err());
+ }
+}
diff --git a/rust/ffmpeg/tests/silence.opus b/rust/ffmpeg/tests/silence.opus
new file mode 100644
index 00000000..d454f451
Binary files /dev/null and b/rust/ffmpeg/tests/silence.opus differ
diff --git a/rust/x264/build.rs b/rust/x264/build.rs
index 4814cd6a..f04592e2 100644
--- a/rust/x264/build.rs
+++ b/rust/x264/build.rs
@@ -1,4 +1,4 @@
-//! x264 r3223 from its source (VideoLAN's archive of 0480cb05, fetched), with nothing installed:
+//! x264 r3223 from its source (the GitHub mirror's archive of 0480cb05, fetched), with nothing installed:
//! the configuration its `configure` would write for the target, its C, and its assembly — on
//! x86-64 NASM's (the `nasm` crate: NASM from its source, in this script), on AArch64 the C
//! compiler's. Elsewhere, its C alone.
@@ -10,7 +10,7 @@ fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/shim.c");
let source = &fetch::tree(
- "https://code.videolan.org/videolan/x264/-/archive/0480cb05fa188d37ae87e8f4fd8f1aea3711f7ee/x264-0480cb05fa188d37ae87e8f4fd8f1aea3711f7ee.tar.gz",
+ "https://github.com/mirror/x264/archive/0480cb05fa188d37ae87e8f4fd8f1aea3711f7ee.tar.gz",
"f6be0c17bbcea2e79823e0dc953ad86f605deb41602d606108e1182a5118c434",
);
let out = PathBuf::from(std::env::var_os("OUT_DIR").unwrap());
diff --git a/rust/x264/src/lib.rs b/rust/x264/src/lib.rs
index 41d01242..029f82b1 100644
--- a/rust/x264/src/lib.rs
+++ b/rust/x264/src/lib.rs
@@ -12,7 +12,7 @@ unsafe extern "C" {
) -> c_int;
fn manimgx_x264_encode(
encoder: *mut c_void, nv12: *const u8, pts: i64, constant: *const u8, force_key: c_int, sample: *mut *const u8, size: *mut c_int,
- sample_pts: *mut i64, sample_dts: *mut i64, key: *mut c_int,
+ sample_pts: *mut i64, key: *mut c_int,
) -> c_int;
fn manimgx_x264_delayed(encoder: *mut c_void) -> c_int;
fn manimgx_x264_close(encoder: *mut c_void);
@@ -22,7 +22,6 @@ unsafe extern "C" {
pub struct Sample<'a> {
pub data: &'a [u8],
pub pts: i64,
- pub dts: i64,
pub key: bool,
}
@@ -73,17 +72,17 @@ impl Encoder {
/// picture, where a player can start). Returns the sample written, if any.
pub fn encode(&mut self, nv12: Option<&[u8]>, pts: i64, constant: Option<&[u8]>, force_key: bool) -> Result<Option<Sample<'_>>, String> {
assert!(nv12.is_none_or(|p| p.len() >= self.picture) && constant.is_none_or(|c| c.len() >= self.macroblocks));
- let (mut sample, mut size, mut sample_pts, mut dts, mut key) = (std::ptr::null(), 0, 0, 0, 0);
+ let (mut sample, mut size, mut sample_pts, mut key) = (std::ptr::null(), 0, 0, 0);
let status = unsafe {
manimgx_x264_encode(
self.raw, nv12.map_or(std::ptr::null(), <[u8]>::as_ptr), pts, constant.map_or(std::ptr::null(), <[u8]>::as_ptr), force_key as c_int, &mut sample,
- &mut size, &mut sample_pts, &mut dts, &mut key,
+ &mut size, &mut sample_pts, &mut key,
)
};
if status < 0 {
return Err("x264 failed to encode a picture".into());
}
- Ok((size > 0).then(|| Sample { data: unsafe { std::slice::from_raw_parts(sample, size as usize) }, pts: sample_pts, dts, key: key != 0 }))
+ Ok((size > 0).then(|| Sample { data: unsafe { std::slice::from_raw_parts(sample, size as usize) }, pts: sample_pts, key: key != 0 }))
}
/// Whether x264 still holds pictures back.
diff --git a/rust/x264/src/shim.c b/rust/x264/src/shim.c
index a4637a88..7b2c6bd7 100644
--- a/rust/x264/src/shim.c
+++ b/rust/x264/src/shim.c
@@ -78,7 +78,7 @@ int manimgx_x264_open(encoder **out, int width, int height, int fps, const char
* x264 holds the picture back. Returns < 0 on failure. */
int manimgx_x264_encode(encoder *e, const uint8_t *nv12, int64_t pts, const uint8_t *constant,
int force_key, const uint8_t **sample, int *size, int64_t *sample_pts,
- int64_t *sample_dts, int *key) {
+ int *key) {
x264_picture_t in, out, *picture = NULL;
if (nv12) {
x264_picture_init(&in);
@@ -111,7 +111,6 @@ int manimgx_x264_encode(encoder *e, const uint8_t *nv12, int64_t pts, const uint
/* the NAL units of a picture are contiguous: together, one sample */
*sample = nals[0].p_payload;
*sample_pts = out.i_pts;
- *sample_dts = out.i_dts;
*key = out.b_keyframe;
}
return 0;