├── LICENSE ├── README.md ├── build_locally_with_various_option_prompts.bat ├── ffmpeg_local_builds └── cross_compile_ffmpeg.sh ├── open_cygwin_windows_prompt.bat └── patches ├── 0001-make-bcrypt-optional.patch ├── 0001-make-bcrypt-optional_ffmpeg6.2.patch ├── 0002-windows-xp-compatible-CancelIoEx.patch ├── 0003-windows-xp-compatible-wcscp.patch ├── 0004-load-shared-libfdk-aac-library-dynamically.patch ├── 0005-load-shared-frei0r-libraries-dynamically.patch ├── bzip2_CMakeLists.txt ├── ffms2_configure-fix-various.patch ├── libaom_restore-winxp-compatibility_use-pthreads.patch ├── libflite-2.1.0_mingw-w64-fixes.diff ├── libxml2-2.9.12_lib-only_static_cve-2017-8872.diff ├── libxvid_CMakeLists.txt ├── mbedtls-2.28.9_mingw-stdio.diff ├── mingw-w64-build-r33 ├── notes ├── python-3.4.10_cygwin.patch └── rubberband_git_static-lib.patch /LICENSE: -------------------------------------------------------------------------------- 1 | # GNU GENERAL PUBLIC LICENSE 2 | # Version 3, 29 June 2007 3 | # 4 | # Copyright (C) 2007 Free Software Foundation, Inc. 5 | # Everyone is permitted to copy and distribute verbatim copies 6 | # of this license document, but changing it is not allowed. 7 | # 8 | # Preamble 9 | # 10 | # The GNU General Public License is a free, copyleft license for 11 | # software and other kinds of works. 12 | # 13 | # The licenses for most software and other practical works are designed 14 | # to take away your freedom to share and change the works. By contrast, 15 | # the GNU General Public License is intended to guarantee your freedom to 16 | # share and change all versions of a program--to make sure it remains free 17 | # software for all its users. We, the Free Software Foundation, use the 18 | # GNU General Public License for most of our software; it applies also to 19 | # any other work released this way by its authors. You can apply it to 20 | # your programs, too. 21 | # 22 | # When we speak of free software, we are referring to freedom, not 23 | # price. Our General Public Licenses are designed to make sure that you 24 | # have the freedom to distribute copies of free software (and charge for 25 | # them if you wish), that you receive source code or can get it if you 26 | # want it, that you can change the software or use pieces of it in new 27 | # free programs, and that you know you can do these things. 28 | # 29 | # To protect your rights, we need to prevent others from denying you 30 | # these rights or asking you to surrender the rights. Therefore, you have 31 | # certain responsibilities if you distribute copies of the software, or if 32 | # you modify it: responsibilities to respect the freedom of others. 33 | # 34 | # For example, if you distribute copies of such a program, whether 35 | # gratis or for a fee, you must pass on to the recipients the same 36 | # freedoms that you received. You must make sure that they, too, receive 37 | # or can get the source code. And you must show them these terms so they 38 | # know their rights. 39 | # 40 | # Developers that use the GNU GPL protect your rights with two steps: 41 | # (1) assert copyright on the software, and (2) offer you this License 42 | # giving you legal permission to copy, distribute and/or modify it. 43 | # 44 | # For the developers' and authors' protection, the GPL clearly explains 45 | # that there is no warranty for this free software. For both users' and 46 | # authors' sake, the GPL requires that modified versions be marked as 47 | # changed, so that their problems will not be attributed erroneously to 48 | # authors of previous versions. 49 | # 50 | # Some devices are designed to deny users access to install or run 51 | # modified versions of the software inside them, although the manufacturer 52 | # can do so. This is fundamentally incompatible with the aim of 53 | # protecting users' freedom to change the software. The systematic 54 | # pattern of such abuse occurs in the area of products for individuals to 55 | # use, which is precisely where it is most unacceptable. Therefore, we 56 | # have designed this version of the GPL to prohibit the practice for those 57 | # products. If such problems arise substantially in other domains, we 58 | # stand ready to extend this provision to those domains in future versions 59 | # of the GPL, as needed to protect the freedom of users. 60 | # 61 | # Finally, every program is threatened constantly by software patents. 62 | # States should not allow patents to restrict development and use of 63 | # software on general-purpose computers, but in those that do, we wish to 64 | # avoid the special danger that patents applied to a free program could 65 | # make it effectively proprietary. To prevent this, the GPL assures that 66 | # patents cannot be used to render the program non-free. 67 | # 68 | # The precise terms and conditions for copying, distribution and 69 | # modification follow. 70 | # 71 | # TERMS AND CONDITIONS 72 | # 73 | # 0. Definitions. 74 | # 75 | # "This License" refers to version 3 of the GNU General Public License. 76 | # 77 | # "Copyright" also means copyright-like laws that apply to other kinds of 78 | # works, such as semiconductor masks. 79 | # 80 | # "The Program" refers to any copyrightable work licensed under this 81 | # License. Each licensee is addressed as "you". "Licensees" and 82 | # "recipients" may be individuals or organizations. 83 | # 84 | # To "modify" a work means to copy from or adapt all or part of the work 85 | # in a fashion requiring copyright permission, other than the making of an 86 | # exact copy. The resulting work is called a "modified version" of the 87 | # earlier work or a work "based on" the earlier work. 88 | # 89 | # A "covered work" means either the unmodified Program or a work based 90 | # on the Program. 91 | # 92 | # To "propagate" a work means to do anything with it that, without 93 | # permission, would make you directly or secondarily liable for 94 | # infringement under applicable copyright law, except executing it on a 95 | # computer or modifying a private copy. Propagation includes copying, 96 | # distribution (with or without modification), making available to the 97 | # public, and in some countries other activities as well. 98 | # 99 | # To "convey" a work means any kind of propagation that enables other 100 | # parties to make or receive copies. Mere interaction with a user through 101 | # a computer network, with no transfer of a copy, is not conveying. 102 | # 103 | # An interactive user interface displays "Appropriate Legal Notices" 104 | # to the extent that it includes a convenient and prominently visible 105 | # feature that (1) displays an appropriate copyright notice, and (2) 106 | # tells the user that there is no warranty for the work (except to the 107 | # extent that warranties are provided), that licensees may convey the 108 | # work under this License, and how to view a copy of this License. If 109 | # the interface presents a list of user commands or options, such as a 110 | # menu, a prominent item in the list meets this criterion. 111 | # 112 | # 1. Source Code. 113 | # 114 | # The "source code" for a work means the preferred form of the work 115 | # for making modifications to it. "Object code" means any non-source 116 | # form of a work. 117 | # 118 | # A "Standard Interface" means an interface that either is an official 119 | # standard defined by a recognized standards body, or, in the case of 120 | # interfaces specified for a particular programming language, one that 121 | # is widely used among developers working in that language. 122 | # 123 | # The "System Libraries" of an executable work include anything, other 124 | # than the work as a whole, that (a) is included in the normal form of 125 | # packaging a Major Component, but which is not part of that Major 126 | # Component, and (b) serves only to enable use of the work with that 127 | # Major Component, or to implement a Standard Interface for which an 128 | # implementation is available to the public in source code form. A 129 | # "Major Component", in this context, means a major essential component 130 | # (kernel, window system, and so on) of the specific operating system 131 | # (if any) on which the executable work runs, or a compiler used to 132 | # produce the work, or an object code interpreter used to run it. 133 | # 134 | # The "Corresponding Source" for a work in object code form means all 135 | # the source code needed to generate, install, and (for an executable 136 | # work) run the object code and to modify the work, including scripts to 137 | # control those activities. However, it does not include the work's 138 | # System Libraries, or general-purpose tools or generally available free 139 | # programs which are used unmodified in performing those activities but 140 | # which are not part of the work. For example, Corresponding Source 141 | # includes interface definition files associated with source files for 142 | # the work, and the source code for shared libraries and dynamically 143 | # linked subprograms that the work is specifically designed to require, 144 | # such as by intimate data communication or control flow between those 145 | # subprograms and other parts of the work. 146 | # 147 | # The Corresponding Source need not include anything that users 148 | # can regenerate automatically from other parts of the Corresponding 149 | # Source. 150 | # 151 | # The Corresponding Source for a work in source code form is that 152 | # same work. 153 | # 154 | # 2. Basic Permissions. 155 | # 156 | # All rights granted under this License are granted for the term of 157 | # copyright on the Program, and are irrevocable provided the stated 158 | # conditions are met. This License explicitly affirms your unlimited 159 | # permission to run the unmodified Program. The output from running a 160 | # covered work is covered by this License only if the output, given its 161 | # content, constitutes a covered work. This License acknowledges your 162 | # rights of fair use or other equivalent, as provided by copyright law. 163 | # 164 | # You may make, run and propagate covered works that you do not 165 | # convey, without conditions so long as your license otherwise remains 166 | # in force. You may convey covered works to others for the sole purpose 167 | # of having them make modifications exclusively for you, or provide you 168 | # with facilities for running those works, provided that you comply with 169 | # the terms of this License in conveying all material for which you do 170 | # not control copyright. Those thus making or running the covered works 171 | # for you must do so exclusively on your behalf, under your direction 172 | # and control, on terms that prohibit them from making any copies of 173 | # your copyrighted material outside their relationship with you. 174 | # 175 | # Conveying under any other circumstances is permitted solely under 176 | # the conditions stated below. Sublicensing is not allowed; section 10 177 | # makes it unnecessary. 178 | # 179 | # 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | # 181 | # No covered work shall be deemed part of an effective technological 182 | # measure under any applicable law fulfilling obligations under article 183 | # 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | # similar laws prohibiting or restricting circumvention of such 185 | # measures. 186 | # 187 | # When you convey a covered work, you waive any legal power to forbid 188 | # circumvention of technological measures to the extent such circumvention 189 | # is effected by exercising rights under this License with respect to 190 | # the covered work, and you disclaim any intention to limit operation or 191 | # modification of the work as a means of enforcing, against the work's 192 | # users, your or third parties' legal rights to forbid circumvention of 193 | # technological measures. 194 | # 195 | # 4. Conveying Verbatim Copies. 196 | # 197 | # You may convey verbatim copies of the Program's source code as you 198 | # receive it, in any medium, provided that you conspicuously and 199 | # appropriately publish on each copy an appropriate copyright notice; 200 | # keep intact all notices stating that this License and any 201 | # non-permissive terms added in accord with section 7 apply to the code; 202 | # keep intact all notices of the absence of any warranty; and give all 203 | # recipients a copy of this License along with the Program. 204 | # 205 | # You may charge any price or no price for each copy that you convey, 206 | # and you may offer support or warranty protection for a fee. 207 | # 208 | # 5. Conveying Modified Source Versions. 209 | # 210 | # You may convey a work based on the Program, or the modifications to 211 | # produce it from the Program, in the form of source code under the 212 | # terms of section 4, provided that you also meet all of these conditions: 213 | # 214 | # a) The work must carry prominent notices stating that you modified 215 | # it, and giving a relevant date. 216 | # 217 | # b) The work must carry prominent notices stating that it is 218 | # released under this License and any conditions added under section 219 | # 7. This requirement modifies the requirement in section 4 to 220 | # "keep intact all notices". 221 | # 222 | # c) You must license the entire work, as a whole, under this 223 | # License to anyone who comes into possession of a copy. This 224 | # License will therefore apply, along with any applicable section 7 225 | # additional terms, to the whole of the work, and all its parts, 226 | # regardless of how they are packaged. This License gives no 227 | # permission to license the work in any other way, but it does not 228 | # invalidate such permission if you have separately received it. 229 | # 230 | # d) If the work has interactive user interfaces, each must display 231 | # Appropriate Legal Notices; however, if the Program has interactive 232 | # interfaces that do not display Appropriate Legal Notices, your 233 | # work need not make them do so. 234 | # 235 | # A compilation of a covered work with other separate and independent 236 | # works, which are not by their nature extensions of the covered work, 237 | # and which are not combined with it such as to form a larger program, 238 | # in or on a volume of a storage or distribution medium, is called an 239 | # "aggregate" if the compilation and its resulting copyright are not 240 | # used to limit the access or legal rights of the compilation's users 241 | # beyond what the individual works permit. Inclusion of a covered work 242 | # in an aggregate does not cause this License to apply to the other 243 | # parts of the aggregate. 244 | # 245 | # 6. Conveying Non-Source Forms. 246 | # 247 | # You may convey a covered work in object code form under the terms 248 | # of sections 4 and 5, provided that you also convey the 249 | # machine-readable Corresponding Source under the terms of this License, 250 | # in one of these ways: 251 | # 252 | # a) Convey the object code in, or embodied in, a physical product 253 | # (including a physical distribution medium), accompanied by the 254 | # Corresponding Source fixed on a durable physical medium 255 | # customarily used for software interchange. 256 | # 257 | # b) Convey the object code in, or embodied in, a physical product 258 | # (including a physical distribution medium), accompanied by a 259 | # written offer, valid for at least three years and valid for as 260 | # long as you offer spare parts or customer support for that product 261 | # model, to give anyone who possesses the object code either (1) a 262 | # copy of the Corresponding Source for all the software in the 263 | # product that is covered by this License, on a durable physical 264 | # medium customarily used for software interchange, for a price no 265 | # more than your reasonable cost of physically performing this 266 | # conveying of source, or (2) access to copy the 267 | # Corresponding Source from a network server at no charge. 268 | # 269 | # c) Convey individual copies of the object code with a copy of the 270 | # written offer to provide the Corresponding Source. This 271 | # alternative is allowed only occasionally and noncommercially, and 272 | # only if you received the object code with such an offer, in accord 273 | # with subsection 6b. 274 | # 275 | # d) Convey the object code by offering access from a designated 276 | # place (gratis or for a charge), and offer equivalent access to the 277 | # Corresponding Source in the same way through the same place at no 278 | # further charge. You need not require recipients to copy the 279 | # Corresponding Source along with the object code. If the place to 280 | # copy the object code is a network server, the Corresponding Source 281 | # may be on a different server (operated by you or a third party) 282 | # that supports equivalent copying facilities, provided you maintain 283 | # clear directions next to the object code saying where to find the 284 | # Corresponding Source. Regardless of what server hosts the 285 | # Corresponding Source, you remain obligated to ensure that it is 286 | # available for as long as needed to satisfy these requirements. 287 | # 288 | # e) Convey the object code using peer-to-peer transmission, provided 289 | # you inform other peers where the object code and Corresponding 290 | # Source of the work are being offered to the general public at no 291 | # charge under subsection 6d. 292 | # 293 | # A separable portion of the object code, whose source code is excluded 294 | # from the Corresponding Source as a System Library, need not be 295 | # included in conveying the object code work. 296 | # 297 | # A "User Product" is either (1) a "consumer product", which means any 298 | # tangible personal property which is normally used for personal, family, 299 | # or household purposes, or (2) anything designed or sold for incorporation 300 | # into a dwelling. In determining whether a product is a consumer product, 301 | # doubtful cases shall be resolved in favor of coverage. For a particular 302 | # product received by a particular user, "normally used" refers to a 303 | # typical or common use of that class of product, regardless of the status 304 | # of the particular user or of the way in which the particular user 305 | # actually uses, or expects or is expected to use, the product. A product 306 | # is a consumer product regardless of whether the product has substantial 307 | # commercial, industrial or non-consumer uses, unless such uses represent 308 | # the only significant mode of use of the product. 309 | # 310 | # "Installation Information" for a User Product means any methods, 311 | # procedures, authorization keys, or other information required to install 312 | # and execute modified versions of a covered work in that User Product from 313 | # a modified version of its Corresponding Source. The information must 314 | # suffice to ensure that the continued functioning of the modified object 315 | # code is in no case prevented or interfered with solely because 316 | # modification has been made. 317 | # 318 | # If you convey an object code work under this section in, or with, or 319 | # specifically for use in, a User Product, and the conveying occurs as 320 | # part of a transaction in which the right of possession and use of the 321 | # User Product is transferred to the recipient in perpetuity or for a 322 | # fixed term (regardless of how the transaction is characterized), the 323 | # Corresponding Source conveyed under this section must be accompanied 324 | # by the Installation Information. But this requirement does not apply 325 | # if neither you nor any third party retains the ability to install 326 | # modified object code on the User Product (for example, the work has 327 | # been installed in ROM). 328 | # 329 | # The requirement to provide Installation Information does not include a 330 | # requirement to continue to provide support service, warranty, or updates 331 | # for a work that has been modified or installed by the recipient, or for 332 | # the User Product in which it has been modified or installed. Access to a 333 | # network may be denied when the modification itself materially and 334 | # adversely affects the operation of the network or violates the rules and 335 | # protocols for communication across the network. 336 | # 337 | # Corresponding Source conveyed, and Installation Information provided, 338 | # in accord with this section must be in a format that is publicly 339 | # documented (and with an implementation available to the public in 340 | # source code form), and must require no special password or key for 341 | # unpacking, reading or copying. 342 | # 343 | # 7. Additional Terms. 344 | # 345 | # "Additional permissions" are terms that supplement the terms of this 346 | # License by making exceptions from one or more of its conditions. 347 | # Additional permissions that are applicable to the entire Program shall 348 | # be treated as though they were included in this License, to the extent 349 | # that they are valid under applicable law. If additional permissions 350 | # apply only to part of the Program, that part may be used separately 351 | # under those permissions, but the entire Program remains governed by 352 | # this License without regard to the additional permissions. 353 | # 354 | # When you convey a copy of a covered work, you may at your option 355 | # remove any additional permissions from that copy, or from any part of 356 | # it. (Additional permissions may be written to require their own 357 | # removal in certain cases when you modify the work.) You may place 358 | # additional permissions on material, added by you to a covered work, 359 | # for which you have or can give appropriate copyright permission. 360 | # 361 | # Notwithstanding any other provision of this License, for material you 362 | # add to a covered work, you may (if authorized by the copyright holders of 363 | # that material) supplement the terms of this License with terms: 364 | # 365 | # a) Disclaiming warranty or limiting liability differently from the 366 | # terms of sections 15 and 16 of this License; or 367 | # 368 | # b) Requiring preservation of specified reasonable legal notices or 369 | # author attributions in that material or in the Appropriate Legal 370 | # Notices displayed by works containing it; or 371 | # 372 | # c) Prohibiting misrepresentation of the origin of that material, or 373 | # requiring that modified versions of such material be marked in 374 | # reasonable ways as different from the original version; or 375 | # 376 | # d) Limiting the use for publicity purposes of names of licensors or 377 | # authors of the material; or 378 | # 379 | # e) Declining to grant rights under trademark law for use of some 380 | # trade names, trademarks, or service marks; or 381 | # 382 | # f) Requiring indemnification of licensors and authors of that 383 | # material by anyone who conveys the material (or modified versions of 384 | # it) with contractual assumptions of liability to the recipient, for 385 | # any liability that these contractual assumptions directly impose on 386 | # those licensors and authors. 387 | # 388 | # All other non-permissive additional terms are considered "further 389 | # restrictions" within the meaning of section 10. If the Program as you 390 | # received it, or any part of it, contains a notice stating that it is 391 | # governed by this License along with a term that is a further 392 | # restriction, you may remove that term. If a license document contains 393 | # a further restriction but permits relicensing or conveying under this 394 | # License, you may add to a covered work material governed by the terms 395 | # of that license document, provided that the further restriction does 396 | # not survive such relicensing or conveying. 397 | # 398 | # If you add terms to a covered work in accord with this section, you 399 | # must place, in the relevant source files, a statement of the 400 | # additional terms that apply to those files, or a notice indicating 401 | # where to find the applicable terms. 402 | # 403 | # Additional terms, permissive or non-permissive, may be stated in the 404 | # form of a separately written license, or stated as exceptions; 405 | # the above requirements apply either way. 406 | # 407 | # 8. Termination. 408 | # 409 | # You may not propagate or modify a covered work except as expressly 410 | # provided under this License. Any attempt otherwise to propagate or 411 | # modify it is void, and will automatically terminate your rights under 412 | # this License (including any patent licenses granted under the third 413 | # paragraph of section 11). 414 | # 415 | # However, if you cease all violation of this License, then your 416 | # license from a particular copyright holder is reinstated (a) 417 | # provisionally, unless and until the copyright holder explicitly and 418 | # finally terminates your license, and (b) permanently, if the copyright 419 | # holder fails to notify you of the violation by some reasonable means 420 | # prior to 60 days after the cessation. 421 | # 422 | # Moreover, your license from a particular copyright holder is 423 | # reinstated permanently if the copyright holder notifies you of the 424 | # violation by some reasonable means, this is the first time you have 425 | # received notice of violation of this License (for any work) from that 426 | # copyright holder, and you cure the violation prior to 30 days after 427 | # your receipt of the notice. 428 | # 429 | # Termination of your rights under this section does not terminate the 430 | # licenses of parties who have received copies or rights from you under 431 | # this License. If your rights have been terminated and not permanently 432 | # reinstated, you do not qualify to receive new licenses for the same 433 | # material under section 10. 434 | # 435 | # 9. Acceptance Not Required for Having Copies. 436 | # 437 | # You are not required to accept this License in order to receive or 438 | # run a copy of the Program. Ancillary propagation of a covered work 439 | # occurring solely as a consequence of using peer-to-peer transmission 440 | # to receive a copy likewise does not require acceptance. However, 441 | # nothing other than this License grants you permission to propagate or 442 | # modify any covered work. These actions infringe copyright if you do 443 | # not accept this License. Therefore, by modifying or propagating a 444 | # covered work, you indicate your acceptance of this License to do so. 445 | # 446 | # 10. Automatic Licensing of Downstream Recipients. 447 | # 448 | # Each time you convey a covered work, the recipient automatically 449 | # receives a license from the original licensors, to run, modify and 450 | # propagate that work, subject to this License. You are not responsible 451 | # for enforcing compliance by third parties with this License. 452 | # 453 | # An "entity transaction" is a transaction transferring control of an 454 | # organization, or substantially all assets of one, or subdividing an 455 | # organization, or merging organizations. If propagation of a covered 456 | # work results from an entity transaction, each party to that 457 | # transaction who receives a copy of the work also receives whatever 458 | # licenses to the work the party's predecessor in interest had or could 459 | # give under the previous paragraph, plus a right to possession of the 460 | # Corresponding Source of the work from the predecessor in interest, if 461 | # the predecessor has it or can get it with reasonable efforts. 462 | # 463 | # You may not impose any further restrictions on the exercise of the 464 | # rights granted or affirmed under this License. For example, you may 465 | # not impose a license fee, royalty, or other charge for exercise of 466 | # rights granted under this License, and you may not initiate litigation 467 | # (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | # any patent claim is infringed by making, using, selling, offering for 469 | # sale, or importing the Program or any portion of it. 470 | # 471 | # 11. Patents. 472 | # 473 | # A "contributor" is a copyright holder who authorizes use under this 474 | # License of the Program or a work on which the Program is based. The 475 | # work thus licensed is called the contributor's "contributor version". 476 | # 477 | # A contributor's "essential patent claims" are all patent claims 478 | # owned or controlled by the contributor, whether already acquired or 479 | # hereafter acquired, that would be infringed by some manner, permitted 480 | # by this License, of making, using, or selling its contributor version, 481 | # but do not include claims that would be infringed only as a 482 | # consequence of further modification of the contributor version. For 483 | # purposes of this definition, "control" includes the right to grant 484 | # patent sublicenses in a manner consistent with the requirements of 485 | # this License. 486 | # 487 | # Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | # patent license under the contributor's essential patent claims, to 489 | # make, use, sell, offer for sale, import and otherwise run, modify and 490 | # propagate the contents of its contributor version. 491 | # 492 | # In the following three paragraphs, a "patent license" is any express 493 | # agreement or commitment, however denominated, not to enforce a patent 494 | # (such as an express permission to practice a patent or covenant not to 495 | # sue for patent infringement). To "grant" such a patent license to a 496 | # party means to make such an agreement or commitment not to enforce a 497 | # patent against the party. 498 | # 499 | # If you convey a covered work, knowingly relying on a patent license, 500 | # and the Corresponding Source of the work is not available for anyone 501 | # to copy, free of charge and under the terms of this License, through a 502 | # publicly available network server or other readily accessible means, 503 | # then you must either (1) cause the Corresponding Source to be so 504 | # available, or (2) arrange to deprive yourself of the benefit of the 505 | # patent license for this particular work, or (3) arrange, in a manner 506 | # consistent with the requirements of this License, to extend the patent 507 | # license to downstream recipients. "Knowingly relying" means you have 508 | # actual knowledge that, but for the patent license, your conveying the 509 | # covered work in a country, or your recipient's use of the covered work 510 | # in a country, would infringe one or more identifiable patents in that 511 | # country that you have reason to believe are valid. 512 | # 513 | # If, pursuant to or in connection with a single transaction or 514 | # arrangement, you convey, or propagate by procuring conveyance of, a 515 | # covered work, and grant a patent license to some of the parties 516 | # receiving the covered work authorizing them to use, propagate, modify 517 | # or convey a specific copy of the covered work, then the patent license 518 | # you grant is automatically extended to all recipients of the covered 519 | # work and works based on it. 520 | # 521 | # A patent license is "discriminatory" if it does not include within 522 | # the scope of its coverage, prohibits the exercise of, or is 523 | # conditioned on the non-exercise of one or more of the rights that are 524 | # specifically granted under this License. You may not convey a covered 525 | # work if you are a party to an arrangement with a third party that is 526 | # in the business of distributing software, under which you make payment 527 | # to the third party based on the extent of your activity of conveying 528 | # the work, and under which the third party grants, to any of the 529 | # parties who would receive the covered work from you, a discriminatory 530 | # patent license (a) in connection with copies of the covered work 531 | # conveyed by you (or copies made from those copies), or (b) primarily 532 | # for and in connection with specific products or compilations that 533 | # contain the covered work, unless you entered into that arrangement, 534 | # or that patent license was granted, prior to 28 March 2007. 535 | # 536 | # Nothing in this License shall be construed as excluding or limiting 537 | # any implied license or other defenses to infringement that may 538 | # otherwise be available to you under applicable patent law. 539 | # 540 | # 12. No Surrender of Others' Freedom. 541 | # 542 | # If conditions are imposed on you (whether by court order, agreement or 543 | # otherwise) that contradict the conditions of this License, they do not 544 | # excuse you from the conditions of this License. If you cannot convey a 545 | # covered work so as to satisfy simultaneously your obligations under this 546 | # License and any other pertinent obligations, then as a consequence you may 547 | # not convey it at all. For example, if you agree to terms that obligate you 548 | # to collect a royalty for further conveying from those to whom you convey 549 | # the Program, the only way you could satisfy both those terms and this 550 | # License would be to refrain entirely from conveying the Program. 551 | # 552 | # 13. Use with the GNU Affero General Public License. 553 | # 554 | # Notwithstanding any other provision of this License, you have 555 | # permission to link or combine any covered work with a work licensed 556 | # under version 3 of the GNU Affero General Public License into a single 557 | # combined work, and to convey the resulting work. The terms of this 558 | # License will continue to apply to the part which is the covered work, 559 | # but the special requirements of the GNU Affero General Public License, 560 | # section 13, concerning interaction through a network will apply to the 561 | # combination as such. 562 | # 563 | # 14. Revised Versions of this License. 564 | # 565 | # The Free Software Foundation may publish revised and/or new versions of 566 | # the GNU General Public License from time to time. Such new versions will 567 | # be similar in spirit to the present version, but may differ in detail to 568 | # address new problems or concerns. 569 | # 570 | # Each version is given a distinguishing version number. If the 571 | # Program specifies that a certain numbered version of the GNU General 572 | # Public License "or any later version" applies to it, you have the 573 | # option of following the terms and conditions either of that numbered 574 | # version or of any later version published by the Free Software 575 | # Foundation. If the Program does not specify a version number of the 576 | # GNU General Public License, you may choose any version ever published 577 | # by the Free Software Foundation. 578 | # 579 | # If the Program specifies that a proxy can decide which future 580 | # versions of the GNU General Public License can be used, that proxy's 581 | # public statement of acceptance of a version permanently authorizes you 582 | # to choose that version for the Program. 583 | # 584 | # Later license versions may give you additional or different 585 | # permissions. However, no additional obligations are imposed on any 586 | # author or copyright holder as a result of your choosing to follow a 587 | # later version. 588 | # 589 | # 15. Disclaimer of Warranty. 590 | # 591 | # THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | # APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | # HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | # OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | # PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | # IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | # ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | # 600 | # 16. Limitation of Liability. 601 | # 602 | # IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | # WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | # THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | # GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | # USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | # DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | # PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | # EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | # SUCH DAMAGES. 611 | # 612 | # 17. Interpretation of Sections 15 and 16. 613 | # 614 | # If the disclaimer of warranty and limitation of liability provided 615 | # above cannot be given local legal effect according to their terms, 616 | # reviewing courts shall apply local law that most closely approximates 617 | # an absolute waiver of all civil liability in connection with the 618 | # Program, unless a warranty or assumption of liability accompanies a 619 | # copy of the Program in return for a fee. 620 | # 621 | # END OF TERMS AND CONDITIONS 622 | # 623 | # How to Apply These Terms to Your New Programs 624 | # 625 | # If you develop a new program, and you want it to be of the greatest 626 | # possible use to the public, the best way to achieve this is to make it 627 | # free software which everyone can redistribute and change under these terms. 628 | # 629 | # To do so, attach the following notices to the program. It is safest 630 | # to attach them to the start of each source file to most effectively 631 | # state the exclusion of warranty; and each file should have at least 632 | # the "copyright" line and a pointer to where the full notice is found. 633 | # 634 | # 635 | # Copyright (C) 636 | # 637 | # This program is free software: you can redistribute it and/or modify 638 | # it under the terms of the GNU General Public License as published by 639 | # the Free Software Foundation, either version 3 of the License, or 640 | # (at your option) any later version. 641 | # 642 | # This program is distributed in the hope that it will be useful, 643 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | # GNU General Public License for more details. 646 | # 647 | # You should have received a copy of the GNU General Public License 648 | # along with this program. If not, see . 649 | # 650 | # Also add information on how to contact you by electronic and paper mail. 651 | # 652 | # If the program does terminal interaction, make it output a short 653 | # notice like this when it starts in an interactive mode: 654 | # 655 | # Copyright (C) 656 | # This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | # This is free software, and you are welcome to redistribute it 658 | # under certain conditions; type `show c' for details. 659 | # 660 | # The hypothetical commands `show w' and `show c' should show the appropriate 661 | # parts of the General Public License. Of course, your program's commands 662 | # might be different; for a GUI interface, you would use an "about box". 663 | # 664 | # You should also get your employer (if you work as a programmer) or school, 665 | # if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | # For more information on this, and how to apply and follow the GNU GPL, see 667 | # . 668 | # 669 | # The GNU General Public License does not permit incorporating your program 670 | # into proprietary programs. If your program is a subroutine library, you 671 | # may consider it more useful to permit linking proprietary applications with 672 | # the library. If this is what you want to do, use the GNU Lesser General 673 | # Public License instead of this License. But first, please read 674 | # . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ffmpeg-windows-build-helpers 2 | 3 | This script is a fork of [Roger Pack's ffmpeg-windows-build-helpers](https://github.com/rdp/ffmpeg-windows-build-helpers). It helps me to compile (FFmpeg) binaries that are Windows XP compatible _and_ will work on old CPUs without SSE2 instruction sets (like my own AMD Athlon XP 3200+). 4 | FFmpeg has officially dropped support for Windows XP, but I'll try to create fresh binaries and update the script nonetheless. 5 | 6 | **Binaries:** https://rwijnsma.home.xs4all.nl/files/ffmpeg/?C=M;O=D 7 | **Other stuff:** https://rwijnsma.home.xs4all.nl/files 8 | **Discussion and more info:** https://forum.doom9.org/showthread.php?t=181802 9 | -------------------------------------------------------------------------------- /build_locally_with_various_option_prompts.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | ECHO Welcome to this FFmpeg compile script. 3 | ECHO This process will first install a local copy of Cygwin to a new directory "ffmpeg_local_builds". 4 | ECHO Then it will prompt you for some options like 32 bit vs. 64 bit, free vs. non free dependencies. 5 | ECHO It will then build the GCC cross compiler, followed by FFmpeg dependencies and FFmpeg itself. 6 | ECHO There are also even *more* option available than what you'll be prompted for. 7 | ECHO If you want more advanced options after the first pass, it will give instructions when done 8 | ECHO on how to run it again with more advanced options. 9 | ECHO. 10 | ECHO Starting Cygwin install/update. 11 | ECHO. 12 | CD ffmpeg_local_builds 13 | SETLOCAL ENABLEDELAYEDEXPANSION 14 | IF NOT EXIST cygwin_local_install ( 15 | MKDIR cygwin_local_install 16 | CD cygwin_local_install 17 | ECHO Downloading Cygwin setup executable. 18 | ECHO Keep an eye on this window for error warning messages from the Cygwin install. Some of them are expected. 19 | powershell -command "$clnt = new-object System.Net.WebClient; $clnt.DownloadFile(\"http://cygwinxp.cathedral-networks.org/cathedral/setup-x86-2.874.exe\", \"setup-x86-2.874.exe\")" 20 | START /wait setup-x86-2.874.exe ^ 21 | -X ^ 22 | --quiet-mode ^ 23 | --no-admin ^ 24 | --no-startmenu ^ 25 | --no-shortcuts ^ 26 | --no-desktop ^ 27 | --site "http://cygwinxp.cathedral-networks.org/" ^ 28 | --root !cd! ^ 29 | --packages autoconf,autogen,automake,bison,cmake,cvs,ed,flex,gcc-core,gcc-g++,git,gperf,libtool,make,mercurial,ncurses,p7zip,patch,pax,pkg-config,subversion,texinfo,unzip,wget,yasm,zlib1g-dev 30 | REM wget for the initial script download as well as zeranoe's uses it 31 | REM ncurses for the "clear" command yikes! 32 | ECHO Done installing Cygwin. 33 | CD .. 34 | ) ELSE ( 35 | ECHO Cygwin already installed. 36 | ) 37 | ENDLOCAL 38 | SET PATH=%cd%\cygwin_local_install\bin;%PATH% 39 | 40 | ECHO. 41 | SET /P "static=Would you like to build static FFmpeg binaries [Y/n]?" 42 | ECHO. 43 | IF /I "%static%"=="n" ( 44 | bash.exe -c "./cross_compile_ffmpeg.sh --build-ffmpeg-static=n %2 %3 %4 %5 %6 %7 %8 %9" 45 | ) ELSE ( 46 | bash.exe -c "./cross_compile_ffmpeg.sh %1 %2 %3 %4 %5 %6 %7 %8 %9" 47 | ) 48 | 49 | ECHO. 50 | ECHO Done with local build. Check output above to see if successfull. 51 | ECHO If not successful, then you could try to rerun the script. It "should" pick up where it left off. 52 | ECHO. 53 | ECHO If you want more advanced configuration, then open '%cd%\cygwin_local_install\cygwin.bat' (which sets up the path for you). Then cd to '%cd%' and run the script manually yourself with -h, like: 54 | ECHO $ cd /cygdrive/.../ffmpeg_local_builds 55 | ECHO $ ./cross_compile_ffmpeg.sh -h 56 | PAUSE 57 | -------------------------------------------------------------------------------- /ffmpeg_local_builds/cross_compile_ffmpeg.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ffmpeg windows cross compile helper/download script, see github repo README 3 | # Copyright (C) 2012 Roger Pack, the script is under the GPLv3, but output FFmpeg's executables aren't 4 | 5 | yes_no_sel() { 6 | unset user_input 7 | local question="$1" 8 | shift 9 | local default_answer="$1" 10 | while [[ "$user_input" != [YyNn] ]]; do 11 | echo -n "$question" 12 | read user_input 13 | if [[ -z "$user_input" ]]; then 14 | echo "using default $default_answer" 15 | user_input=$default_answer 16 | fi 17 | if [[ "$user_input" != [YyNn] ]]; then 18 | clear; echo 'Your selection was not vaild, please try again.'; echo 19 | fi 20 | done 21 | # downcase it 22 | user_input=$(echo $user_input | tr '[A-Z]' '[a-z]') 23 | } 24 | 25 | set_box_memory_size_bytes() { 26 | local ram_kilobytes=`grep MemTotal /proc/meminfo | awk '{print $2}'` 27 | local swap_kilobytes=`grep SwapTotal /proc/meminfo | awk '{print $2}'` 28 | box_memory_size_bytes=$[ram_kilobytes * 1024 + swap_kilobytes * 1024] 29 | } 30 | 31 | check_missing_packages() { 32 | # zeranoe's build scripts use wget, though we don't here... 33 | local check_packages=('7z' 'autoconf' 'autogen' 'automake' 'bison' 'bzip2' 'cmake' 'cvs' 'ed' 'flex' 'g++' 'gcc' 'git' 'gperf' 'hg' 'libtool' 'libtoolize' 'make' 'makeinfo' 'patch' 'pax' 'pkg-config' 'svn' 'unzip' 'wget' 'xz' 'yasm') 34 | for package in "${check_packages[@]}"; do 35 | type -P "$package" >/dev/null || missing_packages=("$package" "${missing_packages[@]}") 36 | done 37 | if [[ -n "${missing_packages[@]}" ]]; then 38 | clear 39 | echo "Could not find the following execs (7z = p7zip, hg = mercurial, makeinfo = texinfo, svn = subversion): ${missing_packages[@]}" 40 | echo 'Install the missing packages before running this script.' 41 | exit 1 42 | fi 43 | 44 | if [ ! -f $HOME/.hgrc ]; then # 'hg purge' (the Mercurial equivalent of 'git clean') isn't enabled by default. 45 | mkdir -p "$HOME" 46 | cat > $HOME/.hgrc <' is not trusted" by updating 'tls-ca-bundle.pem'. 56 | } 57 | 58 | 59 | intro() { 60 | echo `date` 61 | cat < abc_git 136 | fi 137 | if [[ $3 ]]; then 138 | local branch="$3" 139 | else 140 | local branch="master" # http://y/abc.git -> abc_git 141 | fi 142 | if [ ! -d $dir ]; then 143 | rm -fr $dir.tmp # just in case it was interrupted previously... 144 | echo -e "\e[1;33mDownloading (git clone) $1 to $dir.\e[0m" 145 | git clone --branch $branch --single-branch $1 $dir.tmp || exit 1 146 | # prevent partial checkouts by renaming it only after success 147 | mv $dir.tmp $dir 148 | if [[ $4 ]]; then 149 | cd $dir 150 | echo -e "\e[1;33mChanging head of $dir to ${4:0:7}.\e[0m" 151 | git checkout $4 || exit 1 152 | cd .. 153 | fi 154 | else 155 | cd $dir 156 | if [[ $4 ]]; then 157 | if [[ $(git rev-parse HEAD) != $4 ]]; then 158 | echo -e "\e[1;33mChanging head of $dir to ${4:0:7}.\e[0m" 159 | git checkout $4 || exit 1 160 | else 161 | echo -e "\e[1;33mHead of $dir is already at ${4:0:7}.\e[0m" 162 | fi 163 | elif [[ $(git rev-parse HEAD) != $(git ls-remote -h $1 $branch | head -c +40) ]]; then 164 | echo -e "\e[1;33mUpdating $dir to latest git head on 'origin/$branch'.\e[0m" 165 | git reset --hard # Return files to their original state. 166 | git clean -fdx # Clean the working tree; build- as well as untracked files. 167 | git fetch # Fetch list of changes. 168 | git checkout $branch || exit 1 # Show amount of commits behind 'origin/$branch'. 169 | git merge origin/$branch || exit 1 # Apply changes to local repo. 170 | else 171 | echo -e "\e[1;33mLocal $dir is up-to-date.\e[0m" 172 | fi 173 | cd .. 174 | fi 175 | } 176 | 177 | download_and_unpack_file() { 178 | local name="${1##*/}" 179 | if [[ $2 ]]; then 180 | local dir="$2" 181 | else 182 | local dir="${name/.tar*/}" # remove .tar.xx 183 | fi 184 | if [ ! -f "$dir/unpacked.successfully" ]; then 185 | echo -e "\e[1;33mDownloading (wget) $1.\e[0m" 186 | if [[ -f $name ]]; then 187 | rm $name || exit 1 188 | fi 189 | wget -t 5 "$1" || exit 1 190 | tar -xf "$name" || unzip "$name" || exit 1 191 | touch "$dir/unpacked.successfully" || exit 1 192 | rm "$name" || exit 1 193 | fi 194 | } 195 | 196 | get_small_touchfile_name() { # have to call with assignment like a=$(get_small...) 197 | echo "$1_$(echo -- "$@" $CFLAGS $LDFLAGS | /usr/bin/env md5sum | sed "s/ //g")" # md5sum to make it smaller, cflags to force rebuild if changes and sed to remove spaces that md5sum introduced. 198 | } 199 | 200 | do_configure() { 201 | if [ "${1:0:2}" == "./" ]; then 202 | local configure_name=$1 203 | local configure_options=("${@:2}") 204 | else 205 | local configure_name=./configure 206 | local configure_options=("${@}") 207 | fi 208 | local name=$(get_small_touchfile_name already_configured "${configure_options[@]}") 209 | if [ ! -f "$name" ]; then # This is to generate 'configure', 'Makefile.in' and some other files. 210 | if [ ! -f $configure_name ]; then 211 | echo -e "\e[1;33mGenerating 'configure' script.\e[0m" 212 | if [ -f autogen.sh ]; then 213 | NOCONFIGURE=1 ./autogen.sh # Without NOCONFIGURE=1 TwoLame's 'autogen.sh' will run 'configure' with no arguments. 214 | elif [ -f autobuild ]; then 215 | ./autobuild 216 | elif [ -f buildconf ]; then 217 | ./buildconf 218 | elif [ -f bootstrap ]; then 219 | ./bootstrap 220 | elif [ -f bootstrap.sh ]; then 221 | ./bootstrap.sh 222 | else 223 | autoreconf -fiv 224 | fi 225 | fi 226 | echo -e "\e[1;33mConfiguring ${PWD##*/} as \"${configure_options[@]}\".\e[0m" 227 | $configure_name "${configure_options[@]}" || exit 1 228 | touch $name || exit 1 229 | # echo -e "\e[1;33mDoing preventative make clean.\e[0m" 230 | # make -j $cpu_count clean # sometimes useful when files change, etc. 231 | #else 232 | # echo -e "\e[1;33mAlready configured ${PWD##*/}.\e[0m" 233 | fi 234 | } 235 | 236 | generic_configure() { 237 | do_configure --host=$host_target --prefix=$mingw_w64_x86_64_prefix --disable-shared --enable-static "$@" 238 | } 239 | 240 | do_cmake() { 241 | local cmake_options=(-DENABLE_STATIC_RUNTIME=1 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_FIND_ROOT_PATH=$mingw_w64_x86_64_prefix -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_RANLIB=${cross_prefix}ranlib.exe -DCMAKE_C_COMPILER=${cross_prefix}gcc.exe -DCMAKE_CXX_COMPILER=${cross_prefix}g++.exe -DCMAKE_RC_COMPILER=${cross_prefix}windres.exe -DCMAKE_INSTALL_PREFIX=$mingw_w64_x86_64_prefix "${@:2}" $1) 242 | local name=$(get_small_touchfile_name already_ran_cmake "${cmake_options[@]}") 243 | if [ ! -f $name ]; then 244 | echo -e "\e[1;33mConfiguring ${1##*/} as \"cmake -G \"Unix Makefiles\" ${cmake_options[@]}\".\e[0m" 245 | cmake -G "Unix Makefiles" "${cmake_options[@]}" || exit 1 246 | touch $name || exit 1 247 | #else 248 | # echo -e "\e[1;33mAlready configured ${1##*/}.\e[0m" 249 | fi 250 | } 251 | 252 | do_make() { 253 | local dir="${PWD/$cur_dir\/win32\/}" 254 | local make_options=(-j $cpu_count "$@") 255 | local name=$(get_small_touchfile_name already_ran_make "${make_options[@]}") 256 | if [ ! -f $name ]; then 257 | if [[ $1 == install* ]]; then 258 | echo -e "\e[1;33mCompiling and installing ${dir%%/*} as \"make ${make_options[@]}\".\e[0m" 259 | else 260 | echo -e "\e[1;33mCompiling ${dir%%/*} as \"make ${make_options[@]}\".\e[0m" 261 | fi 262 | # if [ ! -f configure ]; then 263 | # make -j $cpu_count clean # just in case helpful if old junk left around and this is a 're make' and wasn't cleaned at reconfigure time 264 | # fi 265 | make "${make_options[@]}" || exit 1 266 | touch $name || exit 1 # only touch if the build was OK 267 | else 268 | if [[ $1 == install* ]]; then 269 | echo -e "\e[1;33mAlready made and installed ${dir%%/*}.\e[0m" 270 | else 271 | echo -e "\e[1;33mAlready made ${dir%%/*}.\e[0m" 272 | fi 273 | fi 274 | } 275 | 276 | do_make_install() { 277 | local dir="${PWD/$cur_dir\/win32\/}" 278 | local make_install_options=(install "$@") 279 | local name=$(get_small_touchfile_name already_ran_make_install "${make_install_options[@]}") 280 | if [ ! -f $name ]; then 281 | echo -e "\e[1;33mInstalling ${dir%%/*} as \"make ${make_install_options[@]}\".\e[0m" 282 | make "${make_install_options[@]}" || exit 1 283 | touch $name || exit 1 284 | else 285 | echo -e "\e[1;33mAlready installed ${dir%%/*}.\e[0m" 286 | fi 287 | } 288 | 289 | apply_patch() { 290 | if [[ $2 ]]; then 291 | local type=$2 # Git patches need '-p1' (also see https://unix.stackexchange.com/a/26502). 292 | else 293 | local type="-p0" 294 | fi 295 | local name="${1##*/}" 296 | if [[ ! -e $name.done ]]; then 297 | if [[ -f $name ]]; then 298 | rm $name || exit 1 # remove old version in case it has been since updated on the server... 299 | fi 300 | cp -v $1 . || exit 1 301 | echo -e "\e[1;33mApplying patch '$name'.\e[0m" 302 | patch $type -i "$name" || exit 1 303 | touch $name.done || exit 1 304 | rm -f already_ran* # if it's a new patch, reset everything too, in case it's really really really new 305 | else 306 | echo -e "\e[1;33mPatch '$name' already applied.\e[0m" 307 | fi 308 | } 309 | 310 | gen_ld_script() { 311 | lib=$mingw_w64_x86_64_prefix/lib/$1 312 | lib_s="${1:3:-2}_s" 313 | if [ "$1" -nt "$mingw_w64_x86_64_prefix/lib/lib$lib_s.a" ]; then 314 | rm -f $mingw_w64_x86_64_prefix/lib/lib$lib_s.a 315 | fi 316 | if [ ! -f "$mingw_w64_x86_64_prefix/lib/lib$lib_s.a" ]; then 317 | echo -e "\e[1;33mGenerating linker script for $1, adding $2.\e[0m" 318 | mv $lib $mingw_w64_x86_64_prefix/lib/lib$lib_s.a 319 | echo "echo \"GROUP ( -l$lib_s $2 )\" > $lib" 320 | echo "GROUP ( -l$lib_s $2 )" > $lib 321 | else 322 | echo -e "\e[1;33mAlready generated linker script for '$1'.\e[0m" 323 | fi 324 | } # gen_ld_script libxxx.a -lxxx 325 | 326 | build_mingw_std_threads() { 327 | do_git_checkout https://github.com/meganz/mingw-std-threads.git 328 | cd mingw-std-threads_git 329 | for header in *.h; do 330 | install -m644 ${header} ${mingw_w64_x86_64_prefix}/include/${header} 331 | done 332 | cd .. 333 | } 334 | 335 | build_python() { 336 | download_and_unpack_file https://www.python.org/ftp/python/3.4.10/Python-3.4.10.tar.xz 337 | cd Python-3.4.10 338 | apply_patch $patch_dir/python-3.4.10_cygwin.patch # Patches from http://cygwinxp.cathedral-networks.org/x86/release/python3/python3-3.4.3-1-src.tar.xz. 339 | ac_cv_func_bind_textdomain_codeset=yes do_configure --prefix=/usr --with-dbmliborder=gdbm --with-libm= --without-ensurepip # 'configure'-options from 'python3.cygport' from within http://cygwinxp.cathedral-networks.org/x86/release/python3/python3-3.4.3-1-src.tar.xz. 340 | do_make install 341 | cd .. 342 | } 343 | 344 | build_cmake() { 345 | download_and_unpack_file https://cmake.org/files/v3.29/cmake-3.29.2.tar.gz 346 | cd cmake-3.29.2 347 | do_configure --prefix=/usr -- -DBUILD_CursesDialog=0 -DBUILD_TESTING=0 # Don't build 'ccmake' (ncurses), or './configure' will fail otherwise. 348 | # Options after "--" are passed to CMake (Usage: ./bootstrap [...] [-- ...]) 349 | do_make install/strip # This overwrites Cygwin's 'cmake.exe', 'cpack.exe' and 'ctest.exe'. 350 | cd .. 351 | } 352 | 353 | build_nasm() { 354 | download_and_unpack_file https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/nasm-2.16.03.tar.xz 355 | cd nasm-2.16.03 356 | if [[ ! -f Makefile.in.bak ]]; then # Library only and install nasm stripped. 357 | sed -i.bak '/man1/d;/install:/a\\t$(STRIP) --strip-unneeded nasm$(X) ndisasm$(X)' Makefile.in 358 | fi 359 | do_configure --prefix=/usr 360 | # No '--prefix=$mingw_w64_x86_64_prefix', because NASM has to be built with Cygwin's GCC. Otherwise it can't read Cygwin paths and you'd get errors like "nasm: fatal: unable to open output file `/cygdrive/c/DOCUME~1/Admin/LOCALS~1/Temp/ffconf.Ld8518el/test.o'" while configuring FFmpeg for instance. 361 | do_make install # 'nasm.exe' and 'ndisasm.exe' will be installed in '/usr/bin' (Cygwin's bin map). 362 | cd .. 363 | } 364 | 365 | build_dlfcn() { 366 | do_git_checkout https://github.com/dlfcn-win32/dlfcn-win32.git 367 | cd dlfcn-win32_git 368 | if [[ ! -f Makefile.bak ]]; then # Change GCC optimization level. 369 | sed -i.bak "s/CFLAGS =/CFLAGS +=/;s/-O3/-O2/" Makefile 370 | fi 371 | do_configure --prefix=$mingw_w64_x86_64_prefix --cross-prefix=$cross_prefix # rejects some normal cross compile options so custom here 372 | do_make 373 | do_make_install 374 | gen_ld_script libdl.a -lpsapi # dlfcn-win32's 'README.md': "If you are linking to the static 'dl.lib' or 'libdl.a', then you would need to explicitly add 'psapi.lib' or '-lpsapi' to your linking command, depending on if MinGW is used." 375 | cd .. 376 | } 377 | 378 | build_bzip2() { 379 | download_and_unpack_file https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz 380 | cd bzip2-1.0.8 381 | if [[ ! -f bzlib.h.bak ]]; then # See https://github.com/sherpya/mplayer-be/blob/master/packages/bzip2/patches/00_sherpya_mingw-cross.diff. 382 | sed -i.bak "s/WINAPI func/func/" bzlib.h 383 | fi 384 | cp -vu $patch_dir/bzip2_CMakeLists.txt CMakeLists.txt # See https://github.com/sherpya/mplayer-be/blob/master/packages/bzip2/install/CMakeLists.txt. 385 | do_cmake $PWD 386 | do_make install 387 | cd .. 388 | } 389 | 390 | build_liblzma() { 391 | download_and_unpack_file https://sourceforge.net/projects/lzmautils/files/xz-5.6.2.tar.xz 392 | cd xz-5.6.2 393 | generic_configure --disable-xz --disable-xzdec --disable-lzmadec --disable-lzmainfo --disable-scripts --disable-doc --disable-nls 394 | do_make install 395 | cd .. 396 | } # [dlfcn] 397 | 398 | build_zlib() { 399 | download_and_unpack_file http://zlib.net/zlib-1.3.1.tar.xz 400 | cd zlib-1.3.1 401 | if [[ ! -f Makefile.in.bak ]]; then # Library only. 402 | sed -i.bak "/man3dir/d" Makefile.in 403 | fi 404 | do_configure --prefix=$mingw_w64_x86_64_prefix --static 405 | do_make install $make_prefix_options 406 | cd .. 407 | } 408 | 409 | build_iconv() { 410 | download_and_unpack_file https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz 411 | cd libiconv-1.17 412 | generic_configure --disable-nls 413 | do_make install-lib # No need for 'do_make_install', because 'install-lib' already has install-instructions. 414 | cd .. 415 | } # [dlfcn] 416 | 417 | build_sdl2() { 418 | download_and_unpack_file https://libsdl.org/release/SDL2-2.30.6.tar.gz 419 | cd SDL2-2.30.6 420 | if [[ ! -f Makefile.in.bak ]]; then 421 | sed -i.bak "/aclocal/d" Makefile.in # Library only. 422 | sed -i.bak "/#ifndef DECLSPEC/i\#define DECLSPEC" include/begin_code.h # Needed for building shared FFmpeg libraries. 423 | fi 424 | generic_configure --bindir=$mingw_bin_path --enable-libiconv 425 | do_make install 426 | if [[ ! -f $mingw_bin_path/${host_target}-sdl2-config ]]; then 427 | mv -v "$mingw_bin_path/sdl2-config" "$mingw_bin_path/${host_target}-sdl2-config" # At the moment FFmpeg's 'configure' doesn't use 'sdl2-config', because it gives priority to 'sdl2.pc', but when it does, it expects 'i686-w64-mingw32-sdl2-config' in 'cross_compilers/mingw-w64-i686/bin'. 428 | fi 429 | cd .. 430 | } # [iconv, dlfcn] 431 | 432 | build_libwebp() { 433 | do_git_checkout https://chromium.googlesource.com/webm/libwebp.git libwebp_git main 434 | cd libwebp_git 435 | if [[ ! -f Makefile.am.bak ]]; then # Library only. 436 | sed -i.bak "s/src.*/src/;4,\$d" Makefile.am 437 | fi 438 | generic_configure --disable-gl --disable-sdl --disable-png --disable-jpeg --disable-tiff --disable-gif --disable-wic # These are only necessary for building the bundled tools/binaries. 439 | do_make install 440 | cd .. 441 | } # [dlfcn] 442 | 443 | build_libjxl() { 444 | do_git_checkout https://github.com/libjxl/libjxl.git libjxl_git main 445 | cd libjxl_git 446 | if [[ ! -d .git/modules ]]; then 447 | echo -e "\e[1;33mDownloading submodules.\e[0m" # 'Brotli' and 'skcms' are the main focus. 448 | git submodule update --init --recursive 449 | else 450 | if [[ $(git --git-dir=.git/modules/third_party/testdata rev-parse HEAD) != $(git ls-remote -h https://github.com/libjxl/testdata.git | head -c +40) ]]; then 451 | git submodule foreach -q 'git reset --hard' # Return files to their original state. 452 | git submodule foreach -q 'git clean -fdx' # Clean the working tree; build- as well as untracked files. 453 | echo -e "\e[1;33mUpdating submodules to latest git head on 'main'.\e[0m" 454 | git submodule foreach git fetch 455 | git submodule update --init 456 | rm -f already_* # Force recompiling. 457 | else 458 | echo -e "\e[1;33mLocal submodules are up-to-date.\e[0m" 459 | fi 460 | fi 461 | if [[ ! -f lib/threads/resizable_parallel_runner.cc.bak ]]; then 462 | sed -i.bak 's//"mingw.condition_variable.h"/;s//"mingw.mutex.h"/;s//"mingw.thread.h"/' lib/threads/resizable_parallel_runner.cc # Use "mingw-std-threads" implementation of standard C++11 threading classes, which are currently still missing on MinGW GCC. 463 | sed -i.bak 's//"mingw.condition_variable.h"/;s//"mingw.mutex.h"/;s//"mingw.thread.h"/' lib/threads/thread_parallel_runner_internal.h # Otherwise you'd get errors like "'std::thread' has not been declared" and "invalid use of incomplete type 'class std::future'". 464 | fi 465 | if [[ ! -f lib/threads/libjxl_threads.pc.in.bak ]]; then 466 | sed -i.bak "s/-lm/& -lstdc++/" lib/threads/libjxl_threads.pc.in # Otherwise you'd get for example "undefined reference to `operator new(unsigned int)'", amongst MANY other variants, while configuring FFmpeg. See https://github.com/libjxl/libjxl/pull/1444. 467 | fi 468 | mkdir -p build_dir 469 | cd build_dir # Out-of-source build. 470 | do_cmake ${PWD%/*} -DBUILD_SHARED_LIBS=0 -DBUILD_TESTING=0 -DCMAKE_BUILD_TYPE=Release -DJPEGXL_ENABLE_BENCHMARK=0 -DJPEGXL_ENABLE_DOXYGEN=0 -DJPEGXL_ENABLE_EXAMPLES=0 -DJPEGXL_ENABLE_JNI=0 -DJPEGXL_ENABLE_JPEGLI=0 -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=0 -DJPEGXL_ENABLE_MANPAGES=0 -DJPEGXL_ENABLE_OPENEXR=0 -DJPEGXL_ENABLE_SJPEG=0 -DJPEGXL_ENABLE_TOOLS=0 471 | if [[ ! -f lib/include/jxl/jxl_export.h.bak ]]; then 472 | sed -i.bak "s/ __declspec(dll.*//" lib/include/jxl/jxl_export.h # Otherwise you'd get "undefined reference to `_imp__JxlDecoderVersion'" while configuring FFmpeg. 473 | fi 474 | do_make install 475 | cd .. 476 | cd .. 477 | } # python 3 478 | 479 | build_freetype() { 480 | download_and_unpack_file https://download.savannah.gnu.org/releases/freetype/freetype-2.13.3.tar.xz 481 | cd freetype-2.13.3 482 | if [[ ! -f builds/unix/install.mk.bak ]]; then 483 | sed -i.bak "/config \\\/s/\s*\\\//;/bindir) /s/\s*\\\//;/aclocal/d;/man1/d;/PLATFORM_DIR/d;/docs/d" builds/unix/install.mk # Library only. 484 | fi 485 | generic_configure --build=i686-pc-cygwin --with-harfbuzz=no --with-brotli=no # Without '--build=i686-pc-cygwin' you'd get: "could not open '/cygdrive/[...]/include/freetype/ttnameid.h' for writing". 486 | do_make install 487 | cd .. 488 | } # [zlib, bzip2, libpng] 489 | 490 | build_libxml2() { 491 | download_and_unpack_file http://xmlsoft.org/sources/libxml2-2.9.12.tar.gz 492 | cd libxml2-2.9.12 493 | apply_patch $patch_dir/libxml2-2.9.12_lib-only_static_cve-2017-8872.diff # See https://github.com/sherpya/mplayer-be/blob/master/packages/libxml2/patches/01_sherpya_always-static.diff and https://github.com/sherpya/mplayer-be/blob/master/packages/libxml2/patches/03_debian_cve-2017-8872.diff. 494 | generic_configure --with-ftp=no --with-http=no --with-python=no 495 | do_make install 496 | cd .. 497 | } # [zlib, liblzma, iconv, dlfcn] 498 | 499 | build_fontconfig() { 500 | download_and_unpack_file https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.15.0.tar.xz 501 | cd fontconfig-2.15.0 502 | if [[ ! -f Makefile.in.bak ]]; then 503 | sed -i.bak "/^SUBDIRS/s/fc.*/src/;470,471d;/^install-data-am/s/:.*/: install-pkgconfigDATA/;/\tinstall-xmlDATA$/d" Makefile.in # Library only. 504 | fi 505 | generic_configure --enable-libxml2 --disable-docs # Use Libxml2 instead of Expat. 506 | do_make install 507 | cd .. 508 | } # freetype, libxml >= 2.6, python >= 3, [iconv, dlfcn] 509 | 510 | build_gmp() { 511 | download_and_unpack_file https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz 512 | cd gmp-6.3.0 513 | if [[ ! -f Makefile.in.bak ]]; then # Library only. 514 | sed -i.bak "/^SUBDIRS/c\SUBDIRS = mpn mpz mpq mpf printf scanf rand cxx tune" Makefile.in 515 | fi 516 | generic_configure 517 | do_make install 518 | cd .. 519 | } # [dlfcn] 520 | 521 | build_mbedtls() { 522 | download_and_unpack_file https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v2.28.9.tar.gz mbedtls-2.28.9 523 | cd mbedtls-2.28.9 524 | apply_patch $patch_dir/mbedtls-2.28.9_mingw-stdio.diff # Windows XP compatibility. See https://github.com/sherpya/mplayer-be/blob/master/packages/mbedtls/patches/00_sherpya_mingw-stdio.diff. 525 | mkdir -p build_dir 526 | cd build_dir # Out-of-source build. 527 | do_cmake ${PWD%/*} -DCMAKE_C_FLAGS="$CFLAGS -D__USE_MINGW_ANSI_STDIO=1" -DENABLE_PROGRAMS=0 -DENABLE_TESTING=0 -DENABLE_ZLIB_SUPPORT=1 528 | do_make install 529 | cd .. 530 | cd .. 531 | } 532 | 533 | build_libogg() { 534 | do_git_checkout https://github.com/xiph/ogg.git 535 | cd ogg_git 536 | if [[ ! -f Makefile.am.bak ]]; then # Library only. 537 | sed -i.bak "s/ doc//;/m4data/,+2d" Makefile.am 538 | fi 539 | ac_cv_sizeof_u_int16_t=2 ac_cv_sizeof_u_int32_t=4 generic_configure # Both are set to 0 otherwise. See https://github.com/sherpya/mplayer-be/blob/master/packages/libogg/build.sh. 540 | do_make install 541 | cd .. 542 | } # [dlfcn] 543 | 544 | build_libvorbis() { 545 | do_git_checkout https://github.com/xiph/vorbis.git 546 | cd vorbis_git 547 | if [[ ! -f Makefile.am.bak ]]; then 548 | sed -i.bak "s/ test doc//;/m4data/,+2d" Makefile.am # Library only. 549 | sed -i.bak "s|if(samples>length/bytespersample)|if(bytespersample \&\& samples>length/bytespersample)|" lib/vorbisfile.c # Avoid SIGFPE when bytespersample is zero. See https://github.com/sherpya/mplayer-be/blob/master/packages/libvorbis/patches/01_debian_avoid-sigfpe.diff 550 | fi 551 | generic_configure --disable-docs --disable-examples --disable-oggtest 552 | do_make install 553 | cd .. 554 | } # libogg >= 1.0, [dlfcn] 555 | 556 | build_libopus() { 557 | do_git_checkout https://github.com/xiph/opus.git opus_git main 558 | cd opus_git 559 | if [[ ! -f Makefile.am.bak ]]; then 560 | sed -i.bak "/m4data/,+2d;/install-data-local/,+2d" Makefile.am # Library only. 561 | sed -i.bak "/#ifndef OPUS_EXPORT/i\#define OPUS_EXPORT" include/opus_defines.h # Static library. 562 | sed -i.bak "s/@LIBM@/& -lssp/" opus.pc.in # Otherwise you'd get "undefined reference to `__memcpy_chk'" while configuring FFmpeg. The alternative is to use '--disable-stack-protector'. 563 | fi 564 | generic_configure --disable-doc --disable-extra-programs 565 | do_make install 566 | cd .. 567 | } # [dlfcn] 568 | 569 | build_lame() { 570 | do_svn_checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame_svn 571 | cd lame_svn 572 | if [[ ! -f Makefile.in.bak ]]; then # Library only. 573 | sed -i.bak "/^SUBDIRS/s/ frontend//;/^SUBDIRS/s/ doc//" Makefile.in 574 | fi 575 | generic_configure --enable-nasm --disable-decoder --disable-frontend 576 | do_make install 577 | cd .. 578 | } # [dlfcn] 579 | 580 | build_twolame() { 581 | do_git_checkout https://github.com/njh/twolame.git twolame_git main 582 | cd twolame_git 583 | if [[ ! -f Makefile.am.bak ]]; then # Library only. 584 | sed -i.bak "/^SUBDIRS/s/ frontend.*//;/pkgdocdir/,+6d;/pkgdoc_DATA/d" Makefile.am 585 | sed -i.bak "/#ifdef TL_API/i\#ifndef LIBTWOLAME_STATIC\\n#define LIBTWOLAME_STATIC\\n#endif\\n" libtwolame/twolame.h # Static library. 586 | fi 587 | generic_configure 588 | do_make install 589 | cd .. 590 | } # [dlfcn] 591 | 592 | build_fdk-aac() { 593 | do_git_checkout https://github.com/mstorsjo/fdk-aac.git 594 | cd fdk-aac_git 595 | do_configure --host=$host_target --prefix=$mingw_w64_x86_64_prefix --disable-static # Build shared library ('libfdk-aac-2.dll'). 596 | do_make install-strip 597 | 598 | mkdir -p $redist_dir 599 | archive="$redist_dir/libfdk-aac-$(git describe | tail -c +2 | sed 's/g//')-win32-xpmod-sse" 600 | if [[ ! -f $archive.7z ]]; then # Pack shared library. 601 | sed "s/$/\r/" NOTICE > NOTICE.txt 602 | 7z a -mx=9 -bb3 $archive.7z $mingw_w64_x86_64_prefix/bin/libfdk-aac-2.dll NOTICE.txt 603 | rm -v NOTICE.txt 604 | else 605 | echo -e "\e[1;33mAlready made '${archive##*/}.7z'.\e[0m" 606 | fi 607 | cd .. 608 | } # [dlfcn] 609 | 610 | build_libmpg123() { 611 | download_and_unpack_file https://sourceforge.net/projects/mpg123/files/mpg123/1.32.7/mpg123-1.32.7.tar.bz2 612 | cd mpg123-1.32.7 613 | if [[ ! -f Makefile.in.bak ]]; then # Library only 614 | sed -i.bak "/^all-am/s/\$(PROG.*/\\\/;/^install-data-am/s/ install-man//;/^install-exec-am/s/ install-binPROGRAMS//" Makefile.in 615 | fi 616 | generic_configure 617 | # '--enable-yasm' results in: "configure: error: Yasm for AVX is currently broken and might go away.". 618 | do_make install 619 | cd .. 620 | } # [dlfcn] 621 | 622 | build_libopenmpt() { 623 | download_and_unpack_file https://lib.openmpt.org/files/libopenmpt/src/libopenmpt-0.7.9+release.autotools.tar.gz 624 | cd libopenmpt-0.7.9+release.autotools 625 | if [[ ! -f Makefile.in.bak ]]; then # Library only 626 | sed -i.bak "/^install-data-am/s/:.*/: install-includelibopenmptHEADERS install-pkgconfigDATA/;/\tinstall-man /d" Makefile.in 627 | fi 628 | CFLAGS="$CFLAGS -D_WIN32_WINNT=_WIN32_WINNT_WINXP" CXXFLAGS="-D_WIN32_WINNT=_WIN32_WINNT_WINXP" generic_configure --disable-openmpt123 --disable-examples --disable-tests 629 | do_make install 630 | cd .. 631 | } # zlib, libmpg123 >= 1.14.0, libogg, libvorbis, [dlfcn, mingw-std-threads] 632 | # GCC11's own std::thread implementation conflicts with mingw-std-threads resulting in "libopenmpt/libopenmpt_impl.cpp:85:2: warning: #warning "Warning: Building libopenmpt with MinGW-w64 without std::thread support is not recommended and is deprecated. Please use MinGW-w64 with posix threading model (as opposed to win32 threading model), or build with mingw-std-threads." [-Wcpp]". See https://forum.openmpt.org/index.php?topic=6822.0. 633 | 634 | build_libgme() { 635 | do_git_checkout https://github.com/libgme/game-music-emu.git 636 | cd game-music-emu_git 637 | if [[ ! -f CMakeLists.txt.bak ]]; then 638 | sed -i.bak "/EXCLUDE_FROM_ALL/d" CMakeLists.txt # Library only. 639 | sed -i.bak "s/gme \${libgme_SRCS}/gme STATIC \${libgme_SRCS}/" gme/CMakeLists.txt # Static library. 640 | fi 641 | do_cmake $PWD -DBUILD_SHARED_LIBS=0 642 | do_make install 643 | cd .. 644 | } # zlib 645 | 646 | build_libsoxr() { 647 | do_git_checkout https://git.code.sf.net/p/soxr/code soxr_git 648 | cd soxr_git 649 | if [[ ! -f CMakeLists.txt.bak ]]; then # Library only. 650 | sed -i.bak "/^install/,+5d" CMakeLists.txt 651 | fi 652 | do_cmake $PWD -DBUILD_SHARED_LIBS=0 -DHAVE_WORDS_BIGENDIAN_EXITCODE=0 -DWITH_OPENMP=0 -DBUILD_TESTS=0 -DBUILD_EXAMPLES=0 653 | do_make install 654 | cd .. 655 | } 656 | 657 | build_libflite() { 658 | download_and_unpack_file http://www.festvox.org/flite/packed/flite-2.1/flite-2.1-release.tar.bz2 659 | cd flite-2.1-release 660 | apply_patch $patch_dir/libflite-2.1.0_mingw-w64-fixes.diff # Fix MinGW-w64 stuff and library only. Without the patch it fails with "../build/i386-mingw32/lib/libflite.a(cst_val.o):cst_val.c:(.text+0xdcd): undefined reference to `c99_snprintf'". 661 | do_configure --host=$host_target --prefix=$mingw_w64_x86_64_prefix --disable-shared 662 | do_make 663 | do_make_install 664 | cd .. 665 | } 666 | 667 | build_libsamplerate() { 668 | do_git_checkout https://github.com/libsndfile/libsamplerate.git 669 | cd libsamplerate_git 670 | if [[ ! -f Makefile.am.bak ]]; then # Library only. 671 | sed -i.bak "53,\$d" Makefile.am 672 | fi 673 | generic_configure --disable-fftw 674 | do_make install 675 | cd .. 676 | } 677 | 678 | build_fftw() { 679 | download_and_unpack_file http://fftw.org/fftw-3.3.10.tar.gz 680 | cd fftw-3.3.10 681 | if [[ ! -f Makefile.in.bak ]]; then # Library only. 682 | sed -i.bak "/^SUBDIRS/s/api.*/api/;/^libbench2/d" Makefile.in 683 | fi 684 | generic_configure --disable-doc 685 | do_make install 686 | cd .. 687 | } 688 | 689 | build_librubberband() { 690 | do_git_checkout https://github.com/breakfastquay/rubberband.git rubberband_git default 18c06ab8c431854056407c467f4755f761e36a8e 691 | cd rubberband_git 692 | apply_patch $patch_dir/rubberband_git_static-lib.patch -p1 # Create install-static target and add missing libraries in the pkg-config file. 693 | do_configure --host=$host_target --prefix=$mingw_w64_x86_64_prefix --disable-programs --disable-vamp --disable-ladspa 694 | do_make install-static # No need for 'do_make_install', because 'install-static' already has install-instructions. 695 | cd .. 696 | } # libsamplerate, fftw 697 | 698 | build_libzimg() { 699 | do_git_checkout https://github.com/sekrit-twc/zimg.git 700 | cd zimg_git 701 | if [[ ! -d .git/modules ]]; then 702 | echo -e "\e[1;33mDownloading submodule 'graphengine'.\e[0m" 703 | git submodule update --init --remote graphengine # Without it results in: "make[1]: *** No rule to make target 'graphengine/graphengine/cpuinfo.cpp', needed by 'graphengine/graphengine/libzimg_internal_la-cpuinfo.lo'. Stop.". This can also be done with 'git clone --recursive', but since this is the only dependency that actually requires a submodule, it's undesirable to have it in 'do_git_checkout()'. 704 | else 705 | if [[ $(git --git-dir=.git/modules/graphengine rev-parse HEAD) != $(git ls-remote -h https://github.com/sekrit-twc/graphengine.git | sed "s/\s.*//") ]]; then 706 | git submodule foreach -q 'git reset --hard' # Return files to their original state. 707 | git submodule foreach -q 'git clean -fdx' # Clean the working tree; build- as well as untracked files. 708 | echo -e "\e[1;33mUpdating submodule 'graphengine' to latest git head on 'origin/master'.\e[0m" 709 | git submodule update --remote graphengine 710 | rm -f already_* # Force recompiling libzimg. 711 | else 712 | echo -e "\e[1;33mLocal submodule 'graphengine' is up-to-date.\e[0m" 713 | fi 714 | fi 715 | if [[ ! -f Makefile.am.bak ]]; then # Library only. 716 | sed -i.bak "/dist_doc_DATA/,+19d" Makefile.am 717 | fi 718 | generic_configure 719 | do_make install 720 | cd .. 721 | } # [dlfcn] 722 | 723 | build_vidstab() { 724 | do_git_checkout https://github.com/georgmartius/vid.stab.git 725 | cd vid.stab_git 726 | do_cmake $PWD -DBUILD_SHARED_LIBS=0 -DUSE_OMP=0 # '-DUSE_OMP' is on by default, but somehow libgomp ('cygwin_local_install/lib/gcc/i686-pc-cygwin/5.4.0/include/omp.h') can't be found, so '-DUSE_OMP=0' to prevent a compilation error. 727 | do_make install 728 | cd .. 729 | } 730 | 731 | build_frei0r() { 732 | do_git_checkout https://github.com/dyne/frei0r.git 733 | cd frei0r_git 734 | if [[ ! -f src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp.bak ]]; then 735 | sed -i.bak 's//"mingw.future.h"/' src/filter/kaleid0sc0pe/kaleid0sc0pe.cpp # Use "mingw-std-threads" implementation of standard C++11 threading classes, which are currently still missing on MinGW GCC. 736 | sed -i.bak 's//\\"mingw.future.h\\"/' src/filter/kaleid0sc0pe/CMakeLists.txt # Otherwise you'd get errors like "'std::thread' has not been declared" and "invalid use of incomplete type 'class std::future'". 737 | fi 738 | do_cmake $PWD -DCMAKE_BUILD_TYPE=Release 739 | do_make install/strip 740 | 741 | mkdir -p $redist_dir 742 | archive="$redist_dir/frei0r-plugins-$(git describe --tags | tail -c +2 | sed 's/g//')-win32-xpmod-sse" 743 | if [[ ! -f $archive.7z ]]; then # Pack shared libraries. 744 | for doc in AUTHORS ChangeLog COPYING README.md; do 745 | sed "s/$/\r/" $doc > $mingw_w64_x86_64_prefix/lib/frei0r-1/$doc.txt 746 | done 747 | 7z a -mx=9 -bb3 $archive.7z $mingw_w64_x86_64_prefix/lib/frei0r-1 748 | rm -v $mingw_w64_x86_64_prefix/lib/frei0r-1/*.txt 749 | else 750 | echo -e "\e[1;33mAlready made '${archive##*/}.7z'.\e[0m" 751 | fi 752 | cd .. 753 | } # dlfcn 754 | 755 | build_fribidi() { 756 | do_git_checkout https://github.com/behdad/fribidi.git 757 | cd fribidi_git 758 | if [[ ! -f Makefile.am.bak ]]; then 759 | sed -i.bak "s/ bin doc test//" Makefile.am # Library only. 760 | sed -i.bak "/#define _FRIBIDI_COMMON_H/a\\\n#ifndef FRIBIDI_LIB_STATIC\n#define FRIBIDI_LIB_STATIC 1\n#endif" lib/fribidi-common.h # Static library. See https://github.com/sherpya/mplayer-be/blob/master/packages/fribidi/patches/01_sherpya_static-lib.diff. 761 | fi 762 | generic_configure --disable-deprecated 763 | do_make install 764 | cd .. 765 | } # [dlfcn] 766 | 767 | build_harfbuzz() { 768 | download_and_unpack_file https://github.com/harfbuzz/harfbuzz/archive/refs/tags/9.0.0.tar.gz harfbuzz-9.0.0 769 | cd harfbuzz-9.0.0 770 | sed -i.bak "s|setlocale|//setlocale|" util/options.hh # See https://github.com/sherpya/mplayer-be/blob/master/packages/harfbuzz/patches/01_sherpya_no-setlocale.diff. 771 | mkdir -p build_dir 772 | cd build_dir # Out-of-source build. 773 | do_cmake ${PWD%/*} -DBUILD_SHARED_LIBS=0 -DHB_HAVE_FREETYPE=1 774 | do_make install 775 | cd .. 776 | cd .. 777 | } # [freetype] 778 | 779 | build_libass() { 780 | do_git_checkout https://github.com/libass/libass.git 781 | cd libass_git 782 | generic_configure --disable-directwrite 783 | # See https://github.com/libass/libass/blob/master/Changelog, libass (0.13.0): "The DirectWrite backend only works on Windows Vista and later. On XP, fontconfig is still needed.". 784 | # Without '--disable-directwrite' you'd get: 785 | # LD ffmpeg_g.exe 786 | # [...]/libass.a(ass_directwrite.o):ass_directwrit:(.text+0x776): undefined reference to `_imp__GetTextFaceW@12' 787 | # [...]/libass.a(ass_directwrite.o):ass_directwrit:(.text+0xef0): undefined reference to `_imp__EnumFontFamiliesW@16' 788 | do_make install 789 | cd .. 790 | } # freetype >= 9.10.3 (see https://bugs.launchpad.net/ubuntu/+source/freetype1/+bug/78573 o_O), fribidi >= 0.19.0, harfbuzz >= 1.2.3, [fontconfig >= 2.10.92, iconv, dlfcn] 791 | 792 | build_avisynth() { 793 | do_git_checkout https://github.com/AviSynth/AviSynthPlus.git 794 | mkdir -p AviSynthPlus_git/avisynth-build 795 | cd AviSynthPlus_git/avisynth-build # Out-of-source build. 796 | do_cmake ${PWD%/*} -DHEADERS_ONLY=1 797 | do_make VersionGen install 798 | cd ../.. 799 | } 800 | 801 | build_libxvid() { 802 | download_and_unpack_file https://downloads.xvid.com/downloads/xvidcore-1.3.7.tar.gz xvidcore 803 | cd xvidcore 804 | cp -vu $patch_dir/libxvid_CMakeLists.txt CMakeLists.txt # See https://github.com/sherpya/mplayer-be/blob/master/packages/xvidcore/install/CMakeLists.txt. 805 | do_cmake $PWD 806 | do_make install 807 | cd .. 808 | } 809 | 810 | build_libx264() { 811 | do_git_checkout https://code.videolan.org/videolan/x264.git 812 | cd x264_git 813 | if [[ ! -f configure.bak ]]; then # Change GCC optimization level. 814 | sed -i.bak "s/O3 -/O2 -/" configure 815 | fi 816 | do_configure --host=$host_target --cross-prefix=$cross_prefix --prefix=$mingw_w64_x86_64_prefix --enable-static --disable-cli --disable-win32thread # Use pthreads instead of win32threads. 817 | do_make install-lib-static 818 | cd .. 819 | } # nasm >= 2.13 (unless '--disable-asm' is specified) 820 | 821 | build_libx265() { 822 | do_git_checkout https://bitbucket.org/multicoreware/x265_git.git x265_git 823 | cd x265_git 824 | if [[ ! -f source/CMakeLists.txt.bak ]]; then # Fix "noasm". See https://github.com/rdp/ffmpeg-windows-build-helpers/pull/738. 825 | sed -i.bak "s/if(X86MATCH GREATER \"-1\")/if(\"\${SYSPROC}\" STREQUAL \"\" OR X86MATCH GREATER \"-1\")/" source/CMakeLists.txt 826 | fi 827 | mkdir -p 8bit 10bit 12bit 828 | cd 12bit 829 | do_cmake ${PWD%/*}/source -DENABLE_SHARED=0 -DENABLE_CLI=0 -DWINXP_SUPPORT=1 -DHIGH_BIT_DEPTH=1 -DMAIN12=1 -DEXPORT_C_API=0 -DENABLE_ASSEMBLY=0 830 | do_make 831 | cd ../10bit 832 | do_cmake ${PWD%/*}/source -DENABLE_SHARED=0 -DENABLE_CLI=0 -DWINXP_SUPPORT=1 -DHIGH_BIT_DEPTH=1 -DEXPORT_C_API=0 -DENABLE_ASSEMBLY=0 833 | do_make 834 | cd ../8bit 835 | ln -sf ../10bit/libx265.a libx265_main10.a 836 | ln -sf ../12bit/libx265.a libx265_main12.a 837 | do_cmake ${PWD%/*}/source -DENABLE_SHARED=0 -DENABLE_CLI=0 -DWINXP_SUPPORT=1 -DEXTRA_LIB="libx265_main10.a;libx265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=1 -DLINKED_12BIT=1 838 | do_make 839 | # rename the 8bit library, then combine all three into libx265.a 840 | mv libx265.a libx265_main.a 841 | ${cross_prefix}ar -M <= 2.13 (unless '-DENABLE_ASSEMBLY=0' is specified) 853 | 854 | build_libvpx() { 855 | do_git_checkout https://chromium.googlesource.com/webm/libvpx.git libvpx_git main 856 | cd libvpx_git 857 | if [[ ! -f vp8/common/threading.h.bak ]]; then 858 | sed -i.bak "/" vp8/common/threading.h # With 'cross_compilers/mingw-w64-i686/include/semaphore.h' you'd otherwise get: "semaphore.h:152:8: error: unknown type name 'mode_t'". 859 | fi 860 | CROSS="$cross_prefix" do_configure --target=x86-win32-gcc --prefix=$mingw_w64_x86_64_prefix --enable-static --disable-shared --disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-vp9-highbitdepth 861 | do_make install 862 | cd .. 863 | } 864 | 865 | build_libaom() { 866 | do_git_checkout https://aomedia.googlesource.com/aom libaom_git main 867 | cd libaom_git 868 | apply_patch $patch_dir/libaom_restore-winxp-compatibility_use-pthreads.patch -p1 # See https://aomedia.googlesource.com/aom/+/64545cb00a29ff872473db481a57cdc9bc4f1f82%5E!/#F1, https://aomedia.googlesource.com/aom/+/e5eec6c5eb14e66e2733b135ef1c405c7e6424bf%5E!/#F0 and https://github.com/sherpya/mplayer-be/blob/master/packages/aom/patches/00_sherpya_use-pthreads.diff. 869 | mkdir -p aom_build 870 | cd aom_build # Out-of-source build. 871 | do_cmake ${PWD%/*} -DCMAKE_TOOLCHAIN_FILE=build/cmake/toolchains/x86-mingw-gcc.cmake -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_NASM=1 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 872 | do_make install 873 | cd .. 874 | cd .. 875 | } # cmake >= 3.5 876 | 877 | build_ffmpeg() { 878 | do_git_checkout https://github.com/FFmpeg/FFmpeg.git "" "" 6aafe61285404022b1e8e882b8a875bc33a93aec 879 | cd FFmpeg_git 880 | apply_patch $patch_dir/0001-make-bcrypt-optional.patch -p1 # WinXP doesn't have 'bcrypt'. See https://github.com/FFmpeg/FFmpeg/commit/aedbf1640ced8fc09dc980ead2a387a59d8f7f68 and https://github.com/sherpya/mplayer-be/blob/master/patches/ff/0001-make-bcrypt-optional-on-win32.patch. 881 | apply_patch $patch_dir/0002-windows-xp-compatible-CancelIoEx.patch -p1 # Otherwise you'd get "The procedure entry point CancelIoEx could not be located in the dynamic link library KERNEL32.dll" while running ffmpeg.exe, ffplay.exe, or ffprobe.exe, because 'CancelIoEx()' is only available on Windows Vista and later. See https://github.com/FFmpeg/FFmpeg/commit/53aa76686e7ff4f1f6625502503d7923cec8c10e, https://trac.ffmpeg.org/ticket/5717 and https://github.com/sherpya/mplayer-be/blob/master/patches/ff/0002-windows-xp-compatible-CancelIoEx.patch. 882 | apply_patch $patch_dir/0003-windows-xp-compatible-wcscp.patch -p1 # Otherwise you'd get "The procedure entry point wcscpy_s could not be located in the dynamic link library msvcrt.dll" while running ffmpeg.exe, ffplay.exe, or ffprobe.exe, because 'wcscpy()' is only available on Windows Vista and later. See https://github.com/FFmpeg/FFmpeg/commit/daf61dddc8e27424c320d5c3abe3e0c5182cd5c0. 883 | apply_patch $patch_dir/0004-load-shared-libfdk-aac-library-dynamically.patch -p1 # See https://github.com/sherpya/mplayer-be/blob/master/patches/ff/0004-dynamic-loading-of-shared-fdk-aac-library.patch. 884 | apply_patch $patch_dir/0005-load-shared-frei0r-libraries-dynamically.patch -p1 # See https://github.com/sherpya/mplayer-be/blob/master/patches/ff/0005-avfilters-better-behavior-of-frei0r-on-win32.patch. 885 | init_options=(--arch=x86 --target-os=mingw32 --prefix=$mingw_w64_x86_64_prefix --cross-prefix=$cross_prefix --extra-cflags="$CFLAGS") 886 | if [[ $1 == "shared" ]]; then 887 | init_options+=(--enable-shared --disable-static) # Building a static FFmpeg is the default, so no need to specify '--enable-static --disable-shared'. 888 | fi 889 | init_options+=(--pkg-config=pkg-config --pkg-config-flags=--static --extra-version=Reino --enable-gpl --enable-gray --enable-version3 --disable-bcrypt --disable-debug --disable-doc --disable-htmlpages --disable-manpages --disable-mediafoundation --disable-podpages --disable-txtpages --disable-w32threads) 890 | do_configure "${init_options[@]}" --enable-avisynth --enable-frei0r --enable-gmp --enable-libaom --enable-libass --enable-libfdk-aac --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libsoxr --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-mbedtls 891 | do_make # Build 'ffmpeg.exe', 'ffplay.exe' and 'ffprobe.exe' (+ '*.dll' for shared build). No install. 892 | 893 | mkdir -p $redist_dir 894 | archive="$redist_dir/ffmpeg-$(git describe --tags | tail -c +2 | sed 's/dev-//;s/g//')-win32-$1-xpmod-sse" 895 | if [[ $1 == "shared" ]]; then 896 | do_make_install 897 | if [[ ! -f $archive.7z ]]; then # Pack shared build. 898 | sed "s/$/\r/" COPYING.GPLv3 > COPYING.GPLv3.txt 899 | 7z a -mx=9 -bb3 $archive.7z $mingw_w64_x86_64_prefix/bin/{ff*.exe,{av,sw,postproc}*.dll} COPYING.GPLv3.txt 900 | rm -v COPYING.GPLv3.txt 901 | else 902 | echo -e "\e[1;33mAlready made '${archive##*/}.7z'.\e[0m" 903 | fi 904 | if [[ ! -f ${archive/shared/dev}.7z ]]; then # Pack shared dev build. 905 | cd $mingw_w64_x86_64_prefix 906 | cp -v bin/*.lib lib 907 | 7z a -mx=9 -bb3 ${archive/shared/dev}.7z include/lib{av,sw,postproc}* lib/{*.lib,*.def,lib{av,sw,postproc}*.dll.a} share/ffmpeg 908 | rm -v lib/*.lib 909 | cd $OLDPWD 910 | else 911 | echo -e "\e[1;33mAlready made '$(basename ${archive/shared/dev}.7z)'.\e[0m" 912 | fi 913 | else 914 | if [[ ! -f $archive.7z ]]; then # Pack static build. 915 | sed "s/$/\r/" COPYING.GPLv3 > COPYING.GPLv3.txt 916 | #7z a -mx=9 -bb3 $archive.7z ffmpeg.exe ffplay.exe ffprobe.exe COPYING.GPLv3.txt # "ERROR: Can't allocate required memory!" with the Cygwin version of 7-Zip. 917 | /cygdrive/c/Program\ Files/Essentials/7-Zip/7z.exe a -bb3 -mx=9 -ms=on -m0=LZMA2:d96m:fb64 $(cygpath -w $archive.7z) ffmpeg.exe ffplay.exe ffprobe.exe COPYING.GPLv3.txt 918 | rm -v COPYING.GPLv3.txt 919 | else 920 | echo -e "\e[1;33mAlready made '${archive##*/}.7z'.\e[0m" 921 | fi 922 | fi 923 | cd .. 924 | } # SDL2 (only for FFplay) 925 | 926 | build_dependencies() { 927 | build_mingw_std_threads 928 | build_python 929 | build_cmake 930 | build_nasm 931 | build_dlfcn 932 | build_bzip2 # Bzlib (bzip2) in FFmpeg is autodetected, so no need for --enable-bzlib. 933 | build_liblzma # Lzma in FFmpeg is autodetected, so no need for --enable-lzma. 934 | build_zlib # Zlib in FFmpeg is autodetected, so no need for --enable-zlib. 935 | build_iconv # Iconv in FFmpeg is autodetected, so no need for --enable-iconv. 936 | build_sdl2 # Sdl2 in FFmpeg is autodetected, so no need for --enable-sdl2. 937 | build_libwebp 938 | build_libjxl 939 | build_freetype 940 | build_libxml2 # For DASH support configure FFmpeg with --enable-libxml2. 941 | build_fontconfig 942 | build_gmp # For RTMP support configure FFmpeg with --enable-gmp. 943 | build_mbedtls # For HTTPS TLS 1.2 support on WinXP configure FFmpeg with --enable-mbedtls. 944 | build_libogg 945 | build_libvorbis 946 | build_libopus 947 | build_lame 948 | build_twolame 949 | build_fdk-aac 950 | build_libmpg123 951 | build_libopenmpt 952 | build_libgme 953 | build_libsoxr 954 | build_libflite 955 | build_libsamplerate 956 | build_fftw 957 | build_librubberband 958 | build_libzimg 959 | build_vidstab 960 | build_frei0r 961 | build_fribidi 962 | build_harfbuzz 963 | build_libass 964 | build_avisynth 965 | build_libxvid 966 | build_libx264 967 | build_libx265 968 | build_libvpx 969 | build_libaom 970 | } 971 | 972 | build_apps() { 973 | if [[ $build_ffmpeg_static = "y" ]]; then 974 | build_ffmpeg static 975 | else 976 | build_ffmpeg shared 977 | fi 978 | } 979 | 980 | build_openssl() { 981 | download_and_unpack_file https://www.openssl.org/source/openssl-1.1.1w.tar.gz 982 | cd openssl-1.1.1w 983 | if [[ ! -f Configurations/10-main.conf.bak ]]; then # Change GCC optimization level. 984 | sed -i.bak "s/-O3/-O2/" Configurations/10-main.conf 985 | fi 986 | local config_options=(./Configure --prefix=$mingw_w64_x86_64_prefix mingw zlib no-async) 987 | # "Note: on older OSes, like CentOS 5, BSD 5, and Windows XP or Vista, you will need to configure with no-async when building OpenSSL 1.1.0 and above. The configuration system does not detect lack of the Posix feature on the platforms." (https://wiki.openssl.org/index.php/Compilation_and_Installation) 988 | if [ "$1" = "static" ]; then 989 | make distclean || exit 1 990 | CC="${cross_prefix}gcc" AR="${cross_prefix}ar" RANLIB="${cross_prefix}ranlib" do_configure "${config_options[@]}" no-shared no-dso # No 'no-engine' because Curl needs it when built with Libssh2. 991 | do_make install_dev 992 | else 993 | CC="${cross_prefix}gcc" AR="${cross_prefix}ar" RANLIB="${cross_prefix}ranlib" do_configure "${config_options[@]}" shared 994 | do_make build_libs 995 | 996 | mkdir -p $redist_dir 997 | archive="$redist_dir/openssl-1.1.1w-win32-xpmod-sse" 998 | if [[ ! -f $archive.7z ]]; then # Pack shared libraries. 999 | sed "s/$/\r/" LICENSE > LICENSE.txt 1000 | ${cross_prefix}strip -ps libcrypto-1_1.dll libssl-1_1.dll 1001 | 7z a -mx=9 -bb3 $archive.7z libcrypto-1_1.dll libssl-1_1.dll LICENSE.txt 1002 | rm -v LICENSE.txt 1003 | else 1004 | echo -e "\e[1;33mAlready made '${archive##*/}.7z'.\e[0m" 1005 | fi 1006 | fi 1007 | cd .. 1008 | } # This is to compile 'libcrypto-1_1.dll' and 'libssl-1_1.dll' for Xidel, or a static library for hlsdl. 1009 | 1010 | build_openssl3() { 1011 | download_and_unpack_file https://www.openssl.org/source/openssl-3.3.1.tar.gz 1012 | cd openssl-3.3.1 1013 | if [[ ! -f Configurations/10-main.conf.bak ]]; then # Change GCC optimization level. 1014 | sed -i.bak "s/-O3/-O2/" Configurations/10-main.conf 1015 | fi 1016 | local config_options=(./Configure --prefix=$mingw_w64_x86_64_prefix mingw zlib no-async) 1017 | # "Note: on older OSes, like CentOS 5, BSD 5, and Windows XP or Vista, you will need to configure with no-async when building OpenSSL 1.1.0 and above. The configuration system does not detect lack of the Posix feature on the platforms." (https://wiki.openssl.org/index.php/Compilation_and_Installation) 1018 | if [ "$1" = "static" ]; then 1019 | #if [[ -f Makefile ]]; then 1020 | # make distclean 1021 | #fi 1022 | CC="${cross_prefix}gcc" AR="${cross_prefix}ar" RANLIB="${cross_prefix}ranlib" do_configure "${config_options[@]}" no-shared no-dso # No 'no-engine' because Curl needs it when built with Libssh2. 1023 | do_make install_dev 1024 | else 1025 | CC="${cross_prefix}gcc" AR="${cross_prefix}ar" RANLIB="${cross_prefix}ranlib" do_configure "${config_options[@]}" shared 1026 | do_make build_libs 1027 | 1028 | mkdir -p $redist_dir 1029 | archive="$redist_dir/openssl-3.3.1-win32-xpmod-sse" 1030 | if [[ ! -f $archive.7z ]]; then # Pack shared libraries. 1031 | ${cross_prefix}strip -ps libcrypto-3.dll libssl-3.dll 1032 | 7z a -mx=9 -bb3 $archive.7z libcrypto-3.dll libssl-3.dll LICENSE.txt 1033 | else 1034 | echo -e "\e[1;33mAlready made '${archive##*/}.7z'.\e[0m" 1035 | fi 1036 | fi 1037 | cd .. 1038 | } # This is to compile 'libcrypto-3.dll' and 'libssl-3.dll' for Xidel, or a static library for hlsdl. 1039 | 1040 | build_libssh2() { 1041 | do_git_checkout https://github.com/libssh2/libssh2.git 1042 | cd libssh2_git 1043 | if [[ ! -f Makefile.am.bak ]]; then 1044 | sed -i.bak "/^SUBDIRS/s/src.*/src/" Makefile.am # Library only. 1045 | fi 1046 | generic_configure --disable-docker-tests --disable-sshd-tests --disable-examples-build --without-libbcrypt-prefix # Needs 'bcrypt.dll' to start otherwise. 1047 | do_make install 1048 | cd .. 1049 | } # openssl, [zlib, dlfcn] 1050 | 1051 | build_curl() { 1052 | download_and_unpack_file https://curl.se/download/curl-8.9.1.tar.xz 1053 | if [ "$1" = "openssl" ]; then # Compile Curl with OpenSSL for hlsdl. 1054 | build_openssl3 static 1055 | cd curl-8.9.1 1056 | PKG_CONFIG="pkg-config --static" generic_configure --with-openssl --without-brotli --without-ca-bundle --with-ca-fallback # Automatically detect all of OpenSSL its dependencies. 1057 | do_make install-strip 1058 | else # Compile Curl with MbedTLS and create archive. 1059 | build_mbedtls 1060 | build_libssh2 1061 | cd curl-8.9.1 1062 | if [[ ! -f cacert.pem ]]; then # See https://curl.se/docs/sslcerts.html and https://superuser.com/a/442797 for more on the CA cert file. 1063 | echo -e "\e[1;33mDownloading 'https://curl.se/ca/cacert.pem'.\e[0m" 1064 | wget https://curl.se/ca/cacert.pem 1065 | fi 1066 | LDFLAGS=-s generic_configure --with-mbedtls --with-libssh2 --without-brotli --with-ca-bundle=cacert.pem # --with-ca-fallback only works with OpenSSL or GnuTLS. 1067 | do_make # 'curl.exe' only. No install. 1068 | 1069 | mkdir -p $redist_dir 1070 | archive="$redist_dir/curl-8.9.1-mbedtls-zlib-ssh2-win32-static-xpmod-sse" 1071 | if [[ ! -f $archive.7z ]]; then # Pack static 'curl.exe'. 1072 | sed "s/$/\r/" COPYING > COPYING.txt 1073 | 7z a -mx=9 -bb3 $archive.7z ./src/curl.exe cacert.pem COPYING.txt 1074 | rm -v COPYING.txt 1075 | else 1076 | echo -e "\e[1;33mAlready made '${archive##*/}.7z'.\e[0m" 1077 | fi 1078 | fi 1079 | cd .. 1080 | } # mbedtls/openssl, [zlib, dlfcn] 1081 | 1082 | build_hlsdl() { 1083 | build_curl openssl 1084 | do_git_checkout https://github.com/selsta/hlsdl.git 1085 | cd hlsdl_git 1086 | LDFLAGS=-s do_make $make_prefix_options # Strip 'hlsdl.exe' during make. 1087 | 1088 | mkdir -p $redist_dir 1089 | archive="$redist_dir/hlsdl-$(grep -Po "(?<=hlsdl v)([0-9]+\.?)+" src/misc.c)-$(git rev-parse --short HEAD)-win32-static-xpmod-sse" 1090 | if [[ ! -f $archive.7z ]]; then # Pack static 'hlsdl.exe'. 1091 | sed "s/$/\r/" LICENSE > LICENSE.txt 1092 | 7z a -mx=9 -bb3 $archive.7z hlsdl.exe LICENSE.txt README.md 1093 | rm -v LICENSE.txt 1094 | else 1095 | echo -e "\e[1;33mAlready made '${archive##*/}.7z'.\e[0m" 1096 | fi 1097 | cd .. 1098 | } # curl(openssl) 1099 | 1100 | build_ffms2_cplugin() { 1101 | if [ "$1" = "static_ffmpeg" ]; then 1102 | do_git_checkout https://github.com/FFmpeg/FFmpeg.git FFmpeg-6.2_git "" 238f9de876c4298606ce41992e16b959d108b633 1103 | cd FFmpeg-6.2_git 1104 | ff_rev=$(git describe --tags | tail -c +2 | sed 's/dev-//;s/g//') 1105 | apply_patch $patch_dir/0001-make-bcrypt-optional_ffmpeg6.2.patch -p1 1106 | do_configure --arch=x86 --target-os=mingw32 --prefix=$mingw_w64_x86_64_prefix --cross-prefix=$cross_prefix --extra-cflags="$CFLAGS" --pkg-config=pkg-config --pkg-config-flags=--static --enable-gpl --enable-version3 --disable-bcrypt --disable-debug --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-schannel --disable-txtpages --disable-w32threads --disable-avdevice --disable-avfilter --disable-devices --disable-encoders --disable-filters --disable-hwaccels --disable-mediafoundation --disable-muxers --disable-network --disable-programs --disable-sdl2 --enable-libaom 1107 | do_make 1108 | do_make_install 1109 | cd .. 1110 | else 1111 | build_ffmpeg shared 1112 | cd FFmpeg_git; ff_rev=$(git describe --tags | tail -c +2 | sed 's/dev-//;s/g//'); cd .. 1113 | fi 1114 | 1115 | do_git_checkout https://github.com/qyot27/ffms2_cplugin.git "" c_plugin 1116 | cd ffms2_cplugin_git 1117 | apply_patch $patch_dir/ffms2_configure-fix-various.patch -p1 # Correctly detect MingW32, use Cygwin's pkg-config and don't set GCC optimization level twice if $CFLAGS already contains one. 1118 | if [[ ! -f src/core/ffms.cpp.bak ]]; then 1119 | sed -i.bak 's//"mingw.mutex.h"/' src/core/ffms.cpp # Use "mingw-std-threads" implementation of standard C++11 threading classes, which are currently still missing on MinGW GCC. 1120 | sed -i.bak 's//"mingw.thread.h"/' src/core/videosource.cpp # Otherwise you'd get errors like "'mutex' in namespace 'std' does not name a type". 1121 | fi 1122 | do_configure --host=$host_target --prefix=$mingw_w64_x86_64_prefix --cross-prefix=$cross_prefix --enable-shared --enable-avisynth --enable-vapoursynth 1123 | do_make 1124 | rm -f NUL # Somehow this "file" is created and Windows Explorer can't delete it. 1125 | 1126 | mkdir -p $redist_dir 1127 | archive="$redist_dir/ffms2-$(git describe --tags | sed 's/g//')-avs-vsp_ffmpeg-$ff_rev-win32" 1128 | if [ "$1" = "static_ffmpeg" ]; then 1129 | archive="${archive}-static-xpmod-sse" 1130 | else 1131 | archive="${archive}-shared-xpmod-sse" 1132 | fi 1133 | if [[ ! -f $archive.7z ]]; then 1134 | sed "s/$/\r/" etc/COPYING.GPLv3 > COPYING.GPLv3.txt 1135 | 7z a -mx=9 -bb3 $archive.7z ffms3.dll ffmsindex.exe ./etc/FFMS2.avsi doc COPYING.GPLv3.txt 1136 | rm -v COPYING.GPLv3.txt 1137 | else 1138 | echo -e "\e[1;33mAlready made '${archive##*/}.7z'.\e[0m" 1139 | fi 1140 | cd .. 1141 | } # ffmpeg, mingw-std-threads 1142 | 1143 | reset_cflags() { 1144 | export CFLAGS=$original_cflags 1145 | } 1146 | 1147 | # set some parameters initial values 1148 | cur_dir="$PWD/sandbox" 1149 | patch_dir="${PWD%/*}/patches" 1150 | redist_dir="${PWD%/*}/redist" 1151 | cpu_count=1 1152 | 1153 | set_box_memory_size_bytes 1154 | if [[ $box_memory_size_bytes -lt 600000000 ]]; then 1155 | echo "your box only has $box_memory_size_bytes, 512MB (only) boxes crash when building cross compiler gcc, please add some swap" # 1G worked OK however... 1156 | exit 1 1157 | fi 1158 | 1159 | if [[ $box_memory_size_bytes -gt 2000000000 ]]; then 1160 | gcc_cpu_count=$cpu_count # they can handle it seemingly... 1161 | else 1162 | echo "low RAM detected so using only one cpu for gcc compilation" 1163 | gcc_cpu_count=1 # compatible low RAM... 1164 | fi 1165 | 1166 | # variables with their defaults 1167 | build_ffmpeg_static=y 1168 | original_cflags='-O2 -march=pentium3 -mtune=athlon-xp -mfpmath=sse -msse' # See https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html, https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html and https://stackoverflow.com/questions/19689014/gcc-difference-between-o3-and-os. 1169 | export ac_cv_func__mktemp_s=no # _mktemp_s is not available on WinXP. 1170 | export ac_cv_func_vsnprintf_s=no # Mark vsnprintf_s as unavailable, as windows xp mscrt doesn't have it. 1171 | 1172 | # parse command line parameters, if any 1173 | while true; do 1174 | case $1 in 1175 | -h | --help ) echo "available option=default_value: 1176 | --build-ffmpeg-static=y (ffmpeg.exe, ffplay.exe and ffprobe.exe) 1177 | --build-ffmpeg-static=n (ffmpeg.exe, ffplay.exe, ffprobe.exe and dll-files) 1178 | --ffmpeg-git-checkout-version=[master] if you want to build a particular version of FFmpeg, ex: n3.1.1 or a specific git hash 1179 | --sandbox-ok=n [skip sandbox prompt if y] 1180 | -d [meaning \"defaults\" skip all prompts, just build ffmpeg static with some reasonable defaults like no git updates] 1181 | --cflags=[default is $original_cflags, which works on any cpu, see README for options] 1182 | --debug Make this script print out each line as it executes 1183 | "; exit 0 ;; 1184 | --sandbox-ok=* ) sandbox_ok="${1#*=}"; shift ;; 1185 | --cflags=* ) 1186 | original_cflags="${1#*=}"; echo "setting cflags as $original_cflags"; shift ;; 1187 | -d ) gcc_cpu_count=$cpu_count; sandbox_ok="y"; shift ;; 1188 | --build-ffmpeg-static=* ) build_ffmpeg_static="${1#*=}"; shift ;; 1189 | --debug ) set -x; shift ;; 1190 | -- ) shift; break ;; 1191 | -* ) echo "Error, unknown option: '$1'."; exit 1 ;; 1192 | * ) break ;; 1193 | esac 1194 | done 1195 | 1196 | reset_cflags # also overrides any "native" CFLAGS, which we may need if there are some 'linux only' settings in there 1197 | check_missing_packages # do this first since it's annoying to go through prompts then be rejected 1198 | intro # remember to always run the intro, since it adjust pwd 1199 | install_cross_compiler 1200 | 1201 | export PKG_CONFIG_LIBDIR= # disable pkg-config from finding [and using] normal linux system installed libs [yikes] 1202 | 1203 | original_path="$PATH" 1204 | echo -e "Starting 32-bit builds.\n" 1205 | host_target='i686-w64-mingw32' 1206 | mingw_w64_x86_64_prefix="$cur_dir/cross_compilers/mingw-w64-i686/$host_target" 1207 | mingw_bin_path="$cur_dir/cross_compilers/mingw-w64-i686/bin" 1208 | export PKG_CONFIG_PATH="$mingw_w64_x86_64_prefix/lib/pkgconfig" 1209 | export PATH="$mingw_bin_path:$original_path" 1210 | cross_prefix="$mingw_bin_path/i686-w64-mingw32-" 1211 | make_prefix_options="CC=${cross_prefix}gcc AR=${cross_prefix}ar PREFIX=$mingw_w64_x86_64_prefix RANLIB=${cross_prefix}ranlib LD=${cross_prefix}ld STRIP=${cross_prefix}strip CXX=${cross_prefix}g++" 1212 | mkdir -p win32 1213 | cd win32 1214 | build_dependencies 1215 | build_apps 1216 | cd .. 1217 | -------------------------------------------------------------------------------- /open_cygwin_windows_prompt.bat: -------------------------------------------------------------------------------- 1 | @setlocal 2 | @ECHO cd to 3 | @.\ffmpeg_local_builds\cygwin_local_install\bin\cygpath.exe -a ffmpeg_local_builds 4 | @echo "for the root ffmpeg build dir" 5 | @ffmpeg_local_builds\cygwin_local_install\bin\bash.exe --login -i -------------------------------------------------------------------------------- /patches/0001-make-bcrypt-optional.patch: -------------------------------------------------------------------------------- 1 | From 8835814afdf7dcc6517e48a66acfdf47f963f0cf Mon Sep 17 00:00:00 2001 2 | From: Reino17 3 | Date: Sun, 1 Sep 2024 15:51:14 +0200 4 | Subject: [PATCH 1/5] libavutil/random_seed.c: make bcrypt optional 5 | 6 | WinXP doesn't have 'bcrypt'. See https://github.com/FFmpeg/FFmpeg/commit/aedbf1640ced8fc09dc980ead2a387a59d8f7f68 and https://github.com/sherpya/mplayer-be/blob/master/patches/ff/0001-make-bcrypt-optional-on-win32.patch. 7 | --- 8 | configure | 4 +++- 9 | libavutil/random_seed.c | 18 +++++++++++++++++- 10 | 2 files changed, 20 insertions(+), 2 deletions(-) 11 | 12 | diff --git a/configure b/configure 13 | index 44cfaeb..b950024 100755 14 | --- a/configure 15 | +++ b/configure 16 | @@ -336,6 +336,7 @@ External library support: 17 | --enable-vapoursynth enable VapourSynth demuxer [no] 18 | --disable-xlib disable xlib [autodetect] 19 | --disable-zlib disable zlib [autodetect] 20 | + --disable-bcrypt disable bcrypt usage on win32, use wincrypt functions [no] 21 | 22 | The following libraries provide various hardware acceleration features: 23 | --disable-amf disable AMF video encoding code [autodetect] 24 | @@ -1855,6 +1856,7 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST=" 25 | sndio 26 | xlib 27 | zlib 28 | + bcrypt 29 | " 30 | 31 | EXTERNAL_LIBRARY_GPL_LIST=" 32 | @@ -6651,7 +6653,7 @@ for LATOMIC in "-latomic" ""; do 33 | done 34 | 35 | check_lib advapi32 "windows.h" RegCloseKey -ladvapi32 36 | -check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt && 37 | +enabled bcrypt && check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt && 38 | check_cpp_condition bcrypt bcrypt.h "defined BCRYPT_RNG_ALGORITHM" 39 | check_lib ole32 "windows.h objbase.h" CoTaskMemFree -lole32 40 | check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32 41 | diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c 42 | index 8a4e4f1..787770f 100644 43 | --- a/libavutil/random_seed.c 44 | +++ b/libavutil/random_seed.c 45 | @@ -26,9 +26,13 @@ 46 | #if HAVE_IO_H 47 | #include 48 | #endif 49 | -#if HAVE_BCRYPT 50 | +#ifdef _WIN32 51 | #include 52 | +#if HAVE_BCRYPT 53 | #include 54 | +#else 55 | +#include 56 | +#endif 57 | #endif 58 | #if CONFIG_GCRYPT 59 | #include 60 | @@ -51,6 +55,7 @@ 61 | #define TEST 0 62 | #endif 63 | 64 | +#ifndef _WIN32 65 | static int read_random(uint8_t *dst, size_t len, const char *file) 66 | { 67 | #if HAVE_UNISTD_H 68 | @@ -71,6 +76,7 @@ static int read_random(uint8_t *dst, size_t len, const char *file) 69 | return AVERROR(ENOSYS); 70 | #endif 71 | } 72 | +#endif 73 | 74 | static uint32_t get_generic_seed(void) 75 | { 76 | @@ -141,6 +147,14 @@ int av_random_bytes(uint8_t* buf, size_t len) 77 | if (BCRYPT_SUCCESS(ret)) 78 | return 0; 79 | } 80 | +#elif defined(_WIN32) 81 | + HCRYPTPROV hProvider; 82 | + if (CryptAcquireContext(&hProvider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { 83 | + BOOL ret = CryptGenRandom(hProvider, len, buf); 84 | + CryptReleaseContext(hProvider, 0); 85 | + if (ret) 86 | + return 0; 87 | + } 88 | #endif 89 | 90 | #if HAVE_ARC4RANDOM_BUF 91 | @@ -148,9 +162,11 @@ int av_random_bytes(uint8_t* buf, size_t len) 92 | return 0; 93 | #endif 94 | 95 | +#ifndef _WIN32 96 | err = read_random(buf, len, "/dev/urandom"); 97 | if (!err) 98 | return err; 99 | +#endif 100 | 101 | #if CONFIG_GCRYPT 102 | gcry_randomize(buf, len, GCRY_VERY_STRONG_RANDOM); 103 | -- 104 | 2.8.3 105 | 106 | -------------------------------------------------------------------------------- /patches/0001-make-bcrypt-optional_ffmpeg6.2.patch: -------------------------------------------------------------------------------- 1 | From d68e88b5b0d63997a3e0fcc99f53a602c1569eb1 Mon Sep 17 00:00:00 2001 2 | From: Reino17 3 | Date: Sun, 31 Dec 2023 19:54:06 +0100 4 | Subject: [PATCH 1/3] libavutil/random_seed.c: make bcrypt optional 5 | 6 | WinXP doesn't have 'bcrypt'. See https://github.com/FFmpeg/FFmpeg/commit/aedbf1640ced8fc09dc980ead2a387a59d8f7f68 and https://github.com/sherpya/mplayer-be/blob/master/patches/ff/0001-make-bcrypt-optional-on-win32.patch. 7 | --- 8 | configure | 4 +++- 9 | libavutil/random_seed.c | 18 +++++++++++++++++- 10 | 2 files changed, 20 insertions(+), 2 deletions(-) 11 | 12 | diff --git a/configure b/configure 13 | index cd66e42..a9dbe95 100755 14 | --- a/configure 15 | +++ b/configure 16 | @@ -328,6 +328,7 @@ External library support: 17 | --enable-vapoursynth enable VapourSynth demuxer [no] 18 | --disable-xlib disable xlib [autodetect] 19 | --disable-zlib disable zlib [autodetect] 20 | + --disable-bcrypt disable bcrypt usage on win32, use wincrypt functions [no] 21 | 22 | The following libraries provide various hardware acceleration features: 23 | --disable-amf disable AMF video encoding code [autodetect] 24 | @@ -1797,6 +1798,7 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST=" 25 | sndio 26 | xlib 27 | zlib 28 | + bcrypt 29 | " 30 | 31 | EXTERNAL_LIBRARY_GPL_LIST=" 32 | @@ -6540,7 +6542,7 @@ for LATOMIC in "-latomic" ""; do 33 | done 34 | 35 | check_lib advapi32 "windows.h" RegCloseKey -ladvapi32 36 | -check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt && 37 | +enabled bcrypt && check_lib bcrypt "windows.h bcrypt.h" BCryptGenRandom -lbcrypt && 38 | check_cpp_condition bcrypt bcrypt.h "defined BCRYPT_RNG_ALGORITHM" 39 | check_lib ole32 "windows.h objbase.h" CoTaskMemFree -lole32 40 | check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32 41 | diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c 42 | index 6d399ce..a3ee536 100644 43 | --- a/libavutil/random_seed.c 44 | +++ b/libavutil/random_seed.c 45 | @@ -26,9 +26,13 @@ 46 | #if HAVE_IO_H 47 | #include 48 | #endif 49 | -#if HAVE_BCRYPT 50 | +#ifdef _WIN32 51 | #include 52 | +#if HAVE_BCRYPT 53 | #include 54 | +#else 55 | +#include 56 | +#endif 57 | #endif 58 | #if CONFIG_GCRYPT 59 | #include 60 | @@ -51,6 +55,7 @@ 61 | #define TEST 0 62 | #endif 63 | 64 | +#ifndef _WIN32 65 | static int read_random(uint8_t *dst, size_t len, const char *file) 66 | { 67 | #if HAVE_UNISTD_H 68 | @@ -71,6 +76,7 @@ static int read_random(uint8_t *dst, size_t len, const char *file) 69 | return AVERROR(ENOSYS); 70 | #endif 71 | } 72 | +#endif 73 | 74 | static uint32_t get_generic_seed(void) 75 | { 76 | @@ -141,6 +147,14 @@ int av_random_bytes(uint8_t* buf, size_t len) 77 | if (BCRYPT_SUCCESS(ret)) 78 | return 0; 79 | } 80 | +#elif defined(_WIN32) 81 | + HCRYPTPROV hProvider; 82 | + if (CryptAcquireContext(&hProvider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { 83 | + BOOL ret = CryptGenRandom(hProvider, len, buf); 84 | + CryptReleaseContext(hProvider, 0); 85 | + if (ret) 86 | + return 0; 87 | + } 88 | #endif 89 | 90 | #if HAVE_ARC4RANDOM_BUF 91 | @@ -148,9 +162,11 @@ int av_random_bytes(uint8_t* buf, size_t len) 92 | return 0; 93 | #endif 94 | 95 | +#ifndef _WIN32 96 | err = read_random(buf, len, "/dev/urandom"); 97 | if (!err) 98 | return err; 99 | +#endif 100 | 101 | #if CONFIG_GCRYPT 102 | gcry_randomize(buf, len, GCRY_VERY_STRONG_RANDOM); 103 | -- 104 | 2.8.3 105 | 106 | -------------------------------------------------------------------------------- /patches/0002-windows-xp-compatible-CancelIoEx.patch: -------------------------------------------------------------------------------- 1 | From 9badf2971b009331bcda5a0fc43d97368a95a7f3 Mon Sep 17 00:00:00 2001 2 | From: Reino17 3 | Date: Sun, 1 Sep 2024 15:51:41 +0200 4 | Subject: [PATCH 2/5] avformat/udp: windows xp compatible CancelIoEx() 5 | 6 | Otherwise you'd get "The procedure entry point CancelIoEx could not be located in the dynamic link library KERNEL32.dll" while running ffmpeg.exe, ffplay.exe, or ffprobe.exe, because 'CancelIoEx()' is only available on Windows Vista and later. See https://github.com/FFmpeg/FFmpeg/commit/53aa76686e7ff4f1f6625502503d7923cec8c10e, https://trac.ffmpeg.org/ticket/5717 and https://github.com/sherpya/mplayer-be/blob/master/patches/ff/0002-windows-xp-compatible-CancelIoEx.patch. 7 | --- 8 | libavformat/udp.c | 10 +++++++++- 9 | 1 file changed, 9 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/libavformat/udp.c b/libavformat/udp.c 12 | index c1ebdd1..3c76f5e 100644 13 | --- a/libavformat/udp.c 14 | +++ b/libavformat/udp.c 15 | @@ -1101,6 +1101,14 @@ static int udp_write(URLContext *h, const uint8_t *buf, int size) 16 | return ret < 0 ? ff_neterrno() : ret; 17 | } 18 | 19 | +#ifdef _WIN32 20 | +void CALLBACK pthread_cancel_winsock(ULONG_PTR fd); 21 | +void CALLBACK pthread_cancel_winsock(ULONG_PTR fd) 22 | +{ 23 | + CancelIo((HANDLE) fd); 24 | +} 25 | +#endif 26 | + 27 | static int udp_close(URLContext *h) 28 | { 29 | UDPContext *s = h->priv_data; 30 | @@ -1128,7 +1136,7 @@ static int udp_close(URLContext *h) 31 | * the socket and abort pending IO, subsequent recvfrom() calls 32 | * will fail with WSAESHUTDOWN causing the thread to exit. */ 33 | shutdown(s->udp_fd, SD_RECEIVE); 34 | - CancelIoEx((HANDLE)(SOCKET)s->udp_fd, NULL); 35 | + QueueUserAPC(pthread_cancel_winsock, pthread_getw32threadhandle_np(s->circular_buffer_thread), s->udp_fd); 36 | #else 37 | pthread_cancel(s->circular_buffer_thread); 38 | #endif 39 | -- 40 | 2.8.3 41 | 42 | -------------------------------------------------------------------------------- /patches/0003-windows-xp-compatible-wcscp.patch: -------------------------------------------------------------------------------- 1 | From 94a527b2d91b1182a992c15f375078e4d9d766e9 Mon Sep 17 00:00:00 2001 2 | From: Reino17 3 | Date: Sun, 1 Sep 2024 15:52:12 +0200 4 | Subject: [PATCH 3/5] libavdevice/dshow_filter: windows xp compatible wcscpy() 5 | 6 | Otherwise you'd get "The procedure entry point wcscpy_s could not be located in the dynamic link library msvcrt.dll" while running ffmpeg.exe, ffplay.exe, or ffprobe.exe, because 'wcscpy()' is only available on Windows Vista and later. See https://github.com/FFmpeg/FFmpeg/commit/daf61dddc8e27424c320d5c3abe3e0c5182cd5c0. 7 | --- 8 | libavdevice/dshow_filter.c | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/libavdevice/dshow_filter.c b/libavdevice/dshow_filter.c 12 | index 2122c84..4642ac0 100644 13 | --- a/libavdevice/dshow_filter.c 14 | +++ b/libavdevice/dshow_filter.c 15 | @@ -135,7 +135,7 @@ long WINAPI ff_dshow_filter_JoinFilterGraph(DShowFilter *this, IFilterGraph *gra 16 | 17 | this->info.pGraph = graph; 18 | if (name) 19 | - wcscpy_s(this->info.achName, sizeof(this->info.achName) / sizeof(wchar_t), name); 20 | + wcscpy(this->info.achName, name); 21 | 22 | return S_OK; 23 | } 24 | -- 25 | 2.8.3 26 | 27 | -------------------------------------------------------------------------------- /patches/0004-load-shared-libfdk-aac-library-dynamically.patch: -------------------------------------------------------------------------------- 1 | From 7e4452efdc36fb17cbc0731cb06789f3a4833ad2 Mon Sep 17 00:00:00 2001 2 | From: Reino17 3 | Date: Sun, 1 Sep 2024 15:52:43 +0200 4 | Subject: [PATCH 4/5] libavcodec/libfdk-aac*: load shared libfdk-aac library dynamically 5 | 6 | See https://github.com/sherpya/mplayer-be/blob/master/patches/ff/0004-dynamic-loading-of-shared-fdk-aac-library.patch. 7 | --- 8 | configure | 6 +-- 9 | libavcodec/libfdk-aac_internal.h | 84 ++++++++++++++++++++++++++++++++++++++++ 10 | libavcodec/libfdk-aacdec.c | 32 +++++++++++++-- 11 | libavcodec/libfdk-aacenc.c | 36 ++++++++++++++++- 12 | 4 files changed, 149 insertions(+), 9 deletions(-) 13 | create mode 100644 libavcodec/libfdk-aac_internal.h 14 | 15 | diff --git a/configure b/configure 16 | index b950024..d999570 100755 17 | --- a/configure 18 | +++ b/configure 19 | @@ -1877,7 +1877,6 @@ EXTERNAL_LIBRARY_GPL_LIST=" 20 | 21 | EXTERNAL_LIBRARY_NONFREE_LIST=" 22 | decklink 23 | - libfdk_aac 24 | libtls 25 | " 26 | 27 | @@ -1917,6 +1916,7 @@ EXTERNAL_LIBRARY_LIST=" 28 | libcodec2 29 | libdav1d 30 | libdc1394 31 | + libfdk_aac 32 | libflite 33 | libfontconfig 34 | libfreetype 35 | @@ -6874,9 +6874,7 @@ enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1 36 | enabled libdrm && check_pkg_config libdrm libdrm xf86drm.h drmGetVersion 37 | enabled libdvdnav && require_pkg_config libdvdnav "dvdnav >= 6.1.1" dvdnav/dvdnav.h dvdnav_open2 38 | enabled libdvdread && require_pkg_config libdvdread "dvdread >= 6.1.2" dvdread/dvd_reader.h DVDOpen2 39 | -enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen || 40 | - { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac && 41 | - warn "using libfdk without pkg-config"; } } 42 | +enabled libfdk_aac && require_headers fdk-aac/aacenc_lib.h 43 | flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite" 44 | enabled libflite && require libflite "flite/flite.h" flite_init $flite_extralibs 45 | enabled fontconfig && enable libfontconfig 46 | diff --git a/libavcodec/libfdk-aac_internal.h b/libavcodec/libfdk-aac_internal.h 47 | new file mode 100644 48 | index 0000000..cd1e6e3 49 | --- /dev/null 50 | +++ b/libavcodec/libfdk-aac_internal.h 51 | @@ -0,0 +1,84 @@ 52 | +/* 53 | + * Copyright (c) 2018 Gianluigi Tiesi 54 | + * 55 | + * This file is part of FFmpeg. 56 | + * 57 | + * FFmpeg is free software; you can redistribute it and/or 58 | + * modify it under the terms of the GNU Lesser General Public 59 | + * License as published by the Free Software Foundation; either 60 | + * version 2.1 of the License, or (at your option) any later version. 61 | + * 62 | + * FFmpeg is distributed in the hope that it will be useful, 63 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of 64 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 65 | + * Lesser General Public License for more details. 66 | + * 67 | + * You should have received a copy of the GNU Lesser General Public 68 | + * License along with FFmpeg; if not, write to the Free Software 69 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 70 | + */ 71 | + 72 | +#ifndef AVCODEC_LIBFDK_AAC_INTERNAL_H 73 | +#define AVCODEC_LIBFDK_AAC_INTERNAL_H 74 | + 75 | +#ifdef _WIN32 76 | +#include 77 | +#define LIBNAME "libfdk-aac-2.dll" 78 | +#define dlopen(fname, f) ((void *) LoadLibraryA(fname)) 79 | +#define dlclose(handle) FreeLibrary((HMODULE) handle) 80 | +#define dlsym(handle, name) GetProcAddress((HMODULE) handle, name) 81 | +#else 82 | +#include 83 | +#define LIBNAME "libfdk-aac.so.2" 84 | +#endif 85 | + 86 | +#define DLSYM(x) \ 87 | + do \ 88 | + { \ 89 | + s->pfn.x = ( imp_##x ) dlsym(s->hLib, AV_STRINGIFY(x)); \ 90 | + if (!s->pfn.x ) \ 91 | + { \ 92 | + av_log(avctx, AV_LOG_ERROR, "Unable to find symbol " AV_STRINGIFY(x) " in dynamic " LIBNAME "\n"); \ 93 | + return -1; \ 94 | + } \ 95 | + } while (0) 96 | + 97 | + 98 | +#include 99 | +#include 100 | + 101 | +typedef AACENC_ERROR (*imp_aacEncOpen)(HANDLE_AACENCODER *phAacEncoder, const UINT encModules, const UINT maxChannels); 102 | +typedef AACENC_ERROR (*imp_aacEncClose)(HANDLE_AACENCODER *phAacEncoder); 103 | +typedef AACENC_ERROR (*imp_aacEncEncode)(const HANDLE_AACENCODER hAacEncoder, const AACENC_BufDesc *inBufDesc, const AACENC_BufDesc *outBufDesc, const AACENC_InArgs *inargs, AACENC_OutArgs *outargs); 104 | +typedef AACENC_ERROR (*imp_aacEncInfo)(const HANDLE_AACENCODER hAacEncoder, AACENC_InfoStruct *pInfo); 105 | +typedef AACENC_ERROR (*imp_aacEncoder_SetParam)(const HANDLE_AACENCODER hAacEncoder, const AACENC_PARAM param, const UINT value); 106 | + 107 | +typedef struct _aacEncLib { 108 | + imp_aacEncOpen aacEncOpen; 109 | + imp_aacEncClose aacEncClose; 110 | + imp_aacEncEncode aacEncEncode; 111 | + imp_aacEncInfo aacEncInfo; 112 | + imp_aacEncoder_SetParam aacEncoder_SetParam; 113 | +} aacEncLib; 114 | + 115 | +typedef LINKSPEC_H HANDLE_AACDECODER (*imp_aacDecoder_Open)(TRANSPORT_TYPE transportFmt, UINT nrOfLayers); 116 | +typedef LINKSPEC_H void (*imp_aacDecoder_Close)(HANDLE_AACDECODER self); 117 | +typedef LINKSPEC_H AAC_DECODER_ERROR (*imp_aacDecoder_Fill)(HANDLE_AACDECODER self, UCHAR *pBuffer[], const UINT bufferSize[], UINT *bytesValid); 118 | +typedef LINKSPEC_H AAC_DECODER_ERROR (*imp_aacDecoder_DecodeFrame)(HANDLE_AACDECODER self, INT_PCM *pTimeData, const INT timeDataSize, const UINT flags); 119 | +typedef LINKSPEC_H CStreamInfo* (*imp_aacDecoder_GetStreamInfo)(HANDLE_AACDECODER self); 120 | +typedef LINKSPEC_H AAC_DECODER_ERROR (*imp_aacDecoder_ConfigRaw)(HANDLE_AACDECODER self, UCHAR *conf[], const UINT length[]); 121 | +typedef LINKSPEC_H AAC_DECODER_ERROR (*imp_aacDecoder_SetParam)(const HANDLE_AACDECODER self, const AACDEC_PARAM param, const INT value); 122 | +typedef LINKSPEC_H AAC_DECODER_ERROR (*imp_aacDecoder_AncDataInit)(HANDLE_AACDECODER self, UCHAR *buffer, int size); 123 | + 124 | +typedef struct _aacDecLib { 125 | + imp_aacDecoder_Open aacDecoder_Open; 126 | + imp_aacDecoder_Close aacDecoder_Close; 127 | + imp_aacDecoder_Fill aacDecoder_Fill; 128 | + imp_aacDecoder_DecodeFrame aacDecoder_DecodeFrame; 129 | + imp_aacDecoder_ConfigRaw aacDecoder_ConfigRaw; 130 | + imp_aacDecoder_GetStreamInfo aacDecoder_GetStreamInfo; 131 | + imp_aacDecoder_SetParam aacDecoder_SetParam; 132 | + imp_aacDecoder_AncDataInit aacDecoder_AncDataInit; 133 | +} aacDecLib; 134 | + 135 | +#endif /* AVCODEC_LIBFDK_AAC_INTERNAL_H */ 136 | diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c 137 | index 1324377..c134d32 100644 138 | --- a/libavcodec/libfdk-aacdec.c 139 | +++ b/libavcodec/libfdk-aacdec.c 140 | @@ -26,6 +26,7 @@ 141 | #include "avcodec.h" 142 | #include "codec_internal.h" 143 | #include "decode.h" 144 | +#include "libfdk-aac_internal.h" 145 | 146 | #ifdef AACDECODER_LIB_VL0 147 | #define FDKDEC_VER_AT_LEAST(vl0, vl1) \ 148 | @@ -49,6 +50,8 @@ enum ConcealMethod { 149 | typedef struct FDKAACDecContext { 150 | const AVClass *class; 151 | HANDLE_AACDECODER handle; 152 | + void *hLib; 153 | + aacDecLib pfn; 154 | uint8_t *decoder_buffer; 155 | int decoder_buffer_size; 156 | uint8_t *anc_buffer; 157 | @@ -114,7 +117,7 @@ static const AVClass fdk_aac_dec_class = { 158 | static int get_stream_info(AVCodecContext *avctx) 159 | { 160 | FDKAACDecContext *s = avctx->priv_data; 161 | - CStreamInfo *info = aacDecoder_GetStreamInfo(s->handle); 162 | + CStreamInfo *info = s->pfn.aacDecoder_GetStreamInfo(s->handle); 163 | int channel_counts[0x24] = { 0 }; 164 | int i, ch_error = 0; 165 | uint64_t ch_layout = 0; 166 | @@ -232,8 +235,10 @@ static av_cold int fdk_aac_decode_close(AVCodecContext *avctx) 167 | { 168 | FDKAACDecContext *s = avctx->priv_data; 169 | 170 | - if (s->handle) 171 | - aacDecoder_Close(s->handle); 172 | + if (s->hLib && s->handle) { 173 | + s->pfn.aacDecoder_Close(s->handle); 174 | + dlclose(s->hLib); 175 | + } 176 | av_freep(&s->decoder_buffer); 177 | av_freep(&s->anc_buffer); 178 | 179 | @@ -245,6 +250,27 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx) 180 | FDKAACDecContext *s = avctx->priv_data; 181 | AAC_DECODER_ERROR err; 182 | 183 | + if (!(s->hLib = dlopen(LIBNAME, RTLD_NOW))) { 184 | + av_log(avctx, AV_LOG_ERROR, "Unable to load " LIBNAME "\n"); 185 | + return -1; 186 | + } 187 | + 188 | + DLSYM(aacDecoder_Open); 189 | +#define aacDecoder_Open s->pfn.aacDecoder_Open 190 | + DLSYM(aacDecoder_Close); 191 | + DLSYM(aacDecoder_Fill); 192 | +#define aacDecoder_Fill s->pfn.aacDecoder_Fill 193 | + DLSYM(aacDecoder_DecodeFrame); 194 | +#define aacDecoder_DecodeFrame s->pfn.aacDecoder_DecodeFrame 195 | + DLSYM(aacDecoder_GetStreamInfo); 196 | +#define aacDecoder_GetStreamInfo s->pfn.aacDecoder_GetStreamInfo 197 | + DLSYM(aacDecoder_ConfigRaw); 198 | +#define aacDecoder_ConfigRaw s->pfn.aacDecoder_ConfigRaw 199 | + DLSYM(aacDecoder_SetParam); 200 | +#define aacDecoder_SetParam s->pfn.aacDecoder_SetParam 201 | + DLSYM(aacDecoder_AncDataInit); 202 | +#define aacDecoder_AncDataInit s->pfn.aacDecoder_AncDataInit 203 | + 204 | s->handle = aacDecoder_Open(avctx->extradata_size ? TT_MP4_RAW : TT_MP4_ADTS, 1); 205 | if (!s->handle) { 206 | av_log(avctx, AV_LOG_ERROR, "Error opening decoder\n"); 207 | diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c 208 | index 0f33cdb..78cc39b 100644 209 | --- a/libavcodec/libfdk-aacenc.c 210 | +++ b/libavcodec/libfdk-aacenc.c 211 | @@ -29,6 +29,7 @@ 212 | #include "codec_internal.h" 213 | #include "encode.h" 214 | #include "profiles.h" 215 | +#include "libfdk-aac_internal.h" 216 | 217 | #ifdef AACENCODER_LIB_VL0 218 | #define FDKENC_VER_AT_LEAST(vl0, vl1) \ 219 | @@ -58,6 +59,8 @@ typedef struct AACContext { 220 | int delay_sent; 221 | int frame_length; 222 | 223 | + void *hLib; 224 | + aacEncLib pfn; 225 | AudioFrameQueue afq; 226 | } AACContext; 227 | 228 | @@ -124,12 +127,37 @@ static const char *aac_get_error(AACENC_ERROR err) 229 | } 230 | } 231 | 232 | +static int aac_encode_dlsym(AVCodecContext *avctx) 233 | +{ 234 | + AACContext *s = avctx->priv_data; 235 | + if (!(s->hLib = dlopen(LIBNAME, RTLD_NOW))) { 236 | + av_log(avctx, AV_LOG_ERROR, "Unable to load " LIBNAME "\n"); 237 | + return -1; 238 | + } 239 | + 240 | + DLSYM(aacEncOpen); 241 | + DLSYM(aacEncClose); 242 | + DLSYM(aacEncEncode); 243 | + DLSYM(aacEncInfo); 244 | + DLSYM(aacEncoder_SetParam); 245 | + 246 | + return 0; 247 | +} 248 | + 249 | +#define aacEncOpen s->pfn.aacEncOpen 250 | +#define aacEncEncode s->pfn.aacEncEncode 251 | +#define aacEncInfo s->pfn.aacEncInfo 252 | +#define aacEncoder_SetParam s->pfn.aacEncoder_SetParam 253 | + 254 | static int aac_encode_close(AVCodecContext *avctx) 255 | { 256 | AACContext *s = avctx->priv_data; 257 | 258 | - if (s->handle) 259 | - aacEncClose(&s->handle); 260 | + if (s->hLib) { 261 | + if (s->handle) 262 | + s->pfn.aacEncClose(&s->handle); 263 | + dlclose(s->hLib); 264 | + } 265 | ff_af_queue_close(&s->afq); 266 | 267 | return 0; 268 | @@ -183,6 +211,10 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) 269 | int aot = AV_PROFILE_AAC_LOW + 1; 270 | int sce = 0, cpe = 0; 271 | 272 | + if ((err = aac_encode_dlsym(avctx))) { 273 | + goto error; 274 | + } 275 | + 276 | if ((err = aacEncOpen(&s->handle, 0, avctx->ch_layout.nb_channels)) != AACENC_OK) { 277 | av_log(avctx, AV_LOG_ERROR, "Unable to open the encoder: %s\n", 278 | aac_get_error(err)); 279 | -- 280 | 2.8.3 281 | 282 | -------------------------------------------------------------------------------- /patches/0005-load-shared-frei0r-libraries-dynamically.patch: -------------------------------------------------------------------------------- 1 | From af9bf5a2950eed7b8c93368bfea5dd578ec7703e Mon Sep 17 00:00:00 2001 2 | From: Reino17 3 | Date: Sun, 1 Sep 2024 15:54:08 +0200 4 | Subject: [PATCH 5/5] libavfilter/vf_frei0r.c: load shared frei0r libraries dynamically 5 | 6 | See https://github.com/sherpya/mplayer-be/blob/master/patches/ff/0005-avfilters-better-behavior-of-frei0r-on-win32.patch. 7 | --- 8 | libavfilter/vf_frei0r.c | 22 ++++++++++++++++++++++ 9 | 1 file changed, 22 insertions(+) 10 | 11 | diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c 12 | index 83ca9c9..4d11ca3 100644 13 | --- a/libavfilter/vf_frei0r.c 14 | +++ b/libavfilter/vf_frei0r.c 15 | @@ -43,6 +43,10 @@ 16 | #include "formats.h" 17 | #include "video.h" 18 | 19 | +#ifdef _WIN32 20 | +#include 21 | +#endif 22 | + 23 | typedef f0r_instance_t (*f0r_construct_f)(unsigned int width, unsigned int height); 24 | typedef void (*f0r_destruct_f)(f0r_instance_t instance); 25 | typedef void (*f0r_deinit_f)(void); 26 | @@ -191,6 +195,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx, 27 | f0r_plugin_info_t *pi; 28 | char *path; 29 | int ret = 0; 30 | +#ifndef _WIN32 31 | int i; 32 | static const char* const frei0r_pathlist[] = { 33 | "/usr/local/lib/frei0r-1/", 34 | @@ -198,6 +203,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx, 35 | "/usr/local/lib64/frei0r-1/", 36 | "/usr/lib64/frei0r-1/" 37 | }; 38 | +#endif 39 | 40 | if (!dl_name) { 41 | av_log(ctx, AV_LOG_ERROR, "No filter name provided.\n"); 42 | @@ -246,11 +252,27 @@ static av_cold int frei0r_init(AVFilterContext *ctx, 43 | if (ret < 0) 44 | return ret; 45 | } 46 | +#ifdef _WIN32 47 | + if (!s->dl_handle) { 48 | + char *ls, prefix[MAX_PATH + 1]; 49 | + if (!GetModuleFileNameA(NULL, prefix, MAX_PATH)) 50 | + return AVERROR(EINVAL); 51 | + prefix[MAX_PATH] = 0; 52 | + if (!(ls = strrchr(prefix, '\\'))) 53 | + return AVERROR(EINVAL); 54 | + *ls = 0; 55 | + strncat(prefix, "\\frei0r-1\\", sizeof(prefix) - 1 - strlen(prefix)); 56 | + ret = load_path(ctx, &s->dl_handle, prefix, dl_name); 57 | + if (ret < 0) 58 | + return ret; 59 | + } 60 | +#else 61 | for (i = 0; !s->dl_handle && i < FF_ARRAY_ELEMS(frei0r_pathlist); i++) { 62 | ret = load_path(ctx, &s->dl_handle, frei0r_pathlist[i], dl_name); 63 | if (ret < 0) 64 | return ret; 65 | } 66 | +#endif 67 | if (!s->dl_handle) { 68 | av_log(ctx, AV_LOG_ERROR, "Could not find module '%s'.\n", dl_name); 69 | return AVERROR(EINVAL); 70 | -- 71 | 2.8.3 72 | 73 | -------------------------------------------------------------------------------- /patches/bzip2_CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(bzip2) 2 | cmake_minimum_required(VERSION 3.0) 3 | 4 | set(bzip2_SRCS blocksort.c 5 | huffman.c 6 | crctable.c 7 | randtable.c 8 | compress.c 9 | decompress.c 10 | bzlib.c) 11 | 12 | add_definitions(-D_FILE_OFFSET_BITS=64) 13 | 14 | set(EXPORTED_HEADERS bzlib.h) 15 | add_library(bz2 STATIC ${bzip2_SRCS}) 16 | 17 | install(TARGETS bz2 ARCHIVE DESTINATION lib${LIB_SUFFIX}) 18 | install(FILES ${EXPORTED_HEADERS} DESTINATION include) 19 | -------------------------------------------------------------------------------- /patches/ffms2_configure-fix-various.patch: -------------------------------------------------------------------------------- 1 | diff --git a/configure b/configure 2 | index fc8f000..b004a71 100755 3 | --- a/configure 4 | +++ b/configure 5 | @@ -33,7 +33,7 @@ fi 6 | 7 | # [cc/cxx]_check will fail on non-windows because of wmain/municode 8 | # unless we check for mingw first 9 | -if [[ "$1" =~ "--cross-prefix=*-w64-mingw32-" ]]; then 10 | +if [ "${1##*-}" = "mingw32" ]; then 11 | mingw_build="yes" 12 | else 13 | mingw_build="no" 14 | @@ -288,7 +288,7 @@ RC="" 15 | if [ -z "$host" -a -z "$cross_prefix" ]; then 16 | host=`./config.guess` 17 | else 18 | - host="${cross_prefix%%-}" 19 | + host="${host##*-}" 20 | fi 21 | # normalize a triplet into a quadruplet 22 | host=`./config.sub $host` 23 | @@ -384,19 +384,19 @@ else 24 | fi 25 | 26 | #find ffmpeg 27 | -if ${cross_prefix}pkg-config --exists libavformat libavcodec libswscale libavutil 2>$DEVNULL; then 28 | - FFMPEG_LIBS="$FFMPEG_LIBS $(${cross_prefix}pkg-config --libs libavformat libavcodec libswscale libavutil)" 29 | - FFMPEG_CFLAGS="$FFMPEG_CFLAGS $(${cross_prefix}pkg-config --cflags libavformat libavcodec libswscale libavutil)" 30 | +if pkg-config --exists libavformat libavcodec libswscale libavutil 2>$DEVNULL; then 31 | + FFMPEG_LIBS="$FFMPEG_LIBS $(pkg-config --libs libavformat libavcodec libswscale libavutil)" 32 | + FFMPEG_CFLAGS="$FFMPEG_CFLAGS $(pkg-config --cflags libavformat libavcodec libswscale libavutil)" 33 | fi 34 | 35 | #check for the presence of swresample and avresample, prefer swresample if present 36 | -if ${cross_prefix}pkg-config --exists libswresample 2>$DEVNULL; then 37 | - FFMPEG_LIBS="$FFMPEG_LIBS $(${cross_prefix}pkg-config --libs libswresample)" 38 | - FFMPEG_CFLAGS="$FFMPEG_CFLAGS $(${cross_prefix}pkg-config --cflags libswresample) -DWITH_SWRESAMPLE" 39 | +if pkg-config --exists libswresample 2>$DEVNULL; then 40 | + FFMPEG_LIBS="$FFMPEG_LIBS $(pkg-config --libs libswresample)" 41 | + FFMPEG_CFLAGS="$FFMPEG_CFLAGS $(pkg-config --cflags libswresample) -DWITH_SWRESAMPLE" 42 | RESAMPLE_LIB="swresample" 43 | -elif ${cross_prefix}pkg-config --exists libavresample 2>$DEVNULL; then 44 | - FFMPEG_LIBS="$FFMPEG_LIBS $(${cross_prefix}pkg-config --libs libavresample)" 45 | - FFMPEG_CFLAGS="$FFMPEG_CFLAGS $(${cross_prefix}pkg-config --cflags libavresample)" 46 | +elif pkg-config --exists libavresample 2>$DEVNULL; then 47 | + FFMPEG_LIBS="$FFMPEG_LIBS $(pkg-config --libs libavresample)" 48 | + FFMPEG_CFLAGS="$FFMPEG_CFLAGS $(pkg-config --cflags libavresample)" 49 | RESAMPLE_LIB="avresample" 50 | fi 51 | 52 | @@ -489,12 +489,11 @@ if [ "$debug" = "yes" ]; then 53 | test "x$?" != "x0" && pkg_failed=yes 54 | fi 55 | 56 | -if [ "$optlevel" != "no" -a "$olev" = "0" ] ; then 57 | - CFLAGS="$CFLAGS" 58 | - CXXFLAGS="$CXXFLAGS" 59 | -else 60 | +if [[ $CFLAGS != *-O* && $olev != 0 ]] ; then 61 | CFLAGS="-O$olev $CFLAGS" 62 | CXXFLAGS="-O$olev $CXXFLAGS" 63 | +else 64 | + olev=$(head -c1 <<< ${CFLAGS/*-O}) 65 | fi 66 | 67 | 68 | -------------------------------------------------------------------------------- /patches/libaom_restore-winxp-compatibility_use-pthreads.patch: -------------------------------------------------------------------------------- 1 | diff --git a/aom_ports/aom_once.h b/aom_ports/aom_once.h 2 | index 680120f..4cc2be7 100644 3 | --- a/aom_ports/aom_once.h 4 | +++ b/aom_ports/aom_once.h 5 | @@ -38,7 +38,14 @@ 6 | * by the call to foo(). 7 | */ 8 | 9 | -#if CONFIG_MULTITHREAD && defined(_WIN32) 10 | +#if CONFIG_MULTITHREAD && HAVE_PTHREAD_H 11 | +#include 12 | +static void aom_once(void (*func)(void)) { 13 | + static pthread_once_t lock = PTHREAD_ONCE_INIT; 14 | + pthread_once(&lock, func); 15 | +} 16 | + 17 | +#elif CONFIG_MULTITHREAD && defined(_WIN32) 18 | #undef WIN32_LEAN_AND_MEAN 19 | #define WIN32_LEAN_AND_MEAN 20 | #include 21 | @@ -60,13 +67,6 @@ static void aom_once(void (*func)(void)) { 22 | InitOnceComplete(&aom_init_once, 0, NULL); 23 | } 24 | 25 | -#elif CONFIG_MULTITHREAD && HAVE_PTHREAD_H 26 | -#include 27 | -static void aom_once(void (*func)(void)) { 28 | - static pthread_once_t lock = PTHREAD_ONCE_INIT; 29 | - pthread_once(&lock, func); 30 | -} 31 | - 32 | #else 33 | /* Default version that performs no synchronization. */ 34 | 35 | diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake 36 | index ac3e132..01fff98 100644 37 | --- a/build/cmake/aom_configure.cmake 38 | +++ b/build/cmake/aom_configure.cmake 39 | @@ -240,7 +240,7 @@ endif() 40 | if(AOM_TARGET_SYSTEM STREQUAL "Windows") 41 | # The default _WIN32_WINNT value in MinGW is 0x0502 (Windows XP with SP2). Set 42 | # it to 0x0601 (Windows 7). 43 | - add_compiler_flag_if_supported("-D_WIN32_WINNT=0x0601") 44 | + #add_compiler_flag_if_supported("-D_WIN32_WINNT=0x0601") 45 | # Quiet warnings related to fopen, printf, etc. 46 | add_compiler_flag_if_supported("-D_CRT_SECURE_NO_WARNINGS") 47 | endif() 48 | -------------------------------------------------------------------------------- /patches/libflite-2.1.0_mingw-w64-fixes.diff: -------------------------------------------------------------------------------- 1 | --- configure.bak 2017-10-21 16:01:07.000000000 +0200 2 | +++ configure 2020-08-29 00:02:33.187500000 +0200 3 | @@ -4081,7 +4081,7 @@ 4 | # http://www.mingw.org 5 | shared=false 6 | CFLAGS="$CFLAGS -DCST_NO_SOCKETS -DUNDER_WINDOWS -DWIN32 -shared" 7 | - MINGWPREF="i386-mingw32-" 8 | + MINGWPREF="${host_alias}-" 9 | CC="${MINGWPREF}gcc" 10 | RANLIB="${MINGWPREF}ranlib" 11 | AR="${MINGWPREF}ar" 12 | --- main/Makefile.bak 2017-10-21 16:01:07.000000000 +0200 13 | +++ main/Makefile 2020-08-29 00:30:25.812500000 +0200 14 | @@ -132,13 +132,6 @@ 15 | $(CC) $(CFLAGS) -o $@ flite_main.o flite_voice_list.o flite_lang_list.o $(flite_LIBS_flags) $(LDFLAGS) 16 | 17 | install: 18 | -# The basic binaries 19 | - @ $(INSTALL) -m 755 $(BINDIR)/flite $(DESTDIR)$(INSTALLBINDIR) 20 | - @ for i in $(VOICES) ; \ 21 | - do \ 22 | - $(INSTALL) $(BINDIR)/flite_$$i $(DESTDIR)$(INSTALLBINDIR); \ 23 | - done 24 | - $(INSTALL) -m 755 $(BINDIR)/flite_time $(DESTDIR)$(INSTALLBINDIR) 25 | # The libraries: static and shared (if built) 26 | cp -pd $(flite_LIBS_deps) $(DESTDIR)$(INSTALLLIBDIR) 27 | ifdef SHFLAGS 28 | --- include/cst_file.h.bak 2017-10-21 16:01:07.000000000 +0200 29 | +++ include/cst_file.h 2020-08-29 00:06:35.390625000 +0200 30 | @@ -99,6 +99,8 @@ 31 | int cst_fprintf(cst_file fh, const char *fmt, ...); 32 | int cst_sprintf(char *s, const char *fmt, ...); 33 | #ifdef _WIN32 34 | +#include 35 | +#ifndef __MINGW64_VERSION_MAJOR 36 | #define snprintf c99_snprintf 37 | 38 | __inline int c99_vsnprintf(char* str, size_t size, const char* format, 39 | @@ -121,6 +123,7 @@ 40 | return count; 41 | } 42 | #endif 43 | +#endif 44 | #define cst_snprintf snprintf 45 | 46 | #if defined(__palmos__) 47 | --- lang/cmu_indic_lang/cmu_indic_lang.h.bak 2017-10-21 16:01:07.000000000 +0200 48 | +++ lang/cmu_indic_lang/cmu_indic_lang.h 2020-08-29 00:08:14.812500000 +0200 49 | @@ -57,5 +57,11 @@ 50 | } /* extern "C" */ 51 | #endif /* __cplusplus */ 52 | 53 | +#ifdef _WIN32 54 | +__inline int ts_utf8_sequence_length(char c0); 55 | +#else 56 | +int ts_utf8_sequence_length(char c0); 57 | +#endif 58 | + 59 | #endif 60 | 61 | --- lang/cmu_indic_lang/cmu_indic_lang.c.bak 2017-12-14 17:55:12.000000000 +0100 62 | +++ lang/cmu_indic_lang/cmu_indic_lang.c 2020-08-29 00:22:34.156250000 +0200 63 | @@ -115,23 +115,16 @@ 64 | #include "indic_tam_num_table.h" 65 | #include "indic_pan_num_table.h" 66 | 67 | - 68 | -int ts_utf8_sequence_length(char c0); 69 | -// inline int utf8_sequence_length(char c0) 70 | -// { 71 | - // Get the expected length of UTF8 sequence given its most 72 | - // significant byte 73 | -// return (( 0xE5000000 >> (( c0 >> 3 ) & 0x1E )) & 3 ) + 1; 74 | -// } 75 | - 76 | - 77 | +#ifdef _WIN32 78 | +__inline int ts_utf8_sequence_length(char c0) 79 | +{ 80 | + /* Get the expected length of UTF8 sequence given its most */ 81 | + /* significant byte */ 82 | + return (( 0xE5000000 >> (( c0 >> 3 ) & 0x1E )) & 3 ) + 1; 83 | +} 84 | +#else 85 | int ts_utf8_sequence_length(char c0); 86 | -// inline int utf8_sequence_length(char c0) 87 | -// { 88 | - // Get the expected length of UTF8 sequence given its most 89 | - // significant byte 90 | -// return (( 0xE5000000 >> (( c0 >> 3 ) & 0x1E )) & 3 ) + 1; 91 | -// } 92 | +#endif 93 | 94 | int indic_digit_to_offset(const char *ind_digit) 95 | { 96 | -------------------------------------------------------------------------------- /patches/libxml2-2.9.12_lib-only_static_cve-2017-8872.diff: -------------------------------------------------------------------------------- 1 | diff -ur Makefile.in.bak Makefile.in 2 | --- Makefile.in.bak 2021-05-13 20:54:56.000000000 +0200 3 | +++ Makefile.in 2022-05-01 13:15:23.859375000 +0200 4 | @@ -121,7 +121,7 @@ 5 | "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(cmakedir)" \ 6 | "$(DESTDIR)$(confexecdir)" "$(DESTDIR)$(m4datadir)" \ 7 | "$(DESTDIR)$(pkgconfigdir)" 8 | -PROGRAMS = $(bin_PROGRAMS) 9 | +PROGRAMS = 10 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 11 | am__vpath_adj = case $$p in \ 12 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ 13 | @@ -724,7 +724,7 @@ 14 | top_builddir = @top_builddir@ 15 | top_srcdir = @top_srcdir@ 16 | ACLOCAL_AMFLAGS = -I m4 17 | -SUBDIRS = include . doc example fuzz xstc $(PYTHON_SUBDIR) 18 | +SUBDIRS = include . 19 | DIST_SUBDIRS = include . doc example fuzz python xstc 20 | AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include 21 | AM_CFLAGS = $(EXTRA_CFLAGS) $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS) 22 | @@ -1911,15 +1911,13 @@ 23 | 24 | info-am: 25 | 26 | -install-data-am: install-cmakeDATA install-data-local \ 27 | - install-m4dataDATA install-man install-pkgconfigDATA 28 | +install-data-am: install-cmakeDATA install-pkgconfigDATA 29 | 30 | install-dvi: install-dvi-recursive 31 | 32 | install-dvi-am: 33 | 34 | -install-exec-am: install-binPROGRAMS install-binSCRIPTS \ 35 | - install-confexecDATA install-libLTLIBRARIES 36 | +install-exec-am: install-libLTLIBRARIES 37 | 38 | install-html: install-html-recursive 39 | 40 | @@ -2055,7 +2053,6 @@ 41 | install-data-am install-data-local install-dvi install-dvi-am \ 42 | install-exec install-exec-am install-html install-html-am \ 43 | install-info install-info-am install-libLTLIBRARIES \ 44 | - install-m4dataDATA install-man install-man1 install-man3 \ 45 | install-pdf install-pdf-am install-pkgconfigDATA install-ps \ 46 | install-ps-am install-strip installcheck installcheck-am \ 47 | installdirs installdirs-am maintainer-clean \ 48 | diff -ur parser.c.bak parser.c 49 | --- parser.c.bak 2021-05-13 14:54:16.000000000 +0200 50 | +++ parser.c 2022-05-01 13:21:32.781250000 +0200 51 | @@ -12565,6 +12565,10 @@ 52 | ctxt->input->length = 0; 53 | ctxt->input->base = ctxt->input->cur; 54 | ctxt->input->end = ctxt->input->cur; 55 | + if (ctxt->input->buf) 56 | + xmlBufEmpty (ctxt->input->buf->buffer); 57 | + else 58 | + ctxt->input->length = 0; 59 | } 60 | } 61 | 62 | diff -ur include/libxml/xmlexports.h.bak include/libxml/xmlexports.h 63 | --- include/libxml/xmlexports.h.bak 2021-05-13 14:53:51.000000000 +0200 64 | +++ include/libxml/xmlexports.h 2022-05-01 13:31:37.218750000 +0200 65 | @@ -8,7 +8,7 @@ 66 | #ifndef __XML_EXPORTS_H__ 67 | #define __XML_EXPORTS_H__ 68 | 69 | -#if defined(_WIN32) || defined(__CYGWIN__) 70 | +#if 0 71 | /** DOC_DISABLE */ 72 | 73 | #ifdef LIBXML_STATIC 74 | -------------------------------------------------------------------------------- /patches/libxvid_CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(xvidcore) 2 | cmake_minimum_required(VERSION 3.6) 3 | 4 | find_program (YASM_EXECUTABLE yasm) 5 | 6 | if(NOT YASM_EXECUTABLE) 7 | message(FATAL_ERROR "yasm executable not found!") 8 | endif() 9 | 10 | set(CMAKE_ASM_NASM_COMPILER ${YASM_EXECUTABLE}) 11 | enable_language(ASM_NASM) 12 | 13 | set(xvidcore_generic_sources 14 | src/decoder.c 15 | src/encoder.c 16 | src/xvid.c 17 | src/bitstream/bitstream.c 18 | src/bitstream/cbp.c 19 | src/bitstream/mbcoding.c 20 | src/dct/fdct.c 21 | src/dct/idct.c 22 | src/dct/simple_idct.c 23 | src/image/colorspace.c 24 | src/image/image.c 25 | src/image/interpolate8x8.c 26 | src/image/font.c 27 | src/image/postprocessing.c 28 | src/image/qpel.c 29 | src/image/reduced.c 30 | src/motion/estimation_bvop.c 31 | src/motion/estimation_common.c 32 | src/motion/estimation_gmc.c 33 | src/motion/estimation_pvop.c 34 | src/motion/estimation_rd_based.c 35 | src/motion/estimation_rd_based_bvop.c 36 | src/motion/gmc.c 37 | src/motion/motion_comp.c 38 | src/motion/vop_type_decision.c 39 | src/motion/sad.c 40 | src/prediction/mbprediction.c 41 | src/plugins/plugin_single.c 42 | src/plugins/plugin_2pass1.c 43 | src/plugins/plugin_2pass2.c 44 | src/plugins/plugin_lumimasking.c 45 | src/plugins/plugin_dump.c 46 | src/plugins/plugin_psnr.c 47 | src/plugins/plugin_ssim.c 48 | src/plugins/plugin_psnrhvsm.c 49 | src/quant/quant_h263.c 50 | src/quant/quant_matrix.c 51 | src/quant/quant_mpeg.c 52 | src/utils/emms.c 53 | src/utils/mbtransquant.c 54 | src/utils/mem_align.c 55 | src/utils/mem_transfer.c 56 | src/utils/timer.c 57 | ) 58 | 59 | set(xvidcore_ia32_sources 60 | src/bitstream/x86_asm/cbp_mmx.asm 61 | src/bitstream/x86_asm/cbp_sse2.asm 62 | src/dct/x86_asm/fdct_mmx_ffmpeg.asm 63 | src/dct/x86_asm/fdct_mmx_skal.asm 64 | src/dct/x86_asm/fdct_sse2_skal.asm 65 | src/dct/x86_asm/idct_3dne.asm 66 | src/dct/x86_asm/idct_mmx.asm 67 | src/dct/x86_asm/idct_sse2_dmitry.asm 68 | src/image/x86_asm/colorspace_rgb_mmx.asm 69 | src/image/x86_asm/colorspace_yuv_mmx.asm 70 | src/image/x86_asm/colorspace_yuyv_mmx.asm 71 | src/image/x86_asm/interpolate8x8_3dn.asm 72 | src/image/x86_asm/interpolate8x8_3dne.asm 73 | src/image/x86_asm/interpolate8x8_mmx.asm 74 | src/image/x86_asm/interpolate8x8_xmm.asm 75 | src/image/x86_asm/postprocessing_mmx.asm 76 | src/image/x86_asm/postprocessing_sse2.asm 77 | src/image/x86_asm/reduced_mmx.asm 78 | src/image/x86_asm/qpel_mmx.asm 79 | src/image/x86_asm/gmc_mmx.asm 80 | src/image/x86_asm/deintl_sse.asm 81 | src/motion/x86_asm/sad_xmm.asm 82 | src/motion/x86_asm/sad_sse2.asm 83 | src/motion/x86_asm/sad_mmx.asm 84 | src/motion/x86_asm/sad_3dne.asm 85 | src/motion/x86_asm/sad_3dn.asm 86 | src/quant/x86_asm/quantize_h263_mmx.asm 87 | src/quant/x86_asm/quantize_h263_3dne.asm 88 | src/quant/x86_asm/quantize_mpeg_xmm.asm 89 | src/quant/x86_asm/quantize_mpeg_mmx.asm 90 | src/utils/x86_asm/mem_transfer_mmx.asm 91 | src/utils/x86_asm/mem_transfer_3dne.asm 92 | src/utils/x86_asm/interlacing_mmx.asm 93 | src/utils/x86_asm/cpuid.asm 94 | src/plugins/x86_asm/plugin_ssim-a.asm 95 | ) 96 | 97 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 98 | add_definitions(-DARCH_IS_X86_64 -DARCH_IS_64BIT) 99 | set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DWINDOWS -DNO_PREFIX -DARCH_IS_X86_64") 100 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) 101 | add_definitions(-DARCH_IS_IA32 -DARCH_IS_32BIT) 102 | set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DWINDOWS") 103 | endif() 104 | 105 | add_definitions(-DARCH_IS_LITTLE_ENDIAN -D_FILE_OFFSET_BITS=64) 106 | 107 | include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/bitstream/x86_asm) 108 | 109 | set(EXPORTED_HEADERS src/xvid.h) 110 | add_library(xvidcore STATIC ${xvidcore_generic_sources} ${xvidcore_ia32_sources}) 111 | 112 | install(TARGETS xvidcore ARCHIVE DESTINATION lib${LIB_SUFFIX}) 113 | install(FILES ${EXPORTED_HEADERS} DESTINATION include) 114 | -------------------------------------------------------------------------------- /patches/mbedtls-2.28.9_mingw-stdio.diff: -------------------------------------------------------------------------------- 1 | diff -ur include/mbedtls/platform.h.bak include/mbedtls/platform.h 2 | --- include/mbedtls/platform.h.bak 2024-03-22 18:26:27.000000000 +0100 3 | +++ include/mbedtls/platform.h 2024-05-02 19:25:58.375000000 +0200 4 | @@ -57,7 +57,7 @@ 5 | * implementations of some standard library functions, including snprintf 6 | * and vsnprintf. This affects MSVC and MinGW builds. 7 | */ 8 | -#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER <= 1900) 9 | +#if !__USE_MINGW_ANSI_STDIO && (defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER <= 1900)) 10 | #define MBEDTLS_PLATFORM_HAS_NON_CONFORMING_SNPRINTF 11 | #define MBEDTLS_PLATFORM_HAS_NON_CONFORMING_VSNPRINTF 12 | #endif 13 | -------------------------------------------------------------------------------- /patches/notes: -------------------------------------------------------------------------------- 1 | ffmpeg -y -i sintel.mpg -t {10,150} -an out.mp4 2 | 3 | k8 4 | 8.6 8.5 8.6 8.7 8.6 8.3 7.8 5 | big: 55 fps 82.4 6 | 7 | my normal, non k8: 8 | 8.9 8.4 8.5 7.6? 7.8? 9 | 55 fps 82.6 10 | 11 | his: 12 | 7.8 7.7 13 | 83.2 [who knows, may have been a fluke even] 14 | 15 | -march=core-avx2 16 | 17 | = speeds = 18 | 19 | ffmpeg_me_x86_64 5.2 20 | ffmpeg_win32_pthreads_x264_win32_pthreads 5.7 21 | ffmpeg_win32_pthreads.exe 5.8 22 | libopus (win32 threads) 6.0 [?] 23 | pixfmt_ramiro 5.6 24 | 25 | = speed failures = 26 | 27 | 6.333559, 6.33356, 6.33356, 6.33356, 6.33356, 6.349159, 6.349159, 6.349159, 6.364759, 6.364759, 6.36476, 6.401155, 6.422355, 6.424389, 6.507555, 6.551958, 6.551958, 6.567557, 6.614357, 6.629764, 6.676757, 6.785957, 6.957555] 28 | 7333 29 | ".\\ffmpeg_win32_pthreads_x264_win32_pthreads.exe -threads 6 -y -i sintel.mpg -pass 1 -t 75 -c:v libx264 -an nul.mp4" 30 | 31 | 6.419555, 6.551958, 6.567558, 6.588355, 6.695155] 32 | 959 33 | ".\\ffmpeg_win32_pthreads.exe -threads 6 -y -i sintel.mpg -pass 1 -t 75 -c:v libx264 -an nul.mp4" this has win32 x264, ffmpeg with win32-pthreads 34 | 35 | == rtmp "drops" == 36 | 37 | maybe related to the VLC audio-desync? 38 | http://planet.videolan.org/ 39 | 40 | blacky3: 41 | Last message repeated 16 times 42 | frame=120967 fps= 10 q=31.0 size= 545552kB time=03:16:56.88 bitrate= 378.2kbitsreal-time buffer 206% full! frame dropped! 43 | [dshow @ 01F1D5A0] real-time buffer 206% full! frame dropped! 44 | Last message repeated 16 times 45 | frame=120980 fps= 10 q=31.0 size= 545595kB time=03:16:57.86 bitrate= 378.2kbitsreal-time buffer 206% full! frame dropped! 46 | [dshow @ 01F1D5A0] real-time buffer 206% full! frame dropped! 47 | Last message repeated 1017 times 48 | WriteN, RTMP send error 10054 (129 bytes)real-time buffer 206% full! frame dropped! 49 | 50 | WriteN, RTMP send error 10054 (79 bytes) 51 | WriteN, RTMP send error 10038 (42 bytes) 52 | av_interleaved_write_frame(): Operation not permitted 53 | [dshow @ 01F1D5A0] real-time buffer 206% full! frame dropped! 54 | Last message repeated 3 times 55 | 56 | 57 | == mac fps drops == 58 | 59 | should always be at 29, 100% cpu 60 | 61 | is with -b 100k 62 | 63 | is not with "normal" 64 | 65 | ffmpeg -i sintel.mpg -ss 90 -an -f flv rtmp://live.justin.tv/ 66 | 67 | 50% 68 | 69 | 700 kbit upload, makes sense� 70 | 71 | 72 | mac: 73 | ffmpeg -i sintel.mpg -ss 90 -an -f flv ...: 74 | 75 | 12 minutes, 37 fps, low cpu� 76 | 77 | should have been: 78 | frame=21654 fps=209 q=31.0 Lsize= 46193kB time=00:13:14.82 bitrate= 476.1kbits/s 79 | 80 | says I have 0.73 Mbps 81 | 82 | frame= 5116 fps= 47 q=31.0 Lsize= 9564kB time=00:03:07.75 bitrate= 417.3kbits/s 83 | 84 | so it's basically 47/30*40 ~ 62 KB/s 85 | 86 | did show 100K outbound, 2.2K incoming, which is good. 87 | 88 | Does show the odd pause right when it gets started� 89 | 90 | If it's a leak, it's a slow one� (this is sans --enable-librtmp though). 91 | 92 | No hint of a leak when streaming a file. 93 | 94 | 135.8 MB when bandwidth limited, at least 95 | 96 | bandwidth not limited 97 | 98 | bandwidth AND cpu limited: 99 | 100 | cpu limited? 101 | 102 | "frame= 4889 fps= 21 " 103 | is actually like a running average since the beginning of time [!] 104 | 105 | actually fps=5 106 | 107 | the thing that can limit it: cpu, bandwidth 108 | 109 | == RTMP fps drops notes == 110 | 111 | *all night* 112 | "C:\Downloads\ffmpeg-distro-static-2012-08-15-045f8ddc07d0d7e4a29a53b0b69a02ebbb34494b.dshow_no_overflow\ffmpeg-distro-static-2012-08-15-045f8ddc07d0d7e4a29a53b0b69a02ebbb34494b\ffmpeg-32.exe" -analyzeduration 0 -i "rtmp://localhost:1936/live/b live=1" -vcodec libx264 -f flv "rtmp://localhost:1936/live/c" 113 | 114 | no discernable leak 115 | 116 | 117 | 118 | 119 | "C:\Downloads\ffmpeg-distro-static-2012-08-15-045f8ddc07d0d7e4a29a53b0b69a02ebbb34494b.dshow_no_overflow\ffmpeg-distro-static-2012-08-15-045f8ddc07d0d7e4a29a53b0b69a02ebbb34494b\ffmpeg-32.exe" -f dshow -i video=screen-capture-recorder -f flv rtmp://localhost:1936/live/b Command Line 120 | 121 | is working now...at least :P 122 | 123 | "bitrate" in the console has no relation to what's being put out on the wire... 124 | maybe the long latency to justin.tv kills it? 125 | 126 | 127 | when you "don't have enough bandwidth" it slows down the cpu usage, and keeps encoding... 128 | 129 | Also is it sending like way more on the wire than it does when it writes it to file? 130 | 131 | 132 | Ok it outputs "fine" to flv, or to udp...or to a pipe. No RAM leaks. 133 | The truly weird part being "even if flv can't write to the disk fast enough" right...no leaks... 134 | so the buffering can't be part of libx264, and all the way through to there... 135 | probably 136 | before rtmp 137 | or within rtmp 138 | is my guess... 139 | 140 | 141 | the video can get very choppy (12 fps reported while encoding and 6-7 noticed while watching with fraps running) but the audio does not. 142 | 143 | -analyzeduration 144 | 145 | try it with VLC as the server? 146 | -max_delay, -muxpreload, and -muxdelay help? 147 | 148 | "you should set a maxrate, a buffer, and use a CRF for quality control (you're doing CBR right now). ? 149 | apparently didn't help 150 | 151 | ffmpeg -t 10 -f dshow -i video=screen-capture-recorder -vcodec libx264 -f flv rtmp://localhost/live/a -loglevel debug > output 2>&1 152 | ffmpeg -t 10 -i \vids\sintel.mpg -ss 90 -an -vcodec libx264 -f flv rtmp://localhost/live/a -loglevel debug > output 2>&1 153 | 154 | 155 | with my proxy: 156 | frame= 162 fps= 1 q=19.0 Lsize= 4067kB time=00:02:51.64 bitrate= 194.1kbits/s 157 | 158 | and that's with *semingly* extra cpu. 159 | 160 | LOL. 161 | 162 | Also NB, with09-11: 163 | 164 | .+,-.+.+.+.+.+.+.+. 165 | 166 | but latest is 167 | .+,.+,.+,.+,.+,.+,.+,.+, 168 | 169 | latest: 170 | 171 | [dshow @ 01C9A600] real-time buffer 199% full! frame dropped!trate= 0.0kbits/s 172 | Last message repeated 1277 times3513kB time=00:02:56.02 bitrate= 163.5kbits/s 173 | 174 | 09-11: 175 | frame= 330 fps= 1 q=17.0 Lsize= 4369kB time=00:03:16.31 bitrate= 182.3kbits/s 176 | 177 | 178 | == Timing with pthreads == 179 | 180 | 0726: ffmpeg-20120726-git-236ecc3-win32-shared\\ffmpeg-20120726-git-236ecc3-win32-shared\\bin\\ffmpeg.exe -threads 1 181 | 6.17, 6.2088, 6.2088, 6.2414, 6.3024, 6.509, 6.5676, 6.5686, 6.5922, 11.5128] 182 | 183 | and a hang, but it was close! 184 | 185 | 6.1017, 6.1073, 6.1631, 8.1559, 8.2254, 10.8354, 11.7285, 12.0542] 186 | 365 187 | 188 | does seem to take awhile, but it's there... 189 | 190 | dec 22 -threads 6 191 | 192 | [7.5816, 7.8156, 7.6284, 22.2768, 8.0652, 7.2072, 19.9212] 193 | 194 | dec 22 -threads 1 195 | 196 | 7.783, 7.7862, 7.791, 7.794, 7.795, 7.8, 7.8, 7.8, 7.8, 7.805, 7.8074, 7.816, 7.8644, 7.93, 9.266, 9.7614, 9.9188] 197 | 1966 198 | 7.7688, 7.808, 7.831, 7.836177, 8.0192, 8.658, 9.2632] 199 | 1199 200 | 201 | those look legit to me... 202 | 203 | dec26 threads 1: 204 | 7.5934, 7.6128, 7.6128, 7.685, 7.722, 7.742, 7.7432, 7.8088, 7.926] 205 | 133 206 | seemed pretty stable... 207 | 208 | 7.8394, 7.8508, 7.852, 7.8624, 7.91, 7.9244, 7.9796, 8.1548, 8.1724, 8.4308, 9.068] 209 | 950 (probably ok) 210 | 211 | dec26 threads 6: 212 | 7.546, 7.5486, 7.5506, 7.5675, 7.5772] 213 | 74 214 | [14.1648, 19.734, 21.6528, 23.5716, 23.7276, 24.336, 26.3016, 35.724, 38.7172, 59.202] 215 | 10 216 | 217 | january 5 threads 1 218 | 7.804, 7.8146, 7.8156, 7.8502, 7.9116, 7.9546, 7.9928, 8.0628, 8.2688] 219 | 4775 220 | 221 | jan 5 th 6 222 | quick die 223 | 224 | OS X macports-devel -th 6 225 | 226 | 36.975005, 36.995226, 37.12962, 37.306911, 38.625307, 38.633342] 227 | 74 228 | 229 | OS X macports "-threads 0" 230 | 38.725472, 40.496907, 47.510419, 50.127104] 231 | 128 232 | hopefully a fluke :P 233 | 234 | 36.534519, 36.542911, 36.587368, 36.783724, 36.888324, 37.006988, 37.71383] 235 | 163 236 | 237 | 36.487204, 36.534519, 36.542911, 36.587368, 36.783724, 36.888324, 36.921875, 36.939317, 37.006988, 37.470837, 37.71383, 37.830948] 238 | 325 239 | 240 | 39.880812, 39.8828, 40.026459, 40.042505, 40.22541, 40.286073, 40.460634] 241 | 1108 242 | ffmpeg version 0.11.1.git-56ae592 Copyright (c) 2000-2012 the FFmpeg developers 243 | 244 | 245 | my 32, threads 6 246 | 6.022, 6.083, 6.386, 6.4216, 6.438, 6.506, 6.563, 6.69, 7.283, 7.3686, 7.518] 247 | 1696 248 | 249 | my 64 threads 6 250 | 5.5138, 5.523285, 5.538, 5.695, 6.267, 6.5428] 251 | 17511 252 | 253 | ffmpeg-20120409-git-6bfb304-win64-static\\bin\\ffmpeg.exe -threads 6 -y -i sintel.mpg -pass 1 -t 75 -c:v libx264 -an nul.mp4" 254 | [6.6186, 6.6536, 6.7067, 6.7275, 6.7331, 6.7605, 6.8356, 6.9484, 7.0748, 7.1302, 12.1823, 13.9774, 16.0897, 17.1871, 18.0254] 255 | 256 | 20120409-git-6bfb304-win64-static\\bin\\ffmpeg.exe -threads 1 -y -i sintel.mpg -pass 1 -t 75 -c:v libx264 -an nul.mp4" 257 | 7.0487, 7.0561, 7.058, 7.0624, 7.0791, 7.0904, 7.1142, 7.1854, 7.2529] 258 | 122 259 | 263 had 9.1 260 | 261 | 7.2048, 7.213, 7.4231, 7.6833, 9.1604, 9.4338] (same 9.1 as above) 262 | 1128 263 | 264 | that feels pretty stable... 265 | 266 | 20120726-git-236ecc3-win32-shared\\bin\\ffmpeg.exe -threads 1 -y -i sintel.mpg -pass 1 -t 75 -c:v libx264 -an nul.mp4" 267 | 6.0511, 6.0536, 6.0554, 6.0566, 6.0711, 6.0722, 6.083, 13.5071, 17.544] 268 | 128 269 | 270 | 271 | 272 | == march/optimized builds == 273 | 274 | 275 | disable stack checking too? 276 | 277 | --nls didn't matter, --static didn't matter... 278 | 279 | 280 | gcj: -fno-bounds-check -O3 -mfpmath=sse -msse2 -ffast-math -march=native; 281 | 282 | enable all instruction subsets supported by the local machine (hence the result might not run on different machines) 283 | 284 | appears you don't need -fomit-frame-pointer on gcc 4.6+: 285 | http://stackoverflow.com/questions/6099919/why-does-gcc-drop-the-frame-pointer-on-64-bit 286 | 287 | libfaac is supposed to be poor quality, libaacplus "up there" I believe, but somebody said libfdk-aac was "super high quality" so I must trust them, right? :) 288 | 289 | libx264 compilation by one guy: 290 | PKG_CONFIG_PATH=$HOME/win32_build/lib/pkgconfig ./configure --prefix=$HOME/win32_build --cross-prefix=i586-mingw32msvc- --extra-cflags="-I$HOME/win32_build/include -march=pentium3" --extra-ldflags="-L$HOME/win32_build/lib" --qtsdk=$HOME/qtsdk --host=i586-mingw32msvc 291 | 292 | -O3 not recommended for gcc 4.x gentoo [?] but maybe it would work... (it's already enabled in ffmpeg builds) 293 | 294 | I think -march=XXX is enough to get away from i386 default land... 295 | is ffmpeg internally using the right sse cpu instructions? 296 | 297 | libfaac:./configure --enable-static -disable-shared --prefix=/opt/ffmpegbuildarea/extralibs --host=x86_64-w64-mingw32 --with-mp4v2=no 298 | 299 | libx264 uses this... : -Wshadow -O3 -ffast-math -m32 -Wall -I. -I. -march=i686 -mfpmath=sse -msse -std=gnu99 -fomit-frame-pointer -fno-tree-vectorize -fno-zero-initialized-in-bss -c -o common/pixel.o common/pixel.c 300 | 301 | specifying -march=cpu-type implies -mtune=cpu-type. 302 | 303 | specifying graphite stuff? 304 | 305 | appears -ffast-math is out [?] but maybe some of its options could be turned on...http://ffmpeg.org/pipermail/ffmpeg-devel/2010-May/095931.html 306 | 307 | -mfpmath=sse looks good for x86 builds at least https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2009-August/061883.html possibly our march trick is the wrong way and ffmpeg's configure could have other things 308 | 309 | msse4? yeah march doesn't look good enough...http://us.generation-nt.com/gentoo-user-march-native-extremely-conservative-help-205789481.html oh wait it's ok: http://web.archiveorange.com/archive/v/aLshbnQGswttQdr9FRib 310 | http://forums.gentoo.org/viewtopic-t-923520-start-0.html mentions -lfto or something... 311 | 312 | license appears ok: License: GPL version 3 or later 313 | 314 | old builds: --extra-libs='-lx264 -lpthread' 315 | 316 | old build hints: http://ffmpeg.arrozcru.org/forum/viewtopic.php?f=1&t=1638 317 | 318 | currently says: enabling runtime_cpu_detect for libvpx even with march specified... 319 | 320 | @home, to 321 | ffmpeg -f dshow -i video=screen-capture-recorder -pix_fmt yuv420p -s hd720 -vcodec libx264 -preset medium -b:v 2400k -maxrate 240 -f flv rtmp://localhost/live/a 2>&1 > output 2>&1 322 | did *not* leak at all ever 323 | 324 | 325 | complained to libgsm :) 326 | -------------------------------------------------------------------------------- /patches/python-3.4.10_cygwin.patch: -------------------------------------------------------------------------------- 1 | --- configure.ac.orig 2019-03-18 17:51:26.000000000 +0100 2 | +++ configure.ac 2023-05-19 17:59:11.359375000 +0200 3 | @@ -947,6 +947,7 @@ 4 | case $ac_sys_system in 5 | CYGWIN*) 6 | LDLIBRARY='libpython$(LDVERSION).dll.a' 7 | + BLDLIBRARY='-L. -lpython$(LDVERSION)' 8 | DLLLIBRARY='libpython$(LDVERSION).dll' 9 | ;; 10 | SunOS*) 11 | @@ -4103,7 +4104,7 @@ 12 | 13 | AC_SUBST(EXT_SUFFIX) 14 | case $ac_sys_system in 15 | - Linux*|GNU*) 16 | + Linux*|GNU*|CYGWIN*) 17 | EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};; 18 | *) 19 | EXT_SUFFIX=${SHLIB_SUFFIX};; 20 | --- Makefile.pre.in.orig 2019-03-18 17:51:26.000000000 +0100 21 | +++ Makefile.pre.in 2023-05-19 17:58:11.640625000 +0200 22 | @@ -638,7 +638,7 @@ 23 | 24 | # This rule builds the Cygwin Python DLL and import library if configured 25 | # for a shared core library; otherwise, this rule is a noop. 26 | -$(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS) 27 | +$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS) 28 | if test -n "$(DLLLIBRARY)"; then \ 29 | $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \ 30 | $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \ 31 | --- setup.py.orig 2019-03-18 17:51:26.000000000 +0100 32 | +++ setup.py 2023-05-19 17:53:08.718750000 +0200 33 | @@ -1165,7 +1165,7 @@ 34 | dbm_setup_debug = False # verbose debug prints from this script? 35 | dbm_order = ['gdbm'] 36 | # The standard Unix dbm module: 37 | - if host_platform not in ['cygwin']: 38 | + if host_platform not in ['win32']: 39 | config_args = [arg.strip("'") 40 | for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] 41 | dbm_args = [arg for arg in config_args 42 | @@ -1220,6 +1220,15 @@ 43 | ], 44 | libraries = gdbm_libs) 45 | break 46 | + if find_file("ndbm.h", inc_dirs, []) is not None: 47 | + if dbm_setup_debug: print("building dbm using gdbm") 48 | + dbmext = Extension( 49 | + '_dbm', ['_dbmmodule.c'], 50 | + define_macros=[ 51 | + ('HAVE_NDBM_H', None), 52 | + ], 53 | + libraries = gdbm_libs) 54 | + break 55 | elif cand == "bdb": 56 | if dblibs: 57 | if dbm_setup_debug: print("building dbm using bdb") 58 | @@ -1766,12 +1775,6 @@ 59 | include_dirs.append('/usr/X11/include') 60 | added_lib_dirs.append('/usr/X11/lib') 61 | 62 | - # If Cygwin, then verify that X is installed before proceeding 63 | - if host_platform == 'cygwin': 64 | - x11_inc = find_file('X11/Xlib.h', [], include_dirs) 65 | - if x11_inc is None: 66 | - return 67 | - 68 | # Check for BLT extension 69 | if self.compiler.find_library_file(lib_dirs + added_lib_dirs, 70 | 'BLT8.0'): 71 | @@ -1789,9 +1792,8 @@ 72 | if host_platform in ['aix3', 'aix4']: 73 | libs.append('ld') 74 | 75 | - # Finally, link with the X11 libraries (not appropriate on cygwin) 76 | - if host_platform != "cygwin": 77 | - libs.append('X11') 78 | + # Finally, link with the X11 libraries 79 | + libs.append('X11') 80 | 81 | ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], 82 | define_macros=[('WITH_APPINIT', 1)] + defs, 83 | --- Include/py_curses.h.orig 2019-03-18 17:51:26.000000000 +0100 84 | +++ Include/py_curses.h 2023-05-19 17:34:30.578125000 +0200 85 | @@ -17,6 +17,13 @@ 86 | #define NCURSES_OPAQUE 0 87 | #endif /* __APPLE__ */ 88 | 89 | +#ifdef __CYGWIN__ 90 | +/* the following define is necessary for Cygwin; without it, the 91 | + Cygwin-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python 92 | + can't get at the WINDOW flags field. */ 93 | +#define NCURSES_INTERNALS 94 | +#endif /* __CYGWIN__ */ 95 | + 96 | #ifdef __FreeBSD__ 97 | /* 98 | ** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards 99 | --- Include/pyerrors.h.orig 2019-03-18 17:51:26.000000000 +0100 100 | +++ Include/pyerrors.h 2023-05-19 17:42:09.343750000 +0200 101 | @@ -319,7 +319,7 @@ 102 | 103 | /* In signalmodule.c */ 104 | #ifndef Py_LIMITED_API 105 | -int PySignal_SetWakeupFd(int fd); 106 | +PyAPI_FUNC(int) PySignal_SetWakeupFd(int fd); 107 | #endif 108 | 109 | /* Support for adding program text to SyntaxErrors */ 110 | --- Include/pythread.h.orig 2019-03-18 17:51:26.000000000 +0100 111 | +++ Include/pythread.h 2023-05-19 17:59:30.296875000 +0200 112 | @@ -77,11 +77,11 @@ 113 | PyAPI_FUNC(PyObject*) PyThread_GetInfo(void); 114 | 115 | /* Thread Local Storage (TLS) API */ 116 | -PyAPI_FUNC(int) PyThread_create_key(void); 117 | -PyAPI_FUNC(void) PyThread_delete_key(int); 118 | -PyAPI_FUNC(int) PyThread_set_key_value(int, void *); 119 | -PyAPI_FUNC(void *) PyThread_get_key_value(int); 120 | -PyAPI_FUNC(void) PyThread_delete_key_value(int key); 121 | +PyAPI_FUNC(long) PyThread_create_key(void); 122 | +PyAPI_FUNC(void) PyThread_delete_key(long); 123 | +PyAPI_FUNC(int) PyThread_set_key_value(long, void *); 124 | +PyAPI_FUNC(void *) PyThread_get_key_value(long); 125 | +PyAPI_FUNC(void) PyThread_delete_key_value(long key); 126 | 127 | /* Cleanup after a fork */ 128 | PyAPI_FUNC(void) PyThread_ReInitTLS(void); 129 | --- Modules/_struct.c.orig 2019-03-18 17:51:26.000000000 +0100 130 | +++ Modules/_struct.c 2023-05-19 17:11:10.578125000 +0200 131 | @@ -1627,7 +1627,7 @@ 132 | } 133 | 134 | static PyTypeObject unpackiter_type = { 135 | - PyVarObject_HEAD_INIT(&PyType_Type, 0) 136 | + PyVarObject_HEAD_INIT(NULL, 0) 137 | "unpack_iterator", /* tp_name */ 138 | sizeof(unpackiterobject), /* tp_basicsize */ 139 | 0, /* tp_itemsize */ 140 | --- Modules/getpath.c.orig 2019-03-18 17:51:26.000000000 +0100 141 | +++ Modules/getpath.c 2023-05-19 17:11:10.593750000 +0200 142 | @@ -551,6 +551,28 @@ 143 | if (isxfile(progpath)) 144 | break; 145 | 146 | +#ifdef __CYGWIN__ 147 | + /* 148 | + * Cygwin automatically removes the ".exe" extension from argv[0] 149 | + * to make programs feel like they are in a more Unix-like 150 | + * environment. Unfortunately, this can make it problemmatic for 151 | + * Cygwin to distinguish between a directory and an executable with 152 | + * the same name excluding the ".exe" extension. For example, the 153 | + * Cygwin Python build directory has a "Python" directory and a 154 | + * "python.exe" executable. This causes isxfile() to erroneously 155 | + * return false. If isdir() returns true and there is enough space 156 | + * to append the ".exe" extension, then we try again with the 157 | + * extension appended. 158 | + */ 159 | +#define EXE L".exe" 160 | + if (isdir(progpath) && wcslen(progpath) + wcslen(EXE) <= MAXPATHLEN) 161 | + { 162 | + wcscat(progpath, EXE); 163 | + if (isxfile(progpath)) 164 | + break; 165 | + } 166 | +#endif /* __CYGWIN__ */ 167 | + 168 | if (!delim) { 169 | progpath[0] = L'\0'; 170 | break; 171 | --- Modules/main.c.orig 2019-03-18 17:51:26.000000000 +0100 172 | +++ Modules/main.c 2023-05-19 17:34:21.890625000 +0200 173 | @@ -9,9 +9,11 @@ 174 | #include 175 | #ifdef HAVE_FCNTL_H 176 | #include 177 | +#ifndef PATH_MAX 178 | #define PATH_MAX MAXPATHLEN 179 | #endif 180 | #endif 181 | +#endif 182 | 183 | #ifdef _MSC_VER 184 | #include 185 | --- Modules/makesetup.orig 2019-03-18 17:51:26.000000000 +0100 186 | +++ Modules/makesetup 2023-05-19 17:58:11.656250000 +0200 187 | @@ -91,7 +91,7 @@ 188 | else 189 | ExtraLibDir='$(LIBPL)' 190 | fi 191 | - ExtraLibs="-L$ExtraLibDir -lpython\$(VERSION)";; 192 | + ExtraLibs="-L$ExtraLibDir -lpython\$(LDVERSION)";; 193 | esac 194 | 195 | # Main loop 196 | --- Modules/selectmodule.c.orig 2019-03-18 17:51:26.000000000 +0100 197 | +++ Modules/selectmodule.c 2023-05-19 17:11:10.593750000 +0200 198 | @@ -4,6 +4,16 @@ 199 | have any value except INVALID_SOCKET. 200 | */ 201 | 202 | +/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined. 203 | + 64 is too small (too many people have bumped into that limit). 204 | + Here we boost it. 205 | + Users who want even more than the boosted limit should #define 206 | + FD_SETSIZE higher before this; e.g., via compiler /D switch. 207 | +*/ 208 | +#if (defined(MS_WINDOWS) || defined(__CYGWIN__)) && !defined(FD_SETSIZE) 209 | +#define FD_SETSIZE 512 210 | +#endif 211 | + 212 | #include "Python.h" 213 | #include 214 | 215 | @@ -22,16 +32,6 @@ 216 | #undef HAVE_BROKEN_POLL 217 | #endif 218 | 219 | -/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined. 220 | - 64 is too small (too many people have bumped into that limit). 221 | - Here we boost it. 222 | - Users who want even more than the boosted limit should #define 223 | - FD_SETSIZE higher before this; e.g., via compiler /D switch. 224 | -*/ 225 | -#if defined(MS_WINDOWS) && !defined(FD_SETSIZE) 226 | -#define FD_SETSIZE 512 227 | -#endif 228 | - 229 | #if defined(HAVE_POLL_H) 230 | #include 231 | #elif defined(HAVE_SYS_POLL_H) 232 | --- Modules/signalmodule.c.orig 2019-03-18 17:51:26.000000000 +0100 233 | +++ Modules/signalmodule.c 2023-05-19 17:11:10.609375000 +0200 234 | @@ -743,7 +743,11 @@ 235 | PyStructSequence_SET_ITEM(result, 4, _PyLong_FromUid(si->si_uid)); 236 | PyStructSequence_SET_ITEM(result, 5, 237 | PyLong_FromLong((long)(si->si_status))); 238 | +#ifdef __CYGWIN__ 239 | + PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(0L)); 240 | +#else 241 | PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(si->si_band)); 242 | +#endif 243 | if (PyErr_Occurred()) { 244 | Py_DECREF(result); 245 | return NULL; 246 | --- Python/dynload_shlib.c.orig 2019-03-18 17:51:26.000000000 +0100 247 | +++ Python/dynload_shlib.c 2023-05-19 17:59:11.343750000 +0200 248 | @@ -34,6 +34,8 @@ 249 | 250 | const char *_PyImport_DynLoadFiletab[] = { 251 | #ifdef __CYGWIN__ 252 | + "." SOABI ".dll", 253 | + ".abi" PYTHON_ABI_STRING ".dll", 254 | ".dll", 255 | #else /* !__CYGWIN__ */ 256 | "." SOABI ".so", 257 | --- Python/pystate.c.orig 2019-03-18 17:51:26.000000000 +0100 258 | +++ Python/pystate.c 2023-05-19 17:59:30.312500000 +0200 259 | @@ -37,7 +37,7 @@ 260 | GILState implementation 261 | */ 262 | static PyInterpreterState *autoInterpreterState = NULL; 263 | -static int autoTLSkey = 0; 264 | +static long autoTLSkey = 0L; 265 | #else 266 | #define HEAD_INIT() /* Nothing */ 267 | #define HEAD_LOCK() /* Nothing */ 268 | --- Python/thread_pthread.h.orig 2019-03-18 17:51:26.000000000 +0100 269 | +++ Python/thread_pthread.h 2023-05-19 17:59:30.328125000 +0200 270 | @@ -603,28 +603,28 @@ 271 | 272 | #define Py_HAVE_NATIVE_TLS 273 | 274 | -int 275 | +long 276 | PyThread_create_key(void) 277 | { 278 | pthread_key_t key; 279 | int fail = pthread_key_create(&key, NULL); 280 | - return fail ? -1 : key; 281 | + return fail ? -1L : (long) key; 282 | } 283 | 284 | void 285 | -PyThread_delete_key(int key) 286 | +PyThread_delete_key(long key) 287 | { 288 | pthread_key_delete(key); 289 | } 290 | 291 | void 292 | -PyThread_delete_key_value(int key) 293 | +PyThread_delete_key_value(long key) 294 | { 295 | pthread_setspecific(key, NULL); 296 | } 297 | 298 | int 299 | -PyThread_set_key_value(int key, void *value) 300 | +PyThread_set_key_value(long key, void *value) 301 | { 302 | int fail; 303 | fail = pthread_setspecific(key, value); 304 | @@ -632,7 +632,7 @@ 305 | } 306 | 307 | void * 308 | -PyThread_get_key_value(int key) 309 | +PyThread_get_key_value(long key) 310 | { 311 | return pthread_getspecific(key); 312 | } 313 | --- Lib/ctypes/__init__.py.orig 2019-03-18 17:51:26.000000000 +0100 314 | +++ Lib/ctypes/__init__.py 2023-05-19 17:34:11.562500000 +0200 315 | @@ -434,7 +434,8 @@ 316 | if _os.name in ("nt", "ce"): 317 | pythonapi = PyDLL("python dll", None, _sys.dllhandle) 318 | elif _sys.platform == "cygwin": 319 | - pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2]) 320 | + pythonapi = PyDLL("libpython%d.%d%s.dll" % \ 321 | + (_sys.version_info[:2] + tuple(_sys.abiflags))) 322 | else: 323 | pythonapi = PyDLL(None) 324 | 325 | --- Lib/ctypes/util.py.orig 2019-03-18 17:51:26.000000000 +0100 326 | +++ Lib/ctypes/util.py 2023-05-19 17:34:11.593750000 +0200 327 | @@ -83,6 +83,25 @@ 328 | continue 329 | return None 330 | 331 | +elif sys.platform == "cygwin": 332 | + def find_library(name): 333 | + for libdir in ['/usr/lib', '/usr/local/lib']: 334 | + for libext in ['lib%s.dll.a' % name, 'lib%s.a' % name]: 335 | + implib = os.path.join(libdir, libext) 336 | + if not os.path.exists(implib): 337 | + continue 338 | + cmd = "dlltool -I " + implib + " 2>/dev/null" 339 | + f = os.popen(cmd) 340 | + try: 341 | + data = f.read() 342 | + finally: 343 | + f.close() 344 | + res = data.replace("\n","") 345 | + if not res: 346 | + continue 347 | + return res 348 | + return None 349 | + 350 | elif os.name == "posix": 351 | # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump 352 | import re, tempfile 353 | @@ -258,6 +277,10 @@ 354 | print(cdll.LoadLibrary("libcrypto.dylib")) 355 | print(cdll.LoadLibrary("libSystem.dylib")) 356 | print(cdll.LoadLibrary("System.framework/System")) 357 | + elif sys.platform == "cygwin": 358 | + print(cdll.LoadLibrary("cygbz2-1.dll")) 359 | + print(cdll.LoadLibrary("cygcrypt-0.dll")) 360 | + print(find_library("crypt")) 361 | else: 362 | print(cdll.LoadLibrary("libm.so")) 363 | print(cdll.LoadLibrary("libcrypt.so")) 364 | --- Lib/distutils/cygwinccompiler.py.orig 2019-03-18 17:51:26.000000000 +0100 365 | +++ Lib/distutils/cygwinccompiler.py 2023-05-19 17:43:10.640625000 +0200 366 | @@ -92,9 +92,7 @@ 367 | compiler_type = 'cygwin' 368 | obj_extension = ".o" 369 | static_lib_extension = ".a" 370 | - shared_lib_extension = ".dll" 371 | - static_lib_format = "lib%s%s" 372 | - shared_lib_format = "%s%s" 373 | + shared_lib_extension = ".dll.a" 374 | exe_extension = ".exe" 375 | 376 | def __init__(self, verbose=0, dry_run=0, force=0): 377 | --- Lib/distutils/unixccompiler.py.orig 2019-03-18 17:51:26.000000000 +0100 378 | +++ Lib/distutils/unixccompiler.py 2023-05-19 17:43:10.640625000 +0200 379 | @@ -79,6 +79,7 @@ 380 | static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s" 381 | if sys.platform == "cygwin": 382 | exe_extension = ".exe" 383 | + dylib_lib_extension = ".dll.a" 384 | 385 | def preprocess(self, source, output_file=None, macros=None, 386 | include_dirs=None, extra_preargs=None, extra_postargs=None): 387 | @@ -222,7 +223,7 @@ 388 | # the configuration data stored in the Python installation, so 389 | # we use this hack. 390 | compiler = os.path.basename(sysconfig.get_config_var("CC")) 391 | - if sys.platform[:6] == "darwin": 392 | + if sys.platform[:6] == "darwin" or sys.platform[:6] == "cygwin": 393 | # MacOSX's linker doesn't understand the -R flag at all 394 | return "-L" + dir 395 | elif sys.platform[:5] == "hp-ux": 396 | --- Lib/distutils/command/build_ext.py.orig 2019-03-18 17:51:26.000000000 +0100 397 | +++ Lib/distutils/command/build_ext.py 2023-05-19 17:58:11.640625000 +0200 398 | @@ -696,9 +696,9 @@ 399 | else: 400 | return ext.libraries 401 | elif sys.platform[:6] == "cygwin": 402 | - template = "python%d.%d" 403 | + template = "python%d.%d%s" 404 | pythonlib = (template % 405 | - (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) 406 | + (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, sys.abiflags)) 407 | # don't extend ext.libraries, it may be shared with other 408 | # extensions, it is a reference to the original list 409 | return ext.libraries + [pythonlib] 410 | -------------------------------------------------------------------------------- /patches/rubberband_git_static-lib.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Makefile.in b/Makefile.in 2 | index 78a7bae..7c2c141 100644 3 | --- a/Makefile.in 4 | +++ b/Makefile.in 5 | @@ -182,6 +182,15 @@ bin: 6 | lib: 7 | $(MKDIR) $@ 8 | 9 | +install-static: lib static 10 | + $(MKDIR) -p $(DESTDIR)$(INSTALL_INCDIR) 11 | + $(MKDIR) -p $(DESTDIR)$(INSTALL_LIBDIR) 12 | + $(MKDIR) -p $(DESTDIR)$(INSTALL_PKGDIR) 13 | + cp $(PUBLIC_INCLUDES) $(DESTDIR)$(INSTALL_INCDIR) 14 | + cp $(STATIC_TARGET) $(DESTDIR)$(INSTALL_LIBDIR) 15 | + sed "s,%PREFIX%,$(PREFIX),;s,%LIBRARY_LIBS%,$(LIBRARY_LIBS)," rubberband.pc.in \ 16 | + > $(DESTDIR)$(INSTALL_PKGDIR)/rubberband.pc 17 | + 18 | install: all 19 | $(MKDIR) -p $(DESTDIR)$(INSTALL_INCDIR) 20 | $(MKDIR) -p $(DESTDIR)$(INSTALL_LIBDIR) 21 | diff --git a/rubberband.pc.in b/rubberband.pc.in 22 | index ac96edd..ba1256c 100644 23 | --- a/rubberband.pc.in 24 | +++ b/rubberband.pc.in 25 | @@ -5,6 +5,7 @@ includedir=${prefix}/include 26 | 27 | Name: rubberband 28 | Version: 1.8.2 29 | -Description: 30 | +Description: An audio time-stretching and pitch-shifting library and utility program 31 | Libs: -L${libdir} -lrubberband 32 | +Libs.private: %LIBRARY_LIBS% 33 | Cflags: -I${includedir} 34 | --------------------------------------------------------------------------------