Changeset 2208
- Timestamp:
- 12/28/08 01:17:23 (3 years ago)
- Location:
- trunk/Padre
- Files:
-
- 2 edited
-
Makefile.PL (modified) (2 diffs)
-
privinc/Module/Install/PRIVATE/Padre.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/Makefile.PL
r2198 r2208 1 # NOTE: inc::Module::Install::PRIVATE::Padre needs Perl 5.8, so make sure 2 # that we force the Perl version check (and fail) early. 3 # Unicode is also considered to finally be "stable" at 5.8.5, so we will 4 # set our dependency on that. 5 use 5.008005; 1 6 use strict; 2 7 use lib 'privinc'; 3 use inc::Module::Install; 4 5 # workaround for the fact that Module::Install loads the modules 6 # into memory and when Test::NoWarnings is loaded it will hide 7 # the warnings generated from that point. 8 eval { 9 require Test::NoWarnings; 10 $SIG{__WARN__} = 'DEFAULT'; 11 }; 8 use inc::Module::Install 0.77; 12 9 13 10 14 use Config;15 unless ( $Config{usethreads} ) {16 warn "Padre requires a perl built using threads\n";17 exit 0;18 }19 11 20 # Fedora and other rpm based build systems remove the DISPLAY by default 21 # which blows up when checking the Wx version. So we disable it. 22 # See #17023 if (win32 or $ENV{DISPLAY}) { 24 check_wx_version; 25 } 12 13 14 ##################################################################### 15 # Normal Boring Commands 16 17 # NOTE: Core modules that aren't dual-life should always have a version of 0 26 18 27 19 name 'Padre'; … … 29 21 author 'Gabor Szabo'; 30 22 all_from 'lib/Padre.pm'; 31 requires 'perl' => '5.008001'; 32 requires 'Carp' => 0; 33 requires 'Class::Adapter' => '1.05'; 34 requires 'Class::XSAccessor' => '0.14'; 35 requires 'Cwd' => '3.2701'; 36 requires 'Data::Dumper' => 0; 37 requires 'Digest::MD5' => 0; 38 requires 'Encode' => '2.26'; 39 requires 'File::Spec' => '3.2701'; 40 requires 'File::Spec::Functions' => '3.2701'; 41 requires 'File::Basename' => 0; 42 requires 'FindBin' => 0; 43 requires 'Getopt::Long' => 0; 44 requires 'HTML::Parser' => '3.58'; 45 requires 'HTML::Entities' => '3.57'; 46 requires 'List::Util' => '1.18'; 47 requires 'IO::Socket' => '1.30'; 48 requires 'IPC::Cmd' => '0.42'; # Requires IPC::Run on Win32 49 requires 'IPC::Run' => '0.82' if win32; 50 requires 'IPC::Open3' => '0'; # not dual-lived! 51 requires 'Term::ReadLine' => 0; 52 requires 'Module::Refresh' => '0.13'; 53 requires 'App::Ack' => '1.86'; 54 requires 'Class::Autouse' => '1.26'; 55 requires 'Class::Unload' => '0.03'; 56 requires 'DBD::SQLite' => '1.10'; 57 requires 'DBI' => '1.58'; 58 requires 'File::Copy::Recursive' => '0.37'; 59 requires 'File::Find::Rule' => '0.30'; 60 requires 'File::HomeDir' => '0.82'; 61 requires 'File::ShareDir' => '1.00'; 62 requires 'File::ShareDir::PAR' => '0.03'; 63 requires 'File::Which' => '0.05'; 64 requires 'IO::String' => '1.08'; 65 requires 'Module::Inspector' => '0.04'; 66 requires 'Module::Starter' => '1.50'; 67 requires 'ORLite' => '0.15'; 68 requires 'ORLite::Migrate' => '0.01'; 69 requires 'Params::Util' => '0.33'; 70 requires 'PAR' => '0.970'; 71 requires 'Pod::POM' => '0.17'; 72 requires 'Pod::Simple' => '3.07'; 73 requires 'Pod::Simple::XHTML' => '3.04'; 74 requires 'Probe::Perl' => '0.01'; 75 requires 'PPI' => '1.203'; 76 requires 'Storable' => '2.15'; 77 requires 'Text::Diff' => '0.35'; 78 requires 'Text::FindIndent' => '0.03'; 79 requires 'threads' => '1.71'; 80 requires 'threads::shared' => '1.26'; 81 requires 'Thread::Queue' => '2.11'; 82 requires 'YAML::Tiny' => '1.32'; 83 84 # See #170 85 if (win32 or $ENV{DISPLAY}) { 86 requires 'Wx' => '0.89'; 87 requires 'Wx::Perl::Dialog' => '0.04'; 88 requires 'Wx::Perl::ProcessStream' => '0.11'; 89 } 90 91 requires 'Parse::ErrorString::Perl'=> '0.08'; 92 test_requires 'Test::Compile' => '0.08' unless win32; 93 test_requires 'Test::More' => '0.47'; 94 test_requires 'Test::Script' => '1.03'; 95 test_requires 'Test::Exception' => '0.27'; 96 test_requires 'Test::NoWarnings' => '0.084'; 97 test_requires 'Test::NeedsDisplay' => '1.05'; 98 no_index 'directory' => qw{ t xt eg share inc privinc}; 23 requires 'perl' => '5.008001'; 24 requires 'Carp' => 0; 25 requires 'Class::Adapter' => '1.05'; 26 requires 'Class::XSAccessor' => '0.14'; 27 requires 'Cwd' => '3.2701'; 28 requires 'Data::Dumper' => 0; 29 requires 'Digest::MD5' => 0; 30 requires 'Encode' => '2.26'; 31 requires 'File::Spec' => '3.2701'; 32 requires 'File::Spec::Functions' => '3.2701'; 33 requires 'File::Basename' => 0; 34 requires 'FindBin' => 0; 35 requires 'Getopt::Long' => 0; 36 requires 'HTML::Parser' => '3.58'; 37 requires 'HTML::Entities' => '3.57'; 38 requires 'List::Util' => '1.18'; 39 requires 'IO::Socket' => '1.30'; 40 requires 'IPC::Cmd' => '0.42'; 41 requires 'IPC::Run' => '0.82' if win32; 42 requires 'IPC::Open3' => 0; 43 requires 'Term::ReadLine' => 0; 44 requires 'Module::Refresh' => '0.13'; 45 requires 'App::Ack' => '1.86'; 46 requires 'Class::Autouse' => '1.26'; 47 requires 'Class::Unload' => '0.03'; 48 requires 'DBD::SQLite' => '1.10'; 49 requires 'DBI' => '1.58'; 50 requires 'File::Copy::Recursive' => '0.37'; 51 requires 'File::Find::Rule' => '0.30'; 52 requires 'File::HomeDir' => '0.82'; 53 requires 'File::ShareDir' => '1.00'; 54 requires 'File::ShareDir::PAR' => '0.03'; 55 requires 'File::Which' => '0.05'; 56 requires 'IO::String' => '1.08'; 57 requires 'Module::Inspector' => '0.04'; 58 requires 'Module::Starter' => '1.50'; 59 requires 'ORLite' => '0.15'; 60 requires 'ORLite::Migrate' => '0.01'; 61 requires 'Params::Util' => '0.33'; 62 requires 'PAR' => '0.970'; 63 requires 'Pod::POM' => '0.17'; 64 requires 'Pod::Simple' => '3.07'; 65 requires 'Pod::Simple::XHTML' => '3.04'; 66 requires 'Probe::Perl' => '0.01'; 67 requires 'PPI' => '1.203'; 68 requires 'Storable' => '2.15'; 69 requires 'Text::Diff' => '0.35'; 70 requires 'Text::FindIndent' => '0.03'; 71 requires 'threads' => '1.71'; 72 requires 'threads::shared' => '1.26'; 73 requires 'Thread::Queue' => '2.11'; 74 requires 'YAML::Tiny' => '1.32'; 75 requires 'Wx' => '0.89'; 76 requires 'Wx::Perl::Dialog' => '0.04'; 77 requires 'Wx::Perl::ProcessStream' => '0.11'; 78 requires 'Parse::ErrorString::Perl' => '0.08'; 79 test_requires 'Test::Compile' => '0.08' unless win32; 80 test_requires 'Test::More' => '0.47'; 81 test_requires 'Test::Script' => '1.03'; 82 test_requires 'Test::Exception' => '0.27'; 83 test_requires 'Test::NoWarnings' => '0.084'; 84 test_requires 'Test::NeedsDisplay' => '1.05'; 85 no_index 'directory' => qw{ t xt eg share inc privinc }; 99 86 homepage 'http://padre.perlide.org/'; 100 87 bugtracker 'http://padre.perlide.org/'; 101 88 repository 'http://svn.perlide.org/padre/trunk/Padre/'; 89 # MailingList 'http://mail.perlide.org/mailman/listinfo/padre-dev'; 102 90 install_script 'script/padre'; 103 91 install_share; 104 92 105 #MailingList => 'http://mail.perlide.org/mailman/listinfo/padre-dev',106 93 94 95 96 97 ##################################################################### 98 # Padre-Specific Oddities 99 100 # Padre requires threads 101 use Config; 102 unless ( $Config{usethreads} ) { 103 warn("Padre requires a perl built using threads\n"); 104 exit(0); 105 } 106 107 # The check_wx_version command SHOULD (hopefully) now be able to verify the 108 # wxWidgets version WITHOUT having to have DISPLAY. 109 check_wx_version; 110 111 # Add the make exe target 107 112 setup_padre; 108 113 114 # EU:MM incorrectly attempts to load all the dependencies. 115 # To prevent this happening we populate the %INC hash and create 116 # a VERSION method for each module, so that we can prevent loading 117 # any modules while convincing EU:MM that we have the right version. 118 # This has to be called immediately before calling WriteAll. 119 trick_eumm; 120 109 121 WriteAll; -
trunk/Padre/privinc/Module/Install/PRIVATE/Padre.pm
r1848 r2208 1 1 package Module::Install::PRIVATE::Padre; 2 3 use 5.008; 2 4 use strict; 3 5 use warnings; 4 6 use Module::Install::Base; 5 7 6 use FindBin (); 7 use File::Spec; 8 use FindBin (); 8 9 use File::Find (); 9 10 10 our @ISA = qw(Module::Install::Base);11 11 our $VERSION = '0.20'; 12 our @ISA = qw{Module::Install::Base}; 12 13 13 14 sub setup_padre { 14 my $self = shift;15 my $inc_class = join( '::', @{$self->_top}{qw(prefix name)});16 my $class = __PACKAGE__;15 my $self = shift; 16 my $inc_class = join( '::', @{ $self->_top }{ qw(prefix name) } ); 17 my $class = __PACKAGE__; 17 18 18 19 $self->postamble(<<"END_MAKEFILE"); … … 27 28 28 29 sub check_wx_version { 29 # Missing Wx should be dealt by the standard prereq system 30 eval { require Wx }; 31 return if $@; 32 33 my $version = Wx::wxVERSION_STRING(); 34 nono("Could not find Wx::wxVERSION_STRING") if not defined $version; 35 36 print "Found $version\n"; 37 print "Found Wx.pm $Wx::VERSION\n"; 38 $version =~ s/wxWidgets\s+//; 39 nono("Sorry we don't known this wxWidgets version format: '$version'") 40 if $version !~ /^\d+\.\d+(\.\d+)?$/; 41 my ($major, $minor, $way_too_minor) = split /\./, $version; 42 nono("Padre needs at least version 2.8.8 of wxWidgets. this is version $version") 43 if $major < 2 or $minor < 8; 30 # Can we find Wx.pm 31 my $wxfile = _module_file('Wx'); 32 my $wxpath = _file_path($wxfile); 33 unless ( $wxpath ) { 34 # Wx.pm is not installed. 35 # Allow EU:MM to do it's thing as normal 36 return; 37 } 38 my $wx_pm = _path_version($wxpath); 39 print "Found Wx.pm $wx_pm\n"; 40 41 # Do we have the alien package 42 eval { 43 require Alien::wxWidgets; 44 Alien::wxWidgets->import; 45 }; 46 if ( $@ ) { 47 # If we don't have the alien package, 48 # we should just pass through to EU:MM 49 return; 50 } 51 52 # Find the wxWidgets version from the alien 53 my $widgets = Alien::wxWidgets->version; 54 unless ( $widgets ) { 55 nono("Alien::wxWidgets was unable to determine the wxWidgets version"); 56 } 57 my $widgets_human = $widgets; 58 $widgets_human =~ s/^(\d\.\d\d\d)(\d\d\d)$/$1.$2/; 59 $widgets_human =~ s/0//g; 60 print "Found wxWidgets $widgets_human\n"; 61 unless ( $widgets >= 2.008008 ) { 62 nono("Padre needs at least version 2.8.8 of wxWidgets. You have wxWidgets $widgets_human"); 63 } 44 64 45 65 return; … … 49 69 my $msg = shift; 50 70 print STDERR "$msg\n"; 51 exit 0; 52 } 53 71 exit(0); 72 } 54 73 55 74 sub make_exe { … … 59 78 eval "use Module::ScanDeps 0.88; 1;" or die $@; 60 79 61 my @libs = get_libs();80 my @libs = get_libs(); 62 81 my @modules = get_modules(); 63 82 my $exe = $^O =~ /win32/i ? 'padre.exe' : 'padre'; 64 if ( -e $exe) {83 if ( -e $exe ) { 65 84 unlink $exe or die "Cannot remove '$exe' $!"; 66 85 } 67 my @cmd = ('pp', '-o', $exe, qw(-I lib script/padre)); 68 push @cmd, @modules, @libs; 69 if ($^O =~ /win32/i) { 86 my @cmd = ( 'pp', '-o', $exe, qw{ -I lib script/padre } ); 87 push @cmd, @modules; 88 push @cmd, @libs; 89 if ( $^O =~ /win32/i ) { 70 90 push @cmd, '-M', 'Tie::Hash::NamedCapture'; 71 91 } 72 92 73 print "@cmd\n";93 print join( ' ', @cmd ) . "\n"; 74 94 system(@cmd); 75 95 … … 77 97 } 78 98 79 80 99 sub get_libs { 100 # Run-time "use" the Alien module 81 101 require Alien::wxWidgets; 82 Alien::wxWidgets->import(); # needed to make it work 102 Alien::wxWidgets->import; 103 104 # Extract the settings we need from the Alient 105 my $prefix = Alien::wxWidgets->prefix; 106 my %libs = map { ($_, 0) } Alien::wxWidgets->shared_libraries( 107 qw(stc xrc html adv core base) 108 ); 109 83 110 require File::Find; 84 my @libs = Alien::wxWidgets->shared_libraries( 85 qw(stc xrc html adv core base) 111 File::Find::find( 112 sub { 113 if ( exists $libs{$_} ) { 114 $libs{$_} = $File::Find::name; 115 } 116 }, 117 $prefix 86 118 ); 87 119 88 # formerly, we needed to put the libs verbatim: 89 # qw( 90 # libwx_gtk2_adv-2.8.so.0 91 # libwx_gtk2_core-2.8.so.0 92 # libwx_base-2.8.so.0 93 # libwx_base_net-2.8.so.0 94 # libwx_gtk2_stc-2.8.so.0 95 # libwx_gtk2_html-2.8.so.0 96 # ); 97 98 my %libs = map {($_,0)} @libs; 99 my $prefix = Alien::wxWidgets->prefix; 100 101 File::Find::find( 102 sub { 103 if (exists $libs{$_}) { 104 $libs{$_} = $File::Find::name; 105 } 106 }, 107 $prefix 108 ); 109 110 my @missing = grep {!$libs{$_}} keys %libs; 111 warn "Could not find shared library on disk for $_" 112 for @missing; 113 114 my @libs_args; 115 push @libs_args, "-l", $_ for values %libs; 116 117 return @libs_args; 118 } 119 120 my @missing = grep { ! $libs{$_} } keys %libs; 121 foreach ( @missing ) { 122 warn("Could not find shared library on disk for $_"); 123 } 124 125 return map { ('-l', $_) } values %libs; 126 } 120 127 121 128 sub get_modules { 122 123 129 my @modules; 124 130 my @files; 125 126 open my $fh, '<', 'MANIFEST' or die "Do you need to run 'make manifest'? Could not open MANIFEST for reading: $!"; 127 while (my $line = <$fh>) { 131 local *FILE; 132 unless ( open(FILE, '<', 'MANIFEST') ) { 133 die("Do you need to run 'make manifest'? Could not open MANIFEST for reading: $!"); 134 } 135 while ( my $line = <FILE> ) { 128 136 chomp $line; 129 if ( $line =~ m{^lib/}) {137 if ( $line =~ m{^lib/} ) { 130 138 $line = substr($line, 4, -3); 131 139 $line =~ s{/}{::}g; 132 140 push @modules, $line; 133 141 } 134 if ( $line =~ m{^share/}) {142 if ( $line =~ m{^share/} ) { 135 143 push @files, $line; 136 144 } 137 145 } 146 138 147 my @args; 139 148 push @args, "-M", $_ for @modules; 140 149 push @args, "-a", $_ for @files; 141 142 150 return @args; 143 151 } 144 152 145 146 147 153 # To prevent EU:MM loading modules, we hijack %INC and then set $VERSION 154 # into all of the packages so that EU:MM still gets the versions it wants. 155 sub trick_eumm { 156 my $self = shift; 157 my @requires = map { $_ ? @$_ : () } ( 158 $self->configure_requires, 159 $self->build_requires, 160 $self->test_requires, 161 $self->requires, 162 ); 163 foreach my $module ( map { $_->[0] } @requires ) { 164 # If the module is already loaded leave it alone 165 my $file = _module_file($module); 166 next if $INC{$file}; 167 168 # What version of the module is installed 169 my $found = _file_path($file); 170 unless ( defined $found ) { 171 # Leave it to EU:MM to not find as well 172 next; 173 } 174 175 # Parse out the version for the currently installed version 176 my $version = _path_version($found); 177 178 # Make the module look like it is loaded, 179 # and set the version to match the one on disk. 180 $INC{$file} = __PACKAGE__; 181 no strict 'refs'; 182 *{"${module}::VERSION"} = sub { $version }; 183 } 184 return 1; 185 } 186 187 sub _module_file { 188 my $module = shift; 189 $module =~ s/::/\//g; 190 $module .= '.pm'; 191 return $module; 192 } 193 194 sub _file_path { 195 my $file = shift; 196 my @found = grep { -f $_ } map { "$_/$file" } @INC; 197 return $found[0]; 198 } 199 200 sub _path_version { 201 require ExtUtils::MM_Unix; 202 ExtUtils::MM_Unix->parse_version($_[0]); 203 } 148 204 149 205 1;
Note: See TracChangeset
for help on using the changeset viewer.
