ExtUtils-Builder-Compiler-0.032000755001750001750 015005700133 16052 5ustar00leontleont000000000000README100644001750001750 60615005700133 16775 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032This archive contains the distribution ExtUtils-Builder-Compiler, version 0.032: An interface around different compilers. This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. This README file was generated by Dist::Zilla::Plugin::Readme v6.032. Changes100644001750001750 1112715005700133 17450 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032Revision history for ExtUtils-Builder-Compiler 0.032 2025-05-04 16:57:26+02:00 Europe/Brussels - Fix compilet.def extension handling - Enable static install 0.031 2025-04-30 15:33:08+02:00 Europe/Brussels - Remove nologo argument to MSVC - Use File::Temp in autodetect tests 0.030 2025-04-25 13:12:46+02:00 Europe/Brussels - Only set MSVC export for shared-library and loadable-object 0.029 2025-04-23 11:25:05+02:00 Europe/Brussels - Correctly set export value for MSVC 0.028 2025-04-09 18:03:07+02:00 Europe/Brussels - Add push_args to try_compile_run - Add defines argument to try_compile_run 0.027 2025-04-05 19:45:01+02:00 Europe/Brussels - Adapt to load_extension rename - Add missing dirname include to Profile::Perl 0.026 2025-03-28 12:37:34+01:00 Europe/Brussels - Add definition file to MSVC linker arguments 0.025 2025-03-16 23:03:34+01:00 Europe/Brussels - Add missing abs2rel import for module_for_xs delegate 0.024 2025-03-14 16:57:33+01:00 Europe/Brussels - Pass module name to prelink for loadable object 0.023 2025-03-13 16:34:20+01:00 Europe/Brussels - Restore module_for_xs delegate - Make module work on static perls - Allow for multiple profiles in compilation - Fix libpath argument in MSVC linker - Ignore manifest files on MSVC for now 0.022 2024-09-13 14:11:23+02:00 Europe/Brussels - Fix quiet argument of try_compile_run 0.021 2024-09-13 10:59:41+02:00 Europe/Brussels - Use tempdir correctly in try_compile_run - Add quiet argument to try_compile_run 0.020 2024-08-10 18:16:16+02:00 Europe/Brussels - Correctly pass lddlflags in Linker creation - Pass ld instead of cc to linker except on AIX 0.019 2024-08-05 21:04:22+02:00 Europe/Brussels - Revert critical breakage in try_compile_run 0.018 2024-08-05 16:00:45+02:00 Europe/Brussels - Add try_find_library_dirs_for - Fix find_libs_for to pass library correctly - Rename find_libs_for to find_libraries_for - Fix basename in try_compile_run 0.017 2024-08-04 20:57:12+02:00 Europe/Brussels - Fix missing prereq declarations - Remove superfluous debugging output in EUB::Conf 0.016 2024-08-01 12:55:40+02:00 Europe/Brussels - Add ExtUtils::Builder::Conf - Add typemap and hiertype arguments to parse-xs 0.015 2024-07-20 15:18:22+02:00 Europe/Brussels - Add exe_file helper to EU::B::Autodetect::C - Add missing argument in MSCV manifesting - Add directories to loadable_file/library_file/exe_file - Use parent instead of base 0.014 2024-07-17 01:30:56+02:00 Europe/Brussels - Correctly check os version with -iwithsysroot 0.013 2024-07-16 19:11:54+02:00 Europe/Brussels - Use -iwithsysroot on Mac for systemperl 0.012 2024-07-15 21:03:08+02:00 Europe/Brussels - Fix implicit mkdir in compile action - Added message to function actions 0.011 2024-07-14 16:57:11+02:00 Europe/Brussels - Depend on ExtUtils::Builder 0.007 0.010 2024-07-14 12:55:11+02:00 Europe/Brussels - Adapt to version argument in load_module 0.009 2024-07-02 19:10:19+02:00 Europe/Brussels - Eliminate references to no longer existing _libraries method 0.008 2024-06-28 12:36:56+02:00 Europe/Brussels - Simplify libperl linking logic on Windows 0.007 2024-06-18 20:39:07+02:00 Europe/Brussels - Use split_like_shell instead of shellwords - Fix adding of libraries for MSVC 0.006 2024-06-17 18:52:59+02:00 Europe/Brussels - Fix ranking of libperl argument on Windows - Correct initialization of Linker::PE::MSVC 0.005 2024-06-16 18:17:46+02:00 Europe/Brussels - Simplify executable check - Reorder libperl argument on Windows 0.004 2024-05-14 10:38:55+02:00 Europe/Brussels - Set default export value for Linker::PE::GCC - Correct loading ExtUtils::Builder::Action::Function in Linker 0.003 2024-05-06 11:37:41+02:00 Europe/Brussels - Add correct libperl for Cygwin and Windows - Fix linking loadable objects on Windows, cygwin, aix and vms 0.002 2024-04-27 11:56:02+02:00 Europe/Brussels - Fix linker flag passing for Mac - Skip executable test when libperl seems unavailable 0.001 2024-04-25 15:17:34+02:00 Europe/Brussels - LICENSE100644001750001750 4644015005700133 17170 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2012 by Leon Timmermans. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, 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 license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our 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. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, 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 a 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 tell them 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. 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 Agreement 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 work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 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 General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual 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 General Public License. d) 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. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 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 Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying 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. 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. 7. 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 the 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 the license, you may choose any version ever published by the Free Software Foundation. 8. 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 9. 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. 10. 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 Appendix: 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 humanity, 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) 19yy 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 1, 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) 19xx 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 a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Perl Artistic License 1.0 --- This software is Copyright (c) 2012 by Leon Timmermans. This is free software, licensed under: The Perl Artistic License 1.0 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End INSTALL100644001750001750 471215005700133 17170 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032This is the Perl distribution ExtUtils-Builder-Compiler. Installing ExtUtils-Builder-Compiler is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm ExtUtils::Builder::Compiler If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan ExtUtils::Builder::Compiler ## Manual installation As a last resort, you can manually install it. If you have not already downloaded the release tarball, you can find the download link on the module's MetaCPAN page: https://metacpan.org/pod/ExtUtils::Builder::Compiler Untar the tarball, install configure prerequisites (see below), then build it: % perl Makefile.PL % make && make test Then install it: % make install On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib The prerequisites of this distribution will also have to be installed manually. The prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated by running the manual build process described above. ## Configure Prerequisites This distribution requires other modules to be installed before this distribution's installer can be run. They can be found under the "configure_requires" key of META.yml or the "{prereqs}{configure}{requires}" key of META.json. ## Other Prerequisites This distribution may require additional modules to be installed after running Makefile.PL. Look for prerequisites in the following phases: * to run make, PHASE = build * to use the module code itself, PHASE = runtime * to run tests, PHASE = test They can all be found in the "PHASE_requires" key of MYMETA.yml or the "{prereqs}{PHASE}{requires}" key of MYMETA.json. ## Documentation ExtUtils-Builder-Compiler documentation is available as POD. You can run `perldoc` from a shell to read the documentation: % perldoc ExtUtils::Builder::Compiler For more information on installing Perl modules via CPAN, please see: https://www.cpan.org/modules/INSTALL.html dist.ini100644001750001750 141015005700133 17573 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032name = ExtUtils-Builder-Compiler author = Leon Timmermans license = Perl_5 copyright_holder = Leon Timmermans copyright_year = 2012 [Prereqs] perl = 5.010 [Git::GatherDir] [PruneCruft] [MetaYAML] [License] [Manifest] [Readme] [AutoPrereqs] [MetaJSON] [GitHub::Meta] [Git::NextVersion] [MetaProvides::Package] [PrereqsFile] [MakeMaker] [StaticInstall] [FileFinder::Filter / WeaverFiles] finder = :InstallModules skip = Linker/ skip = MultiLingual [PodSyntaxTests] ; [PodCoverageTests] [InstallGuide] [PodWeaver] finder = WeaverFiles [PkgVersion] [NextRelease] [CheckChangesHasContent] [Git::Check] [RunExtraTests] [TestRelease] [ConfirmRelease] [UploadToCPAN] [Git::Commit] [Git::Tag] [Git::Push] [RemovePrereqs] remove = Test::Differences META.yml100644001750001750 675415005700133 17420 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032--- abstract: 'An interface around different compilers.' author: - 'Leon Timmermans ' build_requires: Cwd: '0' ExtUtils::Builder::Planner: '0.007' IPC::Open2: '0' Test::More: '0.89' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: ExtUtils-Builder-Compiler provides: ExtUtils::Builder::ArgumentCollector: file: lib/ExtUtils/Builder/ArgumentCollector.pm version: '0.032' ExtUtils::Builder::AutoDetect::C: file: lib/ExtUtils/Builder/AutoDetect/C.pm version: '0.032' ExtUtils::Builder::AutoDetect::Cpp: file: lib/ExtUtils/Builder/AutoDetect/Cpp.pm version: '0.032' ExtUtils::Builder::Binary: file: lib/ExtUtils/Builder/Binary.pm version: '0.032' ExtUtils::Builder::Compiler: file: lib/ExtUtils/Builder/Compiler.pm version: '0.032' ExtUtils::Builder::Compiler::MSVC: file: lib/ExtUtils/Builder/Compiler/MSVC.pm version: '0.032' ExtUtils::Builder::Compiler::Unixy: file: lib/ExtUtils/Builder/Compiler/Unixy.pm version: '0.032' ExtUtils::Builder::Compiler::VMS: file: lib/ExtUtils/Builder/Compiler/VMS.pm version: '0.032' ExtUtils::Builder::Conf: file: lib/ExtUtils/Builder/Conf.pm version: '0.032' ExtUtils::Builder::Linker: file: lib/ExtUtils/Builder/Linker.pm version: '0.032' ExtUtils::Builder::Linker::Ar: file: lib/ExtUtils/Builder/Linker/Ar.pm version: '0.032' ExtUtils::Builder::Linker::COFF: file: lib/ExtUtils/Builder/Linker/COFF.pm version: '0.032' ExtUtils::Builder::Linker::ELF::Any: file: lib/ExtUtils/Builder/Linker/ELF/Any.pm version: '0.032' ExtUtils::Builder::Linker::ELF::GCC: file: lib/ExtUtils/Builder/Linker/ELF/GCC.pm version: '0.032' ExtUtils::Builder::Linker::Mach::GCC: file: lib/ExtUtils/Builder/Linker/Mach/GCC.pm version: '0.032' ExtUtils::Builder::Linker::PE::GCC: file: lib/ExtUtils/Builder/Linker/PE/GCC.pm version: '0.032' ExtUtils::Builder::Linker::PE::MSVC: file: lib/ExtUtils/Builder/Linker/PE/MSVC.pm version: '0.032' ExtUtils::Builder::Linker::Unixy: file: lib/ExtUtils/Builder/Linker/Unixy.pm version: '0.032' ExtUtils::Builder::Linker::XCOFF: file: lib/ExtUtils/Builder/Linker/XCOFF.pm version: '0.032' ExtUtils::Builder::MultiLingual: file: lib/ExtUtils/Builder/MultiLingual.pm version: '0.032' ExtUtils::Builder::ParseXS: file: lib/ExtUtils/Builder/ParseXS.pm version: '0.032' ExtUtils::Builder::Profile::Perl: file: lib/ExtUtils/Builder/Profile/Perl.pm version: '0.032' requires: Carp: '0' DynaLoader: '0' ExtUtils::Builder: '0.016' ExtUtils::Builder::Action::Command: '0' ExtUtils::Builder::Node: '0' ExtUtils::Builder::Planner: '0.007' ExtUtils::Builder::Planner::Extension: '0' ExtUtils::Builder::Util: '0' ExtUtils::Config: '0.007' ExtUtils::Helpers: '0.027' File::Basename: '0' File::Spec::Functions: '0' File::Temp: '0' Perl::OSType: '0' parent: '0' perl: '5.010' sort: '0' strict: '0' warnings: '0' resources: bugtracker: https://github.com/Leont/extutils-builder-compiler/issues repository: git://github.com/Leont/extutils-builder-compiler.git version: '0.032' x_generated_by_perl: v5.40.1 x_serialization_backend: 'YAML::Tiny version 1.76' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' x_static_install: 1 MANIFEST100644001750001750 212015005700133 17257 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.032. Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/ExtUtils/Builder/ArgumentCollector.pm lib/ExtUtils/Builder/AutoDetect/C.pm lib/ExtUtils/Builder/AutoDetect/Cpp.pm lib/ExtUtils/Builder/Binary.pm lib/ExtUtils/Builder/Compiler.pm lib/ExtUtils/Builder/Compiler/MSVC.pm lib/ExtUtils/Builder/Compiler/Unixy.pm lib/ExtUtils/Builder/Compiler/VMS.pm lib/ExtUtils/Builder/Conf.pm lib/ExtUtils/Builder/Linker.pm lib/ExtUtils/Builder/Linker/Ar.pm lib/ExtUtils/Builder/Linker/COFF.pm lib/ExtUtils/Builder/Linker/ELF/Any.pm lib/ExtUtils/Builder/Linker/ELF/GCC.pm lib/ExtUtils/Builder/Linker/Mach/GCC.pm lib/ExtUtils/Builder/Linker/PE/GCC.pm lib/ExtUtils/Builder/Linker/PE/MSVC.pm lib/ExtUtils/Builder/Linker/Unixy.pm lib/ExtUtils/Builder/Linker/XCOFF.pm lib/ExtUtils/Builder/MultiLingual.pm lib/ExtUtils/Builder/ParseXS.pm lib/ExtUtils/Builder/Profile/Perl.pm prereqs.yml t/30-compiler-unixy.t t/30-linker-elf-gcc.t t/40-autodetect-executable.t t/40-autodetect-loadable-object.t xt/author/pod-syntax.t META.json100644001750001750 1236715005700133 17605 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032{ "abstract" : "An interface around different compilers.", "author" : [ "Leon Timmermans " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "ExtUtils-Builder-Compiler", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Test::More" : "0", "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Carp" : "0", "DynaLoader" : "0", "ExtUtils::Builder" : "0.016", "ExtUtils::Builder::Action::Command" : "0", "ExtUtils::Builder::Node" : "0", "ExtUtils::Builder::Planner" : "0.007", "ExtUtils::Builder::Planner::Extension" : "0", "ExtUtils::Builder::Util" : "0", "ExtUtils::Config" : "0.007", "ExtUtils::Helpers" : "0.027", "File::Basename" : "0", "File::Spec::Functions" : "0", "File::Temp" : "0", "Perl::OSType" : "0", "parent" : "0", "perl" : "5.010", "sort" : "0", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "Cwd" : "0", "ExtUtils::Builder::Planner" : "0.007", "IPC::Open2" : "0", "Test::More" : "0.89" } } }, "provides" : { "ExtUtils::Builder::ArgumentCollector" : { "file" : "lib/ExtUtils/Builder/ArgumentCollector.pm", "version" : "0.032" }, "ExtUtils::Builder::AutoDetect::C" : { "file" : "lib/ExtUtils/Builder/AutoDetect/C.pm", "version" : "0.032" }, "ExtUtils::Builder::AutoDetect::Cpp" : { "file" : "lib/ExtUtils/Builder/AutoDetect/Cpp.pm", "version" : "0.032" }, "ExtUtils::Builder::Binary" : { "file" : "lib/ExtUtils/Builder/Binary.pm", "version" : "0.032" }, "ExtUtils::Builder::Compiler" : { "file" : "lib/ExtUtils/Builder/Compiler.pm", "version" : "0.032" }, "ExtUtils::Builder::Compiler::MSVC" : { "file" : "lib/ExtUtils/Builder/Compiler/MSVC.pm", "version" : "0.032" }, "ExtUtils::Builder::Compiler::Unixy" : { "file" : "lib/ExtUtils/Builder/Compiler/Unixy.pm", "version" : "0.032" }, "ExtUtils::Builder::Compiler::VMS" : { "file" : "lib/ExtUtils/Builder/Compiler/VMS.pm", "version" : "0.032" }, "ExtUtils::Builder::Conf" : { "file" : "lib/ExtUtils/Builder/Conf.pm", "version" : "0.032" }, "ExtUtils::Builder::Linker" : { "file" : "lib/ExtUtils/Builder/Linker.pm", "version" : "0.032" }, "ExtUtils::Builder::Linker::Ar" : { "file" : "lib/ExtUtils/Builder/Linker/Ar.pm", "version" : "0.032" }, "ExtUtils::Builder::Linker::COFF" : { "file" : "lib/ExtUtils/Builder/Linker/COFF.pm", "version" : "0.032" }, "ExtUtils::Builder::Linker::ELF::Any" : { "file" : "lib/ExtUtils/Builder/Linker/ELF/Any.pm", "version" : "0.032" }, "ExtUtils::Builder::Linker::ELF::GCC" : { "file" : "lib/ExtUtils/Builder/Linker/ELF/GCC.pm", "version" : "0.032" }, "ExtUtils::Builder::Linker::Mach::GCC" : { "file" : "lib/ExtUtils/Builder/Linker/Mach/GCC.pm", "version" : "0.032" }, "ExtUtils::Builder::Linker::PE::GCC" : { "file" : "lib/ExtUtils/Builder/Linker/PE/GCC.pm", "version" : "0.032" }, "ExtUtils::Builder::Linker::PE::MSVC" : { "file" : "lib/ExtUtils/Builder/Linker/PE/MSVC.pm", "version" : "0.032" }, "ExtUtils::Builder::Linker::Unixy" : { "file" : "lib/ExtUtils/Builder/Linker/Unixy.pm", "version" : "0.032" }, "ExtUtils::Builder::Linker::XCOFF" : { "file" : "lib/ExtUtils/Builder/Linker/XCOFF.pm", "version" : "0.032" }, "ExtUtils::Builder::MultiLingual" : { "file" : "lib/ExtUtils/Builder/MultiLingual.pm", "version" : "0.032" }, "ExtUtils::Builder::ParseXS" : { "file" : "lib/ExtUtils/Builder/ParseXS.pm", "version" : "0.032" }, "ExtUtils::Builder::Profile::Perl" : { "file" : "lib/ExtUtils/Builder/Profile/Perl.pm", "version" : "0.032" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/Leont/extutils-builder-compiler/issues" }, "repository" : { "type" : "git", "url" : "git://github.com/Leont/extutils-builder-compiler.git", "web" : "https://github.com/Leont/extutils-builder-compiler" } }, "version" : "0.032", "x_generated_by_perl" : "v5.40.1", "x_serialization_backend" : "Cpanel::JSON::XS version 4.39", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later", "x_static_install" : 1 } prereqs.yml100644001750001750 6215005700133 20275 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032runtime: requires: ExtUtils::Builder: 0.016 Makefile.PL100644001750001750 424415005700133 20111 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.032. use strict; use warnings; use 5.010; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "An interface around different compilers.", "AUTHOR" => "Leon Timmermans ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "ExtUtils-Builder-Compiler", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.010", "NAME" => "ExtUtils::Builder::Compiler", "PREREQ_PM" => { "Carp" => 0, "DynaLoader" => 0, "ExtUtils::Builder" => "0.016", "ExtUtils::Builder::Action::Command" => 0, "ExtUtils::Builder::Node" => 0, "ExtUtils::Builder::Planner" => "0.007", "ExtUtils::Builder::Planner::Extension" => 0, "ExtUtils::Builder::Util" => 0, "ExtUtils::Config" => "0.007", "ExtUtils::Helpers" => "0.027", "File::Basename" => 0, "File::Spec::Functions" => 0, "File::Temp" => 0, "Perl::OSType" => 0, "parent" => 0, "sort" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "Cwd" => 0, "ExtUtils::Builder::Planner" => "0.007", "IPC::Open2" => 0, "Test::More" => "0.89" }, "VERSION" => "0.032", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "Cwd" => 0, "DynaLoader" => 0, "ExtUtils::Builder" => "0.016", "ExtUtils::Builder::Action::Command" => 0, "ExtUtils::Builder::Node" => 0, "ExtUtils::Builder::Planner" => "0.007", "ExtUtils::Builder::Planner::Extension" => 0, "ExtUtils::Builder::Util" => 0, "ExtUtils::Config" => "0.007", "ExtUtils::Helpers" => "0.027", "File::Basename" => 0, "File::Spec::Functions" => 0, "File::Temp" => 0, "IPC::Open2" => 0, "Perl::OSType" => 0, "Test::More" => "0.89", "parent" => 0, "sort" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); t000755001750001750 015005700133 16236 5ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.03230-compiler-unixy.t100644001750001750 455715005700133 22002 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/t#! perl use strict; use warnings; use Test::More 0.89; BEGIN { *eq_or_diff = eval { require Test::Differences } ? \&Test::Differences::eq_or_diff : \&Test::More::is_deeply; } use ExtUtils::Builder::Compiler::Unixy; { my $compiler = ExtUtils::Builder::Compiler::Unixy->new(cc => 'cc', cccdlflags => [ '-fPIC' ], type => 'loadable-object'); my $obj = $compiler->compile('file.c', 'file.o'); eq_or_diff([ $obj->to_command ], [[qw/cc -fPIC -o file.o -c file.c/]], 'Got "cc -fPIC -o file.o -c file.c"') or diag explain $obj; } { my $compiler = ExtUtils::Builder::Compiler::Unixy->new(cc => [ 'cc' ], cccdlflags => [ '-fPIC' ], type => 'executable'); eq_or_diff([ $compiler->compile('file.c', 'file.o')->to_command ], [[qw/cc -o file.o -c file.c/]], 'Got "cc -o file.o -c file.c"'); } { my $compiler = ExtUtils::Builder::Compiler::Unixy->new(cc => 'cc', cccdlflags => [ ], type => 'loadable-object'); eq_or_diff([ $compiler->compile('file.c', 'file.o')->to_command ], [[qw/cc -o file.o -c file.c/]], 'Got "cc -o file.o -c file.c" 2'); } { my $compiler = ExtUtils::Builder::Compiler::Unixy->new(cc => [ 'cc' ], cccdlflags => [ ], type => 'loadable-object'); $compiler->add_include_dirs([ 'headers' ]); eq_or_diff([ $compiler->compile('file.c', 'file.o')->to_command ], [[qw/cc -Iheaders -o file.o -c file.c/]], 'Got "cc -Iheaders -o file.o -c file.c"'); } { my $compiler = ExtUtils::Builder::Compiler::Unixy->new(cc => 'cc89', cccdlflags => [ '-fPIC' ], type => 'executable'); $compiler->add_include_dirs([ 'headers' ]); $compiler->add_defines({ foo => 'bar' }); eq_or_diff([ $compiler->compile('file.c', 'file.o')->to_command ], [[qw/cc89 -Iheaders -Dfoo=bar -o file.o -c file.c/]], 'Got "cc -Iheaders -Dfoo=bar -o file.o -c file.c"'); } { my $compiler = ExtUtils::Builder::Compiler::Unixy->new(cc => [ qw/cc -std=c89/ ], cccdlflags => [ ], type => 'loadable-object'); $compiler->add_defines({ foo => '' }); eq_or_diff([ $compiler->compile('file.c', 'file.o')->to_command ], [[qw/cc -std=c89 -Dfoo -o file.o -c file.c/]], 'Got "cc -Dfoo -o file.o -c file.c"'); } { my $compiler = ExtUtils::Builder::Compiler::Unixy->new(cc => [ 'cc' ], cccdlflags => [ '-fPIC' ], type => 'executable'); $compiler->add_defines({ foo => undef }); eq_or_diff([ $compiler->compile('file.c', 'file.o')->to_command ], [[qw/cc -Ufoo -o file.o -c file.c/]], 'Got "cc -Ufoo -o file.o -c file.c"'); } done_testing; 30-linker-elf-gcc.t100644001750001750 211015005700133 21557 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/t#! perl use strict; use warnings; use Test::More 0.89; BEGIN { *eq_or_diff = eval { require Test::Differences } ? \&Test::Differences::eq_or_diff : \&Test::More::is_deeply; } use ExtUtils::Builder::Linker::ELF::Any; { my $linker = ExtUtils::Builder::Linker::ELF::Any->new(ld => [ qw/cc/ ], ccdlflags => [ '-Wl,-E' ], lddlflags => ['-shared'], type => 'executable'); eq_or_diff([ $linker->link(['file.o'], 'file')->to_command ], [[qw/cc -o file file.o/]], 'Got "cc -o file file.o"'); } { my $linker = ExtUtils::Builder::Linker::ELF::Any->new(ld => [ qw/cc/ ], ccdlflags => [ '-Wl,-E' ], lddlflags => ['-shared'], type => 'shared-library'); eq_or_diff([ $linker->link(['file.o'], 'file.so')->to_command ], [[qw/cc -shared -o file.so file.o/]], 'Got "cc -shared -o file.so file.o"'); } { my $linker = ExtUtils::Builder::Linker::ELF::Any->new(ld => [ qw/cc/ ], ccdlflags => [ '-Wl,-E' ], lddlflags => ['-shared'], type => 'loadable-object'); eq_or_diff([ $linker->link(['file.o'], 'file')->to_command ], [[qw/cc -shared -o file file.o/]], 'Got "cc -o file -c file.o"'); } done_testing; author000755001750001750 015005700133 17730 5ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/xtpod-syntax.t100644001750001750 25215005700133 22342 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/xt/author#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Builder000755001750001750 015005700133 21710 5ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtilsConf.pm100644001750001750 4274315005700133 23325 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builderpackage ExtUtils::Builder::Conf; $ExtUtils::Builder::Conf::VERSION = '0.032'; use strict; use warnings; use Carp; use File::Basename qw/basename dirname/; use File::Spec::Functions qw/catfile curdir/; use File::Temp qw/tempfile tempdir/; use ExtUtils::Builder::Action::Command; use ExtUtils::Builder::Planner; sub fail { my ($diag) = @_; my $message = defined $diag ? "OS unsupported - $diag\n" : "OS unsupported\n"; die $message; } my @names = qw/include_dirs library_dirs libraries extra_compiler_flags extra_linker_flags/; sub add_methods { my ($self, $planner, %args) = @_; for my $name (@names) { $planner->add_delegate($name, sub { my $self = shift; return @{ $self->{$name} // [] }; }); $planner->add_delegate("push_$name", sub { my ($self, @args) = @_; push @{ $self->{$name} }, @args; }); } $planner->add_delegate(define => sub { my ($self, $symbol, $value) = @_; $self->{defines}{$symbol} = $value // ''; }); $planner->add_delegate(defines => sub { my $self = shift; return %{ $self->{defines} // {} }; }); $planner->add_delegate(write_defines => sub { my ($self, $to, %arguments) = @_; my @lines; for my $symbol (sort keys %{ $self->{defines} }) { if (not defined $self->{defines}{$symbol}) { push @lines, "#undef $symbol\n"; } elsif ($self->{defines}{$symbol} eq '') { push @lines, "#define $symbol\n" } else { my $value = $self->{defines}{$symbol}; $value =~ s/\n/\\\n/g; push @lines, "#define $symbol $symbol\n" } } open my $fh, '>', $to or croak "Cannot open $to for writing: $!"; print join "\n", @lines; close $fh or croak "Cannot write $to for writing: $!" }); $planner->add_delegate(try_compile_run => sub { my ($self, %args) = @_; my $dir = File::Temp->newdir; my ($source_file, $c_file) = tempfile('try_compilerXXXX', DIR => $dir, SUFFIX => '.c'); print $source_file $args{source}; my $inner = $self->new_planner; $inner->load_extension('ExtUtils::Builder::AutoDetect::C', 0.015); my @include_dirs = (@{ $args{include_dirs} // [] }, @{ $self->{include_dirs} // [] }); my @extra_compiler_flags = (@{ $args{extra_compiler_flags} // [] }, @{ $self->{extra_compiler_flags} // [] }); my %defines = (%{ $args{defines} // {} }, %{ $self->{defines} // {} }); my %compile_args = ( extra_args => \@extra_compiler_flags, include_dirs => \@include_dirs, defines => \%defines, ); my $basename = basename($c_file, '.c'); my $o_file = $inner->obj_file($basename, $dir); $inner->compile($c_file, $o_file, %compile_args); my @libraries = (@{ $args{libraries} // [] }, @{ $self->{libraries} // [] }); my @library_dirs = (@{ $args{library_dirs} // [] }, @{ $self->{library_dirs} // [] }); my @extra_linker_flags = (@{ $args{extra_linker_flags} // [] }, @{ $self->{extra_linker_flags} // [] }); my %link_args = ( libraries => \@libraries, library_dirs => \@library_dirs, extra_args => \@extra_linker_flags, ); my $exe_file = $inner->exe_file($basename, $dir); $inner->link([ $o_file ], $exe_file, %link_args); my $run = $args{run} // 1; my $target; if ($run) { $inner->create_node( target => 'test', dependencies => [ $exe_file ], actions => [ ExtUtils::Builder::Action::Command->new(command => [ $exe_file ]), ], phony => 1, ); $target = 'test'; } else { $target = $exe_file; } my $result = eval { $inner->materialize->run($target, quiet => $args{quiet}); 1 }; return !!0 if not $result; $self->define($args{define}) if defined $args{define}; if ($args{push_args}) { for my $name (@names) { if (my $arg = $args{$name}) { push @{ $self->{$name} }, @{$arg}; } } if ($args{defines}) { for my $key (keys %{$args{defines}}) { $self->{defines}{$key} = $args{defines}{$key}; } } } return !!1; }); $planner->add_delegate(assert_compile_run => sub { my ($self, %args) = @_; my $diag = delete $args{diag}; $self->try_compile_run(%args) or fail($diag); }); $planner->add_delegate(try_find_cflags_for => sub { my ($self, %args) = @_; ref(my $cflags = $args{cflags}) eq "ARRAY" or croak "Expected 'cflags' as ARRAY ref"; foreach my $f (@$cflags) { ref $f eq "ARRAY" or croak "Expected 'cflags' element as ARRAY ref"; $self->try_compile_run(%args, extra_compiler_flags => $f, push_args => 1) or next; return !!1; } return !!0; }); $planner->add_delegate(try_find_include_dirs_for => sub { my ($self, %args) = @_; ref(my $dirs = $args{dirs}) eq "ARRAY" or croak "Expected 'dirs' as ARRAY ref"; foreach my $d (@$dirs) { ref $d eq "ARRAY" or croak "Expected 'dirs' element as ARRAY ref"; $self->try_compile_run(%args, include_dirs => $d, push_args => 1) or next; return !!1; } return !!0; }); $planner->add_delegate(try_find_libraries_for => sub { my ($self, %args) = @_; ref(my $libs = $args{libs}) eq "ARRAY" or croak "Expected 'libs' as ARRAY ref"; foreach my $libraries (@$libs) { $self->try_compile_run(%args, libraries => $libraries, push_args => 1) or next; return !!1; } return !!0; }); $planner->add_delegate(try_find_library_dirs_for => sub { my ($self, %args) = @_; ref(my $dirs = $args{dirs}) eq "ARRAY" or croak "Expected 'dirs' as ARRAY ref"; foreach my $d (@$dirs) { ref $d eq "ARRAY" or croak "Expected 'dirs' element as ARRAY ref"; $self->try_compile_run(%args, library_dirs => $d, push_args => 1) or next; return !!1; } return !!0; }); foreach my $name (qw/find_cflags_for find_libraries_for find_include_dirs_for find_library_dirs_for/) { my $trymethod = "try_$name"; $planner->add_delegate($name, sub { my ($self, %args) = @_; my $diag = delete $args{diag}; $self->$trymethod(%args) or fail($diag); }); }; } 1; # ABSTRACT: Configure-time utilities for using C headers, libraries, or OS features __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Conf - Configure-time utilities for using C headers, libraries, or OS features =head1 VERSION version 0.032 =head1 SYNOPSIS load_extension("ExtUtils::Builder::Conf"); assert_compile_run(diag => 'no PF_MOONLASER', source => <<'EOF'); #include #include int main(int argc, char *argv[]) { printf("PF_MOONLASER is %d\n", PF_MOONLASER); return 0; } EOF =head1 DESCRIPTION Often Perl modules are written to wrap functionality found in existing C headers, libraries, or to use OS-specific features. It is useful to check for the existance of these requirements before attempting to actually build the module. Objects in this class provide an extension around L to simplify the creation of a F<.c> file, compiling, linking and running it, to test if a certain feature is present. It may also be necessary to search for the correct library to link against, or for the right include directories to find header files in. This class also provides assistance here. =head1 DELEGATES =head2 try_compile_run $success = try_compile_run(%args); Try to compile, link, and execute a C program whose source is given. Returns true if the program compiled and linked, and exited successfully. Returns false if any of these steps fail. Takes the following named arguments: =over 4 =item source => STRING The source code of the C program to try compiling, building, and running. =item defines => HASH Optional. A set of defines to be passed to the compiler. =item extra_compiler_flags => ARRAY Optional. If specified, pass extra flags to the compiler. =item extra_linker_flags => ARRAY Optional. If specified, pass extra flags to the linker. =item include_dirs => ARRAY Optional. If specified, pass extra include dirs to the compiler. =item libraries => ARRAY Optional. If specified, pass extra libaries to the linker. =item library_dirs => ARRAY Optional. If specified, pass extra libary directories to the linker. =item quiet => BOOL This makes C run quietly. =item define => STRING Optional. If specified, then the named symbol will be defined if the program ran successfully. This will either on the C compiler commandline (by passing an option C<-DI>), in the C method, or via the C method. =item push_args => BOOL If true, any of C, C, C, C, C or C will have its value pushed on success (e.g. C for the C argument). =back =head2 assert_compile_run assert_compile_run(%args); Calls C. If it fails, die with an C message. Useful to call from F or F. Takes one extra optional argument: =over 4 =item diag => STRING If present, this string will be appended to the failure message if one is generated. It may provide more useful information to the user on why the OS is unsupported. =back =head2 try_find_cflags_for $success = try_find_cflags_for(%args); Try to compile, link and execute the given source, using extra compiler flags. When a usable combination is found, the flags are stored in the object for use in further compile operations, or returned by C. The method then returns true. If no usable combination is found, it returns false. Takes the following extra arguments: =over 4 =item source => STRING Source code to compile =item cflags => ARRAY of ARRAYs Gives a list of sets of flags. Each set of flags should be strings in its own array reference. =item define => STRING Optional. If specified, then the named symbol will be defined if the program ran successfully. This will either on the C compiler commandline (by passing an option C<-DI>), in the C method, or via the C method. =back =head2 try_find_include_dirs_for $success = try_find_include_dirs_for(%args); Try to compile, link and execute the given source, using extra include directories. When a usable combination is found, the directories required are stored in the object for use in further compile operations, or returned by C. The method then returns true. If no a usable combination is found, it returns false. Takes the following arguments: =over 4 =item source => STRING Source code to compile =item dirs => ARRAY of ARRAYs Gives a list of sets of dirs. Each set of dirs should be strings in its own array reference. =item define => STRING Optional. If specified, then the named symbol will be defined if the program ran successfully. This will either on the C compiler commandline (by passing an option C<-DI>), in the C method, or via the C method. =back =head2 try_find_libraries_for $success = try_find_libraries_for(%args); Try to compile, link and execute the given source, when linked against a given set of extra libraries. When a usable combination is found, the libraries required are stored in the object for use in further link operations, or returned by C. The method then returns true. If no usable combination is found, it returns false. Takes the following arguments: =over 4 =item source => STRING Source code to compile =item libs => ARRAY of STRINGs Gives a list of sets of libraries. Each set of libraries should be space-separated. =item define => STRING Optional. If specified, then the named symbol will be defined if the program ran successfully. This will either on the C compiler commandline (by passing an option C<-DI>), in the C method, or via the C method. =back =head2 try_find_library_dirs_for $success = try_find_library_dirs_for(%args); Try to compile, link and execute the given source, using extra library directories. When a usable combination is found, the directories required are stored in the object for use in further compile operations, or returned by C. The method then returns true. If no a usable combination is found, it returns false. Takes the following arguments: =over 4 =item source => STRING Source code to compile =item dirs => ARRAY of ARRAYs Gives a list of sets of dirs. Each set of dirs should be strings in its own array reference. =item define => STRING Optional. If specified, then the named symbol will be defined if the program ran successfully. This will either on the C compiler commandline (by passing an option C<-DI>), in the C method, or via the C method. =back =head2 find_cflags_for find_cflags_for(%args); =head2 find_include_dirs_for find_include_dirs_for(%args); =head2 find_libraries_for find_libraries_for(%args); Calls C, C or C respectively. If it fails, die with an C message. Each method takes one extra optional argument: =over 4 =item diag => STRING If present, this string will be appended to the failure message if one is generated. It may provide more useful information to the user on why the OS is unsupported. =back =head2 include_dirs $dirs = include_dirs; Returns the currently-configured include directories as an array. =head2 library_dirs $dirs = library_dirs; Returns the currently-configured library directories as an array. =head2 libraries $libs = libraries; Returns the currently-configured libraries as an array. =head2 extra_compiler_flags $flags = extra_compiler_flags; Returns the currently-configured extra compiler flags as an array. =head2 extra_linker_flags $flags = extra_linker_flags; Returns the currently-configured extra linker flags as an array. =head2 push_include_dirs push_include_dirs(@dirs); Adds more include directories =head2 push_library_dirs push_library_dirs(@dirs); Adds more library directories =head2 push_libraries push_libraries(@libs); Adds more libraries =head2 push_extra_compiler_flags push_extra_compiler_flags(@flags); Adds more compiler flags =head2 push_extra_linker_flags push_extra_linker_flags(@flags); Adds more linker flags =head2 define define($symbol); Adds a new defined symbol directly; either by appending to the compiler flags or writing it into the defines file. =head1 EXAMPLES =head2 Socket Libraries Some operating systems provide the BSD sockets API in their primary F. Others keep it in a separate library which should be linked against. The following example demonstrates how this would be handled. find_libraries_for( diag => 'no socket()', libs => [ [], ['socket', 'nsl' ]], source => q[ #include int main(int argc, char *argv) { int fd = socket(PF_INET, SOCK_STREAM, 0); if (fd < 0) return 1; return 0; } ]); =head2 Testing For Optional Features Sometimes a function or ability may be optionally provided by the OS, or you may wish your module to be useable when only partial support is provided, without requiring it all to be present. In these cases it is traditional to detect the presence of this optional feature in the F script, and define a symbol to declare this fact if it is found. The XS code can then use this symbol to select between differing implementations. For example, the F: try_compile_run( define => 'HAVE_MANGO', source => <<'EOF'); #include #include int main(void) { if (mango() != 0) exit(1); exit(0); } EOF If the C code compiles and runs successfully, and exits with a true status, the symbol C will be defined on the compiler commandline. This allows the XS code to detect it, for example int mango() CODE: #ifdef HAVE_MANGO RETVAL = mango(); #else croak("mango() not implemented"); #endif OUTPUT: RETVAL This module will then still compile even if the operating system lacks this particular function. Trying to invoke the function at runtime will simply throw an exception. =head2 Linux Kernel Headers Operating systems built on top of the F kernel often share a looser association with their kernel version than most other operating systems. It may be the case that the running kernel is newer, containing more features, than the distribution's F headers would believe. In such circumstances it can be difficult to make use of new socket options, Cs, etc.. without having the constants that define them and their parameter structures, because the relevant header files are not visible to the compiler. In this case, there may be little choice but to pull in some of the kernel header files, which will provide the required constants and structures. The Linux kernel headers can be found using the F directory. A fragment in F like the following, may be appropriate. chomp(my $uname_r = `uname -r); my @dirs = ( [], [ "/lib/modules/$uname_r/source/include" ], ); find_include_dirs_for( diag => "no PF_MOONLASER", dirs => \@dirs, source => <<'EOF'); #include #include int family = PF_MOONLASER; struct laserwl lwl; int main(int argc, char *argv[]) { return 0; } EOF This fragment will first try to compile the program as it stands, hoping that the F headers will be sufficient. If it fails, it will then try including the kernel headers, which should make the constant and structure visible, allowing the program to compile. =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut 40-autodetect-executable.t100644001750001750 343015005700133 23264 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/t#! perl use strict; use warnings; use Test::More 0.89; use Config; use Cwd 'getcwd'; use ExtUtils::Builder::Planner; use File::Temp 'tempdir'; use IPC::Open2 qw/open2/; use File::Basename qw/basename dirname/; use File::Spec::Functions qw/catfile/; sub capturex { local @ENV{qw/PATH IFS CDPATH ENV BASH_ENV/}; my $pid = open2(my($in, $out), @_); binmode $in, ':crlf' if $^O eq 'MSWin32'; my $ret = do { local $/; <$in> }; waitpid $pid, 0; return $ret; } my $olddir = getcwd; my $dir = tempdir(CLEANUP => 1); chdir $dir; mkdir 't'; my $planner = ExtUtils::Builder::Planner->new; $planner->load_extension('ExtUtils::Builder::AutoDetect::C', undef, type => 'executable', ); my $source_file = catfile('t', 'executable.c'); { open my $fh, '>', $source_file or die "Can't create $source_file: $!"; my $content = < int main(int argc, char **argv, char **env) { printf("Dubrovnik\\n"); return 0; } END print $fh $content or die "Can't write to $source_file: $!"; close $fh or die "Can't close $source_file: $!"; } ok(-e $source_file, "source file '$source_file' created"); my $object_file = catfile(dirname($source_file), basename($source_file, '.c') . $Config{obj_ext}); $planner->compile($source_file, $object_file); my $exe_file = catfile(dirname($source_file), basename($object_file, $Config{obj_ext}) . $Config{exe_ext}); $planner->link([$object_file], $exe_file); my $plan = $planner->materialize; ok $plan; ok eval { $plan->run($exe_file, logger => \¬e); 1 } or diag "Got exception: $@"; ok(-e $object_file, "object file $object_file has been created"); ok(-e $exe_file, "lib file $exe_file has been created"); my $output = eval { capturex($exe_file) }; is ($output, "Dubrovnik\n", 'Output is "Dubrovnik"') or diag("Error: $@"); chdir $olddir; done_testing; Binary.pm100644001750001750 173615005700133 23641 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builderpackage ExtUtils::Builder::Binary; $ExtUtils::Builder::Binary::VERSION = '0.032'; use strict; use warnings; use Carp qw//; my %allowed_types = map { ($_ => 1) } qw/shared-library static-library loadable-object executable/; sub _init { my ($self, %args) = @_; my $type = $args{type} or Carp::croak('No type given'); $allowed_types{$type} or Carp::croak("$type is not an allowed linkage type"); $self->{type} = $type; return; } sub type { my $self = shift; return $self->{type}; } 1; # ABSTRACT: Helper role for classes producing binary objects __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Binary - Helper role for classes producing binary objects =head1 VERSION version 0.032 =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Linker.pm100644001750001750 737015005700133 23641 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builderpackage ExtUtils::Builder::Linker; $ExtUtils::Builder::Linker::VERSION = '0.032'; use strict; use warnings; use parent qw/ExtUtils::Builder::ArgumentCollector ExtUtils::Builder::Binary/; use ExtUtils::Builder::Node; use ExtUtils::Builder::Util qw/command function/; use Carp (); use File::Basename 'dirname'; my %allowed_export = map { $_ => 1 } qw/none some all/; sub new { my ($class, %args) = @_; my $self = bless {}, $class; $self->_init(%args); return $self; } sub _init { my ($self, %args) = @_; $self->ExtUtils::Builder::ArgumentCollector::_init(%args); $self->ExtUtils::Builder::Binary::_init(%args); my $export = $args{export}; Carp::croak("'$export' is not an allowed export value") if not $allowed_export{$export}; $self->{export} = $export; $self->{ld} = $args{ld}; $self->{library_dirs} = []; $self->{libraries} = []; $self->{option_filters} = []; return; } sub export { my $self = shift; return $self->{export}; } sub ld { my $self = shift; return @{ $self->{ld} }; } sub collect_arguments { my ($self, @args) = @_; return ($self->SUPER::collect_arguments(@args), $self->linker_flags(@args)); } sub add_library_dirs { my ($self, $dirs, %opts) = @_; my $ranking = $self->fix_ranking($self->default_libdir_ranking, $opts{ranking}); push @{ $self->{library_dirs} }, map { { ranking => $ranking, value => $_ } } @{ $dirs }; return; } sub default_libdir_ranking { return 30; } sub add_libraries { my ($self, $dirs, %opts) = @_; my $ranking = $self->fix_ranking($self->default_library_ranking, $opts{ranking}); push @{ $self->{libraries} }, map { { ranking => $ranking, value => $_ } } @{ $dirs }; return; } sub default_library_ranking { return 75; } sub add_option_filter { my ($self, $filter) = @_; push @{ $self->{option_filters} }, $filter; return; } my %key_for = ( dl_vars => 'DL_VARS', dl_funcs => 'DL_FUNCS', dl_func_list => 'FUNCLIST', dl_imports => 'IMPORTS', dl_name => 'NAME', dl_base => 'DLBASE', dl_file => 'FILE', ); sub pre_action { my ($self, $from, $to, %opts) = @_; my @result; if ($self->export eq 'some') { my %args = map { $key_for{$_} => $opts{$_} } grep { exists $key_for{$_} } keys %opts; push @result, function( module => 'ExtUtils::Mksymlists', function => 'Mksymlists', message => join(' ', 'prelink', $to, %args), arguments => [ %args ], exports => 1, ); } if ($opts{mkdir}) { my $dirname = File::Basename::dirname($to); push @result, function( module => 'File::Path', function => 'make_path', exports => 'explicit', arguments => [ $dirname ], message => "mkdir $dirname", ); } return @result; } sub post_action { } sub link { my ($self, @args) = @_; @args = $self->$_(@args) for @{ $self->{option_filters} }; my ($from, $to, %opts) = @args; my @argv = $self->arguments(@args); my $main = command($self->ld, @argv); my @actions = ($self->pre_action(@args), $main, $self->post_action(@args)); my $deps = [ @{$from}, @{ $opts{dependencies} // [] } ]; return ExtUtils::Builder::Node->new(target => $to, dependencies => $deps, actions => \@actions); } 1; __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Linker =head1 VERSION version 0.032 =head1 METHODS =head2 new =over 4 =item type This must be either C, C, C or C. =item libraries =item library_dirs =item export =back =head2 add_library_dirs =head2 add_libraries =head2 link($source, $target, %options) =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut ParseXS.pm100644001750001750 1015515005700133 23755 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builderpackage ExtUtils::Builder::ParseXS; $ExtUtils::Builder::ParseXS::VERSION = '0.032'; use strict; use warnings; use parent 'ExtUtils::Builder::Planner::Extension'; use File::Basename qw/basename dirname/; use File::Spec::Functions qw/abs2rel curdir catfile catdir splitdir/; use ExtUtils::Builder::Util 'function'; sub add_methods { my ($self, $planner, %options) = @_; my $config = $options{config} // ($planner->can('config') ? $planner->config : ExtUtils::Config->new); $planner->add_delegate('parse_xs', sub { my (undef, $source, $destination, %options) = @_; my @actions; if ($options{mkdir}) { my $dirname = dirname($destination); push @actions, function( module => 'File::Path', function => 'make_path', arguments => [ $dirname ], exports => 'explicit', message => "mkdir $dirname", ); } my %args = ( filename => $source, output => $destination, prototypes => 0, die_on_error => 1, ); $args{$_} = $options{$_} for grep { defined $options{$_} } qw/typemap hiertype versioncheck linenumbers optimize prototypes/; push @actions, function( module => 'ExtUtils::ParseXS', function => 'process_file', arguments => [ %args ], message => "parse-xs $source", ); my @dependencies = @{ $options{dependencies} // [] }; $args{typemap} //= 'typemap' if -f 'typemap'; push @dependencies, $args{typemap} if $args{typemap}; $planner->create_node( target => $destination, dependencies => [ $source, @dependencies ], actions => \@actions, ); }); $planner->add_delegate('c_file_for_xs', sub { my (undef, $source, $outdir) = @_; $outdir //= dirname($source); my $file_base = basename($source, '.xs'); return catfile($outdir, "$file_base.c"); }); $planner->add_delegate('module_for_xs', sub { my (undef, $source, $relative) = @_; my @parts = splitdir(dirname(abs2rel($source, $relative))); push @parts, basename($source, '.xs'); return join '::', @parts; }); require DynaLoader; my $mod2fname = defined &DynaLoader::mod2fname ? \&DynaLoader::mod2fname : sub { return $_[0][-1] }; $planner->add_delegate('extension_filename', sub { my (undef, $module) = @_; my @parts = split '::', $module; my $archdir = catdir(qw/blib arch auto/, @parts); my $basename = $mod2fname->(\@parts); my $filename = "$basename." . $config->get('dlext'); return catfile($archdir, $filename); }); } 1; # ABSTRACT: Essential functions for implementing XS in a Plan __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::ParseXS - Essential functions for implementing XS in a Plan =head1 VERSION version 0.032 =head1 SYNOPSIS $planner->load_extension("ExtUtils::Builder::ParseXS"); $planner->parse_xs("foo.xs", "foo.c"); =head1 DESCRIPTION This module implements several helper methods used in implementing XS. It takes one optional argument C, which should be an C compatible object. If your C<$planner> has a C delegate, that will be used as default value. =head2 DELEGATES =head3 parse_xs($source, $destination, %options) This will parse the XS file C<$source> and write the resulting C file to C<$destination>. =over 4 =item * mkdir If set this will mkdir the base of the target before running the parse. =item * dependencies This lists additional dependencies that will be added to the target. =item * typemap The name of the typemap file. Defaults to C if that file exists. =item * hiertype Allow hierarchical types (with double colons) such as used in C++. =back =head3 c_file_for_xs($filename, $dir = dirname($filename)) This returns the path to the C file for a certain XS file. =head3 module_for_xs($filename) This returns the module corresponding to a specific XS files. =head3 extension_filename($module_name) This will return the path for the loadable object of an extension for C<$module>. =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Compiler.pm100644001750001750 560215005700133 24163 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builderpackage ExtUtils::Builder::Compiler; $ExtUtils::Builder::Compiler::VERSION = '0.032'; use strict; use warnings; use ExtUtils::Builder::Util qw/command function/; use ExtUtils::Builder::Node; use parent qw/ExtUtils::Builder::ArgumentCollector ExtUtils::Builder::Binary/; sub new { my ($class, %args) = @_; my $cc = $args{cc}; $cc = [ $cc ] if not ref $cc; my $self = bless { cc => $cc, include_dirs => [], defines => [], }, $class; $self->_init(%args); return $self; } sub _init { my ($self, %args) = @_; $self->ExtUtils::Builder::ArgumentCollector::_init(%args); $self->ExtUtils::Builder::Binary::_init(%args); return; } sub compile_flags; sub cc { my $self = shift; return @{ $self->{cc} }; } sub add_include_dirs { my ($self, $dirs, %opts) = @_; my $ranking = $self->fix_ranking($self->default_include_ranking, $opts{ranking}); push @{ $self->{include_dirs} }, map { { ranking => $ranking, value => $_ } } @{ $dirs }; return; } sub default_include_ranking { return 30; } sub add_defines { my ($self, $defines, %opts) = @_; my $ranking = $self->fix_ranking($self->default_define_ranking, $opts{ranking}); push @{ $self->{defines} }, map { { key => $_, ranking => $ranking, value => $defines->{$_} } } keys %{ $defines }; return; } sub default_define_ranking { return 40; } sub collect_arguments { my ($self, @args) = @_; return ($self->SUPER::collect_arguments, $self->compile_flags(@args)); } sub compile { my ($self, $from, $to, %opts) = @_; my @actions ; if ($opts{mkdir}) { my $dirname = File::Basename::dirname($to); push @actions, function( module => 'File::Path', function => 'make_path', exports => 'explicit', arguments => [ $dirname ], message => "mkdir $dirname", ); } my @argv = $self->arguments($from, $to, %opts); push @actions, command($self->cc, @argv); my $deps = [ $from, @{ $opts{dependencies} // [] } ]; return ExtUtils::Builder::Node->new(target => $to, dependencies => $deps, actions => \@actions); } 1; # ABSTRACT: An interface around different compilers. __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Compiler - An interface around different compilers. =head1 VERSION version 0.032 =head1 DESCRIPTION This is an interface wrapping around different compilers. It's usually not used directly but by a portability layer like L. =head1 METHODS =head2 add_include_dirs($dirs, %options) Add dirs the the include list. =head2 add_defines($defines, %options) Add defines (as a hash) to the define list. =head2 compile($source, $target, %options) Compile a C<$source> to C<$destination>. =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Linker000755001750001750 015005700133 23134 5ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/BuilderAr.pm100644001750001750 142215005700133 24173 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Linkerpackage ExtUtils::Builder::Linker::Ar; $ExtUtils::Builder::Linker::Ar::VERSION = '0.032'; use strict; use warnings; use Carp (); use parent 'ExtUtils::Builder::Linker'; sub _init { my ($self, %args) = @_; $args{ld} //= ['ar']; $args{export} //= 'all'; $self->SUPER::_init(%args); $self->{static_args} = $args{static_args} // ['cr']; return; } sub add_libraries { my ($self, $libs, %opts) = @_; Carp::croak 'Can\'t add libraries to static link yet' if @{$libs}; return; }; sub linker_flags { my ($self, $from, $to, %opts) = @_; my @ret; push @ret, $self->new_argument(ranking => 0, value => $self->static_args); push @ret, $self->new_argument(ranking => 10, value => [ $to ]), push @ret, $self->new_argument(ranking => 75, value => [ @{$from} ]), return @ret; } 1; 40-autodetect-loadable-object.t100644001750001750 476015005700133 24161 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/t#! perl use strict; use warnings; use Test::More 0.89; use Config; plan(skip_all => 'No dynamic linking') if not $Config{usedl}; use Cwd 'getcwd'; use ExtUtils::Builder::Planner 0.007; use File::Basename qw/basename dirname/; use File::Spec::Functions qw/catfile/; use File::Temp 'tempdir'; my $olddir = getcwd; my $dir = tempdir(CLEANUP => 1); chdir $dir; my $planner = ExtUtils::Builder::Planner->new; $planner->load_extension('ExtUtils::Builder::AutoDetect::C', undef, profile => '@Perl', type => 'loadable-object', ); mkdir 't'; my $source_file = File::Spec->catfile('t', 'compilet.c'); { open my $fh, '>', $source_file or die "Can't create $source_file: $!"; my $content = <compile($source_file, $object_file); my $lib_file = catfile(dirname($source_file), basename($object_file, $Config{obj_ext}) . ".$Config{dlext}"); $planner->link([$object_file], $lib_file, dl_name => 'compilet'); my $plan = $planner->materialize; ok $plan; ok eval { $plan->run($lib_file, logger => \¬e); 1 } or diag "Got exception: $@"; ok(-e $object_file, "object file $object_file has been created"); ok(-e $lib_file, "lib file $lib_file has been created"); require DynaLoader; my $libref = DynaLoader::dl_load_file($lib_file, 0); ok($libref, 'libref is defined'); my $symref = DynaLoader::dl_find_symbol($libref, "boot_compilet"); ok($symref, 'symref is defined'); my $boot_compilet = DynaLoader::dl_install_xsub("boot_compilet", $symref, $source_file); is(eval { boot_compilet(); 1 }, 1, 'compilet lives'); is(eval { exported() }, 42, 'exported returns 42'); END { for ($source_file, $object_file, $lib_file) { next if not defined; 1 while unlink; } if ($^O eq 'VMS') { 1 while unlink 'COMPILET.LIS'; 1 while unlink 'COMPILET.OPT'; } } chdir $olddir; done_testing; COFF.pm100644001750001750 107615005700133 24353 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Linkerpackage ExtUtils::Builder::Linker::COFF; $ExtUtils::Builder::Linker::COFF::VERSION = '0.032'; use strict; use warnings; use parent 'ExtUtils::Builder::Linker'; my %export_for = ( executable => 'none', 'static-library' => 'all', 'shared-library' => 'some', 'loadable-object' => 'some', ); sub _init { my ($self, %args) = @_; $args{export} //= $export_for{ $args{type} }; $self->{autoimport} = defined $args{autoimport} ? $args{autoimport} : 1; $self->SUPER::_init(%args); return; } sub autoimport { my $self = shift; return $self->{autoimport}; } 1; AutoDetect000755001750001750 015005700133 23751 5ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/BuilderC.pm100644001750001750 2216115005700133 24653 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/AutoDetectpackage ExtUtils::Builder::AutoDetect::C; $ExtUtils::Builder::AutoDetect::C::VERSION = '0.032'; use strict; use warnings; use parent 'ExtUtils::Builder::Planner::Extension'; use Carp 'croak'; use ExtUtils::Config 0.007; use ExtUtils::Helpers 0.027 'split_like_shell'; use File::Spec::Functions 'catfile'; use Perl::OSType 'is_os_type'; sub _split_conf { my ($config, $name) = @_; return split_like_shell($config->get($name)); } sub _make_command { my ($self, $shortname, $argument, $command, %options) = @_; my $module = "ExtUtils::Builder::$shortname"; require_module($module); my @command = ref $command ? @{$command} : split_like_shell($command); return $module->new($argument => \@command, %options); } sub _is_gcc { my ($config, $cc, $opts) = @_; return $config->get('gccversion') || $cc =~ / ^ g(?: cc | [+]{2} ) /ix; } sub _filter_args { my ($opts, @names) = @_; return map { $_ => $opts->{$_} } grep { exists $opts->{$_} } @names; } sub _get_compiler { my ($self, $opts) = @_; my $os = $opts->{config}->get('osname'); my $cc = $opts->{config}->get('cc'); my ($module, %extra) = is_os_type('Unix', $os) || _is_gcc($opts->{config}, $cc, $opts) ? 'Unixy' : is_os_type('Windows', $os) ? ('MSVC', language => 'C') : croak 'Your platform is not supported yet'; my %args = _filter_args($opts, qw/language type/); $args{cccdlflags} = [ _split_conf($opts->{config}, 'cccdlflags') ]; return ("Compiler::$module", cc => $cc, %extra, %args); } sub require_module { my $module = shift; (my $filename = "$module.pm") =~ s{::}{/}g; require $filename; return $module; } sub add_compiler { my ($self, $planner, %opts) = @_; my $as = $opts{as} // 'compile'; return $planner->add_delegate($as, sub { my ($planner, $from, $to, %extra) = @_; my %args = (%opts, %extra); my $compiler = $self->_make_command($self->_get_compiler(\%args)); $args{profiles} = [ delete $args{profile} ] if $args{profile} and not $args{profiles}; if (my $profiles = $args{profiles}) { for my $profile (@$profiles) { if (not ref($profile)) { $profile =~ s/ \A @ /ExtUtils::Builder::Profile::/xms; require_module($profile); } $profile->process_compiler($compiler, \%args); } } if (my $include_dirs = $args{include_dirs}) { $compiler->add_include_dirs($include_dirs); } if (my $defines = $args{defines}) { $compiler->add_defines($defines); } if (my $extra = $args{extra_args}) { $compiler->add_argument(value => $extra); } my $node = $compiler->compile($from, $to, %args); $planner->add_node($node); }); } sub _unix_flags { my ($self, $opts) = @_; return $opts->{lddlflags} if defined $opts->{lddlflags}; my $lddlflags = $opts->{config}->get('lddlflags'); my $optimize = $opts->{config}->get('optimize'); $lddlflags =~ s/ ?\Q$optimize// if not $self->{auto_optimize}; my %ldflags = map { ($_ => 1) } _split_conf($opts->{config}, 'ldflags'); my @lddlflags = grep { not $ldflags{$_} } split_like_shell($lddlflags); my @cc = _split_conf($opts->{config}, 'ccdlflags'); return (cc => \@cc, lddlflags => \@lddlflags ) } sub _get_linker { my ($self, $opts) = @_; my $os = $opts->{config}->get('osname'); my %args = _filter_args($opts, qw/type export language/); my $cc = $opts->{config}->get('cc'); my $ld = $opts->{config}->get('ld'); my $eff_ld = $args{type} eq 'executable' ? $cc : $ld; my ($module, $link, %opts) = $args{type} eq 'static-library' ? ('Ar', $opts->{config}->get('ar')) : $os eq 'darwin' ? ('Mach::GCC', $eff_ld) : _is_gcc($opts->{config}, $ld, $opts) ? $os eq 'MSWin32' ? ('PE::GCC', $cc) : ('ELF::GCC', $eff_ld) : $os eq 'aix' ? ('XCOFF', $cc) : is_os_type('Unix', $os) ? ('ELF', $eff_ld, $self->_unix_flags($opts)) : $os eq 'MSWin32' ? ('PE::MSVC', $ld) : croak 'Linking is not supported yet on your platform'; return ("Linker::$module", ld => $link, %opts, %args); } sub add_linker { my ($self, $planner, %opts) = @_; my $as = $opts{as} // 'link'; return $planner->add_delegate($as, sub { my ($planner, $from, $to, %extra) = @_; my %args = (%opts, %extra); my $linker = $self->_make_command($self->_get_linker(\%args)); $args{profiles} = [ delete $args{profile} ] if $args{profile} and not $args{profiles}; if (my $profiles = $args{profiles}) { for my $profile (@$profiles) { if (ref($profile)) { } else { $profile =~ s/ \A @ /ExtUtils::Builder::Profile::/xms; require_module($profile); $profile->process_linker($linker, \%args); } } } if (my $library_dirs = $args{library_dirs}) { $linker->add_library_dirs($library_dirs); } if (my $libraries = $args{libraries}) { $linker->add_libraries($libraries); } if (my $extra_args = $args{extra_args}) { $linker->add_argument(ranking => 85, value => [ @{$extra_args} ]); } my $node = $linker->link($from, $to, %args); $planner->add_node($node); }); } sub add_methods { my ($class, $planner, %opts) = @_; $opts{config} //= $planner->can('config') ? $planner->config : ExtUtils::Config->new; $opts{type} //= 'executable'; my $as_compiler = delete $opts{as_compiler}; $class->add_compiler($planner, %opts, as => $as_compiler); my $as_linker = delete $opts{as_linker}; $class->add_linker($planner, %opts, as => $as_linker); my $o = $opts{config}->get('_o'); $planner->add_delegate('obj_file', sub { my ($planner, $file, $dir) = @_; my $filename = "$file$o"; return defined $dir ? catfile($dir, $filename) : $filename; }); my $dlext = $opts{config}->get('dlext'); $planner->add_delegate('loadable_file', sub { my ($planner, $file, $dir) = @_; my $filename = "$file.$dlext"; return defined $dir ? catfile($dir, $filename) : $filename; }); my $so = $opts{config}->get('so'); $planner->add_delegate('library_file', sub { my ($planner, $file, $dir) = @_; my $filename = "$file.$so"; return defined $dir ? catfile($dir, $filename) : $filename; }); my $exe = $opts{config}->get('_exe'); $planner->add_delegate('exe_file', sub { my ($planner, $file, $dir) = @_; my $filename = "$file$exe"; return defined $dir ? catfile($dir, $filename) : $filename; }); return; } 1; #ABSTRACT: compiler configuration, derived from perl's configuration __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::AutoDetect::C - compiler configuration, derived from perl's configuration =head1 VERSION version 0.032 =head1 SYNOPSIS my $planner = ExtUtils::Builder::Planner->new; $planner->load_extension('ExtUtils::Builder::AutoDetect::C', '0.001', profiles => ['@Perl'], type => 'loadable-object', ); $planner->compile('foo.c', 'foo.o', include_dirs => ['.']); $planner->link([ 'foo.o' ], 'foo.so', libraries => ['foo']); my $plan = $planner->materialize; $plan->run(['foo.so']); =head1 DESCRIPTION This module is a L that facilitates compiling object. =head1 METHODS =head2 add_methods(%options) This adds two delegate methods to the planner, C and C. It takes named arguments that will be prefixed to the named arguments for all delegate calls. In practice, it's mainly useful with the C, C and C arguments. If your C<$planner> has a C delegate, that will be used as default value for C. This is usually not called directly, but through L's C method. =head2 link(\@sources, $target, %options) =over 4 =item type This works the same as with C. =item config This works the same as with C. =item profile This works the same as with C. =item libraries A list of libraries to link to. E.g. C<['z']>. =item library_dirs A list of directories to find libraries in. E.g. C<['/opt/my-app/lib/']>. =item extra_args A list of additional arguments to the linker. =back =head1 DELEGATES =head2 compile($source, $target, %options) This compiles C<$source> to C<$target>. It takes the following optional arguments: =over 4 =item type The type of the final product. This must be one of: =over 4 =item * executable An executable to be run. This is the default. =item * static-library A static library to link against. =item * dynamic-library A dynamic library to link against. =item * loadable-object A loadable extension. On most platforms this is the same as a dynamic library, but some (Mac) make a distinction between these two. =back =item config A Perl configuration to take hints from, must be an C compatible object. =item profiles A list of profile that can be used when compiling and linking. One profile comes with this distribution: C<'@Perl'>, which sets up the appropriate things to compile/link with C. =item include_dirs A list of directories to add to the include path, e.g. C<['include', '.']>. =item define A hash of preprocessor defines, e.g. C<< {DEBUG => 1, HAVE_FEATURE => 0 } >> =item extra_args A list of additional arguments to the compiler. =back =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Compiler000755001750001750 015005700133 23462 5ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/BuilderVMS.pm100644001750001750 367315005700133 24636 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Compilerpackage ExtUtils::Builder::Compiler::VMS; $ExtUtils::Builder::Compiler::VMS::VERSION = '0.032'; use strict; use warnings; use parent 'ExtUtils::Builder::Compiler'; use Carp (); sub _init { my ($self, %args) = @_; $args{cc} //= ['CC/DECC']; $self->SUPER::_init(%args); return; } # The VMS compiler can only have one define and one include qualifier, so we need to juggle here sub add_argument { my ($self, %opts) = @_; my @value; for my $elem (@{ delete $opts{value} }) { if ($elem =~ m{ / def [^=]+ =+ (\()? ( [^/\)]* ) (?(1) \) ) }xi) { my @defines = $2 =~ m/ ( \w+ | "[^"]+" ) /gx; push @{ $self->{defines} }, @defines; } elsif ($elem =~ m{ / inc [^=]+ =+ (\()? ( [^/\)]* ) (?(1) \) ) }xi) { $self->add_include_dir([$2]); } else { push @value, $elem; } } $self->SUPER::add_argument(%opts, value => \@value); return; } sub compile_flags { my ($self, $from, $to) = @_; my @ret; my @include_dirs = map { $_->{value} } @{ $self->{include_dirs} }; my @defines = map { defined $_->{value} ? $_->{value} ne '' ? qq/"$_->{key}=$_->{value}"/ : qq{"$_->{key}"} : Carp::croak("Can't undefine '$_->{key}'") } @{ $self->{defines} }; push @ret, $self->new_argument(ranking => 30, value => [ '/include=' . join ',', @include_dirs ]) if @include_dirs; push @ret, $self->new_argument(ranking => 40, value => [ '/define=' . join ',', @defines ]) if @defines; push @ret, $self->new_argument(ranking => 75, value => [ "/obj=$to", $from ]); return @ret; } 1; #ABSTRACT: Class for compiling with a VMS compiler __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Compiler::VMS - Class for compiling with a VMS compiler =head1 VERSION version 0.032 =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Unixy.pm100644001750001750 110415005700133 24742 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Linkerpackage ExtUtils::Builder::Linker::Unixy; $ExtUtils::Builder::Linker::Unixy::VERSION = '0.032'; use strict; use warnings; use parent 'ExtUtils::Builder::Linker'; sub linker_flags { my ($self, $from, $to, %opts) = @_; my @ret; push @ret, map { $self->new_argument(ranking => $_->{ranking}, value => [ "-L$_->{value}" ]) } @{ $self->{library_dirs} }; push @ret, map { $self->new_argument(ranking => $_->{ranking}, value => [ "-l$_->{value}" ]) } @{ $self->{libraries} }; push @ret, $self->new_argument(ranking => 50, value => [ '-o' => $to, @{$from} ]); return @ret; } 1; XCOFF.pm100644001750001750 201415005700133 24474 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Linkerpackage ExtUtils::Builder::Linker::XCOFF; $ExtUtils::Builder::Linker::XCOFF::VERSION = '0.032'; use strict; use warnings; use parent qw/ExtUtils::Builder::Linker::Unixy ExtUtils::Builder::Linker::COFF/; use File::Basename (); sub _init { my ($self, %args) = @_; $args{ld} //= ['ld']; $self->ExtUtils::Builder::Linker::Unixy::_init(%args); $self->ExtUtils::Builder::Linker::COFF::_init(%args); return; } sub linker_flags { my ($self, $from, $to, %opts) = @_; my @ret = $self->SUPER::linker_flags($from, $to, %opts); push @ret, $self->new_argument(ranking => 20, value => ['-bnoautoimp']) if !$self->autoimport; my $type = $self->type; if ($type eq 'shared-library' or $type eq 'loadable-object') { if ($self->export eq 'some') { my $basename = $opts{basename} // File::Basename::basename($to); push @ret, $self->new_arguments(ranking => 20, value => ["-bE:$basename.exp"]); } elsif ($self->export eq 'all') { push @ret, $self->new_argument(ranking => 20, value => ['-bexpfull']); } } return @ret; } 1; MultiLingual.pm100644001750001750 50415005700133 24773 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builderpackage ExtUtils::Builder::MultiLingual; $ExtUtils::Builder::MultiLingual::VERSION = '0.032'; use strict; use warnings; use Carp (); sub _init { my ($self, %args) = @_; $self->{language} = $args{language} or Carp::croak('language missing'); return; } sub language { my $self = shift; return $self->{language}; } 1; Profile000755001750001750 015005700133 23310 5ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/BuilderPerl.pm100644001750001750 665615005700133 24725 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Profilepackage ExtUtils::Builder::Profile::Perl; $ExtUtils::Builder::Profile::Perl::VERSION = '0.032'; use strict; use warnings; use ExtUtils::Helpers 0.027 'split_like_shell'; use File::Basename 'dirname'; use File::Spec::Functions qw/catdir/; sub _get_var { my ($config, $opts, $key) = @_; return delete $opts->{$key} // $config->get($key); } sub _split_var { my ($config, $opts, $key) = @_; return delete $opts->{$key} // [ split_like_shell($config->get($key)) ]; } sub process_compiler { my ($class, $compiler, $opts) = @_; my $config = delete $opts->{config}; my $incdir = catdir(_get_var($config, $opts, 'archlibexp'), 'CORE'); my $os = _get_var($config, $opts, 'osname'); my $osver = _get_var($config, $opts, 'osvers'); my ($osmajor) = $osver =~ /^(\d+)/; if ($os eq 'darwin' && $^X eq '/usr/bin/perl' && $osmajor >= 18) { $compiler->add_argument(value => [ '-iwithsysroot', $incdir ], ranking => $compiler->default_include_ranking + 1); } else { $compiler->add_include_dirs([$incdir], ranking => sub { $_[0] + 1 }); } $compiler->add_argument(ranking => 60, value => _split_var($config, $opts, 'ccflags')); $compiler->add_argument(ranking => 65, value => _split_var($config, $opts, 'optimize')); return; } my $rpath_regex = qr/ ( (? 1 } qw/MSWin32 cygwin aix VMS/; sub process_linker { my ($class, $linker, $opts) = @_; my $config = delete $opts->{config}; $linker->add_argument(ranking => 60, value => _split_var($config, $opts, 'ldflags')); if ($linker->export eq 'some') { $linker->add_option_filter(sub { my ($self, $from, $to, %opts) = @_; $opts{dl_name} //= $opts{module_name} if $opts{module_name}; $opts{dl_file} //= do { (my $short = $opts{dl_name}) =~ s/.*:://; catdir(dirname($to), "$short"); }; return ($from, $to, %opts); }); } my $os = _get_var($config, $opts, 'osname'); if ($linker->type eq 'executable' or $linker->type eq 'shared-library' or ($linker->type eq 'loadable-object' and $needs_relinking{$os})) { my ($libperl, $libext, $so) = map { _get_var($config, $opts, $_) } qw/libperl lib_ext so/; my ($lib) = $libperl =~ / \A (?:lib)? ( \w* perl \w* ) (?: \. $so | $libext) \b /msx; $linker->add_libraries([$lib], ranking => sub { $_[0] - 1 }); my $libdir = catdir(_get_var($config, $opts, 'archlibexp'), 'CORE'); $linker->add_library_dirs([$libdir]); $linker->add_argument(ranking => 80, value => _split_var($config, $opts, 'perllibs')); } if ($linker->type eq 'executable') { my $rpath = $opts->{rpath} // [ split_like_shell($config->get('ccdlflags') =~ $rpath_regex) ]; $linker->add_argument(ranking => 40, value => $rpath) if @{$rpath}; } return; } 1; # ABSTRACT: A profile for compiling and linking against perl __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Profile::Perl - A profile for compiling and linking against perl =head1 VERSION version 0.032 =head1 SYNOPSIS $planner->load_extension('ExtUtils::Builder::AutoDetect::C', profile => '@Perl', ); =head1 DESCRIPTION This is a profile for compiling against perl, whether you're compiling an XS extension or embedding it into your application. =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut MSVC.pm100644001750001750 310015005700133 24722 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Compilerpackage ExtUtils::Builder::Compiler::MSVC; $ExtUtils::Builder::Compiler::MSVC::VERSION = '0.032'; use strict; use warnings; use parent qw/ExtUtils::Builder::Compiler ExtUtils::Builder::MultiLingual/; sub _init { my ($self, %args) = @_; $args{cc} //= ['cl']; $self->ExtUtils::Builder::Compiler::_init(%args); $self->ExtUtils::Builder::MultiLingual::_init(%args); return; } sub compile_flags { my ($self, $from, $to) = @_; my @ret; push @ret, $self->new_argument(ranking => 5, value => ['/NOLOGO']); push @ret, $self->new_argument(ranking => 10, value => [qw{/TP /EHsc}]) if $self->language eq 'C++'; push @ret, $self->new_argument(ranking => 75, value => [ "/Fo$to", '/c', $from ]); push @ret, map { $self->new_argument(ranking => $_->{ranking}, value => [ "/I$_->{value}" ]) } @{ $self->{include_dirs} }; for my $entry (@{ $self->{defines} }) { my $key = $entry->{key}; my $value = defined $entry->{value} ? $entry->{value} ne '' ? "/D$key=$entry->{value}" : "/D$key" : "/U$key"; push @ret, $self->new_argument(ranking => $entry->{ranking}, value => [$value]); } return @ret; } 1; # ABSTRACT: Class for compiling with Microsoft Visual C __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Compiler::MSVC - Class for compiling with Microsoft Visual C =head1 VERSION version 0.032 =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut PE000755001750001750 015005700133 23440 5ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/LinkerGCC.pm100644001750001750 237315005700133 24537 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Linker/PEpackage ExtUtils::Builder::Linker::PE::GCC; $ExtUtils::Builder::Linker::PE::GCC::VERSION = '0.032'; use strict; use warnings; use parent qw/ExtUtils::Builder::Linker::Unixy ExtUtils::Builder::Linker::COFF/; use File::Basename (); sub _init { my ($self, %args) = @_; $args{ld} //= ['gcc']; $args{export} //= 'all'; $self->ExtUtils::Builder::Linker::Unixy::_init(%args); $self->ExtUtils::Builder::Linker::COFF::_init(%args); return; } sub linker_flags { my ($self, $from, $to, %opts) = @_; my @ret = $self->SUPER::linker_flags($from, $to, %opts); push @ret, $self->new_argument(ranking => 85, value => ['-Wl,--enable-auto-image-base']); if ($self->type eq 'shared-library' or $self->type eq 'loadable-object') { push @ret, $self->new_argument(ranking => 10, value => ['--shared']); } if ($self->autoimport) { push @ret, $self->new_argument(ranking => 85, value => ['-Wl,--enable-auto-import']); } if ($self->export eq 'all') { push @ret, $self->new_argument(ranking => 85, value => ['-Wl,--export-all-symbols']); } elsif ($self->export eq 'some') { my $export_file = $opts{export_file} // ($opts{basename} // File::Basename::basename($to)) . '.def'; push @ret, $self->new_argument(ranking => 20, value => [$export_file]); } return @ret; } 1; Cpp.pm100644001750001750 241315005700133 25171 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/AutoDetectpackage ExtUtils::Builder::AutoDetect::Cpp; $ExtUtils::Builder::AutoDetect::Cpp::VERSION = '0.032'; use strict; use warnings; use parent 'ExtUtils::Builder::AutoDetect::C'; sub _get_compiler { my ($self, $opts) = @_; my $os = $opts->{osname} // $^O; my $cc = $self->_get_opt($opts, 'cc'); return $self->_is_gcc($cc, $opts) ? $self->SUPER::_get_compiler({ cc => 'g++', %{$opts} }) : is_os_type('Windows', $os) ? $self->SUPER::_get_compiler({ language => 'C++', %{$opts} }) : Carp::croak('Your platform is not supported yet'); } sub _get_linker { my ($self, $opts) = @_; my $os = $opts->{osname} // $^O; my $cc = $self->_get_opt($opts, 'cc'); return $self->_is_gcc($cc, $opts) ? $self->SUPER::_get_linker({ cc => 'g++', %{$opts} }) : is_os_type('Windows', $os) ? $self->SUPER::_get_linker({ language => 'C++', %{$opts} }) : Carp::croak('Your platform is not supported yet'); return; } 1; __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::AutoDetect::Cpp =head1 VERSION version 0.032 =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Unixy.pm100644001750001750 305515005700133 25277 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Compilerpackage ExtUtils::Builder::Compiler::Unixy; $ExtUtils::Builder::Compiler::Unixy::VERSION = '0.032'; use strict; use warnings; use parent 'ExtUtils::Builder::Compiler'; sub _init { my ($self, %args) = @_; $args{cc} //= ['cc']; $self->SUPER::_init(%args); $self->{cccdlflags} = $args{cccdlflags}; $self->{pic} = $args{pic} // ($self->type eq 'shared-library' || $self->type eq 'loadable-object') && @{ $self->{cccdlflags} }; return; } sub compile_flags { my ($self, $from, $to) = @_; my @ret; push @ret, $self->new_argument(ranking => 75, value => [ '-o' => $to, '-c', $from ]); push @ret, $self->new_argument(ranking => 45, value => $self->{cccdlflags}) if $self->{pic}; push @ret, map { $self->new_argument(ranking => $_->{ranking}, value => [ "-I$_->{value}" ]) } @{ $self->{include_dirs} }; for my $entry (@{ $self->{defines} }) { my $key = $entry->{key}; my $value = defined $entry->{value} ? $entry->{value} ne '' ? "-D$key=$entry->{value}" : "-D$key" : "-U$key"; push @ret, $self->new_argument(ranking => $entry->{ranking}, value => [$value]); } return @ret; } 1; #ABSTRACT: Class for compiling with a unix compiler __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Compiler::Unixy - Class for compiling with a unix compiler =head1 VERSION version 0.032 =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut ELF000755001750001750 015005700133 23542 5ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/LinkerAny.pm100644001750001750 176015005700133 24773 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Linker/ELFpackage ExtUtils::Builder::Linker::ELF::Any; $ExtUtils::Builder::Linker::ELF::Any::VERSION = '0.032'; use strict; use warnings; use parent 'ExtUtils::Builder::Linker::Unixy'; sub _init { my ($self, %args) = @_; $args{ld} //= ['cc']; $args{export} //= $args{type} eq 'executable' ? 'none' : 'all'; $self->SUPER::_init(%args); $self->{ccdlflags} = defined $args{ccdlflags} ? $args{ccdlflags} : Carp::croak(''); $self->{lddlflags} = defined $args{lddlflags} ? $args{lddlflags} : Carp::croak(''); return; } sub linker_flags { my ($self, $from, $to, %args) = @_; my @ret = $self->SUPER::linker_flags($from, $to, %args); my $type = $self->type; if ($type eq 'shared-library' or $type eq 'loadable-object') { push @ret, $self->new_argument(ranking => 10, value => $self->{lddlflags}); } elsif ($type eq 'executable') { push @ret, $self->new_argument(ranking => 10, value => $self->{ccdlflags}) if $self->export eq 'all'; } else { croak("Unknown linkage type $type"); } return @ret; } 1; GCC.pm100644001750001750 103515005700133 24633 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Linker/ELFpackage ExtUtils::Builder::Linker::ELF::GCC; $ExtUtils::Builder::Linker::ELF::GCC::VERSION = '0.032'; use strict; use warnings; use parent 'ExtUtils::Builder::Linker::ELF::Any'; sub _init { my ($self, %args) = @_; $args{ld} //= 'gcc'; $args{ccdlflags} //= ['-Wl,-E']; $args{lddlflags} //= ['-shared']; $self->SUPER::_init(%args); return; } sub add_runtime_path { my ($self, $dirs, %opts) = @_; $self->add_argument(ranking => $self->fix_ranking(30, $opts{ranking}), value => [ map { "-Wl,-rpath,$_" } @{$dirs} ]); return; } 1; MSVC.pm100644001750001750 234315005700133 24710 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Linker/PEpackage ExtUtils::Builder::Linker::PE::MSVC; $ExtUtils::Builder::Linker::PE::MSVC::VERSION = '0.032'; use strict; use warnings; use ExtUtils::Builder::Action::Command; use parent qw/ExtUtils::Builder::Linker::COFF/; sub _init { my ($self, %args) = @_; $args{ld} //= ['link']; $args{export} //= $args{type} eq 'shared-library' || $args{type} eq 'loadable-object' ? 'some' : 'none'; $self->ExtUtils::Builder::Linker::COFF::_init(%args); return; } sub linker_flags { my ($self, $from, $to, %opts) = @_; my @ret; push @ret, $self->new_argument(ranking => 10, value => ['/dll']) if $self->type eq 'shared-library' or $self->type eq 'loadable-object'; push @ret, map { $self->new_argument(ranking => $_->{ranking}, value => [ "/libpath:$_->{value}" ]) } @{ $self->{library_dirs} }; push @ret, map { $self->new_argument(ranking => $_->{ranking}, value => [ "$_->{value}.lib" ]) } @{ $self->{libraries} }; push @ret, $self->new_argument(ranking => 50, value => [ @{$from} ]); push @ret, $self->new_argument(ranking => 60, value => [ "/def:$opts{dl_file}.def" ]) if $self->export eq 'some' && defined $opts{dl_file}; push @ret, $self->new_argument(ranking => 80, value => ["/OUT:$to"]); # map_file, implib, def_file?… return @ret; } 1; Mach000755001750001750 015005700133 24004 5ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/LinkerGCC.pm100644001750001750 157615005700133 25107 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builder/Linker/Machpackage ExtUtils::Builder::Linker::Mach::GCC; $ExtUtils::Builder::Linker::Mach::GCC::VERSION = '0.032'; use strict; use warnings; use parent 'ExtUtils::Builder::Linker::Unixy'; sub _init { my ($self, %args) = @_; $args{ld} //= [qw/env MACOSX_DEPLOYMENT_TARGET=10.3 cc/]; $args{export} //= 'all'; $self->SUPER::_init(%args); return; } my %flag_for = ( 'loadable-object' => [qw/-bundle -undefined dynamic_lookup/], 'shared-library' => ['-dynamiclib'], ); sub linker_flags { my ($self, $from, $to, %args) = @_; my @ret = $self->SUPER::linker_flags($from, $to, %args); push @ret, $self->new_argument(rank => 10, value => $flag_for{ $self->type }) if $flag_for{ $self->type }; return @ret; } sub add_runtime_path { my ($self, $dirs, %opts) = @_; $self->add_argument(ranking => $self->fix_ranking(30, $opts{ranking}), value => [ map { "-Wl,-rpath,$_" } @{$dirs} ]); return; } 1; ArgumentCollector.pm100644001750001750 312615005700133 26041 0ustar00leontleont000000000000ExtUtils-Builder-Compiler-0.032/lib/ExtUtils/Builderpackage ExtUtils::Builder::ArgumentCollector; $ExtUtils::Builder::ArgumentCollector::VERSION = '0.032'; use strict; use warnings; sub _init { my ($self, %args) = @_; $self->{arguments} = $args{arguments} // []; return; } sub add_argument { my ($self, %arguments) = @_; $arguments{ranking} = $self->fix_ranking(delete @arguments{qw/ranking fix/}); push @{ $self->{arguments} }, $self->new_argument(%arguments); return; } sub new_argument { my ($self, %args) = @_; return [ $args{ranking} // 50, $args{value} ]; } sub collect_arguments { my $self = shift; return @{ $self->{arguments} }; } sub arguments { my ($self, @args) = @_; use sort 'stable'; return map { @{ $_->[1] } } sort { $a->[0] <=> $b->[0] } $self->collect_arguments(@args); } sub fix_ranking { my (undef, $baseline, $override) = @_; return $baseline if not defined $override; return (ref($override) eq 'CODE') ? $override->($baseline) : $override; } 1; =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::ArgumentCollector - Helper role for argument collecting classes =head1 VERSION version 0.032 =head1 DESCRIPTION This is a helper role for classes that collect arguments for their command. Classes that use this include ExtUtils::Builder::Compiler and ExtUtils::Builder::Linker =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut __END__ #ABSTRACT: Helper role for argument collecting classes