Alien-IUP
view release on metacpan or search on metacpan
inc/My/Builder/Unix.pm view on Meta::CPAN
);
my %has;
my %has_details;
for (sort keys %list) {
my $v = $self->run_stdout2str(qw[pkg-config --modversion], $list{$_}) || '';
my $p = $self->run_stdout2str(qw[pkg-config --variable=prefix], $list{$_}) || '';
$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;
my @cdtargets;
my @iuptargets;
#possible targets: im im_process im_jp2 im_fftw im_capture im_avi im_wmv
#possible targets: cd_zlib cd_freetype cd_ftgl cd cd_pdflib cdpdf cdgl cdcontextplus cdcairo
#possible targets: iup iupcd iupcontrols iup_pplot iup_mglplot iupgl iupim iupimglib iupweb iuptuio iup_plot
if ($self->notes('is_devel_cvs_version')) {
### DEVEL BUILD ###
@imtargets = qw[im im_process im_jp2 im_fftw im_capture];
@cdtargets = qw[cd cd_pdflib cdpdf cdgl]; #xxx add cdcontextplus
@iuptargets = qw[iup iupcd iupcontrols iupmatrixex iup_plot iup_mglplot iupgl iupglcontrols iup_scintilla iupim iupimglib iupweb iuptuio iup_plot];
}
else {
@imtargets = qw[im];
@cdtargets = qw[cd cdgl];
@iuptargets = qw[iup iupcd iupcontrols iupmatrixex iup_plot iup_mglplot iupgl iupglcontrols iup_scintilla iupim iupimglib iup_plot];
#if ($^O eq 'openbsd') {
# warn "###WARN### skipping im_process on OpenBSD";
# @imtargets = grep { $_ !~ /^im_process$/ } @imtargets;
#}
#if ($^O eq 'solaris') {
# warn "###WARN### skipping iuptuio on Solaris";
# @iuptargets = grep { $_ !~ /^iuptuio$/ } @iuptargets;
#}
if ($^O eq 'solaris') {
warn "###WARN### skipping iup_mglplot on Solaris (fails to compile)";
@iuptargets = grep { $_ !~ /^iup_mglplot$/ } @iuptargets;
}
}
my $ftgl_target = 1;
unless ($has{l_GL} && $has{l_GLU} && $has{gl} && $has{glx} && $has{glu}) {
warn "###WARN### OpenGL libraries not found or not complete\n";
warn "- required headers: GL/gl.h GL/glx.h GL/glu.h\n";
warn "- required libraries: libGL libGLU\n";
my $skip = $ENV{TRAVIS} ? 'y' : $self->prompt("Skip OpenGL related IUP/CD components?", 'y');
if (lc($skip) eq 'y') {
@cdtargets = grep { $_ !~ /^(cd_ftgl|cdgl)$/ } @cdtargets;
@iuptargets = grep { $_ !~ /^(iup_mglplot|iup_plot|iupglcontrols|iupgl)$/ } @iuptargets;
$ftgl_target = 0;
}
}
@iuptargets = grep { $_ !~ /^(iupweb)$/ } @iuptargets unless $has{webkit};
#store debug info into ConfigData
$self->config_data('info_has', \%has);
$self->config_data('info_lib_details', \%has_details);
$self->config_data('info_imtargets', \@imtargets);
$self->config_data('info_cdtargets', \@cdtargets);
$self->config_data('info_iuptargets', \@iuptargets);
my @makeopts = qw[NO_DYNAMIC=Yes USE_NODEPEND=Yes];
#my @makeopts = qw[NO_STATIC=Yes USE_NODEPEND=Yes];
#On solaris, some tools like 'ar' are not in the default PATH, but in /usr/???/bin
if ($^O eq 'solaris') {
my ($ar, $ranlib);
for (qw[/usr/ccs/bin /usr/xpg4/bin /usr/sfw/bin /usr/xpg6/bin /usr/gnu/bin /opt/gnu/bin /usr/bin]) {
$ar = "$_/ar" if (!$ar && -x "$_/ar");
$ranlib = "$_/ranlib" if (!$ranlib && -x "$_/ranlib");
}
push @makeopts, "AR=$ar" if $ar;
push @makeopts, "RANLIB=$ranlib" if $ranlib;
}
#choose GUI subsystem, priorities if multiple subsystems detected: 1. GTK, 2. X11/Motif
my @libs;
my @build_opts;
my $build_target;
push(@build_opts, 'GTK3') if ($has{gtk3} && $has{gdk3} && $has{cairo} && $has{Xlib});
push(@build_opts, 'GTK2') if ($has{gtk} && $has{gdk} && $has{cairo} && $has{Xlib});
push(@build_opts, 'X11/Motif') if ($has{Xlib} && $has{Xm});
if (scalar(@build_opts) == 1) {
$build_target = $build_opts[0];
}
elsif (scalar(@build_opts) > 1) {
( run in 1.754 second using v1.01-cache-2.11-cpan-2398b32b56e )