Alien-IUP

 view release on metacpan or  search on metacpan

inc/My/Builder.pm  view on Meta::CPAN


  return $self->SUPER::ACTION_install(@_);
}

sub ACTION_code {
  my $self = shift;

  if ( ! -e 'build_done' ) {
    my $inst = $self->notes('already_installed_lib');
    if (defined $inst) {
      $self->config_data('config', { LIBS   => $inst->{lflags},
                                     INC    => $inst->{cflags},
                                   });
    }
    else {
      # some questions before we start
      my $dbg = !$ENV{TRAVIS} ? $self->prompt("\nDo you want to see debug info + all messages during 'make' (y/n)?", 'n') : 'n';
      $self->notes('build_msgs',       lc($dbg) eq 'y' ? 1 : 0);
      $self->notes('build_debug_info', lc($dbg) eq 'y' ? 1 : 0);
      #my $large_imglib = $ENV{TRAVIS} ? 'y' : lc($self->prompt("Do you wanna compile built-in images with large (48x48) size? ", "y"));
      my $large_imglib = 'y'; #forcing large icons
      $self->notes('build_large_imglib', lc($large_imglib) eq 'y' ? 1 : 0);

inc/My/Builder.pm  view on Meta::CPAN

      $unpack = (-d "$build_src/cd") && !$ENV{TRAVIS} ? $self->prompt("\nDir '$build_src/cd'  exists, wanna replace with clean sources?", "n") : 'y';
      if (lc($unpack) eq 'y') {
        File::Path::rmtree("$build_src/cd") if -d "$build_src/cd";
        $self->prepare_sources($self->notes('cd_url'), $self->notes('cd_sha1'), $download, $build_src);
        if ($self->notes('cd_patches')) {
          $self->apply_patch("$build_src/cd", $_)  foreach (@{$self->notes('cd_patches')});
        }
      }

      $unpack = (-d "$build_src/zlib") && !$ENV{TRAVIS} ? $self->prompt("\nDir '$build_src/zlib'  exists, wanna replace with clean sources?", "n") : 'y';
      if ($self->notes('zlib_url') && !$self->config_data('syszlib_lflags') && lc($unpack) eq 'y') {
        File::Path::rmtree("$build_src/zlib") if -d "$build_src/zlib";
        $self->prepare_sources($self->notes('zlib_url'), $self->notes('zlib_sha1'), $download, $build_src);
        if ($self->notes('zlib_patches')) {
          $self->apply_patch("$build_src/zlib", $_)  foreach (@{$self->notes('zlib_patches')});
        }
      }

      $unpack = (-d "$build_src/freetype") && !$ENV{TRAVIS} ? $self->prompt("\nDir '$build_src/freetype'  exists, wanna replace with clean sources?", "n") : 'y';
      if ($self->notes('freetype_url') && !$self->config_data('sysfreetype_lflags') && lc($unpack) eq 'y') {
        File::Path::rmtree("$build_src/freetype") if -d "$build_src/freetype";
        $self->prepare_sources($self->notes('freetype_url'), $self->notes('freetype_sha1'), $download, $build_src);
        if ($self->notes('freetype_patches')) {
          $self->apply_patch("$build_src/freetype", $_)  foreach (@{$self->notes('freetype_patches')});
        }
      }

      $unpack = (-d "$build_src/ftgl") && !$ENV{TRAVIS} ? $self->prompt("\nDir '$build_src/ftgl'  exists, wanna replace with clean sources?", "n") : 'y';
      if ($self->notes('ftgl_url') && lc($unpack) eq 'y') {
        File::Path::rmtree("$build_src/ftgl") if -d "$build_src/ftgl";

inc/My/Builder.pm  view on Meta::CPAN

      die "###BUILD FAILED### essential libs (iup/im/cd) not built!" unless $done->{"iup:iup"} && $done->{"iup:iupim"} && $done->{"iup:iupcd"};
      die "###BUILD FAILED###" unless $success;
      #DEBUG: die intentionally at this point if you want to see build details from cpan testers
      print STDERR "RESULT: OK!\n";

      # store info about build to ConfigData
      $self->config_data('share_subdir', $share_subdir);
      $self->config_data('config', { PREFIX => '@PrEfIx@',
                                     LIBS   => '-L' . $self->quote_literal('@PrEfIx@/lib') .
                                               ' -l' . join(' -l', @{$self->config_data('linker_libs')}) .
                                               ' ' . $self->config_data('extra_lflags'),
                                     INC    => '-I' . $self->quote_literal('@PrEfIx@/include') .
                                               ' ' . $self->config_data('extra_cflags'),
                                   });
    }
    # mark sucessfully finished build
    $self->touchfile('build_done');
  }
  $self->SUPER::ACTION_code;
}

sub prepare_sources {
  my ($self, $url, $sha1, $download, $build_src) = @_;

inc/My/Builder.pm  view on Meta::CPAN

  my $idir = $ENV{IUP_DIR} || '';
  my @candidates;
  push(@candidates, { L => "$idir/lib", I => "$idir/include" }) if -d $idir;
  push(@candidates, { L => '', I => '' });
  push(@candidates, { L => '', I => $Config{usrinc} }) if -d $Config{usrinc};
  push(@candidates, { L => '/usr/local/lib', I => '/usr/local/include' }) if -d '/usr/local/lib' && -d '/usr/local/include';
  push(@candidates, { L => '/usr/lib', I => '/usr/include' }) if -d '/usr/lib' && -d '/usr/include';

  print STDERR "Checking iup+im+cd already installed on your system ...\n";
  foreach my $i (@candidates) {
    my $lflags = $i->{L} ? '-L'.$self->quote_literal($i->{L}) : '';
    my $cflags = $i->{I} ? '-I'.$self->quote_literal($i->{I}) : '';
    #xxx does not work with MSVC compiler
    #xxx $lflags = ExtUtils::Liblist->ext($lflags) if($Config{make} =~ /nmake/ && $Config{cc} =~ /cl/); # MSVC compiler hack
    print STDERR "- testing: $cflags $lflags\n";
    my $rv1 = $self->check_header( [ 'iup.h', 'im.h', 'cd.h' ], $cflags);
    #xxx maybe we need to link with more libs
    if ($self->check_lib( [ 'iup', 'im', 'cd' ], $cflags, $lflags)){
      print STDERR "- iup+im+cd FOUND!\n";
      $self->notes('already_installed_lib', { lflags => "$lflags -liup -lim -lcd", cflags => $cflags } );
      return 1;
    }
    elsif ($self->check_lib( [ 'iupwin', 'im', 'cdwin' ], $cflags, $lflags)) {
      print STDERR "- iupwin+im+cdwin FOUND!\n";
      $self->notes('already_installed_lib', { lflags => "$lflags -liupwin -lim -lcdwin", cflags => $cflags } );
      return 1;
    }
    elsif ($self->check_lib( [ 'iupgtk', 'im', 'cdgdk' ], $cflags, $lflags)) {
      print STDERR "- iupgtk+im+cdgdk FOUND!\n";
      $self->notes('already_installed_lib', { lflags => "$lflags -liupgtk -lim -lcdgdk", cflags => $cflags } );
      return 1;
    }
    elsif ($self->check_lib( [ 'iupmot', 'im', 'cdx11' ], $cflags, $lflags)) {
      print STDERR "- iupmot+im+cdx11 FOUND!\n";
      $self->notes('already_installed_lib', { lflags => "$lflags -liupmot -lim -lcdx11", cflags => $cflags } );
      return 1;
    }
  }
  print STDERR "- iup+im+cd not found (we have to build it from sources)!\n";
  return 0;
}

# check presence of header(s) specified as params
sub check_header {
  my ($self, $h, $cflags) = @_;
  $cflags ||= '';
  my @header = ref($h) ? @$h : ( $h );

  my ($fs, $src) = tempfile('tmpfileXXXXXX', SUFFIX => '.c', UNLINK => 1);
  my ($fo, $obj) = tempfile('tmpfileXXXXXX', SUFFIX => '.o', UNLINK => 1);
  my $inc = '';
  $inc .= "#include <$_>\n" foreach @header;
  syswrite($fs, <<MARKER); # write test source code
$inc
int demofunc(void) { return 0; }

MARKER
  close($fs);
  $src = $self->quote_literal($src);
  $obj = $self->quote_literal($obj);
  #Note: $Config{cc} might contain e.g. 'ccache cc' (FreeBSD 8.0)
  my $rv = run3("$Config{cc} -c -o $obj $src $cflags", \undef, \undef, \undef, { return_if_system_error => 1 } );
  return ($rv == 1 && $? == 0) ? 1 : 0;
}

# check presence of lib(s) specified as params
sub check_lib {
  my ($self, $l, $cflags, $lflags) = @_;
  $cflags ||= '';
  $lflags ||= '';
  $cflags =~ s/[\r\n]//g;
  $lflags =~ s/[\r\n]//g;
  my @libs = ref($l) ? @$l : ( $l );
  my $liblist = scalar(@libs) ? '-l' . join(' -l', @libs) : '';

  my ($fs, $src) = tempfile('tmpfileXXXXXX', SUFFIX => '.c', UNLINK => 1);
  my ($fo, $obj) = tempfile('tmpfileXXXXXX', SUFFIX => '.o', UNLINK => 1);
  my ($fe, $exe) = tempfile('tmpfileXXXXXX', SUFFIX => '.out', UNLINK => 1);
  syswrite($fs, <<MARKER); # write test source code
int main() { return 0; }

MARKER
  close($fs);
  $src = $self->quote_literal($src);
  $obj = $self->quote_literal($obj);
  $exe = $self->quote_literal($exe);
  my $output;
  #Note: $Config{cc} might contain e.g. 'ccache cc' (FreeBSD 8.0)
  my $rv1 = run3("$Config{cc} -c -o $obj $src $cflags", \undef, \$output, \$output, { return_if_system_error => 1 } );
  unless ($rv1 == 1 && $? == 0) {
    #print STDERR "OUTPUT(compile):\n$output\n" if $output;
    return 0
  }
  my $rv2 = run3("$Config{ld} $obj -o $exe $lflags $liblist", \undef, \$output, \$output, { return_if_system_error => 1 } );
  unless ($rv2 == 1 && $? == 0) {
    #print STDERR "OUTPUT(link):\n$output\n" if $output;
    return 0
  }
  return 1;
}

# pure perl implementation of patch functionality
sub apply_patch {
  my ($self, $dir_to_be_patched, $patch_file) = @_;

inc/My/Builder.pm  view on Meta::CPAN


sub detect_sys_libs {
  die;
};

sub pkg_config {
  my ($self, $pkc, $nul) = @_;
  if ($nul && $pkc && `$pkc --version 2>$nul`) {
    warn "Checking system libraries zlib, freetype2\n";
    (my $syszlib_ver        = `$pkc zlib --modversion 2>$nul`     ) =~ s/\s*$//;
    (my $syszlib_lflags     = `$pkc zlib --libs 2>$nul`           ) =~ s/\s*$//;
    (my $syszlib_cflags     = `$pkc zlib --cflags 2>$nul`         ) =~ s/\s*$//;
    (my $sysfreetype_ver    = `$pkc freetype2 --modversion 2>$nul`) =~ s/\s*$//;
    (my $sysfreetype_lflags = `$pkc freetype2 --libs 2>$nul`      ) =~ s/\s*$//;
    (my $sysfreetype_cflags = `$pkc freetype2 --cflags 2>$nul`    ) =~ s/\s*$//;
    $self->config_data('syszlib_ver',        $syszlib_ver       );
    $self->config_data('syszlib_lflags',     $syszlib_lflags    );
    $self->config_data('syszlib_cflags',     $syszlib_cflags    );
    $self->config_data('sysfreetype_ver',    $sysfreetype_ver   );
    $self->config_data('sysfreetype_lflags', $sysfreetype_lflags);
    $self->config_data('sysfreetype_cflags', $sysfreetype_cflags);
    warn "FOUND: zlib-$syszlib_ver LF=$syszlib_lflags\n"             if $syszlib_lflags;
    warn "FOUND: freetype-$sysfreetype_ver LF=$sysfreetype_lflags\n" if $sysfreetype_lflags;
  }
};

1;

inc/My/Builder/Cygwin.pm  view on Meta::CPAN

    }
    elsif ($_ !~ /\.dll$/) { # *.dll on cygwin is OK
      warn "###WARN### Unexpected filename '$_'";
      $success = 0;
    }
  }

  my @iuplibs = $self->sort_libs(keys %seen);
  $self->config_data('iup_libs', {map {$_=>1} @iuplibs} );
  $self->config_data('linker_libs', [ @iuplibs, qw/gdi32 comdlg32 comctl32 winspool uuid ole32 oleaut32 opengl32 glu32 imm32/ ] );
  my $syszlib_lflags     = $self->config_data('syszlib_lflags') || '';
  my $sysfreetype_lflags = $self->config_data('sysfreetype_lflags') || '';
  $self->config_data('extra_cflags', '');
  $self->config_data('extra_lflags', "$syszlib_lflags $sysfreetype_lflags -L/usr/lib/w32api");
  
  print STDERR "Build finished!\n";
  return $success;
};

