diff --git a/LICENSE.GPLv3 b/COPYING similarity index 99% rename from LICENSE.GPLv3 rename to COPYING index 94a9ed0..f288702 100644 --- a/LICENSE.GPLv3 +++ b/COPYING @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff --git a/COPYING.LESSER b/COPYING.LESSER new file mode 100644 index 0000000..0a04128 --- /dev/null +++ b/COPYING.LESSER @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/LICENSE.GPLv2 b/LICENSE.GPLv2 deleted file mode 100644 index d159169..0000000 --- a/LICENSE.GPLv2 +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/LICENSE.QPL b/LICENSE.QPL deleted file mode 100644 index 3de30e4..0000000 --- a/LICENSE.QPL +++ /dev/null @@ -1,98 +0,0 @@ - THE Q PUBLIC LICENSE - version 1.0 - - Copyright (C) 1999-2000 Trolltech AS, Norway. - Everyone is permitted to copy and - distribute this license document. - -The intent of this license is to establish freedom to share and change the -software regulated by this license under the open source model. - -This license applies to any software containing a notice placed by the -copyright holder saying that it may be distributed under the terms of -the Q Public License version 1.0. Such software is herein referred to as -the Software. This license covers modification and distribution of the -Software, use of third-party application programs based on the Software, -and development of free software which uses the Software. - - Granted Rights - -1. You are granted the non-exclusive rights set forth in this license - provided you agree to and comply with any and all conditions in this - license. Whole or partial distribution of the Software, or software - items that link with the Software, in any form signifies acceptance of - this license. - -2. You may copy and distribute the Software in unmodified form provided - that the entire package, including - but not restricted to - copyright, - trademark notices and disclaimers, as released by the initial developer - of the Software, is distributed. - -3. You may make modifications to the Software and distribute your - modifications, in a form that is separate from the Software, such as - patches. The following restrictions apply to modifications: - - a. Modifications must not alter or remove any copyright notices in - the Software. - - b. When modifications to the Software are released under this - license, a non-exclusive royalty-free right is granted to the - initial developer of the Software to distribute your modification - in future versions of the Software provided such versions remain - available under these terms in addition to any other license(s) of - the initial developer. - -4. You may distribute machine-executable forms of the Software or - machine-executable forms of modified versions of the Software, provided - that you meet these restrictions: - - a. You must include this license document in the distribution. - - b. You must ensure that all recipients of the machine-executable forms - are also able to receive the complete machine-readable source code - to the distributed Software, including all modifications, without - any charge beyond the costs of data transfer, and place prominent - notices in the distribution explaining this. - - c. You must ensure that all modifications included in the - machine-executable forms are available under the terms of this - license. - -5. You may use the original or modified versions of the Software to - compile, link and run application programs legally developed by you - or by others. - -6. You may develop application programs, reusable components and other - software items that link with the original or modified versions of the - Software. These items, when distributed, are subject to the following - requirements: - - a. You must ensure that all recipients of machine-executable forms of - these items are also able to receive and use the complete - machine-readable source code to the items without any charge - beyond the costs of data transfer. - - b. You must explicitly license all recipients of your items to use - and re-distribute original and modified versions of the items in - both machine-executable and source code forms. The recipients must - be able to do so without any charges whatsoever, and they must be - able to re-distribute to anyone they choose. - - c. If the items are not available to the general public, and the - initial developer of the Software requests a copy of the items, - then you must supply one. - - Limitations of Liability - -In no event shall the initial developers or copyright holders be liable -for any damages whatsoever, including - but not restricted to - lost -revenue or profits or other direct, indirect, special, incidental or -consequential damages, even if they have been advised of the possibility -of such damages, except to the extent invariable law, if any, provides -otherwise. - - No Warranty - -The Software and this license document are provided AS IS with NO WARRANTY -OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE. diff --git a/build-aux/m4/buildsys.m4 b/build-aux/m4/buildsys.m4 index 679ea9f..3e5f8ed 100644 --- a/build-aux/m4/buildsys.m4 +++ b/build-aux/m4/buildsys.m4 @@ -1,25 +1,21 @@ dnl dnl Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017, -dnl 2018, 2020, 2021, 2022 +dnl 2018, 2020, 2021, 2022, 2023, 2024 dnl Jonathan Schleifer dnl -dnl https://fossil.nil.im/buildsys +dnl https://fl.nil.im/buildsys dnl dnl Permission to use, copy, modify, and/or distribute this software for any dnl purpose with or without fee is hereby granted, provided that the above -dnl copyright notice and this permission notice is present in all copies. +dnl copyright notice and this permission notice appear in all copies. dnl -dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -dnl ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -dnl LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -dnl CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -dnl POSSIBILITY OF SUCH DAMAGE. +dnl THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +dnl REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +dnl AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +dnl INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +dnl LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +dnl OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +dnl PERFORMANCE OF THIS SOFTWARE. dnl AC_DEFUN([BUILDSYS_INIT], [ @@ -29,6 +25,10 @@ AC_DEFUN([BUILDSYS_INIT], [ AC_ARG_ENABLE(rpath, AS_HELP_STRING([--disable-rpath], [do not use rpath])) + AC_ARG_ENABLE(silent-rules, + AS_HELP_STRING([--disable-silent-rules], + [print executed commands during build])) + case "$build_os" in darwin*) case "$host_os" in @@ -127,6 +127,11 @@ AC_DEFUN([BUILDSYS_INIT], [ "$($TPUT AF 6 2>/dev/null)") fi ]) + + AS_IF([test x"$enable_silent_rules" != x"no"], [ + AC_SUBST(SILENT, '.SILENT:') + AC_SUBST(MAKEFLAGS_SILENT, '-s') + ]) ]) ]) @@ -144,10 +149,12 @@ AC_DEFUN([BUILDSYS_CHECK_IOS], [ #endif ], [ host_is_ios="yes" + AC_SUBST(HOST_IS_IOS, yes) ], [ host_is_ios="no" ]) AC_MSG_RESULT($host_is_ios) + AC_CHECK_TOOL(CODESIGN, codesign) ;; esac ]) @@ -175,7 +182,7 @@ AC_DEFUN([BUILDSYS_PROG_IMPLIB], [ AC_DEFUN([BUILDSYS_SHARED_LIB], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([BUILDSYS_CHECK_IOS]) - AC_MSG_CHECKING(for shared library system) + AC_MSG_CHECKING(for shared library type) case "$host" in *-*-darwin*) @@ -188,18 +195,8 @@ AC_DEFUN([BUILDSYS_SHARED_LIB], [ AS_IF([test x"$enable_rpath" != x"no"], [ LDFLAGS_RPATH='-Wl,-rpath,${libdir}' ]) - PLUGIN_CFLAGS='-fPIC -DPIC' - PLUGIN_LDFLAGS='-bundle ${PLUGIN_LDFLAGS_BUNDLE_LOADER}' - PLUGIN_SUFFIX='.bundle' - AS_IF([test x"$host_is_ios" = x"yes"], [ - LINK_PLUGIN='rm -fr $$out && ${MKDIR_P} $$out && if test -f Info.plist; then ${INSTALL} -m 644 Info.plist $$out/Info.plist; fi && ${LD} -o $$out/$${out%${PLUGIN_SUFFIX}} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS} && ${CODESIGN} -fs ${CODESIGN_IDENTITY} --timestamp=none $$out' - ], [ - LINK_PLUGIN='rm -fr $$out && ${MKDIR_P} $$out/Contents/MacOS && if test -f Info.plist; then ${INSTALL} -m 644 Info.plist $$out/Contents/Info.plist; fi && ${LD} -o $$out/Contents/MacOS/$${out%${PLUGIN_SUFFIX}} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS} && ${CODESIGN} -fs ${CODESIGN_IDENTITY} --timestamp=none $$out' - ]) INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib && ${LN_S} -f $${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib ${DESTDIR}${libdir}/$$i' UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.dylib ${DESTDIR}${libdir}/$${i%.dylib}.${LIB_MAJOR}.${LIB_MINOR}.dylib' - INSTALL_PLUGIN='&& rm -fr ${DESTDIR}${plugindir}/$$i && cp -R $$i ${DESTDIR}${plugindir}/' - UNINSTALL_PLUGIN='&& rm -fr ${DESTDIR}${plugindir}/$$i' CLEAN_LIB='' ;; *-*-mingw* | *-*-cygwin*) @@ -210,14 +207,8 @@ AC_DEFUN([BUILDSYS_SHARED_LIB], [ LIB_PREFIX='' LIB_SUFFIX='${LIB_MAJOR}.dll' LINK_LIB='&& rm -f lib$${out%${LIB_SUFFIX}}.dll.a && ${LN_S} $$out lib$${out%${LIB_SUFFIX}}.dll.a' - PLUGIN_CFLAGS='' - PLUGIN_LDFLAGS='-shared -Wl,--export-all-symbols' - PLUGIN_SUFFIX='.dll' - LINK_PLUGIN='${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' INSTALL_LIB='&& ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i && ${INSTALL} -m 755 lib$${i%${LIB_SUFFIX}}.dll.a ${DESTDIR}${libdir}/lib$${i%${LIB_SUFFIX}}.dll.a' UNINSTALL_LIB='&& rm -f ${DESTDIR}${bindir}/$$i ${DESTDIR}${libdir}/lib$${i%${LIB_SUFFIX}}.dll.a' - INSTALL_PLUGIN='&& ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i' - UNINSTALL_PLUGIN='&& rm -f ${DESTDIR}${plugindir}/$$i' CLEAN_LIB='${SHARED_LIB}.a ${SHARED_LIB_NOINST}.a' ;; *-*-openbsd* | *-*-mirbsd*) @@ -230,14 +221,8 @@ AC_DEFUN([BUILDSYS_SHARED_LIB], [ AS_IF([test x"$enable_rpath" != x"no"], [ LDFLAGS_RPATH='-Wl,-rpath,${libdir}' ]) - PLUGIN_CFLAGS='-fPIC -DPIC' - PLUGIN_LDFLAGS='-shared' - PLUGIN_SUFFIX='.so' - LINK_PLUGIN='${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i' UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i' - INSTALL_PLUGIN='&& ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i' - UNINSTALL_PLUGIN='&& rm -f ${DESTDIR}${plugindir}/$$i' CLEAN_LIB='' ;; *-*-solaris*) @@ -250,14 +235,8 @@ AC_DEFUN([BUILDSYS_SHARED_LIB], [ AS_IF([test x"$enable_rpath" != x"no"], [ LDFLAGS_RPATH='-Wl,-rpath,${libdir}' ]) - PLUGIN_CFLAGS='-fPIC -DPIC' - PLUGIN_LDFLAGS='-shared' - PLUGIN_SUFFIX='.so' - LINK_PLUGIN='${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR} && rm -f ${DESTDIR}${libdir}/$$i && ${LN_S} $$i.${LIB_MAJOR}.${LIB_MINOR} ${DESTDIR}${libdir}/$$i' UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}' - INSTALL_PLUGIN='&& ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i' - UNINSTALL_PLUGIN='&& rm -f ${DESTDIR}${plugindir}/$$i' CLEAN_LIB='' ;; *-*-android*) @@ -267,14 +246,8 @@ AC_DEFUN([BUILDSYS_SHARED_LIB], [ LIB_LDFLAGS_INSTALL_NAME='' LIB_PREFIX='lib' LIB_SUFFIX='.so' - PLUGIN_CFLAGS='-fPIC -DPIC' - PLUGIN_LDFLAGS='-shared' - PLUGIN_SUFFIX='.so' - LINK_PLUGIN='${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' - INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0 && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.0 ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.0 ${DESTDIR}${libdir}/$$i' - UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0' - INSTALL_PLUGIN='&& ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i' - UNINSTALL_PLUGIN='&& rm -f ${DESTDIR}${plugindir}/$$i' + INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.${LIB_PATCH} && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.${LIB_PATCH} ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.${LIB_PATCH} ${DESTDIR}${libdir}/$$i' + UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.${LIB_PATCH}' CLEAN_LIB='' ;; hppa*-*-hpux*) @@ -288,14 +261,8 @@ AC_DEFUN([BUILDSYS_SHARED_LIB], [ AS_IF([test x"$enable_rpath" != x"no"], [ LDFLAGS_RPATH='-Wl,+b,${libdir}' ]) - PLUGIN_CFLAGS='-fPIC -DPIC' - PLUGIN_LDFLAGS='-shared' - PLUGIN_SUFFIX='.sl' - LINK_PLUGIN='${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i && ${LN_S} -f $$i ${DESTDIR}${libdir}/$${i%%.*}.sl' UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$${i%%.*}.sl' - INSTALL_PLUGIN='&& ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i' - UNINSTALL_PLUGIN='&& rm -f ${DESTDIR}${plugindir}/$$i' CLEAN_LIB='' ;; ia64*-*-hpux*) @@ -309,14 +276,8 @@ AC_DEFUN([BUILDSYS_SHARED_LIB], [ AS_IF([test x"$enable_rpath" != x"no"], [ LDFLAGS_RPATH='-Wl,+b,${libdir}' ]) - PLUGIN_CFLAGS='-fPIC -DPIC' - PLUGIN_LDFLAGS='-shared' - PLUGIN_SUFFIX='.so' - LINK_PLUGIN='${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i && ${LN_S} -f $$i ${DESTDIR}${libdir}/$${i%%.*}.so' UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$${i%%.*}.so' - INSTALL_PLUGIN='&& ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i' - UNINSTALL_PLUGIN='&& rm -f ${DESTDIR}${plugindir}/$$i' CLEAN_LIB='' ;; *) @@ -329,14 +290,8 @@ AC_DEFUN([BUILDSYS_SHARED_LIB], [ AS_IF([test x"$enable_rpath" != x"no"], [ LDFLAGS_RPATH='-Wl,-rpath,${libdir}' ]) - PLUGIN_CFLAGS='-fPIC -DPIC' - PLUGIN_LDFLAGS='-shared' - PLUGIN_SUFFIX='.so' - LINK_PLUGIN='${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' - INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0 && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.0 ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.0 ${DESTDIR}${libdir}/$$i' - UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.0' - INSTALL_PLUGIN='&& ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i' - UNINSTALL_PLUGIN='&& rm -f ${DESTDIR}${plugindir}/$$i' + INSTALL_LIB='&& ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.${LIB_PATCH} && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.${LIB_PATCH} ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} && ${LN_S} -f $$i.${LIB_MAJOR}.${LIB_MINOR}.${LIB_PATCH} ${DESTDIR}${libdir}/$$i' + UNINSTALL_LIB='&& rm -f ${DESTDIR}${libdir}/$$i ${DESTDIR}${libdir}/$$i.${LIB_MAJOR} ${DESTDIR}${libdir}/$$i.${LIB_MAJOR}.${LIB_MINOR}.${LIB_PATCH}' CLEAN_LIB='' ;; esac @@ -348,14 +303,8 @@ AC_DEFUN([BUILDSYS_SHARED_LIB], [ AC_SUBST(LIB_SUFFIX) AC_SUBST(LINK_LIB) AC_SUBST(LDFLAGS_RPATH) - AC_SUBST(PLUGIN_CFLAGS) - AC_SUBST(PLUGIN_LDFLAGS) - AC_SUBST(PLUGIN_SUFFIX) - AC_SUBST(LINK_PLUGIN) AC_SUBST(INSTALL_LIB) AC_SUBST(UNINSTALL_LIB) - AC_SUBST(INSTALL_PLUGIN) - AC_SUBST(UNINSTALL_PLUGIN) AC_SUBST(CLEAN_LIB) ]) @@ -364,15 +313,12 @@ AC_DEFUN([BUILDSYS_FRAMEWORK], [ AC_REQUIRE([BUILDSYS_CHECK_IOS]) AC_REQUIRE([BUILDSYS_SHARED_LIB]) - AC_CHECK_TOOL(CODESIGN, codesign) - case "$host_os" in darwin*) + FRAMEWORK_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR}' AS_IF([test x"$host_is_ios" = x"yes"], [ - FRAMEWORK_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR}' FRAMEWORK_LDFLAGS_INSTALL_NAME='-Wl,-install_name,@executable_path/Frameworks/$$out/$${out%.framework}' ], [ - FRAMEWORK_LDFLAGS='-dynamiclib -current_version ${LIB_MAJOR}.${LIB_MINOR} -compatibility_version ${LIB_MAJOR}' FRAMEWORK_LDFLAGS_INSTALL_NAME='-Wl,-install_name,@executable_path/../Frameworks/$$out/$${out%.framework}' ]) @@ -384,3 +330,60 @@ AC_DEFUN([BUILDSYS_FRAMEWORK], [ ;; esac ]) + +AC_DEFUN([BUILDSYS_PLUGIN], [ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([BUILDSYS_CHECK_IOS]) + AC_MSG_CHECKING(for plugin type) + + case "$host" in + *-*-darwin*) + AC_MSG_RESULT(Darwin) + PLUGIN_CFLAGS='-fPIC -DPIC' + PLUGIN_LDFLAGS='-bundle' + PLUGIN_SUFFIX='.dylib' + ;; + *-*-mingw* | *-*-cygwin*) + AC_MSG_RESULT(MinGW / Cygwin) + PLUGIN_CFLAGS='' + PLUGIN_LDFLAGS='-shared -Wl,--export-all-symbols' + PLUGIN_SUFFIX='.dll' + ;; + hppa*-*-hpux*) + AC_MSG_RESULT([HP-UX (PA-RISC)]) + PLUGIN_CFLAGS='-fPIC -DPIC' + PLUGIN_LDFLAGS='-shared' + PLUGIN_SUFFIX='.sl' + ;; + *) + AC_MSG_RESULT(ELF) + PLUGIN_CFLAGS='-fPIC -DPIC' + PLUGIN_LDFLAGS='-shared' + PLUGIN_SUFFIX='.so' + ;; + esac + + AC_SUBST(PLUGIN_CFLAGS) + AC_SUBST(PLUGIN_LDFLAGS) + AC_SUBST(PLUGIN_SUFFIX) +]) + +AC_DEFUN([BUILDSYS_BUNDLE], [ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([BUILDSYS_CHECK_IOS]) + AC_REQUIRE([BUILDSYS_PLUGIN]) + + case "$host_os" in + darwin*) + AS_IF([test x"$host_is_ios" = x"yes"], [ + LINK_BUNDLE='${MKDIR_P} $$out && ${INSTALL} -m 644 Info.plist $$out/Info.plist && ${LD} -o $$out/$${out%.bundle} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' + ], [ + LINK_BUNDLE='${MKDIR_P} $$out/Contents/MacOS && ${INSTALL} -m 644 Info.plist $$out/Contents/Info.plist && ${LD} -o $$out/Contents/MacOS/$${out%.bundle} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}' + ]) + + AC_SUBST(LINK_BUNDLE) + + $1 + ;; + esac +]) diff --git a/buildsys.mk.in b/buildsys.mk.in index a433235..4120c08 100644 --- a/buildsys.mk.in +++ b/buildsys.mk.in @@ -1,25 +1,21 @@ # # Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, -# 2017, 2018, 2020, 2021, 2022 +# 2017, 2018, 2020, 2021, 2022, 2023, 2024 # Jonathan Schleifer # -# https://fossil.nil.im/buildsys +# https://fl.nil.im/buildsys # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice is present in all copies. +# copyright notice and this permission notice appear in all copies. # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. # PACKAGE_NAME = @PACKAGE_NAME@ @@ -89,6 +85,7 @@ bindir = @bindir@ libdir = @libdir@ amigalibdir ?= ${prefix}/libs plugindir ?= ${libdir}/${PACKAGE_NAME} +bundledir ?= ${prefix}/Library/PlugIns/${PACKAGE_NAME} datarootdir = @datarootdir@ datadir = @datadir@ includedir = @includedir@ @@ -123,18 +120,31 @@ DEPS = ${OBJS:.o=.dep} \ MO_FILES = ${LOCALES:.po=.mo} -.SILENT: +@SILENT@ .SUFFIXES: -.SUFFIXES: .amigalib.o .beam .c .cc .class .cxx .d .erl .lib.o .java .mo .m .mm .o .plugin.o .po .py .pyc .rc .S .xpm -.PHONY: all subdirs subdirs-after pre-depend depend install install-extra uninstall uninstall-extra clean distclean locales copy-headers-into-framework ${SUBDIRS} ${SUBDIRS_AFTER} +.SUFFIXES: .amigalib.o .beam .c .cc .class .cxx .d .erl .lib.o .java \ + .mo .m .mm .o .plugin.o .po .py .pyc .rc .S .xpm +.PHONY: all subdirs subdirs-after pre-depend depend install \ + install-extra uninstall uninstall-extra clean distclean locales \ + copy-headers-into-framework ${SUBDIRS} ${SUBDIRS_AFTER} all: - ${MAKE} -s pre-all - ${MAKE} -s subdirs - ${MAKE} -s depend - ${MAKE} -s ${STATIC_LIB} ${STATIC_LIB_NOINST} ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} ${STATIC_AMIGA_LIB} ${STATIC_AMIGA_LIB_NOINST} ${SHARED_LIB} ${SHARED_LIB_NOINST} ${FRAMEWORK} ${FRAMEWORK_NOINST} ${AMIGA_LIB} ${AMIGA_LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST} ${JARFILE} locales - ${MAKE} -s subdirs-after - ${MAKE} -s post-all + ${MAKE} @MAKEFLAGS_SILENT@ pre-all + ${MAKE} @MAKEFLAGS_SILENT@ subdirs + ${MAKE} @MAKEFLAGS_SILENT@ depend + ${MAKE} @MAKEFLAGS_SILENT@ \ + ${STATIC_LIB} ${STATIC_LIB_NOINST} \ + ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} \ + ${STATIC_AMIGA_LIB}${STATIC_AMIGA_LIB_NOINST} \ + ${SHARED_LIB} ${SHARED_LIB_NOINST} \ + ${FRAMEWORK} ${FRAMEWORK_NOINST} \ + ${AMIGA_LIB} ${AMIGA_LIB_NOINST} \ + ${PLUGIN} ${PLUGIN_NOINST} \ + ${BUNDLE} ${BUNDLE_NOINST} \ + ${PROG} ${PROG_NOINST} \ + ${JARFILE} locales + ${MAKE} @MAKEFLAGS_SILENT@ subdirs-after + ${MAKE} @MAKEFLAGS_SILENT@ post-all pre-all post-all: @@ -144,7 +154,7 @@ subdirs-after: ${SUBDIRS_AFTER} ${SUBDIRS} ${SUBDIRS_AFTER}: for i in $@; do \ ${DIR_ENTER}; \ - ${MAKE} -s || exit $$?; \ + ${MAKE} @MAKEFLAGS_SILENT@ || exit $$?; \ ${DIR_LEAVE}; \ done @@ -169,7 +179,8 @@ ${PROG} ${PROG_NOINST}: ${EXT_DEPS} ${OBJS} ${OBJS_EXTRA} ${JARFILE}: ${EXT_DEPS} ${JAR_MANIFEST} ${OBJS} ${OBJS_EXTRA} ${LINK_STATUS} if test x"${JAR_MANIFEST}" != x""; then \ - if ${JAR} cfm ${JARFILE} ${JAR_MANIFEST} ${OBJS} ${OBJS_EXTRA}; then \ + if ${JAR} cfm ${JARFILE} ${JAR_MANIFEST} ${OBJS} \ + ${OBJS_EXTRA}; then \ ${LINK_OK}; \ else \ ${LINK_FAILED}; \ @@ -185,7 +196,8 @@ ${JARFILE}: ${EXT_DEPS} ${JAR_MANIFEST} ${OBJS} ${OBJS_EXTRA} ${SHARED_LIB} ${SHARED_LIB_NOINST}: ${EXT_DEPS} ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${LINK_STATUS} out="$@"; \ - if ${LD} -o $@ ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${LIB_LDFLAGS} ${LIB_LDFLAGS_INSTALL_NAME} ${LDFLAGS} ${LIBS} ${LINK_LIB}; then \ + if ${LD} -o $@ ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${LIB_LDFLAGS} \ + ${LIB_LDFLAGS_INSTALL_NAME} ${LDFLAGS} ${LIBS} ${LINK_LIB}; then \ ${LINK_OK}; \ else \ ${LINK_FAILED}; \ @@ -194,41 +206,109 @@ ${SHARED_LIB} ${SHARED_LIB_NOINST}: ${EXT_DEPS} ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${FRAMEWORK} ${FRAMEWORK_NOINST}: ${EXT_DEPS} ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${LINK_STATUS} out="$@"; \ - if rm -fr $$out && ${MKDIR_P} $$out && ${MAKE} -s COPY_HEADERS_IF_SUBDIR=${includesubdir} COPY_HEADERS_DESTINATION=$$PWD/$@/Headers copy-headers-into-framework && if test -f Info.plist; then ${INSTALL} -m 644 Info.plist $$out/Info.plist; fi && if test -f module.modulemap; then ${MKDIR_P} $$out/Modules && ${INSTALL} -m 644 module.modulemap $$out/Modules/module.modulemap; fi && ${LD} -o $$out/$${out%.framework} ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${FRAMEWORK_LDFLAGS} ${FRAMEWORK_LDFLAGS_INSTALL_NAME} ${LDFLAGS} ${FRAMEWORK_LIBS} && ${CODESIGN} -fs ${CODESIGN_IDENTITY} $$out; then \ - ${LINK_OK}; \ + if test x"@HOST_IS_IOS@" = x"yes"; then \ + if rm -fr $@ && \ + ${MAKE} @MAKEFLAGS_SILENT@ \ + COPY_HEADERS_IF_SUBDIR=${includesubdir} \ + COPY_HEADERS_DESTINATION=$$PWD/$@/Headers \ + copy-headers-into-framework && \ + ${INSTALL} -m 644 Info.plist $@/Info.plist && \ + if test -f module.modulemap; then \ + ${MKDIR_P} $@/Modules && \ + ${INSTALL} -m 644 module.modulemap \ + $@/Modules/module.modulemap; \ + fi && \ + ${LD} -o $@/$${out%.framework} \ + ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${FRAMEWORK_LDFLAGS} \ + ${FRAMEWORK_LDFLAGS_INSTALL_NAME} ${LDFLAGS} \ + ${FRAMEWORK_LIBS} && \ + ${CODESIGN} -fs ${CODESIGN_IDENTITY} $@; then \ + ${LINK_OK}; \ + else \ + rm -fr $$out; false; \ + ${LINK_FAILED}; \ + fi; \ else \ - rm -fr $$out; false; \ - ${LINK_FAILED}; \ + versiondir="$@/Versions/${LIB_MAJOR}"; \ + if rm -fr $@ && \ + ${MKDIR_P} $$versiondir && \ + ${LN_S} ${LIB_MAJOR} $@/Versions/Current && \ + ${MAKE} @MAKEFLAGS_SILENT@ \ + COPY_HEADERS_IF_SUBDIR=${includesubdir} \ + COPY_HEADERS_DESTINATION=$$PWD/$$versiondir/Headers \ + copy-headers-into-framework && \ + ${LN_S} Versions/Current/Headers $@/Headers && \ + if test -f Info.plist; then \ + ${MKDIR_P} $$versiondir/Resources && \ + ${INSTALL} -m 644 Info.plist \ + $$versiondir/Resources/Info.plist && \ + ${LN_S} Versions/Current/Resources $@/Resources; \ + fi && \ + if test -f module.modulemap; then \ + ${MKDIR_P} $$versiondir/Modules && \ + ${INSTALL} -m 644 module.modulemap \ + $$versiondir/Modules/module.modulemap && \ + ${LN_S} Versions/Current/Modules $@/Modules; \ + fi && \ + ${LD} -o $$versiondir/$${out%.framework} \ + ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${FRAMEWORK_LDFLAGS} \ + ${FRAMEWORK_LDFLAGS_INSTALL_NAME} ${LDFLAGS} \ + ${FRAMEWORK_LIBS} && \ + ${LN_S} Versions/Current/$${out%.framework} \ + $@/$${out%.framework} && \ + ${CODESIGN} -fs ${CODESIGN_IDENTITY} $@; then \ + ${LINK_OK}; \ + else \ + rm -fr $$out; false; \ + ${LINK_FAILED}; \ + fi; \ fi copy-headers-into-framework: for i in "" ${SUBDIRS} ${SUBDIRS_AFTER}; do \ test x"$$i" = x"" && continue; \ cd $$i || exit 1; \ - ${MAKE} -s copy-headers-into-framework || exit $$?; \ + ${MAKE} @MAKEFLAGS_SILENT@ copy-headers-into-framework || \ + exit $$?; \ cd .. || exit 1; \ done if test x"${includesubdir}" = x"${COPY_HEADERS_IF_SUBDIR}"; then \ for i in "" ${INCLUDES}; do \ test x"$$i" = x"" && continue; \ - ${MKDIR_P} $$(dirname ${COPY_HEADERS_DESTINATION}/$$i) || exit $$?; \ - ${INSTALL} -m 644 $$i ${COPY_HEADERS_DESTINATION}/$$i || exit $$?; \ + ${MKDIR_P} \ + $$(dirname ${COPY_HEADERS_DESTINATION}/$$i) || \ + exit $$?; \ + ${INSTALL} -m 644 $$i \ + ${COPY_HEADERS_DESTINATION}/$$i || exit $$?; \ done \ fi -${AMIGA_LIB} ${AMIGA_LIB_NOINST}: ${EXT_DEPS} ${AMIGA_LIB_OBJS_START} ${AMIGA_LIB_OBJS} ${AMIGA_LIB_OBJS_EXTRA} +${AMIGA_LIB} ${AMIGA_LIB_NOINST}: ${EXT_DEPS} ${AMIGA_LIB_OBJS_START} \ + ${AMIGA_LIB_OBJS} ${AMIGA_LIB_OBJS_EXTRA} ${LINK_STATUS} - if ${LD} -o $@ ${AMIGA_LIB_OBJS_START} ${AMIGA_LIB_OBJS} ${AMIGA_LIB_OBJS_EXTRA} ${AMIGA_LIB_LDFLAGS} ${AMIGA_LIB_LIBS}; then \ + if ${LD} -o $@ ${AMIGA_LIB_OBJS_START} ${AMIGA_LIB_OBJS} \ + ${AMIGA_LIB_OBJS_EXTRA} ${AMIGA_LIB_LDFLAGS} \ + ${AMIGA_LIB_LIBS}; then \ ${LINK_OK}; \ else \ ${LINK_FAILED}; \ fi -${PLUGIN} ${PLUGIN_NOINST}: ${EXT_DEPS} ${PLUGIN_OBJS} +${PLUGIN} ${PLUGIN_NOINST}: ${EXT_DEPS} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${LINK_STATUS} out="$@"; \ - if @LINK_PLUGIN@; then \ + if ${LD} -o $$out ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}; then \ + ${LINK_OK}; \ + else \ + rm -fr $$out; false; \ + ${LINK_FAILED}; \ + fi + +${BUNDLE} ${BUNDLE_NOINST}: ${EXT_DEPS} ${PLUGIN_OBJS} ${PLUGIN_OBJS_EXTRA} + ${LINK_STATUS} + out="$@"; \ + if rm -fr $$out && @LINK_BUNDLE@ && ${CODESIGN} -fs ${CODESIGN_IDENTITY} $$out; then \ ${LINK_OK}; \ else \ rm -fr $$out; false; \ @@ -282,11 +362,13 @@ ${STATIC_LIB} ${STATIC_LIB_NOINST}: ${EXT_DEPS} ${OBJS} ${OBJS_EXTRA} done; \ fi -${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST}: ${EXT_DEPS} ${LIB_OBJS} ${LIB_OBJS_EXTRA} +${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST}: ${EXT_DEPS} ${LIB_OBJS} \ + ${LIB_OBJS_EXTRA} ${LINK_STATUS} rm -f $@ if test x"${BUILD_AND_HOST_ARE_DARWIN}" = x"yes"; then \ - if /usr/bin/libtool -static -o $@ ${LIB_OBJS} ${LIB_OBJS_EXTRA}; then \ + if /usr/bin/libtool -static -o $@ ${LIB_OBJS} \ + ${LIB_OBJS_EXTRA}; then \ ${LINK_OK}; \ else \ rm -f $@; false; \ @@ -329,7 +411,8 @@ ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST}: ${EXT_DEPS} ${LIB_OBJS} ${LIB_OBJS_E done; \ fi -${STATIC_AMIGA_LIB} ${STATIC_AMIGA_LIB_NOINST}: ${EXT_DEPS} ${AMIGA_LIB_OBJS} ${AMIGA_LIB_OBJS_EXTRA} +${STATIC_AMIGA_LIB} ${STATIC_AMIGA_LIB_NOINST}: ${EXT_DEPS} ${AMIGA_LIB_OBJS} \ + ${AMIGA_LIB_OBJS_EXTRA} ${LINK_STATUS} rm -f $@ out="$@"; \ @@ -373,7 +456,8 @@ locales: ${MO_FILES} ${COMPILE_STATUS} in="$<"; \ out="$@"; \ - if ${CC} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} ${DEP_CFLAGS} -c -o $@ $<; then \ + if ${CC} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} ${DEP_CFLAGS} \ + -c -o $@ $<; then \ ${COMPILE_OK}; \ else \ ${COMPILE_FAILED}; \ @@ -382,7 +466,8 @@ locales: ${MO_FILES} ${COMPILE_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${CC} ${LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} ${DEP_CFLAGS} -c -o $@ $<; then \ + if ${CC} ${LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} \ + ${DEP_CFLAGS} -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ @@ -391,7 +476,8 @@ locales: ${MO_FILES} ${COMPILE_AMIGA_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${CC} ${AMIGA_LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} ${DEP_CFLAGS} -c -o $@ $<; then \ + if ${CC} ${AMIGA_LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} \ + ${CFLAGS_$@} ${DEP_CFLAGS} -c -o $@ $<; then \ ${COMPILE_AMIGA_LIB_OK}; \ else \ ${COMPILE_AMIGA_LIB_FAILED}; \ @@ -400,7 +486,8 @@ locales: ${MO_FILES} ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ - if ${CC} ${PLUGIN_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} ${DEP_CFLAGS} -c -o $@ $<; then \ + if ${CC} ${PLUGIN_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} \ + ${CFLAGS_$@} ${DEP_CFLAGS} -c -o $@ $<; then \ ${COMPILE_PLUGIN_OK}; \ else \ ${COMPILE_PLUGIN_FAILED}; \ @@ -410,7 +497,8 @@ locales: ${MO_FILES} ${COMPILE_STATUS} in="$<"; \ out="$@"; \ - if ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$<} ${CXXFLAGS_$@} ${DEP_CXXFLAGS} -c -o $@ $<; then \ + if ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$<} ${CXXFLAGS_$@} \ + ${DEP_CXXFLAGS} -c -o $@ $<; then \ ${COMPILE_OK}; \ else \ ${COMPILE_FAILED}; \ @@ -419,7 +507,8 @@ locales: ${MO_FILES} ${COMPILE_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${CXX} ${LIB_CFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$<} ${CXXFLAGS_$@} ${DEP_CXXFLAGS} -c -o $@ $<; then \ + if ${CXX} ${LIB_CFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$<} \ + ${CXXFLAGS_$@} ${DEP_CXXFLAGS} -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ @@ -428,7 +517,8 @@ locales: ${MO_FILES} ${COMPILE_AMIGA_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${CXX} ${AMIGA_LIB_CFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$<} ${CXXFLAGS_$@} ${DEP_CXXFLAGS} -c -o $@ $<; then \ + if ${CXX} ${AMIGA_LIB_CFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$<} \ + ${CXXFLAGS_$@} ${DEP_CXXFLAGS} -c -o $@ $<; then \ ${COMPILE_AMIGA_LIB_OK}; \ else \ ${COMPILE_AMIGA_LIB_FAILED}; \ @@ -437,7 +527,8 @@ locales: ${MO_FILES} ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ - if ${CXX} ${PLUGIN_CFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$<} ${CXXFLAGS_$@} ${DEP_CXXFLAGS} -c -o $@ $<; then \ + if ${CXX} ${PLUGIN_CFLAGS} ${CXXFLAGS} ${CPPFLAGS} ${CXXFLAGS_$<} \ + ${CXXFLAGS_$@} ${DEP_CXXFLAGS} -c -o $@ $<; then \ ${COMPILE_PLUGIN_OK}; \ else \ ${COMPILE_PLUGIN_FAILED}; \ @@ -485,7 +576,8 @@ locales: ${MO_FILES} ${COMPILE_STATUS} in="$<"; \ out="$@"; \ - if ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${OBJCFLAGS_$<} ${OBJCFLAGS_$@} ${DEP_OBJCFLAGS} -c -o $@ $<; then \ + if ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${OBJCFLAGS_$<} ${OBJCFLAGS_$@} \ + ${DEP_OBJCFLAGS} -c -o $@ $<; then \ ${COMPILE_OK}; \ else \ ${COMPILE_FAILED}; \ @@ -494,7 +586,8 @@ locales: ${MO_FILES} ${COMPILE_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${OBJC} ${LIB_CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} ${OBJCFLAGS_$<} ${OBJCFLAGS_$@} ${DEP_OBJCFLAGS} -c -o $@ $<; then \ + if ${OBJC} ${LIB_CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} ${OBJCFLAGS_$<} \ + ${OBJCFLAGS_$@} ${DEP_OBJCFLAGS} -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ @@ -503,7 +596,8 @@ locales: ${MO_FILES} ${COMPILE_AMIGA_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${OBJC} ${AMIGA_LIB_CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} ${OBJCFLAGS_$<} ${OBJCFLAGS_$@} ${DEP_OBJCFLAGS} -c -o $@ $<; then \ + if ${OBJC} ${AMIGA_LIB_CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} \ + ${OBJCFLAGS_$<} ${OBJCFLAGS_$@} ${DEP_OBJCFLAGS} -c -o $@ $<; then \ ${COMPILE_AMIGA_LIB_OK}; \ else \ ${COMPILE_AMIGA_LIB_FAILED}; \ @@ -512,7 +606,8 @@ locales: ${MO_FILES} ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ - if ${OBJC} ${PLUGIN_CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} ${OBJCFLAGS_$<} ${OBJCFLAGS_$@} ${DEP_OBJCFLAGS} -c -o $@ $<; then \ + if ${OBJC} ${PLUGIN_CFLAGS} ${OBJCFLAGS} ${CPPFLAGS} ${OBJCFLAGS_$<} \ + ${OBJCFLAGS_$@} ${DEP_OBJCFLAGS} -c -o $@ $<; then \ ${COMPILE_PLUGIN_OK}; \ else \ ${COMPILE_PLUGIN_FAILED}; \ @@ -522,7 +617,8 @@ locales: ${MO_FILES} ${COMPILE_STATUS} in="$<"; \ out="$@"; \ - if ${OBJCXX} ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$<} ${OBJCXXFLAGS_$@} ${DEP_OBJCXXFLAGS} -c -o $@ $<; then \ + if ${OBJCXX} ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$<} \ + ${OBJCXXFLAGS_$@} ${DEP_OBJCXXFLAGS} -c -o $@ $<; then \ ${COMPILE_OK}; \ else \ ${COMPILE_FAILED}; \ @@ -531,7 +627,9 @@ locales: ${MO_FILES} ${COMPILE_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${OBJCXX} ${LIB_CFLAGS} ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$<} ${OBJCXXFLAGS_$@} ${DEP_OBJCXXFLAGS} -c -o $@ $<; then \ + if ${OBJCXX} ${LIB_CFLAGS} ${OBJCXXFLAGS} ${CPPFLAGS} \ + ${OBJCXXFLAGS_$<} ${OBJCXXFLAGS_$@} ${DEP_OBJCXXFLAGS} -c -o $@ \ + $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ @@ -540,7 +638,9 @@ locales: ${MO_FILES} ${COMPILE_AMIGA_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${OBJCXX} ${AMIGA_LIB_CFLAGS} ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$<} ${OBJCXXFLAGS_$@} ${DEP_OBJCXXFLAGS} -c -o $@ $<; then \ + if ${OBJCXX} ${AMIGA_LIB_CFLAGS} ${OBJCXXFLAGS} ${CPPFLAGS} \ + ${OBJCXXFLAGS_$<} ${OBJCXXFLAGS_$@} ${DEP_OBJCXXFLAGS} -c -o $@ \ + $<; then \ ${COMPILE_AMIGA_LIB_OK}; \ else \ ${COMPILE_AMIGA_LIB_FAILED}; \ @@ -549,7 +649,9 @@ locales: ${MO_FILES} ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ - if ${OBJCXX} ${PLUGIN_CFLAGS} ${OBJCXXFLAGS} ${CPPFLAGS} ${OBJCXXFLAGS_$<} ${OBJCXXFLAGS_$@} ${DEP_OBJCXXFLAGS} -c -o $@ $<; then \ + if ${OBJCXX} ${PLUGIN_CFLAGS} ${OBJCXXFLAGS} ${CPPFLAGS} \ + ${OBJCXXFLAGS_$<} ${OBJCXXFLAGS_$@} ${DEP_OBJCXXFLAGS} -c -o $@ \ + $<; then \ ${COMPILE_PLUGIN_OK}; \ else \ ${COMPILE_PLUGIN_FAILED}; \ @@ -569,7 +671,8 @@ locales: ${MO_FILES} ${COMPILE_STATUS} in="$<"; \ out="$@"; \ - if ${PYTHON} ${PYTHON_FLAGS} -c "import py_compile; py_compile.compile('$<')"; then \ + if ${PYTHON} ${PYTHON_FLAGS} -c \ + "import py_compile; py_compile.compile('$<')"; then \ ${COMPILE_OK}; \ else \ ${COMPILE_FAILED}; \ @@ -589,7 +692,8 @@ locales: ${MO_FILES} ${COMPILE_STATUS} in="$<"; \ out="$@"; \ - if ${AS} ${ASFLAGS} ${CPPFLAGS} ${ASFLAGS_$<} ${ASFLAGS_$@} ${DEP_ASFLAGS} -c -o $@ $<; then \ + if ${AS} ${ASFLAGS} ${CPPFLAGS} ${ASFLAGS_$<} ${ASFLAGS_$@} \ + ${DEP_ASFLAGS} -c -o $@ $<; then \ ${COMPILE_OK}; \ else \ ${COMPILE_FAILED}; \ @@ -598,7 +702,8 @@ locales: ${MO_FILES} ${COMPILE_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${AS} ${LIB_CFLAGS} ${ASFLAGS} ${CPPFLAGS} ${ASFLAGS_$<} ${ASFLAGS_$@} ${DEP_ASFLAGS} -c -o $@ $<; then \ + if ${AS} ${LIB_CFLAGS} ${ASFLAGS} ${CPPFLAGS} ${ASFLAGS_$<} \ + ${ASFLAGS_$@} ${DEP_ASFLAGS} -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ @@ -607,7 +712,8 @@ locales: ${MO_FILES} ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ - if ${AS} ${PLUGIN_CFLAGS} ${ASFLAGS} ${CPPFLAGS} ${ASFLAGS_$<} ${ASFLAGS_$@} ${DEP_ASFLAGS} -c -o $@ $<; then \ + if ${AS} ${PLUGIN_CFLAGS} ${ASFLAGS} ${CPPFLAGS} ${ASFLAGS_$<} \ + ${ASFLAGS_$@} ${DEP_ASFLAGS} -c -o $@ $<; then \ ${COMPILE_PLUGIN_OK}; \ else \ ${COMPILE_PLUGIN_FAILED}; \ @@ -617,7 +723,8 @@ locales: ${MO_FILES} ${COMPILE_STATUS} in="$<"; \ out="$@"; \ - if ${CC} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} -x c -c -o $@ $<; then \ + if ${CC} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} -x c -c -o $@ \ + $<; then \ ${COMPILE_OK}; \ else \ ${COMPILE_FAILED}; \ @@ -626,7 +733,8 @@ locales: ${MO_FILES} ${COMPILE_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${CC} ${LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} -x c -c -o $@ $<; then \ + if ${CC} ${LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} \ + -x c -c -o $@ $<; then \ ${COMPILE_LIB_OK}; \ else \ ${COMPILE_LIB_FAILED}; \ @@ -635,7 +743,8 @@ locales: ${MO_FILES} ${COMPILE_AMIGA_LIB_STATUS} in="$<"; \ out="$@"; \ - if ${CC} ${AMIGA_LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} -x c -c -o $@ $<; then \ + if ${CC} ${AMIGA_LIB_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} \ + ${CFLAGS_$@} -x c -c -o $@ $<; then \ ${COMPILE_AMIGA_LIB_OK}; \ else \ ${COMPILE_AMIGA_LIB_FAILED}; \ @@ -644,7 +753,8 @@ locales: ${MO_FILES} ${COMPILE_PLUGIN_STATUS} in="$<"; \ out="$@"; \ - if ${CC} ${PLUGIN_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} ${CFLAGS_$@} -x c -c -o $@ $<; then \ + if ${CC} ${PLUGIN_CFLAGS} ${CFLAGS} ${CPPFLAGS} ${CFLAGS_$<} \ + ${CFLAGS_$@} -x c -c -o $@ $<; then \ ${COMPILE_PLUGIN_OK}; \ else \ ${COMPILE_PLUGIN_FAILED}; \ @@ -654,7 +764,7 @@ install: all install-extra for i in "" ${SUBDIRS} ${SUBDIRS_AFTER}; do \ test x"$$i" = x"" && continue; \ ${DIR_ENTER}; \ - ${MAKE} -s install || exit $$?; \ + ${MAKE} @MAKEFLAGS_SILENT@ install || exit $$?; \ ${DIR_LEAVE}; \ done @@ -672,7 +782,8 @@ install: all install-extra test x"$$i" = x"" && continue; \ ${INSTALL_STATUS}; \ rm -fr ${DESTDIR}${prefix}/Library/Frameworks/$$i; \ - if ${MKDIR_P} ${DESTDIR}${prefix}/Library/Frameworks && cp -R $$i ${DESTDIR}${prefix}/Library/Frameworks/; then \ + if ${MKDIR_P} ${DESTDIR}${prefix}/Library/Frameworks && \ + cp -R $$i ${DESTDIR}${prefix}/Library/Frameworks/; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \ @@ -682,7 +793,8 @@ install: all install-extra for i in "" ${AMIGA_LIB}; do \ test x"$$i" = x"" && continue; \ ${INSTALL_STATUS}; \ - if ${MKDIR_P} ${DESTDIR}${amigalibdir} && ${INSTALL} -m 755 $$i ${DESTDIR}${amigalibdir}/$$i; then \ + if ${MKDIR_P} ${DESTDIR}${amigalibdir} && \ + ${INSTALL} -m 755 $$i ${DESTDIR}${amigalibdir}/$$i; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \ @@ -692,7 +804,8 @@ install: all install-extra for i in "" ${STATIC_LIB} ${STATIC_PIC_LIB} ${STATIC_AMIGA_LIB}; do \ test x"$$i" = x"" && continue; \ ${INSTALL_STATUS}; \ - if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${libdir}/$$i; then \ + if ${MKDIR_P} ${DESTDIR}${libdir} && \ + ${INSTALL} -m 644 $$i ${DESTDIR}${libdir}/$$i; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \ @@ -702,7 +815,19 @@ install: all install-extra for i in "" ${PLUGIN}; do \ test x"$$i" = x"" && continue; \ ${INSTALL_STATUS}; \ - if ${MKDIR_P} ${DESTDIR}${plugindir} @INSTALL_PLUGIN@; then \ + if ${MKDIR_P} ${DESTDIR}${plugindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i; then \ + ${INSTALL_OK}; \ + else \ + ${INSTALL_FAILED}; \ + fi \ + done + + for i in "" ${BUNDLE}; do \ + test x"$$i" = x"" && continue; \ + ${INSTALL_STATUS}; \ + rm -fr ${DESTDIR}${bundledir}/$$i; \ + if ${MKDIR_P} ${DESTDIR}${bundledir} && \ + cp -R $$i ${DESTDIR}${bundledir}/; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \ @@ -712,7 +837,10 @@ install: all install-extra for i in "" ${DATA}; do \ test x"$$i" = x"" && continue; \ ${INSTALL_STATUS}; \ - if ${MKDIR_P} $$(dirname ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i) && ${INSTALL} -m 644 $$i ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i; then \ + if ${MKDIR_P} $$(dirname \ + ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i) && \ + ${INSTALL} -m 644 $$i \ + ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \ @@ -722,7 +850,8 @@ install: all install-extra for i in "" ${PROG}; do \ test x"$$i" = x"" && continue; \ ${INSTALL_STATUS}; \ - if ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i; then \ + if ${MKDIR_P} ${DESTDIR}${bindir} && \ + ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \ @@ -733,7 +862,10 @@ install: all install-extra for i in "" ${INCLUDES}; do \ test x"$$i" = x"" && continue; \ ${INSTALL_STATUS}; \ - if ${MKDIR_P} $$(dirname ${DESTDIR}${includedir}/${includesubdir}/$$i) && ${INSTALL} -m 644 $$i ${DESTDIR}${includedir}/${includesubdir}/$$i; then \ + if ${MKDIR_P} $$(dirname \ + ${DESTDIR}${includedir}/${includesubdir}/$$i) && \ + ${INSTALL} -m 644 $$i \ + ${DESTDIR}${includedir}/${includesubdir}/$$i; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \ @@ -744,7 +876,10 @@ install: all install-extra for i in "" ${MO_FILES}; do \ test x"$$i" = x"" && continue; \ ${INSTALL_STATUS}; \ - if ${MKDIR_P} ${DESTDIR}${localedir}/$${i%.mo}/LC_MESSAGES && ${INSTALL} -m 644 $$i ${DESTDIR}${localedir}/$${i%.mo}/LC_MESSAGES/${localename}.mo; then \ + dest="${localedir}/$${i%.mo}/LC_MESSAGES/${localename}.mo"; \ + dest="${DESTDIR}$$dest"; \ + if ${MKDIR_P} ${DESTDIR}${localedir}/$${i%.mo}/LC_MESSAGES && \ + ${INSTALL} -m 644 $$i $$dest; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \ @@ -754,7 +889,9 @@ install: all install-extra for i in "" ${MAN}; do \ test x"$$i" = x"" && continue; \ ${INSTALL_STATUS}; \ - if ${MKDIR_P} ${DESTDIR}${mandir}/${mansubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${mandir}/${mansubdir}/$$i; then \ + dest="${DESTDIR}${mandir}/${mansubdir}/$$i"; \ + if ${MKDIR_P} ${DESTDIR}${mandir}/${mansubdir} && \ + ${INSTALL} -m 644 $$i $$dest; then \ ${INSTALL_OK}; \ else \ ${INSTALL_FAILED}; \ @@ -763,17 +900,18 @@ install: all install-extra install-extra: -uninstall: uninstall-extra +uninstall: for i in "" ${SUBDIRS} ${SUBDIRS_AFTER}; do \ test x"$$i" = x"" && continue; \ ${DIR_ENTER}; \ - ${MAKE} -s uninstall || exit $$?; \ + ${MAKE} @MAKEFLAGS_SILENT@ uninstall || exit $$?; \ ${DIR_LEAVE}; \ done for i in "" ${SHARED_LIB}; do \ test x"$$i" = x"" && continue; \ - if test -f ${DESTDIR}${libdir}/$$i -o -f ${DESTDIR}${bindir}/$$i; then \ + if test -f ${DESTDIR}${libdir}/$$i \ + -o -f ${DESTDIR}${bindir}/$$i; then \ if : @UNINSTALL_LIB@; then \ ${DELETE_OK}; \ else \ @@ -785,7 +923,8 @@ uninstall: uninstall-extra for i in "" ${FRAMEWORK}; do \ test x"$$i" = x"" && continue; \ if test -d ${DESTDIR}${prefix}/Library/Frameworks/$$i; then \ - if rm -fr ${DESTDIR}${prefix}/Library/Frameworks/$$i; then \ + if rm -fr ${DESTDIR}${prefix}/Library/Frameworks/$$i; \ + then \ ${DELETE_OK}; \ else \ ${DELETE_FAILED}; \ @@ -809,7 +948,7 @@ uninstall: uninstall-extra for i in "" ${PLUGIN}; do \ test x"$$i" = x"" && continue; \ if test -e ${DESTDIR}${plugindir}/$$i; then \ - if : @UNINSTALL_PLUGIN@; then \ + if rm -f ${DESTDIR}${plugindir}/$$i; then \ ${DELETE_OK}; \ else \ ${DELETE_FAILED}; \ @@ -818,16 +957,32 @@ uninstall: uninstall-extra done rmdir ${DESTDIR}${plugindir} >/dev/null 2>&1 || true + for i in "" ${BUNDLE}; do \ + test x"$$i" = x"" && continue; \ + if test -d ${DESTDIR}${bundledir}/$$i; then \ + if rm -fr ${DESTDIR}${bundledir}/$$i; \ + then \ + ${DELETE_OK}; \ + else \ + ${DELETE_FAILED}; \ + fi \ + fi \ + done + rmdir ${DESTDIR}${bundledir} >/dev/null 2>&1 || true + rmdir ${DESTDIR}${prefix}/Library >/dev/null 2>&1 || true + for i in "" ${DATA}; do \ test x"$$i" = x"" && continue; \ if test -f ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i; then \ - if rm -f ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i; then \ + if rm -f ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i; \ + then \ ${DELETE_OK}; \ else \ ${DELETE_FAILED}; \ fi \ fi; \ - rmdir "$$(dirname ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i)" >/dev/null 2>&1 || true; \ + rmdir "$$(dirname ${DESTDIR}${datadir}/${PACKAGE_NAME}/$$i)" \ + >/dev/null 2>&1 || true; \ done rmdir ${DESTDIR}${datadir}/${PACKAGE_NAME} >/dev/null 2>&1 || true @@ -845,7 +1000,8 @@ uninstall: uninstall-extra for i in "" ${INCLUDES}; do \ test x"$$i" = x"" && continue; \ if test -f ${DESTDIR}${includedir}/${includesubdir}/$$i; then \ - if rm -f ${DESTDIR}${includedir}/${includesubdir}/$$i; then \ + if rm -f ${DESTDIR}${includedir}/${includesubdir}/$$i; \ + then \ ${DELETE_OK}; \ else \ ${DELETE_FAILED}; \ @@ -856,8 +1012,10 @@ uninstall: uninstall-extra for i in "" ${MO_FILES}; do \ test x"$$i" = x"" && continue; \ - if test -f ${DESTDIR}${localedir}/$${i%.mo}/LC_MESSAGES/${localename}.mo; then \ - if rm -f ${DESTDIR}${localedir}/$${i%.mo}/LC_MESSAGES/${localename}.mo; then \ + mo="${localedir}/$${i%.mo}/LC_MESSAGES/${localename}.mo"; \ + mo="${DESTDIR}$$mo"; \ + if test -f $$mo; then \ + if rm -f $$mo; then \ ${DELETE_OK}; \ else \ ${DELETE_FAILED}; \ @@ -876,19 +1034,29 @@ uninstall: uninstall-extra fi \ done + ${MAKE} @MAKEFLAGS_SILENT@ uninstall-extra + uninstall-extra: clean: for i in "" ${SUBDIRS} ${SUBDIRS_AFTER}; do \ test x"$$i" = x"" && continue; \ ${DIR_ENTER}; \ - ${MAKE} -s clean || exit $$?; \ + ${MAKE} @MAKEFLAGS_SILENT@ clean || exit $$?; \ ${DIR_LEAVE}; \ done : >.deps - for i in "" ${DEPS} ${OBJS} ${OBJS_EXTRA} ${LIB_OBJS} ${LIB_OBJS_EXTRA} ${AMIGA_LIB_OBJS} ${AMIGA_LIB_OBJS_START} ${AMIGA_LIB_OBJS_EXTRA} ${PLUGIN_OBJS} ${PROG} ${PROG_NOINST} ${SHARED_LIB} ${SHARED_LIB_NOINST} ${AMIGA_LIB} ${AMIGA_LIB_NOINST} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} ${STATIC_AMIGA_LIB} ${STATIC_AMIGA_LIB_NOINST} ${FRAMEWORK} ${PLUGIN} ${PLUGIN_NOINST} ${CLEAN_LIB} ${MO_FILES} ${CLEAN}; do \ + for i in "" ${DEPS} ${OBJS} ${OBJS_EXTRA} ${LIB_OBJS} \ + ${LIB_OBJS_EXTRA} ${AMIGA_LIB_OBJS} ${AMIGA_LIB_OBJS_START} \ + ${AMIGA_LIB_OBJS_EXTRA} ${PLUGIN_OBJS} ${PROG} ${PROG_NOINST} \ + ${SHARED_LIB} ${SHARED_LIB_NOINST} ${AMIGA_LIB} \ + ${AMIGA_LIB_NOINST} ${STATIC_LIB} ${STATIC_LIB_NOINST} \ + ${STATIC_PIC_LIB} ${STATIC_PIC_LIB_NOINST} ${STATIC_AMIGA_LIB} \ + ${STATIC_AMIGA_LIB_NOINST} ${FRAMEWORK} ${FRAMEWORK_NOINST} \ + ${PLUGIN} ${PLUGIN_NOINST} ${BUNDLE} ${BUNDLE_NOINST} \ + ${CLEAN_LIB} ${MO_FILES} ${CLEAN}; do \ test x"$$i" = x"" && continue; \ if test -f $$i -o -d $$i; then \ if rm -fr $$i; then \ @@ -903,7 +1071,7 @@ distclean: clean for i in "" ${SUBDIRS} ${SUBDIRS_AFTER}; do \ test x"$$i" = x"" && continue; \ ${DIR_ENTER}; \ - ${MAKE} -s distclean || exit $$?; \ + ${MAKE} @MAKEFLAGS_SILENT@ distclean || exit $$?; \ ${DIR_LEAVE}; \ done @@ -923,7 +1091,8 @@ print-hierarchy: test x"$$i" = x"" && continue; \ echo ${PRINT_HIERARCHY_PREFIX}$$i; \ cd $$i || exit $$?; \ - ${MAKE} -s PRINT_HIERARCHY_PREFIX=$$i/ print-hierarchy || exit $$?; \ + ${MAKE} @MAKEFLAGS_SILENT@ PRINT_HIERARCHY_PREFIX=$$i/ \ + print-hierarchy || exit $$?; \ cd .. || exit $$?; \ done diff --git a/configure.ac b/configure.ac index 2568da1..dd79595 100644 --- a/configure.ac +++ b/configure.ac @@ -69,14 +69,14 @@ AS_IF([test x"$enable_static" = x"yes" -o x"$enable_shared" = x"no"], [ AC_SUBST(LIBOBJ3DENGINE_DEP, "../src/libobj3dengine.a") ]) -AC_CHECK_LIB(glide3x, main, [ - LIBS="-lglide3x $LIBS" +AC_CHECK_LIB(glide2x, main, [ + LIBS="-lglide2x $LIBS" AC_CHECK_HEADER(glide.h, [], [ - AC_MSG_ERROR([glide.h not found. Please install Glide 3 SDK!]) + AC_MSG_ERROR([glide.h not found. Please install Glide 2 SDK!]) ]) ], [ - AC_MSG_ERROR([glide3x not found. Please install Glide 3 SDK!]) + AC_MSG_ERROR([glide2x not found. Please install Glide 2 SDK!]) ]) AS_IF([test x"$GOBJC" = x"yes"], [ diff --git a/src/Makefile b/src/Makefile index 62b9f96..dfdcce0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,8 +8,7 @@ FRAMEWORK = ${OBJ3DENGINE_FRAMEWORK} LIB_MAJOR = ${OBJ3DENGINE_LIB_MAJOR} LIB_MINOR = ${OBJ3DENGINE_LIB_MINOR} -SRCS = O3DEngine.m \ - O3DGlide3Renderer.m \ +SRCS = O3DGlideRenderer.m \ O3DRenderer.m \ O3DWinAPIWindow.m INCLUDES := ${SRCS:.m=.h} diff --git a/src/O3DEngine.h b/src/O3DEngine.h deleted file mode 100644 index cf0947d..0000000 --- a/src/O3DEngine.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2022 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of Obj3DEngine. It may be distributed under the terms of - * the Q Public License 1.0, which can be found in the file LICENSE.QPL - * included in the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of - * this file. - */ - -#import - -#import "O3DRenderer.h" - -OF_ASSUME_NONNULL_BEGIN - -@interface O3DEngine: OFObject -{ - id _renderer; -} - -@property (readonly, nonatomic) id renderer; - -+ (OFArray OF_GENERIC(Class ) *)availableRenderers; - -- (instancetype)initWithRenderer: (Class )renderer - options: (nullable OFDictionary - OF_GENERIC(OFString *, id) *)options; -@end - -OF_ASSUME_NONNULL_END diff --git a/src/O3DEngine.m b/src/O3DEngine.m deleted file mode 100644 index 0197772..0000000 --- a/src/O3DEngine.m +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2022 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of Obj3DEngine. It may be distributed under the terms of - * the Q Public License 1.0, which can be found in the file LICENSE.QPL - * included in the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of - * this file. - */ - -#import "O3DEngine.h" -#import "O3DGlide3Renderer.h" - -@implementation O3DEngine -@synthesize renderer = _renderer; - -+ (OFArray OF_GENERIC(Class ) *)availableRenderers -{ - return [OFArray arrayWithObject: [O3DGlide3Renderer class]]; -} - -- (instancetype) - initWithRenderer: (Class )renderer - options: (OFDictionary OF_GENERIC(OFString *, id) *)options -{ - self = [super init]; - - @try { - _renderer = [(id )[(Class)renderer alloc] - initWithOptions: options]; - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (void)dealloc -{ - [_renderer release]; - - [super dealloc]; -} -@end diff --git a/src/O3DGlide3Renderer.h b/src/O3DGlide3Renderer.h deleted file mode 100644 index e3e3849..0000000 --- a/src/O3DGlide3Renderer.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2022 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of Obj3DEngine. It may be distributed under the terms of - * the Q Public License 1.0, which can be found in the file LICENSE.QPL - * included in the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of - * this file. - */ - -#include - -#import "O3DRenderer.h" - -OF_ASSUME_NONNULL_BEGIN - -@class O3DWinAPIWindow; - -@interface O3DGlide3Renderer: OFObject -{ - GrResolution _resolution; -#ifdef OF_WINDOWS - O3DWinAPIWindow *_winAPIWindow; -#endif - GrContext_t _context; - OFSize _clippingWindow; - bool _syncsToVerticalBlank; -} -@end - -OF_ASSUME_NONNULL_END diff --git a/src/O3DGlide3Renderer.m b/src/O3DGlide3Renderer.m deleted file mode 100644 index 511ec5a..0000000 --- a/src/O3DGlide3Renderer.m +++ /dev/null @@ -1,379 +0,0 @@ -/* - * Copyright (c) 2022 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of Obj3DEngine. It may be distributed under the terms of - * the Q Public License 1.0, which can be found in the file LICENSE.QPL - * included in the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of - * this file. - */ - -#include - -#import "O3DGlide3Renderer.h" -#import "O3DWinAPIWindow.h" - -@interface O3DGlide3Renderer () -- (void)setState; -@end - -static OFSize -screenResolutionToSize(GrScreenResolution_t resolution) -{ - switch (resolution) { - case GR_RESOLUTION_320x200: - return OFMakeSize(320, 200); - case GR_RESOLUTION_320x240: - return OFMakeSize(320, 240); - case GR_RESOLUTION_400x256: - return OFMakeSize(400, 256); - case GR_RESOLUTION_512x384: - return OFMakeSize(512, 384); - case GR_RESOLUTION_640x200: - return OFMakeSize(640, 200); - case GR_RESOLUTION_640x350: - return OFMakeSize(640, 350); - case GR_RESOLUTION_640x400: - return OFMakeSize(640, 400); - case GR_RESOLUTION_640x480: - return OFMakeSize(640, 480); - case GR_RESOLUTION_800x600: - return OFMakeSize(800, 600); - case GR_RESOLUTION_960x720: - return OFMakeSize(960, 720); - case GR_RESOLUTION_856x480: - return OFMakeSize(856, 480); - case GR_RESOLUTION_512x256: - return OFMakeSize(512, 256); - case GR_RESOLUTION_1024x768: - return OFMakeSize(1024, 768); - case GR_RESOLUTION_1280x1024: - return OFMakeSize(1280, 1024); - case GR_RESOLUTION_1600x1200: - return OFMakeSize(1600, 1200); - case GR_RESOLUTION_400x300: - return OFMakeSize(400, 300); - case GR_RESOLUTION_1152x864: - return OFMakeSize(1152, 864); - case GR_RESOLUTION_1280x960: - return OFMakeSize(1280, 960); - case GR_RESOLUTION_1600x1024: - return OFMakeSize(1600, 1024); - case GR_RESOLUTION_1792x1344: - return OFMakeSize(1792, 1344); - case GR_RESOLUTION_1856x1392: - return OFMakeSize(1856, 1392); - case GR_RESOLUTION_1920x1440: - return OFMakeSize(1920, 1440); - case GR_RESOLUTION_2048x1536: - return OFMakeSize(2048, 1536); - case GR_RESOLUTION_2048x2048: - return OFMakeSize(2048, 2048); - default: - return OFMakeSize(0, 0); - } -} - -static GrScreenResolution_t -sizeToScreenResolution(OFSize size) -{ - if (size.width == 320 && size.height == 200) - return GR_RESOLUTION_320x200; - if (size.width == 320 && size.height == 240) - return GR_RESOLUTION_320x240; - if (size.width == 400 && size.height == 256) - return GR_RESOLUTION_400x256; - if (size.width == 512 && size.height == 384) - return GR_RESOLUTION_512x384; - if (size.width == 640 && size.height == 200) - return GR_RESOLUTION_640x200; - if (size.width == 640 && size.height == 350) - return GR_RESOLUTION_640x350; - if (size.width == 640 && size.height == 400) - return GR_RESOLUTION_640x400; - if (size.width == 640 && size.height == 480) - return GR_RESOLUTION_640x480; - if (size.width == 800 && size.height == 600) - return GR_RESOLUTION_800x600; - if (size.width == 960 && size.height == 720) - return GR_RESOLUTION_960x720; - if (size.width == 856 && size.height == 480) - return GR_RESOLUTION_856x480; - if (size.width == 512 && size.height == 256) - return GR_RESOLUTION_512x256; - if (size.width == 1024 && size.height == 768) - return GR_RESOLUTION_1024x768; - if (size.width == 1280 && size.height == 1024) - return GR_RESOLUTION_1280x1024; - if (size.width == 1600 && size.height == 1200) - return GR_RESOLUTION_1600x1200; - if (size.width == 400 && size.height == 300) - return GR_RESOLUTION_400x300; - if (size.width == 1152 && size.height == 864) - return GR_RESOLUTION_1152x864; - if (size.width == 1280 && size.height == 960) - return GR_RESOLUTION_1280x960; - if (size.width == 1600 && size.height == 1024) - return GR_RESOLUTION_1600x1024; - if (size.width == 1792 && size.height == 1344) - return GR_RESOLUTION_1792x1344; - if (size.width == 1856 && size.height == 1392) - return GR_RESOLUTION_1856x1392; - if (size.width == 1920 && size.height == 1440) - return GR_RESOLUTION_1920x1440; - if (size.width == 2048 && size.height == 1536) - return GR_RESOLUTION_2048x1536; - if (size.width == 2048 && size.height == 2048) - return GR_RESOLUTION_2048x2048; - - return GR_RESOLUTION_NONE; -} - -static float -screenRefreshToFloat(GrScreenRefresh_t refresh) -{ - switch (refresh) { - case GR_REFRESH_60Hz: - return 60; - case GR_REFRESH_70Hz: - return 70; - case GR_REFRESH_72Hz: - return 72; - case GR_REFRESH_75Hz: - return 75; - case GR_REFRESH_80Hz: - return 80; - case GR_REFRESH_90Hz: - return 90; - case GR_REFRESH_100Hz: - return 100; - case GR_REFRESH_85Hz: - return 85; - case GR_REFRESH_120Hz: - return 120; - default: - return 0; - } -} - -static GrScreenRefresh_t -floatToScreenRefresh(float refresh) -{ - if (refresh == 60) - return GR_REFRESH_60Hz; - if (refresh == 70) - return GR_REFRESH_70Hz; - if (refresh == 72) - return GR_REFRESH_72Hz; - if (refresh == 75) - return GR_REFRESH_75Hz; - if (refresh == 80) - return GR_REFRESH_80Hz; - if (refresh == 90) - return GR_REFRESH_90Hz; - if (refresh == 100) - return GR_REFRESH_100Hz; - if (refresh == 85) - return GR_REFRESH_85Hz; - if (refresh == 120) - return GR_REFRESH_120Hz; - - return GR_REFRESH_NONE; -} - -static OF_INLINE void -translateVertices(O3DVertex *vertices, size_t count, OFSize size) -{ - /* - * Range is -1 to 1, we add 1, so we get 0 to 2 - so we need to - * multiply with half the width / height. - */ - size.width /= 2; - size.height /= 2; - - for (size_t i = 0; i < count; i++) { - vertices[i].x += 1; - vertices[i].y += 1; - vertices[i].x *= size.width; - vertices[i].y *= size.height; - } -} - -@implementation O3DGlide3Renderer -@synthesize syncsToVerticalBlank = _syncsToVerticalBlank; - -- (instancetype)initWithOptions: - (OFDictionary OF_GENERIC(OFString *, id) *)options -{ - self = [super init]; - - @try { - grGlideInit(); - - FxI32 numDevices; - if (grGet(GR_NUM_BOARDS, sizeof(numDevices), &numDevices) == 0) - @throw [OFInitializationFailedException - exceptionWithClass: self.class]; - - long long deviceIndex = [[options objectForKey: - O3DRendererDeviceIndex] longLongValue]; - if (deviceIndex > numDevices) - @throw [OFInvalidArgumentException exception]; - - grSstSelect((int)deviceIndex); - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (void)dealloc -{ - if (_context != 0) - grSstWinClose(_context); - - grGlideShutdown(); - -#ifdef OF_WINDOWS - [_winAPIWindow release]; -#endif - - [super dealloc]; -} - -- (OFArray OF_GENERIC(OFPair OF_GENERIC(OFValue *, OFNumber *) *) *) - availableResolutions -{ - OFMutableArray *ret = [OFMutableArray array]; - GrResolution query = { - .resolution = GR_QUERY_ANY, - .refresh = GR_QUERY_ANY, - .numColorBuffers = 2, - .numAuxBuffers = 1 - }; - size_t size = grQueryResolutions(&query, NULL); - - GrResolution *resolutions = OFAllocMemory(1, size); - @try { - size = grQueryResolutions(&query, resolutions); - - void *pool = objc_autoreleasePoolPush(); - for (size_t i = 0; i < size / sizeof(*resolutions); i++) { - OFSize resolutionSize = - screenResolutionToSize(resolutions[i].resolution); - float refreshFloat = - screenRefreshToFloat(resolutions[i].refresh); - - if (resolutionSize.width == 0 || - resolutionSize.height == 0) - continue; - if (refreshFloat == 0) - continue; - - OFValue *resolution = - [OFValue valueWithSize: resolutionSize]; - OFNumber *refresh = - [OFNumber numberWithFloat: refreshFloat]; - [ret addObject: [OFPair pairWithFirstObject: resolution - secondObject: refresh]]; - } - objc_autoreleasePoolPop(pool); - } @finally { - OFFreeMemory(resolutions); - } - - [ret sortUsingFunction: O3DCompareResolution - context: NULL - options: OFArraySortDescending]; - - [ret makeImmutable]; - - return ret; -} - -- (void)createWithResolution: (O3DResolution)resolution -{ - if (_context != 0) - @throw [OFAlreadyOpenException exceptionWithObject: self]; - - GrScreenResolution_t screenResolution = - sizeToScreenResolution([resolution.firstObject sizeValue]); - GrScreenRefresh_t screenRefresh = - floatToScreenRefresh([resolution.secondObject floatValue]); - - if (screenResolution == GR_RESOLUTION_NONE || - screenRefresh == GR_REFRESH_NONE) - @throw [OFInvalidArgumentException exception]; - - FxU32 hWnd = 0; -#ifdef OF_WINDOWS - _winAPIWindow = [[O3DWinAPIWindow alloc] - initWithSize: [resolution.firstObject sizeValue]]; - hWnd = (FxU32)_winAPIWindow.hWnd; -#endif - - if ((_context = grSstWinOpen(hWnd, screenResolution, screenRefresh, - GR_COLORFORMAT_RGBA, GR_ORIGIN_LOWER_LEFT, 2, 1)) == 0) - @throw [OFInitializationFailedException - exceptionWithClass: self.class]; - - _clippingWindow = [resolution.firstObject sizeValue]; - - [self setState]; -} - -- (void)setState -{ - grVertexLayout(GR_PARAM_XY, offsetof(O3DVertex, x), GR_PARAM_ENABLE); - grSstOrigin(GR_ORIGIN_LOWER_LEFT); -} - -- (void)beginFrame -{ - assert(_context != 0); - - if (!grSelectContext(_context)) - [self setState]; - - grBufferClear(0, 0, 0); -} - -- (void)setColor: (OFColor *)color -{ - float values[4]; - [color getRed: &values[0] - green: &values[1] - blue: &values[2] - alpha: &values[3]]; - for (uint_fast8_t i = 0; i < 4; i++) - values[i] *= 255; - grColorCombine(GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, - GR_COMBINE_LOCAL_CONSTANT, GR_COMBINE_OTHER_NONE, FXFALSE); - grConstantColorValue((((GrColor_t)values[0]) << 24) | - (((GrColor_t)values[1]) << 16) | (((GrColor_t)values[2]) << 8) | - (GrColor_t)values[2]); -} - -- (void)drawVertices: (OFData *)vertices_ -{ - assert(vertices_.itemSize == sizeof(O3DVertex)); - - OFMutableData *vertices = [[vertices_ mutableCopy] autorelease]; - translateVertices(vertices.mutableItems, vertices.count, - _clippingWindow); - grDrawVertexArrayContiguous(GR_TRIANGLE_STRIP, - vertices.count, vertices.mutableItems, sizeof(O3DVertex)); -} - -- (void)endFrame -{ - grBufferSwap(_syncsToVerticalBlank ? 1 : 0); -} -@end diff --git a/src/O3DGlideRenderer.h b/src/O3DGlideRenderer.h new file mode 100644 index 0000000..e7a2d32 --- /dev/null +++ b/src/O3DGlideRenderer.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022, 2023 Jonathan Schleifer + * + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License version 3.0 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * version 3.0 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3.0 along with this program. If not, see + * . + */ + +#include + +#import "O3DRenderer.h" + +OF_ASSUME_NONNULL_BEGIN + +@class O3DWinAPIWindow; + +@interface O3DGlideRenderer: OFObject +{ +#ifdef OF_WINDOWS + O3DWinAPIWindow *_winAPIWindow; +#endif + OFSize _clippingWindow; + bool _syncsToVerticalBlank; + OFMatrix4x4 *_matrix; +} +@end + +OF_ASSUME_NONNULL_END diff --git a/src/O3DGlideRenderer.m b/src/O3DGlideRenderer.m new file mode 100644 index 0000000..e1aa3fc --- /dev/null +++ b/src/O3DGlideRenderer.m @@ -0,0 +1,256 @@ +/* + * Copyright (c) 2022, 2023 Jonathan Schleifer + * + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License version 3.0 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * version 3.0 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3.0 along with this program. If not, see + * . + */ + +#include +#include + +#import "O3DGlideRenderer.h" +#import "O3DWinAPIWindow.h" + +static GrScreenResolution_t +sizeToScreenResolution(OFSize size) +{ + if (size.width == 320 && size.height == 200) + return GR_RESOLUTION_320x200; + if (size.width == 320 && size.height == 240) + return GR_RESOLUTION_320x240; + if (size.width == 400 && size.height == 256) + return GR_RESOLUTION_400x256; + if (size.width == 512 && size.height == 384) + return GR_RESOLUTION_512x384; + if (size.width == 640 && size.height == 200) + return GR_RESOLUTION_640x200; + if (size.width == 640 && size.height == 350) + return GR_RESOLUTION_640x350; + if (size.width == 640 && size.height == 400) + return GR_RESOLUTION_640x400; + if (size.width == 640 && size.height == 480) + return GR_RESOLUTION_640x480; + if (size.width == 800 && size.height == 600) + return GR_RESOLUTION_800x600; + if (size.width == 960 && size.height == 720) + return GR_RESOLUTION_960x720; + if (size.width == 856 && size.height == 480) + return GR_RESOLUTION_856x480; + if (size.width == 512 && size.height == 256) + return GR_RESOLUTION_512x256; + if (size.width == 1024 && size.height == 768) + return GR_RESOLUTION_1024x768; + if (size.width == 1280 && size.height == 1024) + return GR_RESOLUTION_1280x1024; + if (size.width == 1600 && size.height == 1200) + return GR_RESOLUTION_1600x1200; + if (size.width == 400 && size.height == 300) + return GR_RESOLUTION_400x300; +#ifdef GR_RESOLUTION_1152x864 + if (size.width == 1152 && size.height == 864) + return GR_RESOLUTION_1152x864; +#endif +#ifdef GR_RESOLUTION_1280x960 + if (size.width == 1280 && size.height == 960) + return GR_RESOLUTION_1280x960; +#endif +#ifdef GR_RESOLUTION_1600x1024 + if (size.width == 1600 && size.height == 1024) + return GR_RESOLUTION_1600x1024; +#endif +#ifdef GR_RESOLUTION_1792x1344 + if (size.width == 1792 && size.height == 1344) + return GR_RESOLUTION_1792x1344; +#endif +#ifdef GR_RESOLUTION_1856x1392 + if (size.width == 1856 && size.height == 1392) + return GR_RESOLUTION_1856x1392; +#endif +#ifdef GR_RESOLUTION_1920x1440 + if (size.width == 1920 && size.height == 1440) + return GR_RESOLUTION_1920x1440; +#endif +#ifdef GR_RESOLUTION_2048x1536 + if (size.width == 2048 && size.height == 1536) + return GR_RESOLUTION_2048x1536; +#endif +#ifdef GR_RESOLUTION_2048x2048 + if (size.width == 2048 && size.height == 2048) + return GR_RESOLUTION_2048x2048; +#endif + + @throw [OFInvalidArgumentException exception]; +} + +static GrScreenRefresh_t +floatToScreenRefresh(float refresh) +{ + if (refresh == 60) + return GR_REFRESH_60Hz; + if (refresh == 70) + return GR_REFRESH_70Hz; + if (refresh == 72) + return GR_REFRESH_72Hz; + if (refresh == 75) + return GR_REFRESH_75Hz; + if (refresh == 80) + return GR_REFRESH_80Hz; + if (refresh == 90) + return GR_REFRESH_90Hz; + if (refresh == 100) + return GR_REFRESH_100Hz; + if (refresh == 85) + return GR_REFRESH_85Hz; + if (refresh == 120) + return GR_REFRESH_120Hz; + + @throw [OFInvalidArgumentException exception]; +} + +@implementation O3DGlideRenderer +@synthesize syncsToVerticalBlank = _syncsToVerticalBlank; + +static void +grGlideShutdownCdecl(void) +{ + grGlideShutdown(); +} + ++ (void)initialize +{ + if (self != [O3DGlideRenderer class]) + return; + + grGlideInit(); + atexit(grGlideShutdownCdecl); +} + ++ (unsigned int)numAvailableDevices +{ + GrHwConfiguration config; + if (!grSstQueryHardware(&config)) + return 0; + + if (config.num_sst < 0) + return 0; + + return (unsigned int)config.num_sst; +} + +- (instancetype)initWithResolution: (OFSize)resolution + bitsPerPixel: (uint8_t)bitsPerPixel + refreshRate: (float)refreshRate + options: (nullable OFDictionary *)options +{ + self = [super init]; + + @try { + if (bitsPerPixel != 16) + @throw [OFInvalidArgumentException exception]; + + long long deviceIndex = [[options objectForKey: + O3DRendererDeviceIndex] longLongValue]; + if (deviceIndex > [self.class numAvailableDevices]) + @throw [OFInvalidArgumentException exception]; + + grSstSelect((int)deviceIndex); + + FxU32 hWnd = 0; +#ifdef OF_WINDOWS + _winAPIWindow = [[O3DWinAPIWindow alloc] + initWithSize: resolution]; + hWnd = (FxU32)_winAPIWindow.hWnd; +#endif + + if (!grSstWinOpen(hWnd, sizeToScreenResolution(resolution), + floatToScreenRefresh(refreshRate), GR_COLORFORMAT_ARGB, + GR_ORIGIN_LOWER_LEFT, 2, 1)) + @throw [OFInitializationFailedException + exceptionWithClass: self.class]; + + grDepthBufferMode(GR_DEPTHBUFFER_WBUFFER); + grDepthBufferFunction(GR_CMP_LEQUAL); + grDepthMask(FXTRUE); + + _matrix = [[OFMatrix4x4 alloc] initWithValues: + (const float [4][4]){ + { 1, 0, 0, 0 }, + { 0, 1, 0, 0 }, + { 0, 0, 1, 0 }, + { 0, 0, 1, 1 } + }]; + /* Move the range from (-1, 1) to (0, 2) */ + [_matrix translateWithVector: OFMakeVector3D(1, 1, 0)]; + /* + * Scale with half the resolution (since the range is (0, 2) + * and not (0, 1)). + */ + [_matrix scaleWithVector: OFMakeVector3D( + grSstScreenWidth() / 2.f, grSstScreenHeight() / 2.f, 1)]; + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + +- (void)dealloc +{ + [_matrix release]; + + grSstWinClose(); + +#ifdef OF_WINDOWS + [_winAPIWindow release]; +#endif + + [super dealloc]; +} + +- (void)beginFrame +{ + grBufferClear(0, 0, GR_WDEPTHVALUE_FARTHEST); +} + +- (void)drawPolygonWithVertices: (const O3DVertex *)vertices + count: (size_t)count +{ + GrVertex *glideVertices = OFAllocZeroedMemory(count, sizeof(GrVertex)); + @try { + for (size_t i = 0; i < count; i++) { + OFVector4D vec = [_matrix transformedVector: + OFMakeVector4D(vertices[i].position.x, + vertices[i].position.y, vertices[i].position.z, 1)]; + glideVertices[i].x = vec.x / vec.w; + glideVertices[i].y = vec.y / vec.w; + glideVertices[i].oow = 1.f / + (vec.z * GR_WDEPTHVALUE_FARTHEST); + glideVertices[i].r = vertices[i].color.r * 255; + glideVertices[i].g = vertices[i].color.g * 255; + glideVertices[i].b = vertices[i].color.b * 255; + } + + grDrawPolygonVertexList((int)count, glideVertices); + } @finally { + OFFreeMemory(glideVertices); + } +} + +- (void)endFrame +{ + grBufferSwap(_syncsToVerticalBlank ? 1 : 0); +} +@end diff --git a/src/O3DRenderer.h b/src/O3DRenderer.h index 1142e53..c459d72 100644 --- a/src/O3DRenderer.h +++ b/src/O3DRenderer.h @@ -1,39 +1,45 @@ /* - * Copyright (c) 2022 Jonathan Schleifer + * Copyright (c) 2022, 2023 Jonathan Schleifer * * All rights reserved. * - * This file is part of Obj3DEngine. It may be distributed under the terms of - * the Q Public License 1.0, which can be found in the file LICENSE.QPL - * included in the packaging of this file. + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License version 3.0 only, + * as published by the Free Software Foundation. * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of - * this file. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * version 3.0 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3.0 along with this program. If not, see + * . */ #import OF_ASSUME_NONNULL_BEGIN -typedef OFPair OF_GENERIC(OFValue *, OFNumber *) *O3DResolution; - typedef struct OF_BOXABLE { - float x, y; + OFVector3D position; + struct { + float r, g, b; + } color; } O3DVertex; @protocol O3DRenderer -@property (readonly, nonatomic) OFArray OF_GENERIC(OFPair OF_GENERIC(OFValue *, - OFNumber *) *) *availableResolutions; @property (nonatomic) bool syncsToVerticalBlank; -- (instancetype)initWithOptions: - (nullable OFDictionary OF_GENERIC(OFString *, id) *)options; -- (void)createWithResolution: (O3DResolution)resolution; ++ (unsigned int)numAvailableDevices; + +- (instancetype)initWithResolution: (OFSize)resolution + bitsPerPixel: (uint8_t)bitsPerPixel + refreshRate: (float)refreshRate + options: (nullable OFDictionary *)options; - (void)beginFrame; -- (void)setColor: (OFColor *)color; -- (void)drawVertices: (OFData *)vertices; +- (void)drawPolygonWithVertices: (const O3DVertex *)vertices + count: (size_t)count; - (void)endFrame; @end @@ -41,8 +47,6 @@ typedef struct OF_BOXABLE { extern "C" { #endif extern OFString *const O3DRendererDeviceIndex; -extern OFComparisonResult O3DCompareResolution(id _Nullable left, - id _Nullable right, void *_Nullable context); #ifdef __cplusplus } #endif diff --git a/src/O3DRenderer.m b/src/O3DRenderer.m index 7159638..1edee88 100644 --- a/src/O3DRenderer.m +++ b/src/O3DRenderer.m @@ -1,45 +1,22 @@ /* - * Copyright (c) 2022 Jonathan Schleifer + * Copyright (c) 2022, 2023 Jonathan Schleifer * * All rights reserved. * - * This file is part of Obj3DEngine. It may be distributed under the terms of - * the Q Public License 1.0, which can be found in the file LICENSE.QPL - * included in the packaging of this file. + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License version 3.0 only, + * as published by the Free Software Foundation. * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of - * this file. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * version 3.0 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3.0 along with this program. If not, see + * . */ #import "O3DRenderer.h" OFString *const O3DRendererDeviceIndex = @"O3DRendererDeviceIndex"; - -OFComparisonResult -O3DCompareResolution(id left, id right, void *context) -{ - OFSize leftResolution = [[left firstObject] sizeValue]; - OFSize rightResolution = [[right firstObject] sizeValue]; - - if (leftResolution.width > rightResolution.width) - return OFOrderedDescending; - if (leftResolution.width < rightResolution.width) - return OFOrderedAscending; - - if (leftResolution.height > rightResolution.height) - return OFOrderedDescending; - if (leftResolution.height < rightResolution.height) - return OFOrderedAscending; - - float leftRefresh = [[left secondObject] floatValue]; - float rightRefresh = [[right secondObject] floatValue]; - - if (leftRefresh > rightRefresh) - return OFOrderedDescending; - if (leftRefresh < rightRefresh) - return OFOrderedAscending; - - return OFOrderedSame; -} diff --git a/src/O3DWinAPIWindow.h b/src/O3DWinAPIWindow.h index 65b24ce..e7ea734 100644 --- a/src/O3DWinAPIWindow.h +++ b/src/O3DWinAPIWindow.h @@ -1,16 +1,20 @@ /* - * Copyright (c) 2022 Jonathan Schleifer + * Copyright (c) 2022, 2023 Jonathan Schleifer * * All rights reserved. * - * This file is part of Obj3DEngine. It may be distributed under the terms of - * the Q Public License 1.0, which can be found in the file LICENSE.QPL - * included in the packaging of this file. + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License version 3.0 only, + * as published by the Free Software Foundation. * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of - * this file. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * version 3.0 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3.0 along with this program. If not, see + * . */ #import diff --git a/src/O3DWinAPIWindow.m b/src/O3DWinAPIWindow.m index 076b65c..fc63fb5 100644 --- a/src/O3DWinAPIWindow.m +++ b/src/O3DWinAPIWindow.m @@ -1,16 +1,20 @@ /* - * Copyright (c) 2022 Jonathan Schleifer + * Copyright (c) 2022, 2023 Jonathan Schleifer * * All rights reserved. * - * This file is part of Obj3DEngine. It may be distributed under the terms of - * the Q Public License 1.0, which can be found in the file LICENSE.QPL - * included in the packaging of this file. + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License version 3.0 only, + * as published by the Free Software Foundation. * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of - * this file. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * version 3.0 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3.0 along with this program. If not, see + * . */ #import "O3DWinAPIWindow.h" diff --git a/tests/TestsAppDelegate.m b/tests/TestsAppDelegate.m index ac970a8..2320311 100644 --- a/tests/TestsAppDelegate.m +++ b/tests/TestsAppDelegate.m @@ -1,21 +1,25 @@ /* - * Copyright (c) 2022 Jonathan Schleifer + * Copyright (c) 2022, 2023 Jonathan Schleifer * * All rights reserved. * - * This file is part of Obj3DEngine. It may be distributed under the terms of - * the Q Public License 1.0, which can be found in the file LICENSE.QPL - * included in the packaging of this file. + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License version 3.0 only, + * as published by the Free Software Foundation. * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of - * this file. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * version 3.0 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3.0 along with this program. If not, see + * . */ #import -#import "O3DEngine.h" +#import "O3DGlideRenderer.h" @interface TestsAppDelegate: OFObject @end @@ -25,49 +29,29 @@ OF_APPLICATION_DELEGATE(TestsAppDelegate) @implementation TestsAppDelegate - (void)applicationDidFinishLaunching: (OFNotification *)notification { - Class renderer = - [O3DEngine availableRenderers].firstObject; - O3DEngine *engine = - [[[O3DEngine alloc] initWithRenderer: renderer - options: nil] autorelease]; + O3DGlideRenderer *renderer = [[[O3DGlideRenderer alloc] + initWithResolution: OFMakeSize(640, 480) + bitsPerPixel: 16 + refreshRate: 60 + options: nil] autorelease]; - [OFStdOut writeFormat: @"Available resolutions: %@\n", - engine.renderer.availableResolutions]; - - O3DResolution resolution = [OFPair - pairWithFirstObject: [OFValue valueWithSize: OFMakeSize(800, 600)] - secondObject: [OFNumber numberWithFloat: 60]]; - [engine.renderer createWithResolution: resolution]; - - O3DVertex values1[] = { - { -1, -1 }, - { 0, 1 }, - { 1, -1 } + const O3DVertex outerTriangle[] = { + {{ -1, -1, 0 }, { 1, 0, 0 }}, + {{ 0, 1, 0 }, { 0, 1, 0 }}, + {{ 1, -1, 0 }, { 0, 0, 1 }} }; - O3DVertex values2[] = { - { -0.5, 0.5 }, - { 0, -0.5 }, - { 0.5, 0.5 } + const O3DVertex innerTriangle[] = { + {{ -0.5, 0.5, 0 }, { 1, 1, 0 }}, + {{ 0, -0.5, 0 }, { 0, 1, 1 }}, + {{ 0.5, 0.5, 0 }, { 1, 0, 1 }} }; - OFData *vertices1 = [OFData - dataWithItemsNoCopy: values1 - count: sizeof(values1) / sizeof(*values2) - itemSize: sizeof(O3DVertex) - freeWhenDone: false]; - OFData *vertices2 = [OFData - dataWithItemsNoCopy: values2 - count: sizeof(values2) / sizeof(*values2) - itemSize: sizeof(O3DVertex) - freeWhenDone: false]; OFDate *startDate = [OFDate date]; while (-startDate.timeIntervalSinceNow < 5) { - [engine.renderer beginFrame]; - [engine.renderer setColor: [OFColor yellow]]; - [engine.renderer drawVertices: vertices1]; - [engine.renderer setColor: [OFColor red]]; - [engine.renderer drawVertices: vertices2]; - [engine.renderer endFrame]; + [renderer beginFrame]; + [renderer drawPolygonWithVertices: outerTriangle count: 3]; + [renderer drawPolygonWithVertices: innerTriangle count: 3]; + [renderer endFrame]; } [OFApplication terminate];