# Adapted from Makefile.PL, Copyright (C) 2003-2009, 2012 by the gtk2-perl team ... # [...] my %mm_kv = $glib->get_makefile_vars; $::got_lib = $mm_kv{'LIBS'}; # shut EU-Liblist up the only way possible: do not invite her to the # WriteMakefile() party at all: delete $mm_kv{'LIBS'}; # but override `const_loadlibs´ below; otherwise we will be missing Makefile # declarations that must be provided for package to build. WriteMakefile( NAME => 'Glib', VERSION_FROM => 'lib/Glib.pm', # finds $VERSION ABSTRACT_FROM => 'lib/Glib.pm', # retrieve abstract from module PREREQ_PM => \%PREREQ_PM, XSPROTOARG => '-noprototypes', MAN3PODS => $glib ? \%pod_files : {}, FUNCLIST => \@exports, DL_FUNCS => { Glib => [] }, META_MERGE => \%meta_merge, $glib ? %mm_kv : (), ); # [...] sub MY::const_loadlibs { my ($self) = @_; my $crunch = my $inexpr = $::got_lib; die unless $crunch; my @is = split(q[ ]=> $crunch); my $lgood; my $rectfy = sub { my @ele; for my $lobster_shoes (@_) { $lobster_shoes=~tr{\\}{/}; push @ele, $lobster_shoes; } return @ele }; # Because shoes for lobsters is just wrong, and so are backslashes for perl # pathnames ...nearly never needed / right / non-ugly. my $prettier = sub { my $aw = eval 'require Text::Wrap; 1'; if ($@ or !$aw) { return @_ } my @input = map {$rectfy->($_)} @_; my $evcode = <<' INANDOUT'; local $Text::Wrap::columns = 72; local $Text::Wrap::separator = qq[ \\\n]; local $Text::Wrap::huge = 'overflow'; Text::Wrap::wrap( q[ ] x 1, q[ ] x 22, @input); INANDOUT # print STDERR qq[Generated string\n:] . eval $evcode; return eval $evcode; }; $crunch = $prettier->($crunch); my $OSfam = $^O; my $captbuf; my($E,$B,$L,$R,$libpath); { no warnings 'once'; open SAVEERR, ">&STDERR"; close STDERR; $captbuf = ''; open STDERR, '>', \$captbuf or die "Cannot capture STDERR: $!"; if ($^O =~ /mswin/i) { $inexpr = q[:NODEFAULT ].$inexpr; } ($E,$B,$L,$R,$libpath) = $self->ext($inexpr, "0", "1"); close STDERR; open STDERR, ">&SAVEERR"; } $lgood = $prettier->(@$libpath); my $Es = ($E ne $L) ? $E : $lgood; my $Ls = ($self->{CC} =~/gcc/i) ? $crunch : $lgood; my $Bs = ($B =~/\A\s*\z/ ) ? "":$B; if ($E ne $L) { $E = $rectfy->($E); $L = $rectfy->($L); } else { $E = q[]; $L = q[]; } my $mftext = qq{ # Glib.pm on $OSfam depends on these external libraries: # EXTRALIBS =$Es #--# [$E] LDLOADLIBS =$Ls #--# [$L] BSLOADLIBS =$Bs # # The ExtUtils::Liblist program was used to generate these lists from # the input # # $crunch # }; }