http://qs1969.pair.com?node_id=783422


in reply to install Gtk2::GladeXML

This program will download/build/install everything for Gtk2::GladeXML

Requirements Strawberry Perl (or ActivePerl with ppm install MinGW), WWW::Mechanize, unzip, tar, gzip.

#!/usr/bin/perl -- $VERSION = '0.01'; use strict; use warnings; my @gtk_bundle; my @tarball; sub write_file { my( $fname, $fcontent ) = @_; print "Creating $fname \n"; open my $fh, '>', $fname or die $!; print $fh $fcontent; close $fh; } use WWW::Mechanize; sub URI::file { return (shift->path_segments)[-1] } sub Alien_perlGtk2 { my( @dist ) = qw[ http://search.cpan.org/dist/ExtUtils-Depends http://search.cpan.org/dist/ExtUtils-PkgConfig http://search.cpan.org/dist/Cairo http://search.cpan.org/dist/Glib http://search.cpan.org/dist/Pango http://search.cpan.org/dist/Gtk2 http://search.cpan.org/dist/Gtk2-GladeXML ]; my $ua = WWW::Mechanize->new( autocheck => 1 ); $ua->env_proxy(); for my $dist( @dist ){ $dist = URI->new($dist); $ua->get($dist); my $bundle = $ua->find_link('text' => 'Download')->url_abs; my $filename = $bundle->file; push @tarball, $filename; print "$bundle\n"; $ua->mirror( $bundle, $filename ); print " ", -s $filename, " bytes\n"; $ua->back; } } sub Alien_libglade { my $ua = WWW::Mechanize->new( autocheck => 1 ); $ua->env_proxy(); my $libglade = URI->new("http://ftp.gnome.org/pub/gnome/binaries/w +in32/libglade/2.6/?C=M;O=D"); $ua->get($libglade); my( @links ) = map { $_->url_abs } $ua->find_all_links( text_regex + => qr/^libglade/ ); for my $zip( @links[0,1] ){ $zip = URI->new($zip); my $filename = $zip->file; push @gtk_bundle, $filename; print "$zip\n"; $ua->mirror( $zip, $filename ); print " ", -s $filename, " bytes\n"; $ua->back; } } sub Alien_Gtk2 { my $ua = WWW::Mechanize->new( autocheck => 1 ); $ua->env_proxy(); # http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.20/ $ua->get('http://www.gtk.org/download-windows.html'); my $bundle = $ua->find_link('text' => 'bundle')->url_abs; my $filename = $bundle->file; push @gtk_bundle, $filename; print "$bundle\n"; $ua->mirror( $bundle, $filename ); print " ", -s $filename, " bytes\n"; } #### MAIN use File::Spec; $ENV{GTK_BASEPATH} = File::Spec->rel2abs('gtk-bundle'); my $newpath = File::Spec->catfile($ENV{GTK_BASEPATH}, 'bin'); $ENV{PATH} = "$newpath;$ENV{PATH}"; $ENV{PKG_CONFIG_PATH} = File::Spec->catfile( $ENV{GTK_BASEPATH}, qw' +lib pkgconfig '); print " set GTK_BASEPATH=$ENV{GTK_BASEPATH} set PATH=%GTK_BASEPATH%\\bin;%PATH% set PKG_CONFIG_PATH=%GTK_BASEPATH%\\lib\\pkgconfig "; write_file('gtk_bundle.patch', <<'__PATCH__'); diff -ruN gtk-bundle/lib/pkgconfig/libglade-2.0.pc gtk+-bundle_2.16.4- +20090708_win32/lib/pkgconfig/libglade-2.0.pc --- gtk-bundle/lib/pkgconfig/libglade-2.0.pc 2008-09-23 21:22:00.00 +0000000 -0700 +++ gtk+-bundle_2.16.4-20090708_win32/lib/pkgconfig/libglade-2.0.pc + 2009-07-26 12:33:52.750000000 -0700 @@ -11,7 +11,7 @@ Name: Libglade Description: a library for dynamically loading GLADE interface files Version: 2.6.3 -Requires: gtk+-2.0 libxml-2.0 +#Requires: gtk+-2.0 libxml-2.0 Libs: -L${libdir} -lglade-2.0 Cflags: -I${includedir}/libglade-2.0 __PATCH__ write_file('Cairo.patch', <<'__PATCH__'); diff -ruN Cairo-1.061/Makefile.PL Cairo-1.061-new/Makefile.PL --- Cairo-1.061/Makefile.PL 2009-03-28 04:19:31.000000000 -0800 +++ Cairo-1.061-new/Makefile.PL 2009-07-26 15:34:38.109375000 -0700 @@ -381,6 +381,10 @@ SvCairoPath ); +my %makefilevars = $dep->get_makefile_vars; +$makefilevars{LIBS}=":nosearch $makefilevars{LIBS}"; # SPECIAL +#use DDS; Dump\%makefilevars; + WriteMakefile ( NAME => 'Cairo', VERSION_FROM => 'lib/Cairo.pm', @@ -390,7 +394,7 @@ FUNCLIST => \@exports, DL_FUNCS => { Cairo=> [] }, - $dep->get_makefile_vars, + %makefilevars, META_MERGE => { configure_requires => \%prereqs, __PATCH__ write_file('ExtUtils-Depends.patch', <<'__PATCH__'); diff -ruN ExtUtils-Depends-0.302/lib/ExtUtils/Depends.pm ExtUtils-Depe +nds-0.302-new/lib/ExtUtils/Depends.pm --- ExtUtils-Depends-0.302/lib/ExtUtils/Depends.pm 2009-07-04 06:30 +:45.000000000 -0700 +++ ExtUtils-Depends-0.302-new/lib/ExtUtils/Depends.pm 2009-07-26 1 +4:27:15.734375000 -0700 @@ -332,7 +332,7 @@ }, map { -d $_ ? ($_) : () } @INC); # only extant dirs if ($matching_file && -f $matching_file) { - push @found_libs, ('-L' . $matching_dir, '-l' . $stem); + push @found_libs, $matching_file; next; } } __PATCH__ write_file('Glib.patch', <<'__PATCH__'); diff -ruN Glib-1.222/Makefile.PL Glib-1.222-new/Makefile.PL --- Glib-1.222/Makefile.PL 2009-07-04 10:22:55.000000000 -0700 +++ Glib-1.222-new/Makefile.PL 2009-07-26 15:37:51.656250000 -0700 @@ -157,6 +157,10 @@ our @exports; require 'Glib.exports'; +my( %makefilevars ) = $glib ? $glib->get_makefile_vars : (); +#use DDS; Dump\%makefilevars; +$makefilevars{LIBS}=":nosearch $makefilevars{LIBS}"; # SPECIAL + WriteMakefile( NAME => 'Glib', VERSION_FROM => 'Glib.pm', # finds $VERSION @@ -175,7 +179,7 @@ }, }, - $glib ? $glib->get_makefile_vars : (), + %makefilevars, ); =unstable __PATCH__ write_file('Gtk2.patch', <<'__PATCH__'); diff -ruN Gtk2-1.221/Makefile.PL Gtk2-1.221-new/Makefile.PL --- Gtk2-1.221/Makefile.PL 2009-05-17 04:59:39.000000000 -0700 +++ Gtk2-1.221-new/Makefile.PL 2009-07-26 15:38:31.968750000 -0700 @@ -268,6 +268,11 @@ our @exports; require 'Gtk2.exports'; +my(%makefilevars)=$gtk2->get_makefile_vars; +#use DDS; Dump\%makefilevars; +$makefilevars{LIBS}=":nosearch $makefilevars{LIBS}"; # SPECIAL + + WriteMakefile( NAME => 'Gtk2', VERSION_FROM => 'Gtk2.pm', # finds $VERSION @@ -283,7 +288,7 @@ no_index => { directory => [qw/tools xs/] }, }, - $gtk2->get_makefile_vars, + %makefilevars, ); =unstable diff -ruN Gtk2-1.221/t/GtkRecentChooser.t Gtk2-1.221-new/t/GtkRecentCh +ooser.t --- Gtk2-1.221/t/GtkRecentChooser.t 2009-05-17 04:59:40.000000000 - +0700 +++ Gtk2-1.221-new/t/GtkRecentChooser.t 2009-07-26 12:50:04.3750000 +00 -0700 @@ -41,9 +41,13 @@ # ------------------------------------------------------------------- +-------- # -use Cwd qw(cwd); -my $uri_one = "file://" . cwd() . "/" . $0; -my $uri_two = "file://" . $^X; +#~ use Cwd qw(cwd); +#~ my $uri_one = "file://" . cwd() . "/" . $0; +#~ my $uri_two = "file://" . $^X; +use URI::file; +my $uri_one = URI::file->new(__FILE__)->abs(URI::file->cwd); +my $uri_two = URI::file->new($^X)->abs(URI::file->cwd); + $manager -> purge_items(); $manager -> add_item($uri_one); __PATCH__ write_file('Gtk2-GladeXML.patch', <<'__PATCH__'); diff -ruN Gtk2-GladeXML-1.007/Makefile.PL Gtk2-GladeXML-1.007-new/Make +file.PL --- Gtk2-GladeXML-1.007/Makefile.PL 2008-09-07 13:05:50.000000000 - +0700 +++ Gtk2-GladeXML-1.007-new/Makefile.PL 2009-07-26 17:34:59.7031250 +00 -0700 @@ -65,13 +65,18 @@ $gladexml->install ('gladexmlperl.h'); $gladexml->save_config ('build/IFiles.pm'); +my(%makefilevars)=$gladexml->get_makefile_vars; +#use DDS; Dump\%makefilevars; +$makefilevars{LIBS}=":nosearch $makefilevars{LIBS}"; # SPECIAL + + WriteMakefile( NAME => 'Gtk2::GladeXML', VERSION_FROM => 'GladeXML.pm', ABSTRACT_FROM => 'GladeXML.pm', PREREQ_PM => \%pre_reqs, XSPROTOARG => '-noprototypes', - $gladexml->get_makefile_vars, + %makefilevars, ); __PATCH__ write_file('Pango.patch', <<'__PATCH__'); diff -ruN Pango-1.220/Makefile.PL Pango-1.220-new/Makefile.PL --- Pango-1.220/Makefile.PL 2009-03-17 08:58:06.000000000 -0800 +++ Pango-1.220-new/Makefile.PL 2009-07-26 15:47:26.265625000 -0700 @@ -184,6 +184,10 @@ # exports list needed for win32, unused on others my @exports = Glib::MakeHelper->read_source_list_file ('pango.exports +'); +my(%makefilevars) = $pango->get_makefile_vars; +#use DDS; Dump\%makefilevars; +$makefilevars{LIBS}=":nosearch $makefilevars{LIBS}"; # SPECIAL + WriteMakefile( NAME => 'Pango', VERSION_FROM => 'lib/Pango.pm', @@ -196,7 +200,7 @@ META_MERGE => { configure_requires => \%PREREQ_PM }, - $pango->get_makefile_vars, + %makefilevars, ); diff -ruN Pango-1.220/pango.exports Pango-1.220-new/pango.exports --- Pango-1.220/pango.exports 2008-11-16 10:57:55.000000000 -0800 +++ Pango-1.220-new/pango.exports 2009-07-26 12:00:56.140625000 -07 +00 @@ -1,2 +1,8 @@ newSVPangoRectangle SvPangoRectangle +gtk2perl_pango_attribute_get_type +gtk2perl_pango_attribute_register_custom_type +gtk2perl_pango_attr_iterator_get_type +gtk2perl_pango_layout_iter_get_type +gtk2perl_pango_layout_line_get_type +gtk2perl_pango_script_iter_get_type __PATCH__ @tarball = map { glob $_ } qw[ ExtUtils-Depends*gz ExtUtils-PkgCon +fig*gz Cairo*gz Glib*gz Pango*gz Gtk2*gz ]; unless( @tarball == 7 ){ print "Downloading neccessary files\n"; Alien_libglade(); Alien_Gtk2(); Alien_perlGtk2(); print "Extracting bundle\n"; for my $tgz ( @gtk_bundle ){ system qw[ unzip -od gtk_bundle ], $tgz; } } chdir 'gtk-bundle' or die sprintf "chdir ($!)(%s)", $!,$!; system qw[ patch -p1 -N --global-reject-file=../global.rejects -i ../g +tk_bundle.patch ]; chdir '..' or die sprintf "chdir ($!)(%s)", $!,$!; for my $tgz ( @tarball ){ system qw[ gzip -dkf ], $tgz; $tgz =~ s/\.gz$//i; system qw[ tar -xvf ], $tgz; $tgz =~ s/\.tar$//i; chdir $tgz or die sprintf "chdir ($!)(%s)", $!,$!; my ( $lepatch ) = $tgz =~ m~^(.+?)\-\d+\.[\d_]+.*$~; $lepatch = "../$lepatch.patch"; system qw[ patch -p1 -N --global-reject-file=../global.rejects -i +], $lepatch; system $^X, qw[ Makefile.PL make=dmake ]; system qw[ dmake test ]; system qw[ dmake install ]; chdir '..' or die sprintf "chdir ($!)(%s)", $!,$!; }
Your laptop will get warm :)

Replies are listed 'Best First'.
Re^2: install Gtk2::GladeXML
by Anonymous Monk on Jul 27, 2009 at 01:34 UTC
    Bah, typo s/gtk-bundle/gtk_bundle/g;
      And I now have a ppm package for Gtk2-GladeXML-1.007. Anyone wanta it, just /msg me and I'll send it over. (It's for perl-5.10, though I could probably provide the same for 5.8 if needed.)

      Cheers,
      Rob