sub build_via_tecmake {
  my ($self, $build_out, $srcdir, $mopts, $iuptgs, $cdtgs, $imtgs) = @_;
  my $prefixdir = rel2abs($build_out);

  my $success = 1;

inc/My/Builder/Cygwin.pm  view on Meta::CPAN

  mkdir "$prefixdir/lib" unless -d "$prefixdir/lib";
  mkdir "$prefixdir/include" unless -d "$prefixdir/include";

  my %done;
  my $tecuname = 'gcc4';
  #my $tecuname = 'dllg4';
  my @basecmd = ("make", "TEC_UNAME=$tecuname");
  my @opts = @$mopts;

  my $cpp11 = $Config{gccversion} !~ /^3\./ ? '-std=gnu++11' : '';
  my $fcf   = $self->config_data('sysfreetype_cflags') || '';
  push @opts, "FLAGS=$fcf" if $fcf;
  push @opts, "CPPFLAGS=$fcf $cpp11" if $fcf || $cpp11;

  if(-d "$srcdir/zlib/src") {
    print STDERR "Gonna build 'zlib'\n";
    chdir "$srcdir/zlib/src";
    copy('../../iup/tecmakewin.mak', '../tecmakewin.mak') unless -f '../tecmakewin.mak'; #WORKAROUND
    $done{"zlib"} = $self->run_custom(@basecmd, @opts, 'zlib');
    $success = 0 unless $done{"zlib"};
    copy($_, "$prefixdir/include/") foreach (bsd_glob("../include/*.h"));

inc/My/Builder/Unix.pm  view on Meta::CPAN


use File::Spec::Functions qw(catdir catfile rel2abs);
use File::Spec;
use File::Glob qw(bsd_glob);
use File::Copy;
use Config;

sub build_binaries {
  my ($self, $build_out, $srcdir) = @_;
  my $success = 1;
  my ($extra_cflags, $extra_lflags) = ('-I/usr/local/include', '-L/usr/local/lib');

  #try to detect some inc/lib directories
  my $d;
  $d = $self->run_stdout2str(qw[pkg-config --variable=libdir x11]);
  my $dir_x11_lib = ($d && -d $d && $d ne '/usr/lib') ? $d : '';
  $d = $self->run_stdout2str(qw[pkg-config --variable=includedir x11]);
  my $dir_x11_inc = ($d && -d $d && $d ne '/usr/include') ? $d : '';
  $d = $self->run_stdout2str(qw[pkg-config --variable=libdir gl]);
  my $dir_opengl_lib = ($d && -d $d && $d ne '/usr/lib') ? $d : '';
  $d = $self->run_stdout2str(qw[pkg-config --variable=includedir gl]);

inc/My/Builder/Unix.pm  view on Meta::CPAN

    $dir_mot_lib    ||= '/usr/dt/lib'                if (-f '/usr/dt/lib/libXm.so');
    $dir_opengl_inc ||= '/usr/X11/include'           if (-f '/usr/X11/include/GL/gl.h');
    $dir_opengl_lib ||= '/usr/X11/lib/GL'            if (-f '/usr/X11/lib/GL/libGL.so');
    $dir_x11_inc    ||= '/usr/openwin/include'       if (-f '/usr/openwin/include/X11/Xlib.h');
    $dir_x11_lib    ||= '/usr/openwin/lib'           if (-f '/usr/openwin/lib/libX11.so');
    $dir_x11_inc    ||= '/usr/openwin/share/include' if (-f '/usr/openwin/share/include/X11/Xlib.h');
    $dir_x11_lib    ||= '/usr/openwin/share/lib'     if (-f '/usr/openwin/share/lib/libX11.so');
  }

  if ($^O eq 'darwin') {
    $extra_cflags .= ' -I/opt/local/include';
    $extra_lflags .= ' -L/opt/local/lib';
  }

  #generic /usr/X11R6/...
  $dir_x11_inc    ||= '/usr/X11R6/include' if (-f '/usr/X11R6/include/X11/Xlib.h');
  $dir_x11_lib    ||= '/usr/X11R6/lib'     if (-f '/usr/X11R6/lib/libX11.so');
  $dir_opengl_inc ||= '/usr/X11R6/include' if (-f '/usr/X11R6/include/GL/gl.h');
  $dir_opengl_lib ||= '/usr/X11R6/lib'     if (-f '/usr/X11R6/lib/libGL.so');
  #generic /usr/X11R7/...
  $dir_x11_inc    ||= '/usr/X11R7/include' if (-f '/usr/X11R7/include/X11/Xlib.h');
  $dir_x11_lib    ||= '/usr/X11R7/lib'     if (-f '/usr/X11R7/lib/libX11.so');
  $dir_opengl_inc ||= '/usr/X11R7/include' if (-f '/usr/X11R7/include/GL/gl.h');
  $dir_opengl_lib ||= '/usr/X11R7/lib'     if (-f '/usr/X11R7/lib/libGL.so');

  $extra_cflags .= " -I$dir_x11_inc"    if $dir_x11_inc;
  $extra_lflags .= " -L$dir_x11_lib"    if $dir_x11_lib;
  $extra_cflags .= " -I$dir_opengl_inc" if $dir_opengl_inc;
  $extra_lflags .= " -I$dir_opengl_lib" if $dir_opengl_lib;

  print STDERR "Checking available libraries/headers...\n";
  if ($self->notes('build_debug_info')) {
    print STDERR "extra_cflags=$extra_cflags\n";
    print STDERR "extra_lflags=$extra_lflags\n";
  }

  my %list = (
    gtk        => 'gtk+-2.0',
    gtk3       => 'gtk+-3.0',
    gtkx11     => 'gtk+-x11-2.0',
    gdk        => 'gdk-2.0',
    gdk3       => 'gdk-3.0',
    gdkx11     => 'gdk-x11-2.0',
    gtkprint   => 'gtk+-unix-print-2.0',

inc/My/Builder/Unix.pm  view on Meta::CPAN

    $has{$_} = $v ? 1 : 0;
    $has_details{$_} = { version=>$v, prefix=>$p };    
    printf STDERR ("mod:% 20s version:% 9s prefix:%s\n", $list{$_}, $v, $p) if $self->notes('build_debug_info');
  }

  #detect pkg-config
  my $pkgcfg = $self->run_stdout2str(qw[pkg-config --version]);
  $has{'pkg-config'} = $pkgcfg ? 1 : 0;
  $has_details{'pkg-config'} = { version=>$pkgcfg, prefix=>$self->run_stdout2str(qw[which pkg-config]) };
  
  $has{l_gtk}   = $has{gtk}    && $self->check_lib( [] , `pkg-config --cflags gtk+-2.0 2>/dev/null`,     `pkg-config --libs gtk+-2.0 2>/dev/null`);
  $has{l_gtk3}  = $has{gtk3}   && $self->check_lib( [] , `pkg-config --cflags gtk+-3.0 2>/dev/null`,     `pkg-config --libs gtk+-3.0 2>/dev/null`);
  $has{l_gtkx11}= $has{gtkx11} && $self->check_lib( [] , `pkg-config --cflags gtk+-x11-2.0 2>/dev/null`, `pkg-config --libs gtk+-x11-2.0 2>/dev/null`);
  $has{l_gdk}   = $has{gdk}    && $self->check_lib( [] , `pkg-config --cflags gdk-2.0 2>/dev/null`,      `pkg-config --libs gdk-2.0 2>/dev/null`);
  $has{l_gdk3}  = $has{gdk3}   && $self->check_lib( [] , `pkg-config --cflags gdk-3.0 2>/dev/null`,      `pkg-config --libs gdk-3.0 2>/dev/null`);
  $has{l_gdkx11}= $has{gdkx11} && $self->check_lib( [] , `pkg-config --cflags gdk-x11-2.0 2>/dev/null`,  `pkg-config --libs gdk-x11-2.0 2>/dev/null`);
  $has{l_cairo} = $has{cairo}  && $self->check_lib( [] , `pkg-config --cflags cairo 2>/dev/null`,        `pkg-config --libs cairo 2>/dev/null`);
  $has{l_pango} = $has{pango}  && $self->check_lib( [] , `pkg-config --cflags pango 2>/dev/null`,        `pkg-config --libs pango 2>/dev/null`);
  #$has{l_pangox}= $has{pangox} && $self->check_lib( [] , `pkg-config --cflags pangox 2>/dev/null`,       `pkg-config --libs pangox 2>/dev/null`);

  $has{l_Xp}    = $self->check_lib( 'Xp',   $extra_cflags, $extra_lflags );
  $has{l_Xt}    = $self->check_lib( 'Xt',   $extra_cflags, $extra_lflags );
  $has{l_Xm}    = $self->check_lib( 'Xm',   $extra_cflags, $extra_lflags . ' -lX11 -lXt' );
  $has{l_Xmu}   = $self->check_lib( 'Xmu',  $extra_cflags, $extra_lflags );
  $has{l_Xext}  = $self->check_lib( 'Xext', $extra_cflags, $extra_lflags );
  $has{l_X11}   = $self->check_lib( 'X11',  $extra_cflags, $extra_lflags );
  $has{l_GL}    = $self->check_lib( 'GL',   $extra_cflags, $extra_lflags );
  $has{l_GLU}   = $self->check_lib( 'GLU',  $extra_cflags, $extra_lflags . ' -lGL -lm' );
  $has{l_glut}  = $self->check_lib( 'glut', $extra_cflags, $extra_lflags );
  $has{'l_stdc++'} = $self->check_lib( 'stdc++', $extra_cflags, $extra_lflags );

  $has{Xm}      = $self->check_header('Xm/Xm.h',   $extra_cflags);
  $has{Xlib}    = $self->check_header('X11/Xlib.h',$extra_cflags); #iupgl cdx11
  $has{glx}     = $self->check_header('GL/glx.h',  $extra_cflags); #iupgl
  $has{glu}     = $self->check_header('GL/glu.h',  $extra_cflags);
  $has{gl}      = $self->check_header('GL/gl.h',   $extra_cflags);

  #kind of a special hack
  $has{freetype} = $self->check_header('ft2build.h', `pkg-config --cflags gtk+-2.0 gdk-2.0 2>/dev/null`) ||
                   $self->check_header('ft2build.h', `pkg-config --cflags gtk+-3.0 gdk-3.0 2>/dev/null`);

  my @x11_libs; # just base X11 libs
  push(@x11_libs, 'X11')  if $has{l_X11};
  push(@x11_libs, 'Xext') if $has{l_Xext};

  my @opengl_libs;
  push(@opengl_libs, 'GL')  if $has{l_GL};
  push(@opengl_libs, 'GLU') if $has{l_GLU};

  my @imtargets;

inc/My/Builder/Unix.pm  view on Meta::CPAN


  if ($self->notes('build_debug_info') || ( !$build_target && $ENV{AUTOMATED_TESTING} ) ) {
    foreach (sort keys %has) {
      my $msg = "has: $has{$_} - $_";
      $msg .= "; version=" . $has_details{$_}->{version} if $has_details{$_}->{version};
      $msg .= "; prefix="  . $has_details{$_}->{prefix}  if $has_details{$_}->{prefix};
      print STDERR $msg, "\n";
    }

    print STDERR "Dumping some pkg-info:\n";
    print STDERR "[gtk2 cflags] " . $self->run_stdout2str(qw[pkg-config --cflags gtk+-2.0]) . "\n";
    print STDERR "[gtk2 libs  ] " . $self->run_stdout2str(qw[pkg-config --libs gtk+-2.0]) . "\n";
    print STDERR "[gtk3 cflags] " . $self->run_stdout2str(qw[pkg-config --cflags gtk+-3.0]) . "\n";
    print STDERR "[gtk3 libs  ] " . $self->run_stdout2str(qw[pkg-config --libs gtk+-3.0]) . "\n";
    for my $pkg (qw[gtk+-2.0 gtk+-3.0 gl glu glut x11 xt xext xmu]) {
      print STDERR "[prefix     $pkg] " . $self->run_stdout2str(qw[pkg-config --variable=prefix], $pkg) . "\n";
      print STDERR "[libdir     $pkg] " . $self->run_stdout2str(qw[pkg-config --variable=libdir], $pkg) . "\n";
      print STDERR "[includedir $pkg] " . $self->run_stdout2str(qw[pkg-config --variable=includedir], $pkg) . "\n";
    }

    print STDERR "Brute force lookup:\n";
    my $re = qr/\/(Xlib.h|Xm.h|gtk.h|cairo.h|glu.h|glut.h|gl.h|freetype.h|gtkprintunixdialog.h|jasper.h|jas_image.h|lib(X11|GL|Xm|freetype)\.[^\d]*)$/;
    print STDERR "[/usr    ] $_\n" foreach ($self->find_file('/usr', $re));

inc/My/Builder/Unix.pm  view on Meta::CPAN


    #detected libs
    push(@makeopts, "X11_LIBS=" . join(' ', @x11_libs));
    push(@makeopts, "X11_LIB=$dir_x11_lib") if $dir_x11_lib;
    push(@makeopts, "X11_INC=$dir_x11_inc") if $dir_x11_inc;
    push(@makeopts, "OPENGL_LIBS=" . join(' ', @opengl_libs));
    push(@makeopts, "OPENGL_LIB=$dir_opengl_lib") if $dir_opengl_lib;
    push(@makeopts, "OPENGL_INC=$dir_opengl_inc") if $dir_opengl_inc;

    push(@libs, @opengl_libs);
    #Note: $extra_?flags will be stored into ConfigData - they are not used for building
    my @mods = ($build_target eq 'GTK2') ?
               qw[gtk+-2.0 gdk-2.0 pango cairo] :
               qw[gtk+-3.0 gdk-3.0 pango cairo];
    $extra_cflags = $self->run_stdout2str(qw[pkg-config --cflags], @mods) . " $extra_cflags";
    $extra_lflags = $self->run_stdout2str(qw[pkg-config --libs], @mods) . " $extra_lflags";
  }
  elsif ($build_target eq 'X11/Motif') {
    push(@makeopts, 'USE_X11=Yes');
    push(@makeopts, 'USE_MOTIF=Yes');
    #additional X11 related libs
    push(@x11_libs, 'Xp')   if $has{l_Xp};
    push(@x11_libs, 'Xt')   if $has{l_Xt};
    push(@x11_libs, 'Xm')   if $has{l_Xm};
    push(@x11_libs, 'Xmu')  if $has{l_Xmu};
    #detected libs
    push(@makeopts, "X11_LIBS=" . join(' ', @x11_libs));
    push(@makeopts, "X11_LIB=$dir_x11_lib") if $dir_x11_lib;
    push(@makeopts, "X11_INC=$dir_x11_inc") if $dir_x11_inc;
    push(@makeopts, "OPENGL_LIBS=" . join(' ', @opengl_libs));
    push(@makeopts, "OPENGL_LIB=$dir_opengl_lib") if $dir_opengl_lib;
    push(@makeopts, "OPENGL_INC=$dir_opengl_inc") if $dir_opengl_inc;
    push(@makeopts, "MOTIF_INC=$dir_mot_inc") if $dir_mot_inc;
    push(@makeopts, "MOTIF_LIB=$dir_mot_lib") if $dir_mot_lib;
    push(@libs, @x11_libs, @opengl_libs);
    #Note: $extra_?flags set at the beginning of this sub
  }
  else {
    die "###ERROR### Wrong build target '$build_target!";
  }
  
  #extra options for iup/imglib
  push(@makeopts, 'USE_IUP_IMGLIB_LARGE=1') if $self->notes('build_large_imglib');
  
  if ($Config{cc} eq 'cc') {
    # fix for: https://rt.cpan.org/Public/Bug/Display.html?id=94615

inc/My/Builder/Unix.pm  view on Meta::CPAN

    elsif ($_ !~ /\.dll$/) { # *.dll on cygwin is OK
      warn "###WARN### Unexpected filename '$_'";
      $success = 0;
    }
  }

  push(@libs, 'stdc++') if $has{'l_stdc++'}; # -lstdc++ needed by Linux (at least)
  my @iuplibs = $self->sort_libs(keys %seen);
  $self->config_data('iup_libs', {map {$_=>1} @iuplibs} );
  $self->config_data('linker_libs', [@iuplibs, @libs] );
  $self->config_data('extra_cflags', $extra_cflags);
  $self->config_data('extra_lflags', $extra_lflags);

  print STDERR "Build finished!\n";
  return $success;
};

sub build_via_tecmake {
  my ($self, $build_out, $srcdir, $mopts, $iuptgs, $cdtgs, $imtgs, $ftgl_target) = @_;
  $srcdir ||= 'src';
  my $prefixdir = rel2abs($build_out);

inc/My/Builder/Windows.pm  view on Meta::CPAN

      push(@cmd_iup, 'BUILDBITS=64');
      push(@cmd_zl,  'BUILDBITS=64');
      push(@cmd_ft,  'BUILDBITS=64');
      push(@cmd_ftgl,'BUILDBITS=64');
    }    
  }
  
  #common for both compilers
  push(@cmd_iup, 'CF_iupimglib_EXTRA=-DIUP_IMGLIB_LARGE') if $self->notes('build_large_imglib');
  
  if (my $fcf = $self->config_data('sysfreetype_cflags')) {
    push @cmd_ftgl, "CF_cd_ftgl_EXTRA=$fcf";
    push @cmd_iup,  "CF_iupglcontrols_EXTRA=$fcf";
    push @cmd_cd,   "CF_cd_EXTRA=$fcf";
    push @cmd_cd,   "CF_cdgl_EXTRA=$fcf";
  }
  if (my $flf = $self->config_data('sysfreetype_lflags')) {
    push @cmd_ftgl, "LF_cd_ftgl_EXTRA=$flf";
    push @cmd_iup,  "LF_iupglcontrols_EXTRA=$flf";
    push @cmd_cd,   "LF_cd_EXTRA=$flf";
    push @cmd_cd,   "LF_cdgl_EXTRA=$flf";
  }

  my $libtype = 'static';
  my $success = 1;
  my %done;

