Alien-Uninum

 view release on metacpan or  search on metacpan

inc/Alien/Uninum/ModuleBuild.pm  view on Meta::CPAN

use warnings;
use base qw( Alien::Base::ModuleBuild );
use FindBin ();
use Text::ParseWords qw( shellwords );
 
sub new {
  my $class = shift;
  return $class->SUPER::new(@_);
}

my $cflags;
my $libs;

sub alien_do_commands
{
  my($self, $phase) = @_;
 
  #unless(defined $cflags)
  #{
    #my $first = 1;
    #foreach my $dep (qw( Alien::GMP ))
    #{
      #my @dep = ref $dep ? @$dep : ($dep);
      #foreach my $name (@dep)
      #{
        #my $alien = eval qq{ require $name; $name->new };
        #next if $@;
        #print "\n\n" if $first; $first = 0;
        #print "  trying to use $name: ";
       
        #require ExtUtils::CChecker;
        #require Capture::Tiny;
       
        #my $cc = ExtUtils::CChecker->new;
        #$cc->push_extra_compiler_flags(shellwords ' ' . $alien->cflags);
        #$cc->push_extra_linker_flags(shellwords  ' ' . $alien->libs);
        #my $ok;
        #my $out = Capture::Tiny::capture_merged(sub {
          #$ok = $cc->try_compile_run("int main(int argc, char *argv[]) { return 0; }");
        #});
        #if($ok)
        #{
          #print "ok\n";
          #$cflags .= ' ' . $alien->cflags;
          #$libs   .= ' ' . $alien->libs;
          #last;
        #}
        #else
        #{
          #print "failed\n";
          #print $out;
        #}
      #}
    #}
    #print "\n\n" unless $first;
  #}
 
  #local $ENV{CFLAGS} = $cflags;
  #local $ENV{LIBS}   = $libs;
   
  $self->SUPER::alien_do_commands($phase);
}

package
  main;

use Config;

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

use strict;
use warnings;

use parent 'Alien::Base';

sub Inline {
	return unless $_[-1] eq 'C'; # Inline's error message is good
	my $self = __PACKAGE__->new;
	+{
		LIBS => $self->libs,
		INC => $self->cflags,
		AUTO_INCLUDE =>
		q/#include <unicode.h>
#include <nsdefs.h>
#include <uninum.h>

/,
	};
}




( run in 0.240 second using v1.01-cache-2.11-cpan-94b05bcf43c )