diff --git a/AGENTS.md b/AGENTS.md index ba3ee60..d1ace50 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -19,7 +19,8 @@ Read in this order and stop as soon as you have what you need: the workflow, the environment), `docs/FINDINGS.md` (the evidence behind each invariant), `docs/TESTING.md`, `docs/DEPLOYMENT.md`, `docs/TROUBLESHOOTING.md`, `docs/GPU_PATH_CRITERIA.md` (the acceptance - criteria for the Vulkan route), `docs/PHASE_LOG.md` (append-only run logs). + criteria for the Vulkan route), `docs/PHASE_LOG.md` (append-only run logs), + `docs/RELEASING.md` (what a release carries and the order of its steps). Never read a long log end to end to answer a status question: `docs/ACTIVE.md` and each log's own summary say what passed. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. 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 +them 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 prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. 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. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey 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; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If 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 convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + 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. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +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. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md index 9b228e7..42dcf69 100644 --- a/README.md +++ b/README.md @@ -335,6 +335,7 @@ assets and can be removed. Keep the normal development logs when reporting bugs. | [Troubleshooting](docs/TROUBLESHOOTING.md) | Recorded symptoms, causes and fixes | | [Findings](docs/FINDINGS.md) | Technical observations and evidence behind decisions | | [Phase log](docs/PHASE_LOG.md) | Dated development and console-test history | +| [Releasing](docs/RELEASING.md) | What a release carries (licences, component manifest, source archives) and the order that keeps tag, ZIP and source in step; [what each past release was built from](docs/releases/SOURCE_CORRESPONDENCE.md) | | [Evidence](evidence/) | Machine-readable captures and expected results | | [Contributor/agent instructions](AGENTS.md) | Scope, verification, attribution and commit rules | @@ -376,16 +377,36 @@ lists and original notices. ## License and third-party terms -Port-authored code uses **GPL-3.0-or-later**, with copyright and SPDX notices in -the source files. RetroArch and each dependency retain their own license and -copyright notices. The locally generated runtime shim is described in -[runtime/README.md](runtime/README.md). +This repository's own code is **GPL-3.0-or-later** ([LICENSE](LICENSE)). Most source +files carry a copyright and SPDX notice; the ones that do not (for example +`src/memory_ps5.cpp` and the build scripts in `tools/`) are under the same licence. +Code inherited from BlackBearReloaded's ps5-native-app-boilerplate and ProsperoLight +is Copyright (C) 2026 BlackBearReloaded, GPL-3.0-or-later. The generated +`sce_module/libc.prx` is described in [runtime/README.md](runtime/README.md). -Emulator cores are not all GPL-3.0: FCEUmm uses GPLv2, PPSSPP and Dolphin use -GPLv2-or-later, LRPS2 is GPLv3, mGBA uses MPL-2.0, and Snes9x, FBNeo and -Genesis Plus GX include non-commercial terms. Consult each -linked upstream repository for the complete applicable terms. Asset and font -licenses are retained with their files. +Every built title folder carries `licenses/`: the licence texts each part requires, +and `components.json`, which ties every executable file to the source revision it +was built from ([tooling/notices/components.json](tooling/notices/components.json), +[docs/RELEASING.md](docs/RELEASING.md)). Releases up to v0.5.0-alpha.5 were +published without it; [docs/releases/SOURCE_CORRESPONDENCE.md](docs/releases/SOURCE_CORRESPONDENCE.md) +records what each was built from. + +The cores keep their own licences, and they differ: + +| Licence | Cores | +| --- | --- | +| GPL-2.0-or-later | FCEUmm, PPSSPP, Dolphin, Beetle PSX HW, Beetle Saturn, Mupen64Plus-Next (with MIT and LGPL parts), VICE, DeSmuME, Azahar (Dynarmic is 0BSD), MAME (as a whole; many files BSD-3-Clause) | +| GPL-3.0-or-later | LRPS2 (PCSX2) | +| GPL-2.0-only | RPCS3, in development here and in no release | +| MPL-2.0 | mGBA | +| Non-commercial licences | Snes9x, FinalBurn Neo, Genesis Plus GX: they may not be sold or used commercially, and FBNeo's forbids asking for donations for a project that uses its code | + +Assets and fonts keep their licences too: the XMB theme is CC-BY-4.0 with the M+ +font licence, PPSSPP's fonts are OFL-1.1, and Dolphin's `Sys` files carry theirs. This is an independent homebrew project, not affiliated with or endorsed by Sony -Interactive Entertainment. PlayStation and PS5 are Sony trademarks. +Interactive Entertainment, the Khronos Group or the libretro project. PlayStation +and PS5 are Sony trademarks. Vulkan is a registered trademark of the Khronos Group +Inc.; the RADV port this title uses is not a Khronos-conformant product (see +[PS5_Vulkan](https://github.com/mihawk-99/PS5_Vulkan)). RetroArch is the libretro +project's name and logo, used here to name the frontend this port is built from. diff --git a/docs/PHASE_LOG.md b/docs/PHASE_LOG.md index e5117a4..74f1813 100644 --- a/docs/PHASE_LOG.md +++ b/docs/PHASE_LOG.md @@ -4476,3 +4476,39 @@ Earlier" card. Two things were needed: A 4K screenshot costs a run its last windows: RetroArch encodes and writes it after the last frame (5.5-5.8 MB of PNG, held to the title's write budget), and the core does not run meanwhile, so the windows then read 0-70%. + +## 2026-09-29 — Licences, notices and source for every build (licence audit) + +A licence audit of the published releases found that none of the five ZIPs +carries the licence texts its parts require (GPLv3, GPLv2, MPL-2.0, the Snes9x, +FBNeo and Genesis Plus GX licences, MIT notices, OFL for PPSSPP's fonts), and that +the tags of v0.1.0-alpha.1, v0.3.0-alpha.3 and v0.5.0-alpha.5 name commits older +than the ones built (docs/releases/SOURCE_CORRESPONDENCE.md). This step changes +what every build produces; the published ZIPs are unchanged. + +- `tooling/notices/components.json`: every part of the title, its licence, the + texts that travel with it and where its source is. +- `tools/stage-notices.py`, run by `tools/build-title.sh` before the manifest: + writes `licenses/` into the title folder (texts, `components.json` tying every + executable to its source revision, `README.txt`). A core whose digest is not the + one its `build/cores//build.json` records, or a missing licence text, + fails the build. +- `tools/check-notices.py`, in the integration gate: every executable and `.info` + belongs to a listed part with its digest; verbatim texts unchanged; `--release` + also requires committed, published source. +- `tools/source-bundle.py`: one source archive per part at the recorded revision, + submodules included, with `SHA256SUMS` and `SOURCES.txt`. +- `LICENSE` (GPLv3), `docs/RELEASING.md`, README licence and trademark sections, + `docs/RPCS3_PORT.md` licence section (RPCS3 stays out of releases), and + `runtime/README.md` (what libc.prx contains, as verified). + +Evidence: `python3 tools/stage-notices.py` on a copy of the 2026-09-29 16-core +`dist/PPSA99169`: 28 parts, every core's digest equal to its build report, the +RADV archive equal to its PROVENANCE; `tools/check-notices.py` passes on it and +`--release` fails on the uncommitted tree, as it should. `tools/source-bundle.py` +built 10 archives (PPSSPP with 29 submodules, Azahar with 52) whose `SHA256SUMS` +verify. `make test-unit`: 83 tests OK (7 new in tests/test_notices.py). +`tools/lint-shell.sh`: PASS. libc.prx rebuilt from the committed files alone is +byte-identical to the one in every release (`e6ff45d1…`). The full build was not +rerun (the build tree was in use); a `dist/` built before this change fails the +integration gate until it is rebuilt. diff --git a/docs/RELEASING.md b/docs/RELEASING.md new file mode 100644 index 0000000..e69ee0a --- /dev/null +++ b/docs/RELEASING.md @@ -0,0 +1,79 @@ +# Releasing + +What a published release must carry, and the order that makes the tag, the ZIP and +the source agree. The history behind each rule is docs/releases/SOURCE_CORRESPONDENCE.md. + +## What a release carries + +1. **The title ZIP**, `PS5_RetroArch-.zip`, holding `PPSA99169/` with its + `licenses/` folder: the licence texts each part requires, `components.json` + (every part's licence and source revision, and the sha256 of every executable + file) and `README.txt`. `tools/build-title.sh` writes it + (`tools/stage-notices.py`, from `tooling/notices/components.json`). +2. **The source archives** from `tools/source-bundle.py`, with their `SHA256SUMS` and + `SOURCES.txt`, attached to the same release. The GPLv3 lets the source sit on + another server with clear directions (section 6(d)), and GPLv2 counts access from + the same place as the binary (section 3); attaching the archives satisfies both, + and it covers the cores this project fetches from repositories it does not + control. Genesis Plus GX's licence asks for the complete source of a modified + redistribution, which the archives are. +3. **The notes**, with a "Source" section naming the commit the ZIP was built from + (it is the tag, see below) and the non-commercial parts (Snes9x, FBNeo, Genesis + Plus GX): they may not be sold. FBNeo's licence also forbids asking for donations + for a project that uses its code, so a release page carries no donation link. + +## The order + +1. **Commit and push everything that is linked in.** PS5_RetroArch itself, and every + revision it pins or takes from a sibling: PS5_PayloadSDK (`sdk_revision`), each + core fork, PS5_Vulkan (its `HEAD`) and the PS5_Mesa revision its RADV archive + records. Check that each is on GitHub before building: + + ```bash + gh api repos/mihawk-99/PS5_Mesa/commits/ --jq .sha + ``` + +2. **Build from the clean tree**, naming the release: + + ```bash + PS5_RELEASE_TAG=v0.6.0-alpha.6 bash tools/build-title.sh + bash tools/verify.sh + python3 tools/check-notices.py --release + ``` + + `--release` fails when any part was built from uncommitted source or has no + published address. + +3. **Make the source archives and the ZIP**: + + ```bash + python3 tools/source-bundle.py dist/PPSA99169 dist/source-v0.6.0-alpha.6 + (cd dist && zip -r -X PS5_RetroArch-v0.6.0-alpha.6.zip PPSA99169) + sha256sum dist/PS5_RetroArch-v0.6.0-alpha.6.zip + ``` + + An asset may be at most 2 GiB. The largest archives are PPSSPP (about 560 MB, + its submodules included), MAME and the parts of LLVM RPCS3 links. + +4. **Tag the built commit and push the tag before creating the release**, so GitHub + does not make a tag from whatever `main` holds: + + ```bash + git tag -a v0.6.0-alpha.6 -m "PS5 RetroArch v0.6.0-alpha.6" + git push PS5_RetroArch v0.6.0-alpha.6 # this repository's remote for github.com/mihawk-99/PS5_RetroArch + gh release create v0.6.0-alpha.6 --verify-tag --prerelease \ + dist/PS5_RetroArch-v0.6.0-alpha.6.zip dist/source-v0.6.0-alpha.6/* + ``` + +5. **Read it back.** Download the ZIP from the release, compare its sha256 with step + 3, unpack it and run `python3 tools/check-notices.py /PPSA99169`. + +## Parts that need a decision before they ship + +- **RPCS3** is GPL-2.0-only and is combined with GPL-3.0-or-later code (this port's + core runtime object is linked into it, and it runs against the title's GPL-3.0 + platform code). Do not ship it in a release until that is resolved; the audit's + counsel packet sets out the options. +- **Artwork whose origin is not recorded** (`sce_sys/pic0.dds`, `pic1.dds`) should be + replaced with artwork whose licence is known, or its origin recorded, before the + next release. diff --git a/docs/RPCS3_PORT.md b/docs/RPCS3_PORT.md index 36e522b..285e57a 100644 --- a/docs/RPCS3_PORT.md +++ b/docs/RPCS3_PORT.md @@ -45,10 +45,34 @@ PS5_Dynarmic. ## Licence -RPCS3 is GPLv2. It ships as a separate libretro core, loaded by RetroArch at -run time, on the same model as the Snes9x and FBNeo cores the title already -ships, and the fork's source is published at the pinned revision. The title -bundles no PS3 firmware, keys or games. +RPCS3 states its licence as GPL-2.0-only (its README; `LICENSE` is the GPLv2). +The rest of the title is GPL-3.0-or-later (RetroArch, this port, the payload SDK +fork and its platform layer), and GPL-2.0-only code and GPL-3.0 code cannot be +combined into one work and distributed. Whether the core and the title are one +work is not settled by the core being a separate `.so`; these are the facts that +bear on it (2026-09-29): + +- `rpcs3_libretro.so` statically links `tooling/native/core_cxx_runtime.cpp` + (this repository, GPL-3.0-or-later by the repository's licence) through + `PS5_CORE_LINK_INPUTS`, beside LLVM (Apache-2.0 WITH LLVM-exception, whose + exception addresses GPLv2 combinations), FFmpeg and GNU libiconv + (LGPL-2.1-or-later). +- At load time the title's native loader binds the core's libc and file-system + imports to the title's own wrappers and to the platform layer + (`tools/core-imports.py`, `build/core_imports.inc`), and the core runs in the + title's process, on the title's heap, through RetroArch's libretro and Vulkan + context interfaces. + +So it is not in a release. The ways out are a licence decision for the owner of +the GPL-3.0 parts that touch the core (dual-licensing `core_cxx_runtime.cpp` +and the platform layer's bound functions under a GPLv2-compatible licence, which +is possible only for code whose authors agree), a change of interface, or +counsel's view that the combination is not one work; the licence audit of +2026-09-29 sets them out for that decision. + +The title bundles no PS3 firmware, keys or games; RPCS3 installs the firmware +the user supplies and decrypts packages with the user's own licence files +(RAP); that audit covers those paths too. ## Phase 1: the audit diff --git a/docs/releases/SOURCE_CORRESPONDENCE.md b/docs/releases/SOURCE_CORRESPONDENCE.md new file mode 100644 index 0000000..668d617 --- /dev/null +++ b/docs/releases/SOURCE_CORRESPONDENCE.md @@ -0,0 +1,68 @@ +# Which source each published release was built from + +Each GitHub release of this project carries one ZIP. This page records, for every +release, the commit whose tree the ZIP's `eboot.bin` was built from, the revisions +of what was linked into it, and where the release's tag points. It was established +on 2026-09-29 from the published assets (downloaded and hashed), their upload +times, the repositories' public push events and this repository's history. What +could not be established is said so. + +**The tags do not always name the built commit.** The releases were created with +`gh release create` against `main`, and GitHub made each tag from whatever `main` +held on GitHub at that moment. Three times the build was pushed afterwards, so the +tag names an older commit than the one built. Tags are not moved (published history +is not rewritten); the table below is the correction, and docs/RELEASING.md is the +procedure that prevents it. + +## The releases + +| Release | Asset (sha256) | Tag points to | Built from | Evidence for "built from" | +| --- | --- | --- | --- | --- | +| v0.1.0-alpha.1 | `PS5_RetroArch-v0.1.0-alpha.1.zip` `757a6ab774b990638a71e8dbe80deb6d66e799b53c4b52ac4cb504280c3388c4` | `a18cec6` | `b1dced9` | The ZIP was uploaded at 2026-09-20 01:02 UTC, after the release was created; its `eboot.bin` build identity `e11018a7…` is recorded in `b1dced9` (docs/THUMBNAIL_INPUT_DEFAULTS.md), pushed at 01:01 UTC. | +| v0.2.0-alpha.2 | `…v0.2.0-alpha.2.zip` `5f611cb32e8212fb8a0b63f32c2329bfecd828dfd4434949a9a1366f332b13f2` | `d0a815b` | `d0a815b` | Pushed at 13:49 UTC, release at 13:53 UTC; no later commit before the upload. The build identity `cce8e166…` is not recorded in the repository. | +| v0.3.0-alpha.3 | `…v0.3.0-alpha.3.zip` `d313b30dba97ed82277ee74a495801306a64a24fe365e9aba464c8df25da86eb` | `18dc105` | a tree at or after `c1d9f15`, most likely `6c7f418` | The ZIP's `eboot.bin` contains `src/permissions_ps5.cpp`'s log string ("permissions: /app0 checked=…"), which `c1d9f15` added after the tag. `6c7f418` is the last commit before the upload; the build identity `ad98b960…` is not recorded. | +| v0.4.0-alpha.4 | `…v0.4.0-alpha.4.zip` `093fd883bbff63237486d3f7b9b1cd29c9a0d3142e42bf53367861b72757b144` | `52009a9` | `52009a9` | Build identity `870bd1bb…` is recorded in `054ab98`, an ancestor of the tag; the next commit (`a9452a6`) is documentation. | +| v0.5.0-alpha.5 | `…v0.5.0-alpha.5.zip` `aa85d74e224bab3f0dc414c1176f3aa04ddf02b5d86d522b218d6c9c30e769de` | `1ae4a1a` (2026-09-26) | `72847d6` | The tag's tree cannot link RADV (`tools/build-title.sh` there has no RADV path; it arrived in `f932c82` on 2026-09-28). Build identity `f96bdb0e…` is recorded in `72847d6`, pushed at 12:30 UTC, five minutes after the release. | + +Every "built from" commit above is now on the public `main`. + +## What was linked in, per release + +| Release | RetroArch | Cores (pinned upstream or fork revision) | Graphics driver | SDK | +| --- | --- | --- | --- | --- | +| alpha.1 | 1.22.2 `69a4f0e` + patches | FCEUmm `236ccdf`, mGBA `7a12d6d`, Snes9x `fae2fea`, FBNeo `6bb3167`, Genesis Plus GX `c2838c7` | ps5vk from `../PS5_Vulkan`, revision not recorded; built before PS5_Vulkan's public history begins (2026-09-20) | ps5-payload-dev v0.42 release | +| alpha.2 | same | + PPSSPP v1.20.4 `fa50bb1` | ps5vk, revision not recorded (PS5_Vulkan `085aac6` was pushed 5 minutes before the release) | v0.42 release | +| alpha.3 | same | + Dolphin `c6630001` (libretro/dolphin) | ps5vk, revision not recorded; the latest driver commit before the upload (`81b21d8`) was pushed 2026-09-26 01:19 UTC, after the release | v0.42 release | +| alpha.4 | same | + LRPS2 `6d14775` (PS5_LRPS2) | ps5vk `40e9d30` (release notes); pushed 2026-09-28 04:06 UTC, after the release | PS5_PayloadSDK `a110320`; the fork was published 2026-09-28 | +| alpha.5 | same | same eight | RADV from PS5_Mesa `cedb774`, built by PS5_Vulkan `5d8f37d` | PS5_PayloadSDK `95c08f2` | + +The upstream cores' pins did not change between releases. The mGBA and Genesis Plus +GX cores built on 2026-09-29 from these pins are byte-identical to the ones in all +five ZIPs, and FCEUmm's to alpha.2–alpha.5, which confirms those pins. + +## Gaps these releases still carry + +- **Licence texts.** None of the five ZIPs contains the GPL, the MPL, or the + Snes9x, FBNeo or Genesis Plus GX licences, or the OFL of PPSSPP's fonts. Builds + from now on stage them in `licenses/` (tools/stage-notices.py). The published + ZIPs are unchanged. +- **Source not offered beside the binary.** The release pages link the + repositories but carry no source archives; several cores come from upstream + repositories this project does not control. tools/source-bundle.py makes the + archives; attaching them to a release is the maintainer's decision. +- **alpha.1's driver.** The ps5vk revision linked into alpha.1 predates PS5_Vulkan's + public history, so its source is not published anywhere today. +- **Driver revisions of alpha.2 and alpha.3** are not recorded. + +## Proposed "Source" section for each release's notes + +Not applied: editing a published release is the maintainer's call. + +```markdown +## Source + +This ZIP was built from PS5_RetroArch (the tag points to +, an earlier commit; see docs/releases/SOURCE_CORRESPONDENCE.md). Every +component, its licence and its source revision are listed there. The licence texts +for this release are in . +``` diff --git a/runtime/README.md b/runtime/README.md index b73ffe4..b599bae 100644 --- a/runtime/README.md +++ b/runtime/README.md @@ -1,31 +1,37 @@ -# Clean-room runtime shim +# The generated runtime module (libc.prx) -`libc.prx` is generated locally from the independently authored source in this -repository and is distributed under GPL-3.0-or-later. It contains no Sony -runtime implementation, proprietary SDK binary, or game file. +`sce_module/libc.prx` is the module a title carries where the console's loader +expects a C library companion. It is generated, not copied: `make libc` (or +`tools/rebuild-libc.sh`) builds `tooling/native/libc_builder.cpp` and runs it on the +two manifests in `tooling/native/runtime/`, then signs the result as a fake SELF. +The code is Copyright (C) 2026 BlackBearReloaded (ps5-native-app-boilerplate), +GPL-3.0-or-later. -The release artifact has SHA-256: +What the module contains: + +- a few dozen bytes of machine code written by the builder: an initializer that hands + the title's `malloc`/`free`/`posix_memalign` to the kernel's heap hook and registers + three thread callbacks, and functions that return zero; +- loader metadata: the NIDs, ELF bindings, types and sizes of the symbols the + console's libc exports (`api-surface.txt`, recorded by observing that module, as + its header says), the imports it declares (`imports.txt`), and a + segment layout that matches what the loader accepts. + +It contains no instructions or data copied from a console module. That is +established by the generator's source, and by reproduction: on 2026-09-29 the +module rebuilt from this repository's committed files alone was byte-identical to +the one below, which is also the `libc.prx` in every published PS5_RetroArch release +(v0.1.0-alpha.1 to v0.5.0-alpha.5). The name "clean-room", used for this module +elsewhere, is BlackBearReloaded's description of how it was written; this +repository has no record of that process beyond the source itself. + +The expected artifact has SHA-256: ```text e6ff45d16adf687855cc3b33b0c8a4132b6504360b221e0a34c7e99fb3ba0036 ``` -Generate it from the repository root: - -```sh -make libc -``` - -Then verify it from this directory with: - -```sh -sha256sum -c libc.prx.sha256 -``` - -The generated file is ignored by Git. Bare `make` also creates it as part of a -normal application build. Tagged GitHub Releases provide the verified binary -as a convenience asset. - -The complete source, reproduction procedure, and compatibility scope are in -[`tooling/native`](../tooling/native) and -[`docs/RUNTIME_SHIM.md`](../docs/RUNTIME_SHIM.md). +Generate it from the repository root with `make libc`, then verify it from this +directory with `sha256sum -c libc.prx.sha256`. The generated file is ignored by +Git; a normal build creates it too. The upstream description of the generator and +its compatibility scope is ps5-native-app-boilerplate's `docs/RUNTIME_SHIM.md`. diff --git a/tests/test_notices.py b/tests/test_notices.py new file mode 100644 index 0000000..03aaf3c --- /dev/null +++ b/tests/test_notices.py @@ -0,0 +1,144 @@ +"""The title's licenses/ folder: staged from the component table, checked against the files.""" + +import hashlib +import importlib.util +import json +import subprocess +import tempfile +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent + + +def load(name, path): + spec = importlib.util.spec_from_file_location(name, ROOT / path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +stage = load("stage_notices", "tools/stage-notices.py") +check = load("check_notices", "tools/check-notices.py") + + +def digest(data): + return hashlib.sha256(data).hexdigest() + + +class Notices(unittest.TestCase): + """A miniature repository, title and table, so no build is needed.""" + + def setUp(self): + self.directory = tempfile.TemporaryDirectory() + base = Path(self.directory.name) + self.repo = base / "repo" + self.title = base / "title" + (self.repo / "build/cores/demo").mkdir(parents=True) + (self.repo / "src").mkdir() + (self.repo / "LICENSE").write_text("GNU GENERAL PUBLIC LICENSE\n") + (self.repo / "src/demo-license.txt").write_text("Demo licence, verbatim.\n") + (self.repo / "tools").mkdir() + (self.repo / "tools/fetch.sh").write_text('revision="abc123"\n') + subprocess.run(["git", "init", "-q", str(self.repo)], check=True) + subprocess.run(["git", "-C", str(self.repo), "add", "-A"], check=True) + subprocess.run(["git", "-C", str(self.repo), "-c", "user.name=t", "-c", "user.email=t@t", + "commit", "-qm", "fixture"], check=True) + (self.title / "cores").mkdir(parents=True) + (self.title / "eboot.bin").write_bytes(b"title") + self.core = b"core bytes" + (self.title / "cores/demo_libretro.so").write_bytes(self.core) + self.report(self.core) + self.table = self.repo / "components.json" + self.table.write_text(json.dumps({"components": [ + {"id": "port", "name": "Port", "kind": "code", "always": True, + "artifacts": ["eboot.bin"], "licence": "GPL-3.0-or-later", + "texts": [{"from": "LICENSE", "to": "GPL-3.0.txt"}], + "source": {"kind": "git", "path": ".", "remote": "https://example.org/port"}}, + {"id": "upstream", "name": "Upstream", "kind": "code", "always": True, + "artifacts": ["eboot.bin"], "licence": "GPL-3.0-or-later", + "texts": [{"from": "LICENSE", "to": "COPYING"}], + "source": {"kind": "pin", "file": "tools/fetch.sh", "var": "revision", + "remote": "https://example.org/upstream"}}, + {"id": "demo", "name": "Demo core", "kind": "code", "noncommercial": True, + "artifacts": ["cores/demo_libretro.so"], "licence": "LicenseRef-Demo", + "texts": [{"from": "src/demo-license.txt", "to": "license.txt", "verbatim": True}], + "source": {"kind": "core", "build": "demo", "remote": "https://example.org/demo"}}, + {"id": "absent", "name": "A core this build does not have", "kind": "code", + "artifacts": ["cores/absent_libretro.so"], "licence": "MIT", "texts": [], + "source": {"kind": "fixed", "revision": "1"}}, + ]})) + + def tearDown(self): + self.directory.cleanup() + + def report(self, data): + (self.repo / "build/cores/demo/build.json").write_text(json.dumps( + {"sha256": digest(data), "source_revision": "f00d"})) + + def run_stage(self): + return stage.stage(self.title, "radv", "v-test", {}, root=self.repo, table=self.table) + + def test_staged_folder_passes_the_check(self): + staged = self.run_stage() + self.assertEqual([c["id"] for c in staged], ["port", "upstream", "demo"]) + self.assertEqual(check.check(self.title), []) + record = json.loads((self.title / "licenses/components.json").read_text()) + demo = next(c for c in record["components"] if c["id"] == "demo") + self.assertEqual(demo["source"]["revision"], "f00d") + self.assertEqual(demo["source"]["url"], "https://example.org/demo/tree/f00d") + self.assertEqual(demo["executables"], {"cores/demo_libretro.so": digest(self.core)}) + upstream = next(c for c in record["components"] if c["id"] == "upstream") + self.assertEqual(upstream["source"]["revision"], "abc123") + readme = (self.title / "licenses/README.txt").read_text() + self.assertIn("Non-commercial terms", readme) + self.assertIn("Demo core", readme) + + def test_a_core_that_is_not_its_build_report_is_refused(self): + self.report(b"another build") + with self.assertRaisesRegex(stage.NoticeError, "build.json describes"): + self.run_stage() + + def test_a_missing_licence_text_is_refused(self): + (self.repo / "src/demo-license.txt").unlink() + with self.assertRaisesRegex(stage.NoticeError, "not found"): + self.run_stage() + + def test_an_unlisted_core_fails_the_check(self): + self.run_stage() + (self.title / "cores/stray_libretro.so").write_bytes(b"stray") + problems = check.check(self.title) + self.assertTrue(any("stray_libretro.so belongs to no listed part" in p for p in problems)) + + def test_a_changed_core_or_edited_verbatim_text_fails_the_check(self): + self.run_stage() + (self.title / "cores/demo_libretro.so").write_bytes(b"rebuilt") + (self.title / "licenses/demo/license.txt").write_text("shortened\n") + problems = check.check(self.title) + self.assertTrue(any("changed after its notice was staged" in p for p in problems)) + self.assertTrue(any("not the verbatim text" in p for p in problems)) + + def test_release_requires_committed_source(self): + (self.repo / "LICENSE").write_text("edited\n") + self.run_stage() + self.assertEqual(check.check(self.title), []) + problems = check.check(self.title, release=True) + self.assertEqual(problems, ["port: built from uncommitted source"]) + + def test_the_repository_table_names_existing_build_scripts(self): + table = json.loads((ROOT / "tooling/notices/components.json").read_text()) + ids = [c["id"] for c in table["components"]] + self.assertEqual(len(ids), len(set(ids))) + for component in table["components"]: + self.assertTrue(component["licence"]) + source = component["source"] + if source["kind"] == "pin": + self.assertTrue((ROOT / source["file"]).is_file(), source["file"]) + if source["kind"] == "core": + self.assertTrue(component["artifacts"][0].startswith("cores/")) + if "LicenseRef" in component["licence"]: + self.assertTrue(component.get("noncommercial"), component["id"]) + + +if __name__ == "__main__": + unittest.main() diff --git a/tooling/notices/components.json b/tooling/notices/components.json new file mode 100644 index 0000000..64cfe40 --- /dev/null +++ b/tooling/notices/components.json @@ -0,0 +1,382 @@ +{ + "about": [ + "What the title folder is made of, and for each part its licence, the licence texts that travel with it and where its source is.", + "tools/stage-notices.py reads this table after a build and writes licenses/ into the title folder: the texts, a", + "components.json that ties every executable file to the source revision it was built from, and a README.txt.", + "tools/check-notices.py verifies the result. Paths are relative to this repository; ${VULKAN} is ../PS5_Vulkan", + "(PS5_VULKAN_DIR), ${SDK_FORK} is ../PS5_PayloadSDK and ${LLVM} is .deps/llvm-project. A component is staged", + "when one of its 'artifacts' patterns matches a file in the title folder, or when 'always' is set.", + "'licence' is the licence the upstream project states for the part that ships; 'noncommercial' marks terms", + "that forbid commercial use, which the GPL does not allow a combined work to add (see the audit's counsel packet)." + ], + "schema": 1, + "components": [ + { + "id": "ps5-retroarch", + "name": "PS5 RetroArch (this port: title code, platform integration, build scripts and patches)", + "kind": "code", + "always": true, + "artifacts": ["eboot.bin", "retroarch.cfg", "sce_sys/param.json"], + "licence": "GPL-3.0-or-later", + "copyright": [ + "Copyright (C) 2026 Mihawk", + "Copyright (C) 2026 BlackBearReloaded (the native title pipeline from ps5-native-app-boilerplate and ProsperoLight)" + ], + "texts": [{"from": "LICENSE", "to": "GPL-3.0.txt"}], + "source": {"kind": "git", "path": ".", "remote": "https://github.com/mihawk-99/PS5_RetroArch"}, + "modifications": "This is the port itself. Its patches to RetroArch and the cores are patches/ and tools/apply-port-patches.py in this repository." + }, + { + "id": "retroarch", + "name": "RetroArch 1.22.2", + "kind": "code", + "always": true, + "artifacts": ["eboot.bin", "assets/rgui/**"], + "licence": "GPL-3.0-or-later", + "copyright": ["Copyright (C) 2010-2026 The RetroArch team and contributors"], + "texts": [{"from": "vendor/retroarch/COPYING", "to": "COPYING"}], + "source": {"kind": "pin", "file": "tools/fetch-retroarch.sh", "var": "revision", "remote": "https://github.com/libretro/RetroArch"}, + "modifications": "patches/series, applied by tools/fetch-retroarch.sh and tools/apply-port-patches.py (PS5_RetroArch)." + }, + { + "id": "libc-prx-shim", + "name": "sce_module/libc.prx, the generated loader companion (ps5-native-app-boilerplate)", + "kind": "code", + "artifacts": ["sce_module/libc.prx"], + "licence": "GPL-3.0-or-later", + "copyright": ["Copyright (C) 2026 BlackBearReloaded"], + "texts": [{"from": "LICENSE", "to": "GPL-3.0.txt"}], + "source": {"kind": "git", "path": ".", "remote": "https://github.com/mihawk-99/PS5_RetroArch"}, + "modifications": "Generated by tools/rebuild-libc.sh from tooling/native/libc_builder.cpp and the manifests in tooling/native/runtime/ (PS5_RetroArch); runtime/libc.prx.sha256 is the expected digest. It holds generated stubs and loader metadata (exported symbol NIDs and sizes), no code taken from a console." + }, + { + "id": "payload-sdk", + "name": "PS5 payload SDK fork and its platform layer (libps5platform.a, headers, import stubs)", + "kind": "code", + "always": true, + "artifacts": ["eboot.bin", "cores/*.so"], + "licence": "GPL-3.0-or-later", + "copyright": ["Copyright (C) 2022-2026 John Törnblom and ps5-payload-dev contributors", "Copyright (C) 2026 Mihawk (the platform layer)"], + "texts": [ + {"from": "${SDK_FORK}/LICENSE", "to": "GPL-3.0.txt"}, + {"from": "${SDK_FORK}/platform/src/regex/COPYRIGHT.musl", "to": "musl-regex-COPYRIGHT.txt"}, + {"from": "${SDK_FORK}/platform/src/dlmalloc/SOURCE", "to": "dlmalloc-SOURCE.txt"} + ], + "source": {"kind": "stamp", "file": ".deps/native/ps5-payload-sdk/.ps5-sdk-revision", "pin": {"file": "tools/setup-native-dependencies.sh", "var": "sdk_revision"}, "remote": "https://github.com/mihawk-99/PS5_PayloadSDK"}, + "modifications": "The fork installs over the ps5-payload-dev SDK v0.42 release binaries (tools/setup-native-dependencies.sh). The platform layer's regex is musl's (MIT, with TRE's BSD-2-Clause notice) and its heap is dlmalloc 2.8.6 (MIT)." + }, + { + "id": "dlmalloc", + "name": "dlmalloc 2.8.6 (the title's overflow heap)", + "kind": "code", + "always": true, + "artifacts": ["eboot.bin"], + "licence": "MIT", + "copyright": ["Copyright 2023 Doug Lea"], + "texts": [{"from": "tooling/third_party/dlmalloc/malloc.c", "to": "malloc.c-header.txt", "head": 40}, {"from": "tooling/third_party/dlmalloc/SOURCE", "to": "SOURCE.txt"}], + "source": {"kind": "git", "path": ".", "remote": "https://github.com/mihawk-99/PS5_RetroArch"}, + "modifications": "Unmodified; tooling/third_party/dlmalloc in PS5_RetroArch." + }, + { + "id": "llvm-runtime", + "name": "LLVM libc++, libc++abi, libunwind and compiler-rt builtins (statically linked into eboot.bin; the cores resolve them from it)", + "kind": "code", + "always": true, + "artifacts": ["eboot.bin"], + "licence": "Apache-2.0 WITH LLVM-exception", + "copyright": ["Copyright (c) 2003-2026 University of Illinois at Urbana-Champaign and the LLVM project contributors"], + "texts": [{"from": ["${LLVM}/llvm/LICENSE.TXT", "../PS5_LLVM/llvm/LICENSE.TXT"], "to": "LICENSE.TXT"}], + "source": {"kind": "fixed", "revision": "ps5-payload-dev SDK v0.42 release archives", "url": "https://github.com/ps5-payload-dev/sdk/releases/tag/v0.42"}, + "modifications": "Unmodified release archives of the SDK. RPCS3's own LLVM is listed with that core." + }, + { + "id": "zlib", + "name": "zlib 1.3.2", + "kind": "code", + "always": true, + "artifacts": ["eboot.bin"], + "licence": "Zlib", + "copyright": ["Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler"], + "texts": [{"from": ".deps/native/zlib/zlib-1.3.2/LICENSE", "to": "LICENSE"}], + "source": {"kind": "pin", "file": "tools/setup-native-dependencies.sh", "var": "zlib_version", "url": "https://zlib.net/fossils/zlib-{rev}.tar.gz"}, + "modifications": "Unmodified." + }, + { + "id": "radv", + "name": "RADV, Mesa's Vulkan driver, and the parts of Mesa it links (PS5_Mesa fork with the PS5 winsys)", + "kind": "code", + "driver": "radv", + "artifacts": ["eboot.bin"], + "licence": "MIT AND others stated per file (see Mesa-license.rst)", + "copyright": ["Copyright the Mesa contributors (per-file notices in the source)"], + "texts": [ + {"from": "../PS5_Mesa/docs/license.rst", "to": "Mesa-license.rst"}, + {"from": "../PS5_Mesa/licenses", "to": "licenses"} + ], + "source": {"kind": "provenance", "file": "${VULKAN}/.deps/native/radv-release/PROVENANCE.txt", "key": "revision", "remote": "https://github.com/mihawk-99/PS5_Mesa", "archive": "${VULKAN}/.deps/native/radv-release/lib/libvulkan_radeon.ps5.a"}, + "modifications": "The fork's commits on main over Mesa 26.2.0 (the PS5 winsys, src/amd/vulkan/winsys/ps5)." + }, + { + "id": "ps5-vulkan", + "name": "PS5_Vulkan: the RADV link recipe and linker script (RADV builds), or ps5vk (ps5vk builds)", + "kind": "code", + "always": true, + "artifacts": ["eboot.bin"], + "licence": "GPL-3.0-or-later", + "copyright": ["Copyright (C) 2026 Mihawk", "Copyright (C) 2026 BlackBearReloaded"], + "texts": [{"from": "${VULKAN}/LICENSE", "to": "GPL-3.0.txt"}], + "source": {"kind": "git", "path": "${VULKAN}", "remote": "https://github.com/mihawk-99/PS5_Vulkan"}, + "modifications": "tools/radv-link.sh and tooling/psbc/ps5-pie-unwind.ld (RADV builds); driver/ and its archives (ps5vk builds)." + }, + { + "id": "ps5vk-mesa-runtime", + "name": "Mesa's common Vulkan runtime (ps5vk builds only)", + "kind": "code", + "driver": "ps5vk", + "artifacts": ["eboot.bin"], + "licence": "MIT", + "copyright": ["Copyright the Mesa contributors (per-file notices in the source)"], + "texts": [{"from": "${VULKAN}/.deps/native/mesa/mesa-26.2.0/docs/license.rst", "to": "Mesa-license.rst"}, {"from": "${VULKAN}/.deps/native/mesa/mesa-26.2.0/licenses", "to": "licenses"}], + "source": {"kind": "fixed", "revision": "26.2.0", "url": "https://archive.mesa3d.org/mesa-26.2.0.tar.xz"}, + "modifications": "Built by PS5_Vulkan tools/build-vulkan-runtime.sh with its window-system stubs." + }, + { + "id": "ps5vk-psbc", + "name": "OpenGNM PSBC shader compiler and ps5-opengl's package writer (ps5vk builds only)", + "kind": "code", + "driver": "ps5vk", + "artifacts": ["eboot.bin"], + "licence": "MIT AND GPL-3.0-or-later", + "copyright": ["Copyright (c) 2026 OpenGNM contributors", "Copyright (c) 2015-2024 Mesa contributors", "Copyright (C) 2026 BlackBearReloaded"], + "texts": [{"from": "${VULKAN}/.deps/native/opengl-sdk/third_party/opengnm-psbc/LICENSE", "to": "OpenGNM-PSBC-LICENSE.txt"}], + "source": {"kind": "provenance", "file": "${VULKAN}/.deps/native/opengl-sdk/PROVENANCE.txt", "key": "source revision", "remote": "https://github.com/blackbearreloaded/ps5-opengl"}, + "modifications": "PS5_Vulkan tooling/psbc/patch-*.py over the SDK's compiler fork." + }, + { + "id": "retroarch-assets", + "name": "RetroArch assets: the XMB monochrome theme and its font", + "kind": "asset", + "artifacts": ["assets/xmb/**"], + "licence": "CC-BY-4.0 (icons); the M+ FONT LICENSE (font)", + "copyright": ["The RetroArch assets contributors (https://github.com/libretro/retroarch-assets)", "The M+ FONTS PROJECT (monochrome/font.ttf)"], + "texts": [{"from": "assets/xmb/COPYING", "to": "CC-BY-4.0.txt"}, {"from": "assets/xmb/monochrome/FONT-LICENSE.txt", "to": "M+-FONT-LICENSE.txt"}, {"from": "assets/xmb/source.json", "to": "source.json"}], + "source": {"kind": "json", "file": "assets/xmb/source.json", "key": "revision", "remote": "https://github.com/libretro/retroarch-assets"}, + "modifications": "A selection of files, unmodified; assets/xmb/source.json lists each with its digest." + }, + { + "id": "core-info", + "name": "libretro-core-info metadata (.info files)", + "kind": "metadata", + "artifacts": ["info/*.info", "cores/*.info"], + "licence": "MIT", + "copyright": ["Copyright (c) 2019 The RetroArch team"], + "texts": [{"from": "tooling/notices/texts/libretro-core-info-COPYING.txt", "to": "COPYING"}], + "source": {"kind": "pin", "file": "tools/core-fork.sh", "var": "core_info_revision", "remote": "https://github.com/libretro/libretro-core-info"}, + "modifications": "Unmodified, except rpcs3_libretro.info, which this repository writes (tooling/rpcs3)." + }, + { + "id": "title-art", + "name": "Launcher artwork and selection music (sce_sys)", + "kind": "asset", + "artifacts": ["sce_sys/icon0.png", "sce_sys/pic0.dds", "sce_sys/pic1.dds", "sce_sys/snd0.at9"], + "licence": "see modifications", + "copyright": ["snd0.at9: Copyright (C) 2026 BlackBearReloaded, GPL-3.0-or-later according to ps5-native-app-boilerplate's NOTICE.md"], + "texts": [], + "source": {"kind": "git", "path": ".", "remote": "https://github.com/mihawk-99/PS5_RetroArch"}, + "modifications": "icon0.png is the RetroArch logo (libretro's branding); pic0.dds and pic1.dds were converted from a background image whose origin is not recorded (docs/releases/SOURCE_CORRESPONDENCE.md); snd0.at9 is ps5-native-app-boilerplate's default selection track." + }, + { + "id": "fceumm", + "name": "FCEUmm (NES)", + "kind": "code", + "artifacts": ["cores/fceumm_libretro.so"], + "licence": "GPL-2.0-or-later", + "copyright": ["Copyright the FCEU team, CaH4e3 and contributors (per-file notices)"], + "texts": [{"from": "build/cores/fceumm/Copying", "to": "Copying"}], + "source": {"kind": "core", "build": "fceumm", "remote": "https://github.com/libretro/libretro-fceumm"}, + "modifications": "None beyond the build (tools/build-fceumm.sh)." + }, + { + "id": "mgba", + "name": "mGBA (Game Boy, Game Boy Color, Game Boy Advance)", + "kind": "code", + "artifacts": ["cores/mgba_libretro.so"], + "licence": "MPL-2.0", + "copyright": ["Copyright (c) 2013-2026 Jeffrey Pfau and contributors"], + "texts": [{"from": "build/cores/mgba/LICENSE", "to": "LICENSE"}, {"from": "build/cores/mgba/res/licenses", "to": "licenses"}], + "source": {"kind": "core", "build": "mgba", "remote": "https://github.com/libretro/mgba"}, + "modifications": "patches/mgba (PS5_RetroArch)." + }, + { + "id": "snes9x", + "name": "Snes9x (SNES)", + "kind": "code", + "noncommercial": true, + "artifacts": ["cores/snes9x_libretro.so"], + "licence": "LicenseRef-Snes9x (non-commercial)", + "copyright": ["Copyright (c) 1996-2026 the Snes9x authors listed in LICENSE"], + "texts": [{"from": "build/cores/snes9x/LICENSE", "to": "LICENSE", "verbatim": true}], + "source": {"kind": "core", "build": "snes9x", "remote": "https://github.com/libretro/snes9x"}, + "modifications": "patches/snes9x (PS5_RetroArch)." + }, + { + "id": "fbneo", + "name": "FinalBurn Neo (arcade)", + "kind": "code", + "noncommercial": true, + "artifacts": ["cores/fbneo_libretro.so"], + "licence": "LicenseRef-FBNeo (non-commercial; includes MAME-derived code under MAME's licence)", + "copyright": ["Copyright Team FBNeo and the authors listed in src/license.txt"], + "texts": [{"from": "build/cores/fbneo/src/license.txt", "to": "license.txt", "verbatim": true}, {"from": "build/cores/fbneo/LICENSE.md", "to": "LICENSE.md"}], + "source": {"kind": "core", "build": "fbneo", "remote": "https://github.com/libretro/FBNeo"}, + "modifications": "patches/fbneo (PS5_RetroArch). FBNeo's licence requires its full text, verbatim, with every copy." + }, + { + "id": "genesis-plus-gx", + "name": "Genesis Plus GX (Mega Drive/Genesis, Master System, Game Gear, SG-1000, Sega CD)", + "kind": "code", + "noncommercial": true, + "artifacts": ["cores/genesis_plus_gx_libretro.so"], + "licence": "LicenseRef-GenesisPlusGX (non-commercial; parts LGPL-2.1-or-later and BSD, see LICENSE.txt)", + "copyright": ["Copyright (c) 1998-2003 Charles MacDonald", "Copyright (c) 2007-2026 Eke-Eke"], + "texts": [{"from": "build/cores/genesis_plus_gx/LICENSE.txt", "to": "LICENSE.txt", "verbatim": true}], + "source": {"kind": "core", "build": "genesis_plus_gx", "remote": "https://github.com/libretro/Genesis-Plus-GX"}, + "modifications": "patches/genesis-plus-gx (PS5_RetroArch). Its licence requires the complete source of a modified redistribution: the release's source archives." + }, + { + "id": "ppsspp", + "name": "PPSSPP v1.20.4 (PSP) and its system assets", + "kind": "code", + "artifacts": ["cores/ppsspp_libretro.so", "system/PPSSPP/**"], + "licence": "GPL-2.0-or-later (code); OFL-1.1 (fonts); others per file", + "copyright": ["Copyright (c) 2012- PPSSPP Project and contributors", "Roboto Condensed: Copyright 2011 The Roboto Project Authors", "Inconsolata: Copyright 2006 The Inconsolata Project Authors"], + "texts": [{"from": ".deps/ppsspp-src/LICENSE.TXT", "to": "LICENSE.TXT"}, {"from": "tooling/notices/texts/OFL-1.1.txt", "to": "fonts-OFL-1.1.txt"}], + "source": {"kind": "core", "build": "ppsspp", "tree": ".deps/ppsspp-src", "remote": "https://github.com/hrydgard/ppsspp"}, + "modifications": "patches/ppsspp/ps5-port.patch (PS5_RetroArch); submodules at the revisions its build.json records." + }, + { + "id": "dolphin", + "name": "Dolphin (GameCube, Wii), libretro/dolphin, and its Sys tree", + "kind": "code", + "artifacts": ["cores/dolphin_libretro.so", "system/dolphin-emu/**"], + "licence": "GPL-2.0-or-later (and the licences in LICENSES/ for bundled parts)", + "copyright": ["Copyright the Dolphin Emulator Project and contributors"], + "texts": [{"from": ".deps/dolphin-src/COPYING", "to": "COPYING"}, {"from": ".deps/dolphin-src/LICENSES", "to": "LICENSES"}], + "source": {"kind": "core", "build": "dolphin", "tree": ".deps/dolphin-src", "remote": "https://github.com/libretro/dolphin"}, + "modifications": "patches/dolphin/ps5-port.patch (PS5_RetroArch)." + }, + { + "id": "lrps2", + "name": "LRPS2 (PCSX2, PlayStation 2)", + "kind": "code", + "artifacts": ["cores/pcsx2_libretro.so"], + "licence": "GPL-3.0-or-later", + "copyright": ["Copyright the PCSX2 Dev Team and contributors"], + "texts": [{"from": ".deps/lrps2-src/COPYING.GPLv3", "to": "COPYING.GPLv3"}], + "source": {"kind": "core", "build": "lrps2", "tree": ".deps/lrps2-src", "remote": "https://github.com/mihawk-99/PS5_LRPS2"}, + "modifications": "The fork's commits over libretro/ps2." + }, + { + "id": "beetle-psx", + "name": "Beetle PSX HW (Mednafen PSX, PlayStation)", + "kind": "code", + "artifacts": ["cores/mednafen_psx_hw_libretro.so"], + "licence": "GPL-2.0-or-later", + "copyright": ["Copyright Mednafen Team and the beetle-psx-libretro contributors"], + "texts": [{"from": ".deps/beetle-psx-src/COPYING", "to": "COPYING"}, {"from": ".deps/beetle-psx-src/parallel-psx/COPYING", "to": "parallel-psx-COPYING"}], + "source": {"kind": "core", "build": "beetle-psx", "tree": ".deps/beetle-psx-src", "remote": "https://github.com/mihawk-99/PS5_BeetlePSX"}, + "modifications": "The fork's commits over libretro/beetle-psx-libretro." + }, + { + "id": "mupen64plus", + "name": "Mupen64Plus-Next (Nintendo 64), with GLideN64, ParaLLEl-RDP and ParaLLEl-RSP", + "kind": "code", + "artifacts": ["cores/mupen64plus_next_libretro.so"], + "licence": "GPL-2.0-or-later AND MIT AND LGPL-3.0-or-later (per component)", + "copyright": ["Copyright the Mupen64Plus, GLideN64 and ParaLLEl authors"], + "texts": [ + {"from": ".deps/mupen64plus-src/LICENSE", "to": "LICENSE"}, + {"from": ".deps/mupen64plus-src/GLideN64/LICENSE", "to": "GLideN64-LICENSE"}, + {"from": ".deps/mupen64plus-src/mupen64plus-rsp-paraLLEl/LICENSE", "to": "paraLLEl-RSP-LICENSE"}, + {"from": ".deps/mupen64plus-src/mupen64plus-rsp-paraLLEl/LICENSE.LESSER", "to": "paraLLEl-RSP-LICENSE.LESSER"}, + {"from": ".deps/mupen64plus-src/mupen64plus-rsp-paraLLEl/LICENSE.MIT", "to": "paraLLEl-RSP-LICENSE.MIT"}, + {"from": ".deps/mupen64plus-src/mupen64plus-core/LICENSES", "to": "mupen64plus-core-LICENSES"} + ], + "source": {"kind": "core", "build": "mupen64plus", "tree": ".deps/mupen64plus-src", "remote": "https://github.com/mihawk-99/PS5_Mupen64Plus"}, + "modifications": "The fork's commits over libretro/mupen64plus-libretro-nx." + }, + { + "id": "beetle-saturn", + "name": "Beetle Saturn (Mednafen Saturn)", + "kind": "code", + "artifacts": ["cores/mednafen_saturn_libretro.so"], + "licence": "GPL-2.0-or-later", + "copyright": ["Copyright Mednafen Team and the beetle-saturn-libretro contributors"], + "texts": [{"from": ".deps/beetle-saturn-src/COPYING", "to": "COPYING"}], + "source": {"kind": "core", "build": "beetle-saturn", "tree": ".deps/beetle-saturn-src", "remote": "https://github.com/mihawk-99/PS5_BeetleSaturn"}, + "modifications": "The fork's commits over libretro/beetle-saturn-libretro." + }, + { + "id": "vice", + "name": "VICE x64sc (Commodore 64)", + "kind": "code", + "artifacts": ["cores/vice_x64sc_libretro.so"], + "licence": "GPL-2.0-or-later", + "copyright": ["Copyright the VICE Team and vice-libretro contributors"], + "texts": [{"from": ".deps/vice-src/COPYING", "to": "COPYING"}], + "source": {"kind": "core", "build": "vice", "tree": ".deps/vice-src", "remote": "https://github.com/mihawk-99/PS5_VICE"}, + "modifications": "The fork's commits over libretro/vice-libretro." + }, + { + "id": "desmume", + "name": "DeSmuME (Nintendo DS)", + "kind": "code", + "artifacts": ["cores/desmume_libretro.so"], + "licence": "GPL-2.0-or-later", + "copyright": ["Copyright the DeSmuME team and contributors"], + "texts": [{"from": ".deps/desmume-src/desmume/COPYING", "to": "COPYING"}], + "source": {"kind": "core", "build": "desmume", "tree": ".deps/desmume-src", "remote": "https://github.com/mihawk-99/PS5_DeSmuME"}, + "modifications": "The fork's commits over libretro/desmume." + }, + { + "id": "azahar", + "name": "Azahar (Nintendo 3DS), with Dynarmic", + "kind": "code", + "artifacts": ["cores/azahar_libretro.so"], + "licence": "GPL-2.0-or-later (Azahar); 0BSD (Dynarmic); others per externals/", + "copyright": ["Copyright the Citra Emulator Project / Azahar Emulator Project", "Copyright MerryMage and the Dynarmic contributors"], + "texts": [{"from": ".deps/azahar-src/license.txt", "to": "license.txt"}, {"from": ".deps/azahar-src/externals/dynarmic/LICENSE.txt", "to": "dynarmic-LICENSE.txt"}], + "source": {"kind": "core", "build": "azahar", "tree": ".deps/azahar-src", "remote": "https://github.com/mihawk-99/PS5_Azahar"}, + "modifications": "The fork's commits over azahar-emu/azahar; externals/dynarmic is mihawk-99/PS5_Dynarmic." + }, + { + "id": "mame", + "name": "MAME 0.289 (arcade), libretro/mame", + "kind": "code", + "artifacts": ["cores/mame_libretro.so"], + "licence": "GPL-2.0-or-later (MAME as a whole; files BSD-3-Clause and others, see docs/legal)", + "copyright": ["Copyright the MAME team and contributors"], + "texts": [{"from": ".deps/mame-src/COPYING", "to": "COPYING"}, {"from": ".deps/mame-src/docs/legal", "to": "legal"}], + "source": {"kind": "core", "build": "mame", "tree": ".deps/mame-src", "remote": "https://github.com/mihawk-99/PS5_MAME"}, + "modifications": "The fork's commits over libretro/mame." + }, + { + "id": "rpcs3", + "name": "RPCS3 (PlayStation 3), with its bundled third-party code, LLVM, FFmpeg and GNU libiconv", + "kind": "code", + "artifacts": ["cores/rpcs3_libretro.so", "system/RPCS3/Icons/**", "system/RPCS3/patches/**", "system/RPCS3/fonts/**"], + "licence": "GPL-2.0-only (RPCS3); wolfSSL under GPL-2.0 by its RPCS3 exception; Apache-2.0 WITH LLVM-exception (LLVM); LGPL-2.1-or-later (FFmpeg, libiconv); OFL-1.1 (Inter); others per 3rdparty/", + "copyright": ["Copyright the RPCS3 team and contributors", "Copyright the LLVM project contributors", "Copyright the FFmpeg developers", "Copyright the Free Software Foundation (GNU libiconv)"], + "texts": [ + {"from": ".deps/rpcs3-src/LICENSE", "to": "LICENSE"}, + {"from": ".deps/rpcs3-src/3rdparty/wolfssl/wolfssl/LICENSING", "to": "wolfSSL-LICENSING"}, + {"from": ["${LLVM}/llvm/LICENSE.TXT", "../PS5_LLVM/llvm/LICENSE.TXT"], "to": "LLVM-LICENSE.TXT"}, + {"tar": ".deps/downloads/ffmpeg-8.1.1.tar.xz", "member": "ffmpeg-8.1.1/LICENSE.md", "to": "FFmpeg-LICENSE.md"}, + {"tar": ".deps/downloads/ffmpeg-8.1.1.tar.xz", "member": "ffmpeg-8.1.1/COPYING.LGPLv2.1", "to": "FFmpeg-COPYING.LGPLv2.1"}, + {"tar": ".deps/downloads/libiconv-1.18.tar.gz", "member": "libiconv-1.18/COPYING.LIB", "to": "libiconv-COPYING.LIB"} + ], + "source": {"kind": "core", "build": "rpcs3", "tree": ".deps/rpcs3-src", "extra": [{"git": ".deps/llvm-project", "pin": {"file": "tools/build-llvm.sh", "var": "revision"}, "paths": ["cmake", "llvm", "third-party"], "name": "llvm-project", "remote": "https://github.com/mihawk-99/PS5_LLVM"}, {"tarball": ".deps/downloads/ffmpeg-8.1.1.tar.xz"}, {"tarball": ".deps/downloads/libiconv-1.18.tar.gz"}, {"tarball": ".deps/downloads/vulkan-headers-1.4.354.tar.gz"}, {"tarball": ".deps/downloads/volk-1.4.350.1.tar.gz"}], "remote": "https://github.com/mihawk-99/PS5_RPCS3"}, + "modifications": "The fork's commits over RPCS3/rpcs3; LLVM from mihawk-99/PS5_LLVM (tools/build-llvm.sh), FFmpeg and libiconv release tarballs (tools/build-ffmpeg.sh, tools/build-libiconv.sh). Not in a public release: see the audit's RPCS3 licence finding before shipping it." + } + ] +} diff --git a/tooling/notices/texts/OFL-1.1.txt b/tooling/notices/texts/OFL-1.1.txt new file mode 100644 index 0000000..3934b47 --- /dev/null +++ b/tooling/notices/texts/OFL-1.1.txt @@ -0,0 +1,90 @@ +The SIL Open Font License 1.1, verbatim. Copied from the LICENSE.txt of Inter 4.1 +(https://github.com/rsms/inter/releases/tag/v4.1), from the line that opens the licence; +each font's own copyright line is recorded beside it in the title's licenses/ folder. + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION AND CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/tooling/notices/texts/libretro-core-info-COPYING.txt b/tooling/notices/texts/libretro-core-info-COPYING.txt new file mode 100644 index 0000000..fbfbe29 --- /dev/null +++ b/tooling/notices/texts/libretro-core-info-COPYING.txt @@ -0,0 +1,24 @@ +libretro-core-info's licence (COPYING at 5a74858ab2f7a50cebb5a6330895bc38899531c0), which covers the +core metadata (.info) files staged in info/ and cores/. + +MIT License + +Copyright (c) 2019 The RetroArch team + +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. diff --git a/tools/build-title.sh b/tools/build-title.sh index cdd64f1..51d24cd 100755 --- a/tools/build-title.sh +++ b/tools/build-title.sh @@ -376,6 +376,13 @@ else "$icd" >&2 fi +# The licences and notices the parts of this folder require, and the source revision +# of each (tooling/notices/components.json, docs/RELEASING.md), written before the +# manifest so the manifest covers them. It fails if a staged core is not the file its +# build report describes. +python3 "$root/tools/stage-notices.py" "$dist" --driver "$vulkan_driver" \ + --vulkan-dir "$vulkan_dir" --release-tag "${PS5_RELEASE_TAG:-}" + # The manifest is recorded here, as part of building, because a folder published # without one cannot be told apart from the folder published last week: this # project has already produced a title folder whose eboot.bin was a raw link-stage diff --git a/tools/check-notices.py b/tools/check-notices.py new file mode 100644 index 0000000..6d552d9 --- /dev/null +++ b/tools/check-notices.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (C) 2026 Mihawk +"""Check a title folder's licenses/ against the files it ships. + + python3 tools/check-notices.py [dist/PPSA99169] [--release] + +What it establishes, and nothing more: + - every executable file (eboot.bin, *.prx, *.so) and every core .info file belongs + to at least one listed part, and the sha256 recorded for it is the file's own; + - every listed licence text is present and not empty, and a text marked verbatim + (FBNeo's, Snes9x's, Genesis Plus GX's) is byte for byte the one staged; + - a part under non-commercial terms is marked as such; + - with --release, every part's source is at a committed revision and has an + address, which is what a published build needs. +It does not decide whether a licence permits a combination; the audit does that. +""" + +import argparse +import fnmatch +import hashlib +import json +import sys +from pathlib import Path + +COVERED = ("eboot.bin", "sce_module/*.prx", "cores/*.so", "cores/*.info", "info/*.info") +EXECUTABLE = ("eboot.bin", "*.prx", "*.so") + + +def sha256(path): + return hashlib.sha256(Path(path).read_bytes()).hexdigest() + + +def check(title, release=False): + problems = [] + folder = title / "licenses" + table = folder / "components.json" + if not table.is_file(): + return [f"{table} is missing; run tools/stage-notices.py"] + if not (folder / "README.txt").is_file(): + problems.append("licenses/README.txt is missing") + components = json.loads(table.read_text(encoding="utf-8"))["components"] + owned = {} + for component in components: + for name in component["files"]: + owned.setdefault(name, []).append(component["id"]) + for record in component.get("text_records", []): + path = folder / component["id"] / record["file"] + if not path.exists() or (path.is_file() and path.stat().st_size == 0): + problems.append(f"{component['id']}: licence text {record['file']} is missing or empty") + elif "sha256" in record and sha256(path) != record["sha256"]: + problems.append(f"{component['id']}: {record['file']} is not the verbatim text staged") + if component["kind"] == "code" and not component["texts"]: + problems.append(f"{component['id']}: code shipped with no licence text") + for name, recorded in component["executables"].items(): + if not (title / name).is_file(): + problems.append(f"{component['id']}: {name} is listed but not in the title") + elif sha256(title / name) != recorded: + problems.append(f"{component['id']}: {name} changed after its notice was staged") + if "LicenseRef" in component["licence"] and not component.get("noncommercial"): + problems.append(f"{component['id']}: custom licence not marked non-commercial or reviewed") + source = component["source"] + if release: + if source.get("dirty"): + problems.append(f"{component['id']}: built from uncommitted source") + if not source.get("url", "").startswith("https://"): + problems.append(f"{component['id']}: no published source address") + for path in sorted(p for p in title.rglob("*") if p.is_file()): + name = path.relative_to(title).as_posix() + if name.startswith("licenses/"): + continue + if any(fnmatch.fnmatchcase(name, pattern) for pattern in COVERED) and name not in owned: + problems.append(f"{name} belongs to no listed part") + if (any(fnmatch.fnmatchcase(path.name, p) for p in EXECUTABLE) + and not any(name in c["executables"] for c in components)): + problems.append(f"{name} has no recorded digest") + return problems + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("title", type=Path, nargs="?", + help="the title folder (default: the one folder under dist/)") + parser.add_argument("--release", action="store_true", + help="also require committed, published source for every part") + args = parser.parse_args(argv) + if args.title is None: + built = sorted(Path(__file__).resolve().parent.parent.glob("dist/PPSA[0-9]*")) + if len(built) != 1: + print("error: [notices] name the title folder; dist/ holds " + f"{len(built)} of them", file=sys.stderr) + return 2 + args.title = built[0] + problems = check(args.title, args.release) + for problem in problems: + print(f" FAIL {problem}", file=sys.stderr) + if problems: + print(f"==> [notices] {len(problems)} problem(s) in {args.title}/licenses", file=sys.stderr) + return 1 + print(f"==> [notices] {args.title}/licenses covers every shipped executable") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/source-bundle.py b/tools/source-bundle.py new file mode 100644 index 0000000..bbcebd7 --- /dev/null +++ b/tools/source-bundle.py @@ -0,0 +1,209 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (C) 2026 Mihawk +"""Archive the corresponding source of a staged title, one archive per part. + + python3 tools/source-bundle.py dist/PPSA99169 OUT [--only a,b] [--skip a,b] [--list] + [--allow-dirty] + +It reads the title's licenses/components.json (tools/stage-notices.py) and writes, for +each part that is code, the source at the revision recorded there: + + a git source git archive of that revision, with every submodule the build + checked out, each at the commit the revision records for it + a core's tarball the pinned tarball the build verified (build.json's digest) + RetroArch vendor/retroarch, the pristine fetched tree, checked against its pin + +plus SHA256SUMS and SOURCES.txt, which say what each archive is. These are meant to be +attached to the release beside the title ZIP (docs/RELEASING.md), so the source is +offered from the same place as the binary. A part whose repository has uncommitted +changes is refused unless --allow-dirty is given: its committed revision is not what +was built. --list prints the plan without writing anything. +""" + +import argparse +import hashlib +import io +import json +import re +import shutil +import subprocess +import sys +import tarfile +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent +TABLE = ROOT / "tooling/notices/components.json" + + +class BundleError(Exception): + pass + + +def sha256(path): + digest = hashlib.sha256() + with open(path, "rb") as stream: + for block in iter(lambda: stream.read(1 << 20), b""): + digest.update(block) + return digest.hexdigest() + + +def git(path, *args, binary=False): + result = subprocess.run(["git", "-C", str(path), *args], check=True, capture_output=True) + return result.stdout if binary else result.stdout.decode().strip() + + +def pinned(spec, root): + text = (root / spec["file"]).read_text(encoding="utf-8") + found = re.search(r'^\s*' + re.escape(spec["var"]) + r'="?([^"\s#]+)', text, re.M) + if not found: + raise BundleError(f"no {spec['var']}= in {spec['file']}") + return found.group(1) + + +def submodules(tree, revision, prefix=""): + """(path, commit, checkout) for each submodule initialised in TREE, recursively.""" + found = [] + listing = git(tree, "ls-tree", "-r", revision) + for line in listing.splitlines(): + meta, path = line.split("\t", 1) + mode, kind, commit = meta.split() + if kind != "commit": + continue + checkout = tree / path + if not (checkout / ".git").exists(): + continue # not checked out, so not part of what was built + found.append((prefix + path, commit, checkout)) + found += submodules(checkout, commit, prefix + path + "/") + return found + + +def git_archive(tree, revision, output, name, paths=(), with_submodules=True): + """One tar.gz: TREE at REVISION under NAME/, submodules appended at their paths.""" + with tarfile.open(output, "w:gz") as bundle: + parts = [("", revision, tree)] + if with_submodules: + parts += submodules(tree, revision) + for path, commit, checkout in parts: + prefix = f"{name}/{path}/" if path else f"{name}/" + raw = git(checkout, "archive", "--format=tar", f"--prefix={prefix}", commit, + *(paths if not path else ()), binary=True) + with tarfile.open(fileobj=io.BytesIO(raw)) as part: + for member in part.getmembers(): + if member.type == tarfile.XGLTYPE or member.name == "pax_global_header": + continue + bundle.addfile(member, part.extractfile(member) if member.isfile() else None) + return len(parts) - 1 + + +def plan(component, root): + """The archives to write for one part: a list of (filename, action, description).""" + source = component["source"] + kind, revision = source["kind"], source["revision"] + short = revision[:12] + cid = component["id"] + spec = next(c for c in json.loads(TABLE.read_text())["components"] if c["id"] == cid)["source"] + steps = [] + if kind in ("git", "stamp", "provenance") or (kind == "core" and "tree" in spec): + if kind == "git": + tree = root / spec["path"].replace("${VULKAN}", "../PS5_Vulkan") + elif kind == "stamp": + tree = root / "../PS5_PayloadSDK" + elif kind == "provenance": + tree = root / ("../PS5_Mesa" if cid == "radv" else "../ps5-opengl-sdk-0.3.0") + else: + tree = root / spec["tree"] + # Parts from one repository share one archive, named after the repository. + name = cid if kind == "core" else tree.resolve().name + steps.append((f"{name}-{short}.tar.gz", ("git", tree, revision, ()), source.get("url", ""))) + elif kind == "core": + digest = source.get("source_archive_sha256") + matches = [p for p in (root / ".deps/downloads").glob(f"*-{revision}.tar.gz") + if digest and sha256(p) == digest] + if not matches: + raise BundleError(f"{cid}: no downloaded tarball with the digest build.json records") + steps.append((matches[0].name, ("copy", matches[0]), source.get("url", ""))) + elif kind == "pin" and cid == "retroarch": + stamp = (root / "vendor/retroarch/.rarch-revision").read_text().strip() + if stamp != revision: + raise BundleError(f"vendor/retroarch is at {stamp}, the pin is {revision}") + steps.append((f"retroarch-{short}.tar.gz", ("tree", root / "vendor/retroarch"), source.get("url", ""))) + elif kind == "pin" and cid == "zlib": + tarball = root / f".deps/native/zlib/zlib-{revision}.tar.gz" + steps.append((tarball.name, ("copy", tarball), source.get("url", ""))) + else: + return [] # a part with no source to archive here (see SOURCES.txt) + for extra in spec.get("extra", []): + if "tarball" in extra: + tarball = root / extra["tarball"] + steps.append((tarball.name, ("copy", tarball), f"used by {cid}")) + else: + rev = pinned(extra["pin"], root) + steps.append((f"{extra['name']}-{rev[:12]}.tar.gz", + ("git", root / extra["git"], rev, tuple(extra.get("paths", ()))), + f"{extra.get('remote', '')}/tree/{rev} (used by {cid})")) + return steps + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("title", type=Path) + parser.add_argument("out", type=Path) + parser.add_argument("--only", default="") + parser.add_argument("--skip", default="") + parser.add_argument("--list", action="store_true") + parser.add_argument("--allow-dirty", action="store_true") + args = parser.parse_args(argv) + staged = json.loads((args.title / "licenses/components.json").read_text(encoding="utf-8")) + only = set(filter(None, args.only.split(","))) + skip = set(filter(None, args.skip.split(","))) + written, index, done = [], [], set() + try: + for component in staged["components"]: + cid = component["id"] + if component["kind"] != "code" or (only and cid not in only) or cid in skip: + continue + if component["source"].get("dirty") and not args.allow_dirty: + raise BundleError(f"{cid}: built from uncommitted source (commit it, or --allow-dirty)") + steps = plan(component, ROOT) + if not steps: + # Nothing archived here: say where the source is, so the index is complete. + index.append(f"-\t{cid}\t{component['source'].get('url', component['source']['revision'])}") + for filename, action, where in steps: + if filename in done: + continue + done.add(filename) + index.append(f"{filename}\t{cid}\t{where}") + if args.list: + print(f"{cid:18} {filename} <- {action[0]} {action[1]}") + continue + args.out.mkdir(parents=True, exist_ok=True) + target = args.out / filename + if action[0] == "copy": + shutil.copyfile(action[1], target) + elif action[0] == "tree": + with tarfile.open(target, "w:gz") as bundle: + bundle.add(action[1], arcname=filename[:-len(".tar.gz")], + filter=lambda m: None if m.name.endswith(".rarch-revision") else m) + else: + count = git_archive(action[1], action[2], target, filename[:-len(".tar.gz")], + action[3]) + print(f"==> [source] {filename}: {count} submodules") + written.append(target) + except (BundleError, OSError, subprocess.CalledProcessError, StopIteration) as error: + print(f"error: [source] {error}", file=sys.stderr) + return 2 + if args.list: + return 0 + args.out.mkdir(parents=True, exist_ok=True) + (args.out / "SOURCES.txt").write_text( + "archive\tpart\tpublished at\n" + "\n".join(index) + "\n", encoding="utf-8") + with open(args.out / "SHA256SUMS", "w", encoding="utf-8") as sums: + for path in sorted(args.out.glob("*.tar*")): + sums.write(f"{sha256(path)} {path.name}\n") + print(f"==> [source] {len(written)} archives in {args.out}") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/stage-notices.py b/tools/stage-notices.py new file mode 100644 index 0000000..2a3e144 --- /dev/null +++ b/tools/stage-notices.py @@ -0,0 +1,284 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (C) 2026 Mihawk +"""Write licenses/ into a built title folder. + + python3 tools/stage-notices.py dist/PPSA99169 [--driver radv|ps5vk] [--release-tag TAG] + +Every part of the title is listed in tooling/notices/components.json with its licence, +the licence texts that must travel with it and where its source is. This copies those +texts from the source trees the build used, and writes two files beside them: + + licenses/components.json each part's licence, source revision and URL, and the + sha256 of each executable file it went into + licenses/README.txt the same for a person reading the folder + +A core is tied to its source by its build report (build/cores//build.json): the +digest recorded there must be the digest of the staged file, or this fails. RADV is tied +to PS5_Mesa by the release archive's PROVENANCE.txt, whose archive digest is checked. +tools/check-notices.py verifies the result; tools/source-bundle.py archives the sources. +""" + +import argparse +import fnmatch +import hashlib +import json +import os +import re +import shutil +import subprocess +import sys +import tarfile +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent +TABLE = ROOT / "tooling/notices/components.json" +EXECUTABLE = ("eboot.bin", "*.prx", "*.so") + + +class NoticeError(Exception): + pass + + +def sha256(path): + digest = hashlib.sha256() + with open(path, "rb") as stream: + for block in iter(lambda: stream.read(1 << 20), b""): + digest.update(block) + return digest.hexdigest() + + +def expand(text, tokens): + for name, value in tokens.items(): + text = text.replace("${" + name + "}", value) + return text + + +def resolve(path, tokens, root): + candidate = Path(expand(path, tokens)) + return candidate if candidate.is_absolute() else root / candidate + + +def title_files(title): + return sorted(p.relative_to(title).as_posix() for p in title.rglob("*") + if p.is_file() and not p.relative_to(title).as_posix().startswith("licenses/")) + + +def matches(pattern, files): + return [f for f in files if fnmatch.fnmatchcase(f, pattern)] + + +def git(path, *args): + return subprocess.run(["git", "-C", str(path), *args], check=True, text=True, + capture_output=True).stdout.strip() + + +def source_of(component, tokens, root, title): + """The revision and URL of a component's source, and whether it is committed.""" + spec = component["source"] + kind = spec["kind"] + info = {"kind": kind} + if kind == "git": + path = resolve(spec["path"], tokens, root) + info["revision"] = git(path, "rev-parse", "HEAD") + # Tracked changes only: ignored build output is not source. + info["dirty"] = bool(git(path, "status", "--porcelain", "--untracked-files=no")) + elif kind == "pin": + text = resolve(spec["file"], tokens, root).read_text(encoding="utf-8") + found = re.search(r'^\s*' + re.escape(spec["var"]) + r'="?([^"\s#]+)', text, re.M) + if not found: + raise NoticeError(f"{component['id']}: no {spec['var']}= in {spec['file']}") + info["revision"] = found.group(1) + info["pinned_in"] = spec["file"] + elif kind == "stamp": + # The revision the installed tree records, which is what was linked; the pin + # that installs it must agree, or the build used something else. + info["revision"] = resolve(spec["file"], tokens, root).read_text().split()[0] + pinned = source_of({"id": component["id"], "source": {"kind": "pin", **spec["pin"]}}, + tokens, root, title)["revision"] + if pinned != info["revision"]: + raise NoticeError(f"{component['id']}: {spec['file']} records {info['revision']}, " + f"but {spec['pin']['file']} pins {pinned}; rerun the build") + info["pinned_in"] = spec["pin"]["file"] + elif kind == "json": + data = json.loads(resolve(spec["file"], tokens, root).read_text(encoding="utf-8")) + info["revision"] = data[spec["key"]] + elif kind == "provenance": + text = resolve(spec["file"], tokens, root).read_text(encoding="utf-8") + fields = dict(line.split(":", 1) for line in text.splitlines() if ":" in line) + fields = {k.strip(): v.strip() for k, v in fields.items()} + info["revision"] = fields[spec["key"]].split()[0] + if "archive" in spec: + archive = resolve(spec["archive"], tokens, root) + recorded = fields.get("archive sha256") + if recorded and sha256(archive) != recorded: + raise NoticeError(f"{component['id']}: {archive} is not the archive its " + "PROVENANCE.txt describes") + info["archive_sha256"] = recorded + elif kind == "core": + report = json.loads((root / "build/cores" / spec["build"] / "build.json").read_text()) + staged = [f for f in component["artifacts"] if f.endswith(".so")] + for name in staged: + path = title / name + if path.is_file() and sha256(path) != report["sha256"]: + raise NoticeError(f"{component['id']}: {name} is not the file " + f"build/cores/{spec['build']}/build.json describes") + info["revision"] = report["source_revision"] + for key in ("source_archive_sha256", "source_submodules", "port_inputs_sha256"): + if report.get(key): + info[key] = report[key] + elif kind == "fixed": + info["revision"] = spec["revision"] + else: + raise NoticeError(f"{component['id']}: unknown source kind {kind}") + if "url" in spec: + info["url"] = spec["url"].replace("{rev}", info["revision"]) + elif "remote" in spec: + info["url"] = f"{spec['remote']}/tree/{info['revision']}" + return info + + +def copy_text(entry, tokens, root, target): + """Copy one licence text (a file, a directory or a tarball member).""" + destination = target / entry["to"] + destination.parent.mkdir(parents=True, exist_ok=True) + if "tar" in entry: + archive = resolve(entry["tar"], tokens, root) + with tarfile.open(archive) as tar: + member = tar.extractfile(entry["member"]) + if member is None: + raise NoticeError(f"{archive} has no {entry['member']}") + destination.write_bytes(member.read()) + return f"{entry['tar']}:{entry['member']}" + choices = entry["from"] if isinstance(entry["from"], list) else [entry["from"]] + for choice in choices: + source = resolve(choice, tokens, root) + if source.is_dir(): + shutil.copytree(source, destination) + return choice + if source.is_file(): + if "head" in entry: + lines = source.read_text(encoding="utf-8", errors="replace").splitlines(True) + destination.write_text("".join(lines[:entry["head"]]), encoding="utf-8") + else: + shutil.copyfile(source, destination) + return choice + raise NoticeError(f"licence text not found: {' or '.join(choices)}") + + +def readme(components, tag): + lines = [ + "PS5 RetroArch - licences, notices and sources", + "=" * 45, + "", + f"Release: {tag or 'a development build (no release tag given)'}", + "", + "This folder lists every part of this title, the licence each is under, the", + "licence texts those licences require to travel with it, and the exact source", + "revision each part was built from. components.json holds the same, with the", + "sha256 of every executable file.", + "", + "Corresponding source: each part's source is published at the address given", + "for it below, at the revision given. The release page this title was", + "downloaded from also carries the release's source archives (made by", + "tools/source-bundle.py in PS5_RetroArch), including this port's patches and", + "the scripts that build and install the title (tools/build-title.sh).", + "", + "Not included: no games, BIOS files, console firmware or decryption keys. The", + "emulators need the ones you supply from your own hardware and media.", + "", + ] + noncommercial = [c for c in components if c.get("noncommercial")] + if noncommercial: + lines += ["Non-commercial terms", "--------------------", + "These parts may not be sold or used commercially under their own licences:", + *[f" - {c['name']} ({c['licence']})" for c in noncommercial], ""] + lines += ["Parts", "-----", ""] + for c in components: + source = c["source"] + lines += [ + c["name"], + f" kind: {c['kind']}", + f" licence: {c['licence']}", + *[f" copyright: {line}" for line in c.get("copyright", [])], + f" texts: {', '.join(c['id'] + '/' + t for t in c['texts']) or '-'}", + f" source: {source.get('url', source['revision'])}", + f" revision: {source['revision']}" + (" (uncommitted changes)" if source.get("dirty") else ""), + f" changes: {c.get('modifications', '-')}", + f" files: {', '.join(sorted(c['files'])[:6])}" + (" ..." if len(c["files"]) > 6 else ""), + "", + ] + lines += ["PlayStation and PS5 are trademarks of Sony Interactive Entertainment. This", + "is an independent homebrew project, not affiliated with or endorsed by Sony", + "Interactive Entertainment, the Khronos Group or the libretro project.", ""] + return "\n".join(lines) + + +def stage(title, driver, tag, tokens, root=ROOT, table=TABLE): + table = json.loads(Path(table).read_text(encoding="utf-8")) + files = title_files(title) + target = title / "licenses" + if target.exists(): + shutil.rmtree(target) + target.mkdir() + staged = [] + for component in table["components"]: + if component.get("driver") not in (None, driver): + continue + present = sorted({f for p in component["artifacts"] for f in matches(p, files)}) + if not present and not component.get("always"): + continue + if not present: + raise NoticeError(f"{component['id']}: none of {component['artifacts']} is in {title}") + texts = [] + folder = target / component["id"] + folder.mkdir() + for entry in component["texts"]: + origin = copy_text(entry, tokens, root, folder) + record = {"file": entry["to"], "from": origin} + if entry.get("verbatim"): + record["sha256"] = sha256(folder / entry["to"]) + texts.append(record) + executables = {f: sha256(title / f) for f in present + if any(fnmatch.fnmatchcase(Path(f).name, p) for p in EXECUTABLE)} + staged.append({ + "id": component["id"], "name": component["name"], "kind": component["kind"], + "licence": component["licence"], "noncommercial": bool(component.get("noncommercial")), + "copyright": component.get("copyright", []), "modifications": component.get("modifications"), + "texts": [t["file"] for t in texts], "text_records": texts, + "source": source_of(component, tokens, root, title), + "files": present, "executables": executables, + }) + (target / "components.json").write_text( + json.dumps({"schema": 1, "release": tag, "driver": driver, "components": staged}, + indent=2, ensure_ascii=False) + "\n", encoding="utf-8") + (target / "README.txt").write_text(readme(staged, tag), encoding="utf-8") + return staged + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("title", type=Path) + parser.add_argument("--driver", default=os.environ.get("PS5_VULKAN_DRIVER", "radv"), + choices=("radv", "ps5vk")) + parser.add_argument("--release-tag", default="") + parser.add_argument("--vulkan-dir", default=os.environ.get("PS5_VULKAN_DIR", "../PS5_Vulkan")) + parser.add_argument("--sdk-fork", default="../PS5_PayloadSDK") + parser.add_argument("--llvm", default=".deps/llvm-project") + args = parser.parse_args(argv) + tokens = {"VULKAN": args.vulkan_dir, "SDK_FORK": args.sdk_fork, "LLVM": args.llvm} + try: + staged = stage(args.title.resolve(), args.driver, args.release_tag, tokens) + except (NoticeError, OSError, KeyError, subprocess.CalledProcessError) as error: + print(f"error: [notices] {error}", file=sys.stderr) + return 2 + dirty = [c["id"] for c in staged if c["source"].get("dirty")] + print(f"==> [notices] {len(staged)} parts, licences in {args.title}/licenses") + if dirty: + print(f"==> [notices] uncommitted source in: {', '.join(dirty)} " + "(a release needs committed, published source)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/verify.sh b/tools/verify.sh index a4c77ab..a97f0dd 100755 --- a/tools/verify.sh +++ b/tools/verify.sh @@ -65,6 +65,7 @@ gate_integration() { require tools/check-manifest.sh || return 1 make test-integration bash tools/check-manifest.sh + python3 tools/check-notices.py } gate_evidence() { @@ -78,7 +79,7 @@ case "${1:-}" in format 'bash tools/lint-shell.sh && bash tools/lint-format.sh' \ unit 'make test-unit' \ build 'bash tools/build-title.sh' \ - integration 'make test-integration && bash tools/check-manifest.sh' \ + integration 'make test-integration && bash tools/check-manifest.sh && python3 tools/check-notices.py' \ evidence 'python3 tools/evidence.py compare evidence/' exit 0 ;;