inc/My/Builder/Windows.pm  view on Meta::CPAN

    }
    else {
      warn "###WARN### Unexpected filename '$_'";
    }
  }

  # xxx TODO: maybe more libs needed like - gdiplus ...
  my @iuplibs = $self->sort_libs(keys %seen);
  $self->config_data('iup_libs', {map {$_=>1} @iuplibs} );
  $self->config_data('linker_libs', [ @iuplibs, qw/gdi32 comdlg32 comctl32 winspool uuid ole32 oleaut32 opengl32 glu32 imm32/ ] );
  my $syszlib_lflags     = $self->config_data('syszlib_lflags') || '';
  my $sysfreetype_lflags = $self->config_data('sysfreetype_lflags') || '';
  $self->config_data('extra_lflags', "$syszlib_lflags $sysfreetype_lflags");
  $self->config_data('extra_cflags', '');
  $self->config_data('info_done', \%done);
  
  print STDERR "Build finished!\n";
  return $success;
}

sub get_make {
  my ($self) = @_;
  my @try = ( 'dmake', 'mingw32-make', 'gmake', 'make', $Config{make}, $Config{gmake} );
  print STDERR "Gonna detect make\n" if $self->notes('build_debug_info');

t/20-compile.t  view on Meta::CPAN

  return 0;
}

MARKER
close($fs);

my $i = Alien::IUP->config('INC');
my $l = Alien::IUP->config('LIBS');
$l = ExtUtils::Liblist->ext($l) if($Config{make} =~ /nmake/ && $Config{cc} =~ /cl/); # MSVC compiler hack

my $obj = $cb->compile( source => $src, extra_compiler_flags => $i );
isnt( $obj, undef, 'Testing compilation' );

my $exe = $cb->link_executable( objects => $obj, extra_linker_flags => $l );
isnt( $exe, undef, 'Testing linking' );



( run in 6.255 seconds using v1.01-cache-2.11-cpan-94b05bcf43c )