Created
April 3, 2011 18:05
-
-
Save jnbek/900623 to your computer and use it in GitHub Desktop.
This is 'supposed' to build Gtk2-Perl on Strawberry Perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -- | |
# Stolen from http://perlmonks.com/?node_id=793472 | |
# Install WWW:Mechanize and GnuWin32 http://getgnuwin32.sourceforge.net/ | |
$VERSION = '0.0104'; | |
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 | |
http://search.cpan.org/dist/Gtk2-ImageView | |
]; | |
## 2009-09-04- 05:02:37 patches patches | |
( @dist ) = qw[ | |
http://search.cpan.org/dist/ExtUtils-Depends-0.302 | |
http://search.cpan.org/dist/ExtUtils-PkgConfig-1.12 | |
http://search.cpan.org/dist/Cairo-1.061 | |
http://search.cpan.org/dist/Glib-1.222 | |
http://search.cpan.org/dist/Pango-1.221 | |
http://search.cpan.org/dist/Gtk2-1.221 | |
http://search.cpan.org/dist/Gtk2-GladeXML-1.007 | |
http://search.cpan.org/dist/Gtk2-ImageView-0.05 | |
]; | |
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/win32/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.000000000 -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('gtk_bundle.patch', '');#2009-09-04- 04:48:29 | |
warn join ' ', $^X, qw[ -pi.orig -e ], q[s!Requires!#Requires!], 'gtk_bundle/lib/pkgconfig/libglade-2.0.pc'; | |
system $^X, qw[ -pi.orig -e ], q[s!Requires!#Requires!], 'gtk_bundle/lib/pkgconfig/libglade-2.0.pc'; | |
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-Depends-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 14: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/GtkRecentChooser.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.375000000 -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/Makefile.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.703125000 -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 -0700 | |
@@ -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__ | |
write_file('Gtk2-ImageView.patch', <<'__PATCH__'); | |
diff -ruN Gtk2-ImageView-0.05/Makefile.PL Gtk2-ImageView-0.05-new/Makefile.PL | |
--- Gtk2-ImageView-0.05/Makefile.PL 2009-04-04 14:25:14.000000000 -0800 | |
+++ Gtk2-ImageView-0.05-new/Makefile.PL 2009-07-27 10:24:22.515625000 -0700 | |
@@ -88,7 +88,8 @@ | |
# my $configure_requires = | |
# Glib::MakeHelper->get_configure_requires_yaml(%PREREQ_PM); | |
my $configure_requires = get_configure_requires_yaml(%PREREQ_PM); | |
- | |
+my(%makefilevars) = $depends->get_makefile_vars; | |
+$makefilevars{LIBS}=":nosearch $makefilevars{LIBS}"; # SPECIAL | |
WriteMakefile( | |
NAME => 'Gtk2::ImageView', | |
VERSION_FROM => 'ImageView.pm', # finds $VERSION | |
@@ -98,7 +99,7 @@ | |
PREREQ_PM => \%PREREQ_PM, | |
XSPROTOARG => '-noprototypes', | |
MAN3PODS => \%pod_files, | |
- $depends->get_makefile_vars, | |
+ %makefilevars, | |
EXTRA_META => qq/ | |
$configure_requires | |
/, | |
__PATCH__ | |
@tarball = grep -e, map glob, qw[ ExtUtils-Depends*gz ExtUtils-PkgConfig*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 ../gtk_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)", $!,$!; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment