Alien-TinyCCx

 view release on metacpan or  search on metacpan

lib/Alien/TinyCCx.pm  view on Meta::CPAN

     dynamic_config => 1,
     include_dirs => [Alien::TinyCCx->libtcc_include_path],
     extra_linker_flags => [Alien::TinyCCx->MB_linker_flags],
 )->create_build_script

At the top of the Perl module that provides the Perl libtcc interface:

 # My/C/Tiny/Interface.pm
 use Alien::TinyCCx;  # set LD_LIBRARY_PATH, PATH, etc
 
 BEGIN {
     our $VERSION = '0.02';
     use XSLoader;
     XSLoader::load 'My::C::Tiny::Interface', $VERSION;
 }

In your XS file that interfaces with libtcc:

 /* Usual Perl XS suspects */
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
 #include "ppport.h"
 
 /* This is the important one */
 #include "libtcc.h"

=head1 DESCRIPTION

This module ensures that you have a copy of the Tiny C Compiler with
extended symbol table management accessible
to your Perl code, ensures that F<tcc> is in your path after saying
C<use Alien::TinyCCx>, ensures that F<libtcc> is in your C<LD_LIBRARY_PATH>
for Unixen and C<PATH> for Windows, and provides some functions for
identifying those paths and building against them.

This module is blissfully unaware of any other F<tcc> installations on your
system and it does not install F<tcc> into a generically usable location.
Rather, it installs it into a Perl-specific location. The basic idea is that
this Perl module should not interfere with your non-Perl stuff.

The provided path functions include:

=over

=item path_to_tcc

gives the full path to the directory containing the F<tcc> executable

=item libtcc_include_path

gives the full path to the diretory containing F<libtcc.h>

=item libtcc_library_path

gives the full path to the directory containing F<libtcc.dll> or F<libtcc.a>

=back

If you want to link against F<libtcc>, you will need to include C<Alien::TinyCC>
in your F<.pm> file that loads your XS bindings, to ensure that the
C<PATH> or C<LD_LIBRARY_PATH> is properly set. Then, in your F<Build.PL>
file, you can use

=over

=item MB_linker_flags

gives the proper list of arguments to link against F<libtcc>.

=back

=head1 SEE ALSO

This module provides the Tiny C Compiler. To learn more about this great
project, see L<http://bellard.org/tcc/> and
L<http://savannah.nongnu.org/projects/tinycc>.

To learn more about Alien Perl distributions in general, read the L<Alien>
manifesto.

This library was built to distributed my fork of the Tiny C Compiler with
extended symbol tables, which I needed to implement L<C::Blocks>.

This library is based on C<Alien::TinyCC>.

=head1 AUTHOR

David Mertens (dcmertens.perl@gmail.com)

=head1 BUGS

Please report any bugs or feature requests for the Alien bindings at the
project's main github page:
L<http://github.com/run4flat/Alien-TinyCCx/issues>.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Alien::TinyCCx

You can also look for information at:

=over 4

=item * The Github issue tracker (report bugs here)

L<http://github.com/run4flat/Alien-TinyCCx/issues>

=item * My fork or TCC packaged with this distribution

L<http://github.com/run4flat/tinycc>

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/Alien-TinyCCx>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/Alien-TinyCCx>

=item * Search CPAN

L<http://p3rl.org/Alien::TinyCCx>
L<http://search.cpan.org/dist/Alien-TinyCCx/>

=item * Stack Overflow

L<//http://stackoverflow.com/questions/tagged/tcc>

=back

=head1 ACKNOWLEDGEMENTS

The tcc developers have made this a very easy project to wrap up. They even
had the Windows install command nicely packaged up! How amazing!

=head1 LICENSE AND COPYRIGHT

Code copyright 2013, 2015 Dickinson College. Documentation copyright 2013, 2015 David
Mertens.

Everything not contained in the F<src/> directory is free software, the
distribution and/or modification of which is governed by the terms of
either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

=head1 TINY C COMPILER LICENSE AND COPYRIGHT

This distribution distributes the source for the Tiny C Compiler project



( run in 0.963 second using v1.01-cache-2.11-cpan-2398b32b56e )